From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: hao.a.wu@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Tue, 23 Apr 2019 20:19:58 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 20:19:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,388,1549958400"; d="scan'208";a="133862335" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga007.jf.intel.com with ESMTP; 23 Apr 2019 20:19:58 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 23 Apr 2019 20:19:57 -0700 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 23 Apr 2019 20:19:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.92]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.21]) with mapi id 14.03.0415.000; Wed, 24 Apr 2019 11:19:55 +0800 From: "Wu, Hao A" To: "Loh, Tien Hock" , "devel@edk2.groups.io" , "thloh85@gmail.com" CC: "Wang, Jian J" Subject: Re: [PATCH 1/1] MdeModulePkg: BaseSerialPortLib16550: Add Mmio32 support Thread-Topic: [PATCH 1/1] MdeModulePkg: BaseSerialPortLib16550: Add Mmio32 support Thread-Index: AQHU+kq0BUU4BUPL50a9Y+NOeDgfaqZKoZHg Date: Wed, 24 Apr 2019 03:19:54 +0000 Message-ID: References: <1556075112-185791-1-git-send-email-tien.hock.loh@intel.com> In-Reply-To: <1556075112-185791-1-git-send-email-tien.hock.loh@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Loh, Tien Hock > Sent: Wednesday, April 24, 2019 11:05 AM > To: devel@edk2.groups.io; thloh85@gmail.com > Cc: Loh, Tien Hock; Wang, Jian J; Wu, Hao A > Subject: [PATCH 1/1] MdeModulePkg: BaseSerialPortLib16550: Add Mmio32 > support >=20 > From: "Tien Hock, Loh" >=20 > Some busses doesn't allow 8 bit MMIO read/write, this adds support for > 32 bits read/write Hello Tien Hock, Your V2 patch seems to be based on your V1 patch. Could you help to update the V2 patch to base on the tip of the edk2 master branch? Thanks. One easy way to do this is to squash the 2 commits into one. Some minor comments: A. Please help to update the copyright year for the files: BaseSerialPortLib16550.c BaseSerialPortLib16550.inf B. For BaseSerialPortLib16550.inf, maybe: gEfiMdeModulePkgTokenSpaceGuid.PcdSerialMmio32BitAccess ## SOMETIME= S_CONSUMES is more appropriate here. Best Regards, Hao Wu >=20 > Signed-off-by: "Tien Hock, Loh" > Cc: Jian J Wang > Cc: Hao Wu >=20 > -- > v2: > - Updates the Pcd name to PcdSerialMmio32BitAccess and access 32 bits > register if PcdSerialUseMmio and PcdSerialMmio32BitAccess is set > --- > .../BaseSerialPortLib16550/BaseSerialPortLib16550.c | 16 ++++++++--= ------ > .../BaseSerialPortLib16550/BaseSerialPortLib16550.inf | 2 +- > MdeModulePkg/MdeModulePkg.dec | 12 +++++++---= -- > 3 files changed, 16 insertions(+), 14 deletions(-) >=20 > diff --git > a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c > b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c > index b242b23..f90fb55 100644 > --- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.= c > +++ > b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c > @@ -76,10 +76,10 @@ SerialPortReadRegister ( > UINTN Offset > ) > { > - if (PcdGetBool (PcdSerialUseMmio32)) { > - return (UINT8) MmioRead32 (Base + Offset * PcdGet32 > (PcdSerialRegisterStride)); > - } > - else if (PcdGetBool (PcdSerialUseMmio)) { > + if (PcdGetBool (PcdSerialUseMmio)) { > + if (PcdGetBool (PcdSerialMmio32BitAccess)) { > + return (UINT8) MmioRead32 (Base + Offset * PcdGet32 > (PcdSerialRegisterStride)); > + } > return MmioRead8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride)= ); > } else { > return IoRead8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride)); > @@ -106,10 +106,10 @@ SerialPortWriteRegister ( > UINT8 Value > ) > { > - if (PcdGetBool (PcdSerialUseMmio32)) { > - return MmioWrite32 (Base + Offset * PcdGet32 (PcdSerialRegisterStrid= e), > (UINT8)Value); > - } > - else if (PcdGetBool (PcdSerialUseMmio)) { > + if (PcdGetBool (PcdSerialUseMmio)) { > + if (PcdGetBool (PcdSerialMmio32BitAccess)) { > + return (UINT8) MmioWrite32 (Base + Offset * PcdGet32 > (PcdSerialRegisterStride), (UINT8)Value); > + } > return MmioWrite8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride= ), > Value); > } else { > return IoWrite8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride),= Value); > diff --git > a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf > b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf > index 575728a..c03d90d 100644 > --- > a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf > +++ > b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf > @@ -29,7 +29,7 @@ > BaseSerialPortLib16550.c >=20 > [Pcd] > - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio32 ## > CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialMmio32BitAccess ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdSerialDetectCable ## > SOMETIMES_CONSUMES > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec > index 4e53625..f868850 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -1170,11 +1170,13 @@ > # @Prompt Serial port registers use MMIO. >=20 > gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|FALSE|BOOLEAN|0x00 > 020000 >=20 > - ## Indicates the 16550 serial port registers are in MMIO 32 bit space,= or 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|0x > 00020007 > + ## Indicates the access mode for 16550 serial port registers when they= are in > MMIO space. > + # The PCD is only valid if PcdSerialUseMmio is set to TRUE. > + # Default is 8-bit access mode.

> + # TRUE - 16550 serial port MMIO registers are accessed in 32-bit > width.
> + # FALSE - 16550 serial port MMIO registers are accessed in 8-bit wid= th.
> + # @Prompt Serial port MMIO registers access mode. > + > gEfiMdeModulePkgTokenSpaceGuid.PcdSerialMmio32BitAccess|FALSE|BOOLE > AN|0x00020007 >=20 > ## Indicates if the 16550 serial port hardware flow control will be en= abled. > Default is FALSE.

> # TRUE - 16550 serial port hardware flow control will be enabled. > -- > 2.2.2