From nobody Fri May 3 14:03:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39360+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39360+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1555914489; cv=none; d=zoho.com; s=zohoarc; b=aBPzU51GCNRs6zbo/3Yp48/KaY2+uH7JxYOFNNMZwbSZWua8Lo9UqpzNRv5QdwOvCBOPMrfHl09tSJRcx3hnfdJ3TUYf7b2UpKhIDbYm+6Vde3JFktesRYOWJXu3RuaqB+WLZMQf3ieWUI7zPxj8hZ5dyaONWSvA7ryWgcN1gxs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555914489; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=hBlmBsJuoJ2i18nHyzWuMa7f/QsY1yR1zcYeO5biVPw=; b=n1kqrDaG8/aZ23+KrPNFMUjghQtjaT6uLvfEfOiuJLabis8snVVTFTMHKzfHVtOjJ1EwckrNiifcsz/3ZnXvFLZW9bPHI3zhsEx+tD9FMCDZdyRvGBSJ1ECiQR8lAUGpEdyvz8BBFnNxk/0BbMJw9J7Uomy3UggRCxo8KsVDPbY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39360+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1555914489494102.54939077882; Sun, 21 Apr 2019 23:28:09 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Sun, 21 Apr 2019 23:28:08 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Apr 2019 23:28:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,380,1549958400"; d="scan'208";a="133297983" X-Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.8]) by orsmga007.jf.intel.com with ESMTP; 21 Apr 2019 23:28:06 -0700 From: "Wu, Hao A" To: devel@edk2.groups.io Cc: "Tien Hock, Loh" , Jian J Wang , Hao Wu Subject: [edk2-devel] [PATCH v1] MdeModulePkg: BaseSerialPortLib16550: Add Mmio32 support Date: Mon, 22 Apr 2019 14:28:01 +0800 Message-Id: <20190422062801.12372-1-hao.a.wu@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,hao.a.wu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1555914489; bh=3qCzc1Tfe16Etwg6jtEKj5p3+Ym8/Obe7azBuGVpO/g=; h=Cc:Date:From:Reply-To:Subject:To; b=flLrOn9CqkdhlyXCMz2ueeU7okTXduqbES0egr7IQzED6PIKYCzadyMyZFaEWYb9I7L 111SQvWg1AyF4Zz4paxSH13451MC+ru/Ql5Dt0loco0EgT9WcNbixBgW++w75i/zqMuka CjTtEL8cyUOj/XwKARW/L7+u6Zo1Ll97QtI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Tien Hock, Loh" Some busses doesn't allow 8 bit MMIO read/write, this adds support for 32 bits read/write Signed-off-by: "Tien Hock, Loh" Cc: Jian J Wang Cc: Hao Wu --- MdeModulePkg/MdeModulePkg.dec | = 6 ++++++ MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf | = 1 + MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c | 1= 0 ++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index be84916cc0..4e53625767 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -1170,6 +1170,12 @@ # @Prompt Serial port registers use MMIO. gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|FALSE|BOOLEAN|0x00020000 =20 + ## Indicates the 16550 serial port registers are in MMIO 32 bit space, o= r in I/O space. Default is I/O space.

+ # TRUE - 16550 serial port registers are in MMIO 32 bit space.
+ # FALSE - 16550 serial port registers are in I/O space.
+ # @Prompt Serial port registers use MMIO. + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio32|FALSE|BOOLEAN|0x000200= 07 + ## Indicates if the 16550 serial port hardware flow control will be enab= led. Default is FALSE.

# TRUE - 16550 serial port hardware flow control will be enabled.
# FALSE - 16550 serial port hardware flow control will be disabled.
diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib1= 6550.inf b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib165= 50.inf index b60779cf57..575728af3a 100644 --- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf +++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf @@ -29,6 +29,7 @@ BaseSerialPortLib16550.c =20 [Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio32 ## CONSU= MES gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## CONSU= MES gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl ## CONSU= MES gEfiMdeModulePkgTokenSpaceGuid.PcdSerialDetectCable ## SOMET= IMES_CONSUMES diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib1= 6550.c b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550= .c index 34df34d9c6..b242b23ec8 100644 --- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c +++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c @@ -76,7 +76,10 @@ SerialPortReadRegister ( UINTN Offset ) { - if (PcdGetBool (PcdSerialUseMmio)) { + if (PcdGetBool (PcdSerialUseMmio32)) { + return (UINT8) MmioRead32 (Base + Offset * PcdGet32 (PcdSerialRegister= Stride)); + } + else if (PcdGetBool (PcdSerialUseMmio)) { return MmioRead8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride)); } else { return IoRead8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride)); @@ -103,7 +106,10 @@ SerialPortWriteRegister ( UINT8 Value ) { - if (PcdGetBool (PcdSerialUseMmio)) { + if (PcdGetBool (PcdSerialUseMmio32)) { + return MmioWrite32 (Base + Offset * PcdGet32 (PcdSerialRegisterStride)= , (UINT8)Value); + } + else if (PcdGetBool (PcdSerialUseMmio)) { return MmioWrite8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride),= Value); } else { return IoWrite8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride), V= alue); --=20 2.12.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39360): https://edk2.groups.io/g/devel/message/39360 Mute This Topic: https://groups.io/mt/31271424/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-