From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web09.4320.1658395096532496941 for ; Thu, 21 Jul 2022 02:18:16 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=E50uxOS1; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658395096; x=1689931096; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=FPn4RIQTOJ0V2cd4gJ5YMossZF4Xn3km/B3EbPKV9s4=; b=E50uxOS1rJ+GHBqzMQq7YNbKXje7o73mj852cOcmxT1O/u4YueqxArB5 Bn0qlObuHKJ6JgzZRyyENXRK1lexrfawmpFfr7ZrpEna2byX0FCQ68z3K YJsgdPxCs8XkKNMoWrgh2Qn0acraumGCvoaBbwmEc4eeZc5n2bE5WsyOx wOiIanDbVgP/XIiR6Z5pSF/cph92UJQoWS5taNnUDScpHteedTbA8JI3x THg8f3zHA3HQtvuSaZX2KGXzaVQEAik9A9CoT7HTtNfFxIXmplcUnlHZ8 WJr50BygaaClq4ODlo3wjXCzyOhkUx+VyoWE5z8C+3lw7Eocf5DCrdrFE A==; X-IronPort-AV: E=McAfee;i="6400,9594,10414"; a="270027146" X-IronPort-AV: E=Sophos;i="5.92,289,1650956400"; d="scan'208";a="270027146" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2022 02:18:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,289,1650956400"; d="scan'208";a="631103205" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga001.jf.intel.com with ESMTP; 21 Jul 2022 02:18:16 -0700 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 21 Jul 2022 02:18:15 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Thu, 21 Jul 2022 02:18:15 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Thu, 21 Jul 2022 02:18:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M3R2wX8v6j/OdTQ8BGw6mpFSj53JA9HJRrRM23un7YHlCyExwzh26c+sLDsXUuDg8X+PokrG+hEWiqRB/ncKHlN0OF/SqYrc5TiNvs2K3DNL+6yEx8hCDp0XM4iQ9RlwABCHLgubuVyBxTZvUIAdseyQzPiINCGDuzE7KxhXyi6McbLFzavY3hyBnTwDuCDLcOOMsAxaEx9bVQF5dH85EwiP1t9MSV135reuhLwPShfxqz3g3nOXofRe6IYoaJeVyzfN7QaJ804WmNH+vy2OxEP74ZUvaqbrLbr7/Eo0YLY/ArwdSFK7Bdq26RZkGv59ZYewBZs4X2aU6g7bbbv4eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=M20YXYtRW03XHFO7H+IAT5Z606R595quK2SpFMSrRYE=; b=myASZpvbK5ENmqS/Ym540Vv5bjZRY3FdPvOBmX0cSBq4G7P7ETpY7AzJSXppRbaUYa9HZJ7E+0YsjoLC5L3vBfPmvVIM/jojuZOsRorEkO555f85tMv/NdyscZY//NO0VC7IkF7cjWrh3ndoxxRmTrmuINFFrVrKdqYIjeb6B3YQ/EaD9mI8bkXFv20aJlrqr8UaZZl7n45yG+oe5cBBMeHOHvPV4hhTaOZtO5q8fWvRb2YJJQ7t4+OXN/a938hsgyfUUVajJLKynzP+falWD7rqPlKOzbDqvk0DPjcjeW3VKPwlhroX/DM74wSKixHqTG81SbJudBwLpQzp11vdJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by BN6PR11MB1795.namprd11.prod.outlook.com (2603:10b6:404:101::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.23; Thu, 21 Jul 2022 09:18:12 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::991b:97a0:7836:5174]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::991b:97a0:7836:5174%10]) with mapi id 15.20.5458.018; Thu, 21 Jul 2022 09:18:12 +0000 From: "Ni, Ray" To: "Sravanthi, K KavyaX" , "devel@edk2.groups.io" CC: "Dong, Guo" , "Rhodes, Sean" , "Guo, Gua" Subject: Re: [PATCH v3 1/2] UefiPayloadPkg: Implement a new SerialPortLib instance Thread-Topic: [PATCH v3 1/2] UefiPayloadPkg: Implement a new SerialPortLib instance Thread-Index: AQHYnOJ7zW+ST5+KaUObxxQfT03QKq2IixXw Date: Thu, 21 Jul 2022 09:18:12 +0000 Message-ID: References: <20220721091422.421-1-k.kavyax.sravanthi@intel.com> In-Reply-To: <20220721091422.421-1-k.kavyax.sravanthi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3014c502-cb4e-4d38-b1a4-08da6af9ef56 x-ms-traffictypediagnostic: BN6PR11MB1795:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IYc5HB/G0P+DCLBEPPZ6MWA5ohOHOKiCVeddJSaXL/1FAxYqTB4bcvgBd7vBYzYtlKK89dXuddzEE+/EP3b9MyUwWowxRDxUIrMqunRGgg4tRlyigIeGhwOSPsJ9WNeAj7fKuJSS7eYY9a5OCDDr8/HDrmSTsSDakByqrDjXSmsJkHtgJNbab6e29Kiupdh78MBKrr3rH3W/XVoTtY2wdRDzieHb5Xyui0X0HOHIv+bnNW8qQGDp9KLlVVuBp1mXpk+QAMi87c2lYenQXe1VBzGtjRd4RlNx1e8Y0uT4Z2CPFXs0LeECLFEl0Y8yiV5+6/rLEI5F/RYULFrtmSxVkYpXhGIxJMdagZvs1vIrI45BdqvBxGbrz7FljxEG++2iOh2JWpp9Des6/eLrMh2+jB+xw+G6WjBoZY5sEAQs949fk9m7Il3VBeJ6PCaos+W1FC04IbqnapFU/XV2P0eL+kTUBs2Y/qlyrfClV1my4Slx4r4wYFj4fa0dNcKMqleh01FJyhIJIqP9JYfIoPxL6wzRK5Hrt5HxhNOiN0tGWhiaVJkCr4GLvoyWbE1Haap7SYoWmjuInnhIQxXBY59CEdfOW4rYt6ffZh0q40hPdIbj01IzgX5XxzewbjXaHlrxLAnrsOXwmkjjhFdlDBx/9MaO7eoJl6tv0cjfX4GZtioeR4j2apZbWPF9Mto7t2UZixyhs2oOUaRAiyc+cXFxLRVzcPaECY8T5zIUCvx8OimlHOp+1o2kHyLsAkIKbEbxoYqVtnvAeZWWZG4VmAs0Tv+LUclgg4EsvfLtQ02MmQ405KG/52v8MQ+2wsuIco06 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(346002)(396003)(366004)(39860400002)(376002)(107886003)(38070700005)(71200400001)(83380400001)(122000001)(38100700002)(33656002)(86362001)(41300700001)(82960400001)(186003)(6506007)(7696005)(9686003)(26005)(478600001)(110136005)(316002)(66476007)(64756008)(55016003)(2906002)(52536014)(8936002)(76116006)(30864003)(4326008)(66556008)(8676002)(66946007)(66446008)(5660300002)(53546011)(54906003)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Uk1mqm/L5oxd6uC9+NLuGuwVB2akN0My9xxkG12shf0xeJSBwN0JunwwSVTi?= =?us-ascii?Q?kQzpBpnuAkjrlRtntlQau2C4OwJnQk1NAIg42qxFmGtzoS8OfNAhJAsyB7hQ?= =?us-ascii?Q?FSaSxJLdanX4DkEsxc/Xx56LB5aTeOwCceZ+wf8DurWfM19iABhqX7oQz3ZM?= =?us-ascii?Q?aHepFDbEwhQVSjSr9JINVyaMLmSiXH2hDwX2a1DGQ25uxOkltJJRonLrHoXN?= =?us-ascii?Q?5wTfnHmXRhpUj78CJW8o3kOimBHYKa/tSdPUf/5GKob4YASY8qQwGScC2tvF?= =?us-ascii?Q?SdPFUvHqOX9aKTOlXtulnpYVW8vdYEygDFhGjqSlbhsy+oY8ZcpOQcOx5tWo?= =?us-ascii?Q?R8q8LdhZpfsPIf5xWdQkQuBckujJs7wF65qjBKPUPw1w6x1K/kGn4bzCpese?= =?us-ascii?Q?fGHKzrk6FI91Fv+B85arEu/YL6pahbp1oVGtnQX+sQ+R/oaKvJm26s7/FYxX?= =?us-ascii?Q?sz3yh8YitB5NKG53/05yQqpB2p1MrlYCIJLxot/HBLYZFjsQu1wPN2MLzFMl?= =?us-ascii?Q?929RUvQBtdoP1JeyQyX2JWm056+6K4qmwF5b56q/25Sg3D7ULSLZOBKOnt81?= =?us-ascii?Q?FabCtpAxy+QqyAjU0eii0mPePox6l6dwGLA4GjDS72x6ZTCn+n73W+7eUCfM?= =?us-ascii?Q?ybuvaOMiq/FS8e6Yx/DCT25188CtxlwVNm5ex2hFxXOvd17FfOSnru6AQOTv?= =?us-ascii?Q?jsn9LyEdzFfwyAT1ys72pd5FOuJVQIqIlb9Jh+JB4ujp41S15RSLF9Cnbw7d?= =?us-ascii?Q?JV+yUpf2RdbCvhFHaSrKiXWhWraRS2dpdLwZ7MHDnzsGR1WMoATIzXLefju3?= =?us-ascii?Q?ID2nhaNjfM3qKAhr7kukyZjcrE25xEbtbNvtDoJjf2gEB1OkvXlI9rVpRSb+?= =?us-ascii?Q?dGW02orcwYQfM1E7GJIB5uVEYolY8xRhJeJZvjbTykC+7+hUa+wpNXJ8KBle?= =?us-ascii?Q?RSlAtMHol8atcDoiyGk6RRqcngqsjfwj2Rok2X+J04LKno9iJ8XOcIlyrhxk?= =?us-ascii?Q?FsZpuJ/CXCSm4ec8HjbPAdQVYQta3Kn+xwoEZMtllrd1bFRFeHUFABRAHrXV?= =?us-ascii?Q?v8YRvIBuvFK+mpSDKf7g1cZFAlKj9NdxdNvGAnH5Y85VCi//jA5WbiCDVkKw?= =?us-ascii?Q?EL+x/hzVdOfPGtW90ENFiqqjaQ4pJFkTSIkqThpDppFha8fFkOAngA9KbBND?= =?us-ascii?Q?abBwY+2y1kIIpbwiSp0rVw39C47PYcXQ3XckjNZQFsRZXV2n4H+h9WKUEBz4?= =?us-ascii?Q?PxX14ZenhYbAphQ13FBJhTb/ELBMsDnfQdR2co+AfoMLTAv4l4rl6yMBTTD9?= =?us-ascii?Q?di9NbwTD7OqpUIGQj9bIfE5ThK2kUyvixj/YTM3VBa5pt/3RqyJyDxH0n0JV?= =?us-ascii?Q?SKLnBF/6XZVTGO91m2295SqtcXhCcZCGnhT9fv8ZXiH8siiZlIaHUfuyWzjo?= =?us-ascii?Q?Y+2aLNN3ICuRS8vFkWCGbMyHvZIYVVC+jhiVwph5e6/ZfQ+u9kD6FcLYGkee?= =?us-ascii?Q?CEEOuMAFo6Mg7Kf9fSkdWiOY5XmW3ehuxNzi0cu3X5a80zvMbcl5jntuEtmd?= =?us-ascii?Q?04EQv1ykxViARzBX5Qku+Z5vHCPm7WBiJM0+hj/w?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3014c502-cb4e-4d38-b1a4-08da6af9ef56 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2022 09:18:12.0871 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8Xkrl18Cl7MI0IObux5R+UgTpUbHKarV6glAh2OBwfQ5vfN/LVm9tNZYX4h53zeWalaDNqrNTge8ulxk1Xc1HQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1795 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Please try to not use AllocatePool in this library because in early part of DxeMain, the memory service may not be available. You could use a C array with maximum maybe 16 elements. Then the SerialPortLib may only support up to 16 serial ports. But I think that should be enough. Thanks, Ray > -----Original Message----- > From: Sravanthi, K KavyaX > Sent: Thursday, July 21, 2022 5:14 PM > To: devel@edk2.groups.io > Cc: Sravanthi, K KavyaX ; Dong, Guo > ; Ni, Ray ; Rhodes, Sean > ; Guo, Gua > Subject: [PATCH v3 1/2] UefiPayloadPkg: Implement a new SerialPortLib > instance >=20 > Add new Serial port library instance that consumes the HOB defined > in MdeModulePkg/Include/UniversalPayload/SerialPortInfo.h to support > multiple UART's. >=20 > Cc: Guo Dong > Cc: Ray Ni > Cc: Sean Rhodes > Cc: Gua Guo > Signed-off-by: Kavya > --- > UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c | 8= 14 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++ > UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.inf | = 40 > ++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 854 insertions(+) >=20 > diff --git > a/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c > b/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c > new file mode 100644 > index 0000000000..13eddf0934 > --- /dev/null > +++ b/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c > @@ -0,0 +1,814 @@ > +/** @file > + UART Serial Port library functions. > + > + Copyright (c) 2022, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +// > +// 16550 UART register offsets and bitfields > +// > +#define R_UART_RXBUF 0 // LCR_DLAB =3D 0 > +#define R_UART_TXBUF 0 // LCR_DLAB =3D 0 > +#define R_UART_BAUD_LOW 0 // LCR_DLAB =3D 1 > +#define R_UART_BAUD_HIGH 1 // LCR_DLAB =3D 1 > +#define R_UART_IER 1 // LCR_DLAB =3D 0 > +#define R_UART_FCR 2 > +#define B_UART_FCR_FIFOE BIT0 > +#define B_UART_FCR_FIFO64 BIT5 > +#define R_UART_LCR 3 > +#define B_UART_LCR_DLAB BIT7 > +#define R_UART_MCR 4 > +#define B_UART_MCR_DTRC BIT0 > +#define B_UART_MCR_RTS BIT1 > +#define R_UART_LSR 5 > +#define B_UART_LSR_RXRDY BIT0 > +#define B_UART_LSR_TXRDY BIT5 > +#define B_UART_LSR_TEMT BIT6 > +#define R_UART_MSR 6 > +#define B_UART_MSR_CTS BIT4 > +#define B_UART_MSR_DSR BIT5 > +#define B_UART_MSR_RI BIT6 > +#define B_UART_MSR_DCD BIT7 > + > +typedef struct { > + UINTN BaseAddress; > + BOOLEAN UseMmio; > + UINT32 BaudRate; > + UINT8 RegisterStride; > +} UART_INFO; > + > +UART_INFO **mUartInfo; > +UINT8 mUartCount; > + > +/** > + Reads an 8-bit register. If UseMmio is TRUE, then the value is read fr= om > + MMIO space. If UseMmio is FALSE, then the value is read from I/O space= . > The > + parameter Offset is added to the base address of the register. > + > + @param Base The base address register of UART device. > + @param Offset The offset of the register to read. > + @param UseMmio Check if value has to be read from MMIO space= or > IO space. > + @param RegisterStride Number of bytes between registers in serial > device. > + > + @return The value read from the register. > + > +**/ > +UINT8 > +SerialPortReadRegister ( > + UINTN Base, > + UINTN Offset, > + BOOLEAN UseMmio, > + UINT8 RegisterStride > + ) > +{ > + if (UseMmio) { > + return MmioRead8 (Base + Offset * RegisterStride); > + } else { > + return IoRead8 (Base + Offset * RegisterStride); > + } > +} > + > +/** > + Writes an 8-bit register.. If UseMmio is TRUE, then the value is writt= en to > + MMIO space. If UseMmio is FALSE, then the value is written to I/O spac= e. > The > + parameter Offset is added to the base address of the registers. > + > + @param Base The base address register of UART device. > + @param Offset The offset of the register to write. > + @param Value Value to be written. > + @param UseMmio Check if value has to be written to MMIO spac= e or > IO space. > + @param RegisterStride Number of bytes between registers in serial > device. > + > + @return The value written to the register. > + > +**/ > +UINT8 > +SerialPortWriteRegister ( > + UINTN Base, > + UINTN Offset, > + UINT8 Value, > + BOOLEAN UseMmio, > + UINT8 RegisterStride > + ) > +{ > + if (UseMmio) { > + return MmioWrite8 (Base + Offset * RegisterStride, Value); > + } else { > + return IoWrite8 (Base + Offset * RegisterStride, Value); > + } > +} > + > +/** > + Initialize the serial device hardware. > + > + If no initialization is required, then return RETURN_SUCCESS. > + If the serial device was successfully initialized, then return > RETURN_SUCCESS. > + If the serial device could not be initialized, then return > RETURN_DEVICE_ERROR. > + > + @retval RETURN_SUCCESS The serial device was initialized. > + @retval RETURN_DEVICE_ERROR The serial device could not be initializ= ed. > + > +**/ > +RETURN_STATUS > +EFIAPI > +SerialPortInitialize ( > + VOID > + ) > +{ > + UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *SerialPortInfo; > + EFI_HOB_GUID_TYPE *GuidHob; > + UINTN SerialRegisterBase; > + UINT8 RegisterStride; > + UINT32 Divisor; > + UINT32 CurrentDivisor; > + UINT32 BaudRate; > + BOOLEAN Initialized; > + BOOLEAN MmioEnable; > + UINT8 Index; > + UINT8 Count; > + > + Count =3D 0; > + > + GuidHob =3D GetFirstGuidHob (&gUniversalPayloadSerialPortInfoGuid); > + while (GuidHob !=3D NULL) { > + Count++; > + GuidHob =3D GET_NEXT_HOB (GuidHob); > + GuidHob =3D GetNextGuidHob (&gUniversalPayloadSerialPortInfoGuid, > GuidHob); > + } > + > + mUartCount =3D Count; > + > + mUartInfo =3D (UART_INFO **)AllocateZeroPool (sizeof (UART_INFO *) * > Count); > + ASSERT (mUartInfo !=3D NULL); > + > + for (Index =3D 0; Index < Count; Index++) { > + mUartInfo[Index] =3D (UART_INFO *)AllocateZeroPool (sizeof > (UART_INFO)); > + } > + > + Index =3D 0; > + GuidHob =3D GetFirstGuidHob (&gUniversalPayloadSerialPortInfoGuid); > + while (GuidHob !=3D NULL) { > + SerialPortInfo =3D (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO > *)GET_GUID_HOB_DATA (GuidHob); > + SerialRegisterBase =3D SerialPortInfo->RegisterBase; > + MmioEnable =3D SerialPortInfo->UseMmio; > + BaudRate =3D SerialPortInfo->BaudRate; > + RegisterStride =3D SerialPortInfo->RegisterStride; > + > + mUartInfo[Index]->BaseAddress =3D SerialRegisterBase; > + mUartInfo[Index]->UseMmio =3D MmioEnable; > + mUartInfo[Index]->BaudRate =3D BaudRate; > + mUartInfo[Index]->RegisterStride =3D RegisterStride; > + Index++; > + > + if (SerialRegisterBase =3D=3D 0) { > + return RETURN_DEVICE_ERROR; > + } > + > + Divisor =3D PcdGet32 (PcdSerialClockRate) / (BaudRate * 16); > + if ((PcdGet32 (PcdSerialClockRate) % (BaudRate * 16)) >=3D BaudRate = * 8) { > + Divisor++; > + } > + > + // > + // See if the serial port is already initialized > + // > + Initialized =3D TRUE; > + if ((SerialPortReadRegister (SerialRegisterBase, R_UART_LCR, > MmioEnable, RegisterStride) & 0x3F) !=3D (PcdGet8 (PcdSerialLineControl) = & > 0x3F)) { > + Initialized =3D FALSE; > + } > + > + SerialPortWriteRegister (SerialRegisterBase, R_UART_LCR, > (UINT8)(SerialPortReadRegister (SerialRegisterBase, R_UART_LCR, > MmioEnable, RegisterStride) | B_UART_LCR_DLAB), MmioEnable, > RegisterStride); > + CurrentDivisor =3D SerialPortReadRegister (SerialRegisterBase, > R_UART_BAUD_HIGH, MmioEnable, RegisterStride) << 8; > + CurrentDivisor |=3D (UINT32)SerialPortReadRegister (SerialRegisterBa= se, > R_UART_BAUD_LOW, MmioEnable, RegisterStride); > + SerialPortWriteRegister (SerialRegisterBase, R_UART_LCR, > (UINT8)(SerialPortReadRegister (SerialRegisterBase, R_UART_LCR, > MmioEnable, RegisterStride) & ~B_UART_LCR_DLAB), MmioEnable, > RegisterStride); > + if (CurrentDivisor !=3D Divisor) { > + Initialized =3D FALSE; > + } > + > + if (Initialized) { > + GuidHob =3D GET_NEXT_HOB (GuidHob); > + GuidHob =3D GetNextGuidHob (&gUniversalPayloadSerialPortInfoGuid, > GuidHob); > + continue; > + } > + > + // > + // Configure baud rate > + // > + SerialPortWriteRegister (SerialRegisterBase, R_UART_LCR, > B_UART_LCR_DLAB, MmioEnable, RegisterStride); > + SerialPortWriteRegister (SerialRegisterBase, R_UART_BAUD_HIGH, > (UINT8)(Divisor >> 8), MmioEnable, RegisterStride); > + SerialPortWriteRegister (SerialRegisterBase, R_UART_BAUD_LOW, > (UINT8)(Divisor & 0xff), MmioEnable, RegisterStride); > + > + // > + // Clear DLAB and configure Data Bits, Parity, and Stop Bits. > + // Strip reserved bits from PcdSerialLineControl > + // > + SerialPortWriteRegister (SerialRegisterBase, R_UART_LCR, > (UINT8)(PcdGet8 (PcdSerialLineControl) & 0x3F), MmioEnable, > RegisterStride); > + > + // > + // Enable and reset FIFOs > + // Strip reserved bits from PcdSerialFifoControl > + // > + SerialPortWriteRegister (SerialRegisterBase, R_UART_FCR, 0x00, > MmioEnable, RegisterStride); > + SerialPortWriteRegister (SerialRegisterBase, R_UART_FCR, > (UINT8)(PcdGet8 (PcdSerialFifoControl) & (B_UART_FCR_FIFOE | > B_UART_FCR_FIFO64)), MmioEnable, RegisterStride); > + > + // > + // Set FIFO Polled Mode by clearing IER after setting FCR > + // > + SerialPortWriteRegister (SerialRegisterBase, R_UART_IER, 0x00, > MmioEnable, RegisterStride); > + > + // > + // Put Modem Control Register(MCR) into its reset state of 0x00. > + // > + SerialPortWriteRegister (SerialRegisterBase, R_UART_MCR, 0x00, > MmioEnable, RegisterStride); > + > + GuidHob =3D GET_NEXT_HOB (GuidHob); > + GuidHob =3D GetNextGuidHob (&gUniversalPayloadSerialPortInfoGuid, > GuidHob); > + } > + > + return RETURN_SUCCESS; > +} > + > +/** > + Write data from buffer to serial device. > + > + Writes NumberOfBytes data bytes from Buffer to the serial device. > + The number of bytes actually written to the serial device is returned. > + If the return value is less than NumberOfBytes, then the write operati= on > failed. > + > + If Buffer is NULL, then return 0. > + > + If NumberOfBytes is zero, then return 0. > + > + @param Buffer Pointer to the data buffer to be written. > + @param NumberOfBytes Number of bytes to written to the serial devi= ce. > + > + @retval 0 NumberOfBytes is 0. > + @retval >0 The number of bytes written to the serial dev= ice. > + If this value is less than NumberOfBytes, the= n the write > operation failed. > + > +**/ > +UINTN > +EFIAPI > +SerialPortWrite ( > + IN UINT8 *Buffer, > + IN UINTN NumberOfBytes > + ) > +{ > + UINTN BaseAddress; > + BOOLEAN UseMmio; > + UINTN BytesLeft; > + UINTN Index; > + UINTN FifoSize; > + UINT8 *DataBuffer; > + UINT8 Count; > + UINT8 Stride; > + > + if (Buffer =3D=3D NULL || NumberOfBytes =3D=3D 0) { > + return 0; > + } > + > + // > + // Compute the maximum size of the Tx FIFO > + // > + FifoSize =3D 1; > + if ((PcdGet8 (PcdSerialFifoControl) & B_UART_FCR_FIFOE) !=3D 0) { > + if ((PcdGet8 (PcdSerialFifoControl) & B_UART_FCR_FIFO64) =3D=3D 0) { > + FifoSize =3D 16; > + } else { > + FifoSize =3D PcdGet32 (PcdSerialExtendedTxFifoSize); > + } > + } > + > + Count =3D 0; > + while (Count < mUartCount) { > + BaseAddress =3D mUartInfo[Count]->BaseAddress; > + UseMmio =3D mUartInfo[Count]->UseMmio; > + Stride =3D mUartInfo[Count]->RegisterStride; > + > + DataBuffer =3D Buffer; > + BytesLeft =3D NumberOfBytes; > + > + while (BytesLeft !=3D 0) { > + // > + // Fill the entire Tx FIFO > + // > + for (Index =3D 0; Index < FifoSize && BytesLeft !=3D 0; Index++, B= ytesLeft--, > DataBuffer++) { > + // > + // Write byte to the transmit buffer. > + // > + SerialPortWriteRegister (BaseAddress, R_UART_TXBUF, *DataBuffer, > UseMmio, Stride); > + } > + MicroSecondDelay (20); > + } > + Count++; > + } > + > + return NumberOfBytes; > +} > + > +/** > + Reads data from a serial device into a buffer. > + > + @param Buffer Pointer to the data buffer to store the data = read from > the serial device. > + @param NumberOfBytes Number of bytes to read from the serial devic= e. > + > + @retval 0 NumberOfBytes is 0. > + @retval >0 The number of bytes read from the serial devi= ce. > + If this value is less than NumberOfBytes, the= n the read > operation failed. > + > +**/ > +UINTN > +EFIAPI > +SerialPortRead ( > + OUT UINT8 *Buffer, > + IN UINTN NumberOfBytes > + ) > +{ > + UINTN BaseAddress; > + BOOLEAN UseMmio; > + UINT8 *DataBuffer; > + UINTN BytesLeft; > + UINTN Result; > + UINT8 Mcr; > + UINT8 Count; > + UINT8 Stride; > + > + if (Buffer =3D=3D NULL) { > + return 0; > + } > + > + Count =3D 0; > + while (Count < mUartCount) { > + BaseAddress =3D mUartInfo[Count]->BaseAddress; > + UseMmio =3D mUartInfo[Count]->UseMmio; > + Stride =3D mUartInfo[Count]->RegisterStride; > + > + DataBuffer =3D Buffer; > + BytesLeft =3D NumberOfBytes; > + > + if (BaseAddress =3D=3D 0) { > + return 0; > + } > + > + Mcr =3D (UINT8)(SerialPortReadRegister (BaseAddress, R_UART_MCR, > UseMmio, Stride) & ~B_UART_MCR_RTS); > + > + for (Result =3D 0; BytesLeft-- !=3D 0; Result++, DataBuffer++) { > + // > + // Wait for the serial port to have some data. > + // > + while ((SerialPortReadRegister (BaseAddress, R_UART_LSR, UseMmio, > Stride) & B_UART_LSR_RXRDY) =3D=3D 0) { > + if (PcdGetBool (PcdSerialUseHardwareFlowControl)) { > + // > + // Set RTS to let the peer send some data > + // > + SerialPortWriteRegister (BaseAddress, R_UART_MCR, (UINT8)(Mcr = | > B_UART_MCR_RTS), UseMmio, Stride); > + } > + } > + > + if (PcdGetBool (PcdSerialUseHardwareFlowControl)) { > + // > + // Clear RTS to prevent peer from sending data > + // > + SerialPortWriteRegister (BaseAddress, R_UART_MCR, Mcr, UseMmio, > Stride); > + } > + > + // > + // Read byte from the receive buffer. > + // > + *DataBuffer =3D SerialPortReadRegister (BaseAddress, R_UART_RXBUF, > UseMmio, Stride); > + } > + Count++; > + } > + > + return Result; > +} > + > +/** > + Polls a serial device to see if there is any data waiting to be read. > + > + Polls a serial device to see if there is any data waiting to be read. > + If there is data waiting to be read from the serial device, then TRUE = is > returned. > + If there is no data waiting to be read from the serial device, then FA= LSE is > returned. > + > + @retval TRUE Data is waiting to be read from the serial de= vice. > + @retval FALSE There is no data waiting to be read from the = serial > device. > + > +**/ > +BOOLEAN > +EFIAPI > +SerialPortPoll ( > + VOID > + ) > +{ > + UINTN BaseAddress; > + BOOLEAN UseMmio; > + UINT8 Stride; > + UINT8 Count; > + > + Count =3D 0; > + while (Count < mUartCount) { > + BaseAddress =3D mUartInfo[Count]->BaseAddress; > + UseMmio =3D mUartInfo[Count]->UseMmio; > + Stride =3D mUartInfo[Count]->RegisterStride; > + > + if (BaseAddress =3D=3D 0) { > + return FALSE; > + } > + > + // > + // Read the serial port status > + // > + if ((SerialPortReadRegister (BaseAddress, R_UART_LSR, UseMmio, Strid= e) > & B_UART_LSR_RXRDY) !=3D 0) { > + if (PcdGetBool (PcdSerialUseHardwareFlowControl)) { > + // > + // Clear RTS to prevent peer from sending data > + // > + SerialPortWriteRegister (BaseAddress, R_UART_MCR, > (UINT8)(SerialPortReadRegister (BaseAddress, R_UART_MCR, UseMmio, > Stride) & ~B_UART_MCR_RTS), UseMmio, Stride); > + } > + return TRUE; > + } > + > + if (PcdGetBool (PcdSerialUseHardwareFlowControl)) { > + // > + // Set RTS to let the peer send some data > + // > + SerialPortWriteRegister (BaseAddress, R_UART_MCR, > (UINT8)(SerialPortReadRegister (BaseAddress, R_UART_MCR, UseMmio, > Stride) | B_UART_MCR_RTS), UseMmio, Stride); > + } > + Count++; > + } > + return FALSE; > +} > + > +/** > + Sets the control bits on a serial device. > + > + @param Control Sets the bits of Control that are settab= le. > + > + @retval RETURN_SUCCESS The new control bits were set on the ser= ial > device. > + @retval RETURN_UNSUPPORTED The serial device does not support this > operation. > + @retval RETURN_DEVICE_ERROR The serial device is not functioning > correctly. > + > +**/ > +RETURN_STATUS > +EFIAPI > +SerialPortSetControl ( > + IN UINT32 Control > + ) > +{ > + UINTN BaseAddress; > + BOOLEAN UseMmio; > + UINT8 Mcr; > + UINT8 Count; > + UINT8 Stride; > + > + Count =3D 0; > + while (Count < mUartCount) { > + BaseAddress =3D mUartInfo[Count]->BaseAddress; > + UseMmio =3D mUartInfo[Count]->UseMmio; > + Stride =3D mUartInfo[Count]->RegisterStride; > + > + if (BaseAddress =3D=3D 0) { > + return RETURN_UNSUPPORTED; > + } > + > + // > + // First determine the parameter is invalid. > + // > + if ((Control & (~(EFI_SERIAL_REQUEST_TO_SEND | > EFI_SERIAL_DATA_TERMINAL_READY | > + EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE))) !=3D 0) > + { > + return RETURN_UNSUPPORTED; > + } > + > + // > + // Read the Modem Control Register. > + // > + Mcr =3D SerialPortReadRegister (BaseAddress, R_UART_MCR, UseMmio, > Stride); > + Mcr &=3D (~(B_UART_MCR_DTRC | B_UART_MCR_RTS)); > + > + if ((Control & EFI_SERIAL_DATA_TERMINAL_READY) =3D=3D > EFI_SERIAL_DATA_TERMINAL_READY) { > + Mcr |=3D B_UART_MCR_DTRC; > + } > + > + if ((Control & EFI_SERIAL_REQUEST_TO_SEND) =3D=3D > EFI_SERIAL_REQUEST_TO_SEND) { > + Mcr |=3D B_UART_MCR_RTS; > + } > + > + // > + // Write the Modem Control Register. > + // > + SerialPortWriteRegister (BaseAddress, R_UART_MCR, Mcr, UseMmio, > Stride); > + Count++; > + } > + > + return RETURN_SUCCESS; > +} > + > +/** > + Retrieve the status of the control bits on a serial device. > + > + @param Control A pointer to return the current control = signals > from the serial device. > + > + @retval RETURN_SUCCESS The control bits were read from the seri= al > device. > + @retval RETURN_UNSUPPORTED The serial device does not support this > operation. > + @retval RETURN_DEVICE_ERROR The serial device is not functioning > correctly. > + > +**/ > +RETURN_STATUS > +EFIAPI > +SerialPortGetControl ( > + OUT UINT32 *Control > + ) > +{ > + UINTN BaseAddress; > + BOOLEAN UseMmio; > + UINT8 Msr; > + UINT8 Mcr; > + UINT8 Lsr; > + UINT8 Count; > + UINT8 Stride; > + > + Count =3D 0; > + while (Count < mUartCount) { > + BaseAddress =3D mUartInfo[Count]->BaseAddress; > + UseMmio =3D mUartInfo[Count]->UseMmio; > + Stride =3D mUartInfo[Count]->RegisterStride; > + > + if (BaseAddress =3D=3D 0) { > + return RETURN_UNSUPPORTED; > + } > + > + *Control =3D 0; > + > + // > + // Read the Modem Status Register. > + // > + Msr =3D SerialPortReadRegister (BaseAddress, R_UART_MSR, UseMmio, > Stride); > + > + if ((Msr & B_UART_MSR_CTS) =3D=3D B_UART_MSR_CTS) { > + *Control |=3D EFI_SERIAL_CLEAR_TO_SEND; > + } > + > + if ((Msr & B_UART_MSR_DSR) =3D=3D B_UART_MSR_DSR) { > + *Control |=3D EFI_SERIAL_DATA_SET_READY; > + } > + > + if ((Msr & B_UART_MSR_RI) =3D=3D B_UART_MSR_RI) { > + *Control |=3D EFI_SERIAL_RING_INDICATE; > + } > + > + if ((Msr & B_UART_MSR_DCD) =3D=3D B_UART_MSR_DCD) { > + *Control |=3D EFI_SERIAL_CARRIER_DETECT; > + } > + > + // > + // Read the Modem Control Register. > + // > + Mcr =3D SerialPortReadRegister (BaseAddress, R_UART_MCR, UseMmio, > Stride); > + > + if ((Mcr & B_UART_MCR_DTRC) =3D=3D B_UART_MCR_DTRC) { > + *Control |=3D EFI_SERIAL_DATA_TERMINAL_READY; > + } > + > + if ((Mcr & B_UART_MCR_RTS) =3D=3D B_UART_MCR_RTS) { > + *Control |=3D EFI_SERIAL_REQUEST_TO_SEND; > + } > + > + if (PcdGetBool (PcdSerialUseHardwareFlowControl)) { > + *Control |=3D EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE; > + } > + > + // > + // Read the Line Status Register. > + // > + Lsr =3D SerialPortReadRegister (BaseAddress, R_UART_LSR, UseMmio, > Stride); > + > + if ((Lsr & (B_UART_LSR_TEMT | B_UART_LSR_TXRDY)) =3D=3D > (B_UART_LSR_TEMT | B_UART_LSR_TXRDY)) { > + *Control |=3D EFI_SERIAL_OUTPUT_BUFFER_EMPTY; > + } > + > + if ((Lsr & B_UART_LSR_RXRDY) =3D=3D 0) { > + *Control |=3D EFI_SERIAL_INPUT_BUFFER_EMPTY; > + } > + Count++; > + } > + > + return RETURN_SUCCESS; > +} > + > +/** > + Sets the baud rate, receive FIFO depth, transmit/receice time out, par= ity, > + data bits, and stop bits on a serial device. > + > + @param BaudRate The requested baud rate. A BaudRate value of= 0 > will use the > + device's default interface speed. > + On output, the value actually set. > + @param ReveiveFifoDepth The requested depth of the FIFO on the > receive side of the > + serial interface. A ReceiveFifoDepth value o= f 0 will use > + the device's default FIFO depth. > + On output, the value actually set. > + @param Timeout The requested time out for a single characte= r in > microseconds. > + This timeout applies to both the transmit an= d receive side of > the > + interface. A Timeout value of 0 will use the= device's default > time > + out value. > + On output, the value actually set. > + @param Parity The type of parity to use on this serial dev= ice. A Parity > value of > + DefaultParity will use the device's default = parity value. > + On output, the value actually set. > + @param DataBits The number of data bits to use on the serial= device. > A DataBits > + vaule of 0 will use the device's default dat= a bit setting. > + On output, the value actually set. > + @param StopBits The number of stop bits to use on this seria= l device. > A StopBits > + value of DefaultStopBits will use the device= 's default number > of > + stop bits. > + On output, the value actually set. > + > + @retval RETURN_SUCCESS The new attributes were set on the s= erial > device. > + @retval RETURN_UNSUPPORTED The serial device does not support > this operation. > + @retval RETURN_INVALID_PARAMETER One or more of the attributes has > an unsupported value. > + @retval RETURN_DEVICE_ERROR The serial device is not functioning > correctly. > + > +**/ > +RETURN_STATUS > +EFIAPI > +SerialPortSetAttributes ( > + IN OUT UINT64 *BaudRate, > + IN OUT UINT32 *ReceiveFifoDepth, > + IN OUT UINT32 *Timeout, > + IN OUT EFI_PARITY_TYPE *Parity, > + IN OUT UINT8 *DataBits, > + IN OUT EFI_STOP_BITS_TYPE *StopBits > + ) > +{ > + UINTN BaseAddress; > + BOOLEAN UseMmio; > + UINT32 SerialBaudRate; > + UINTN Divisor; > + UINT8 Lcr; > + UINT8 LcrData; > + UINT8 LcrParity; > + UINT8 LcrStop; > + UINT8 Count; > + UINT8 Stride; > + > + Count =3D 0; > + while (Count < mUartCount) { > + BaseAddress =3D mUartInfo[Count]->BaseAddress; > + UseMmio =3D mUartInfo[Count]->UseMmio; > + Stride =3D mUartInfo[Count]->RegisterStride; > + > + if (BaseAddress =3D=3D 0) { > + return RETURN_UNSUPPORTED; > + } > + > + // > + // Check for default settings and fill in actual values. > + // > + if (*BaudRate =3D=3D 0) { > + *BaudRate =3D mUartInfo[Count]->BaudRate; > + } > + > + SerialBaudRate =3D (UINT32)*BaudRate; > + > + if (*DataBits =3D=3D 0) { > + LcrData =3D (UINT8)(PcdGet8 (PcdSerialLineControl) & 0x3); > + *DataBits =3D LcrData + 5; > + } else { > + if ((*DataBits < 5) || (*DataBits > 8)) { > + return RETURN_INVALID_PARAMETER; > + } > + > + // > + // Map 5..8 to 0..3 > + // > + LcrData =3D (UINT8)(*DataBits - (UINT8)5); > + } > + > + if (*Parity =3D=3D DefaultParity) { > + LcrParity =3D (UINT8)((PcdGet8 (PcdSerialLineControl) >> 3) & 0x7)= ; > + switch (LcrParity) { > + case 0: > + *Parity =3D NoParity; > + break; > + > + case 3: > + *Parity =3D EvenParity; > + break; > + > + case 1: > + *Parity =3D OddParity; > + break; > + > + case 7: > + *Parity =3D SpaceParity; > + break; > + > + case 5: > + *Parity =3D MarkParity; > + break; > + > + default: > + break; > + } > + } else { > + switch (*Parity) { > + case NoParity: > + LcrParity =3D 0; > + break; > + > + case EvenParity: > + LcrParity =3D 3; > + break; > + > + case OddParity: > + LcrParity =3D 1; > + break; > + > + case SpaceParity: > + LcrParity =3D 7; > + break; > + > + case MarkParity: > + LcrParity =3D 5; > + break; > + > + default: > + return RETURN_INVALID_PARAMETER; > + } > + } > + > + if (*StopBits =3D=3D DefaultStopBits) { > + LcrStop =3D (UINT8)((PcdGet8 (PcdSerialLineControl) >> 2) & 0x1); > + switch (LcrStop) { > + case 0: > + *StopBits =3D OneStopBit; > + break; > + > + case 1: > + if (*DataBits =3D=3D 5) { > + *StopBits =3D OneFiveStopBits; > + } else { > + *StopBits =3D TwoStopBits; > + } > + > + break; > + > + default: > + break; > + } > + } else { > + switch (*StopBits) { > + case OneStopBit: > + LcrStop =3D 0; > + break; > + > + case OneFiveStopBits: > + case TwoStopBits: > + LcrStop =3D 1; > + break; > + > + default: > + return RETURN_INVALID_PARAMETER; > + } > + } > + > + // > + // Calculate divisor for baud generator > + // Ref_Clk_Rate / Baud_Rate / 16 > + // > + Divisor =3D PcdGet32 (PcdSerialClockRate) / (SerialBaudRate * 16); > + if ((PcdGet32 (PcdSerialClockRate) % (SerialBaudRate * 16)) >=3D > SerialBaudRate * 8) { > + Divisor++; > + } > + > + // > + // Configure baud rate > + // > + SerialPortWriteRegister (BaseAddress, R_UART_LCR, B_UART_LCR_DLAB, > UseMmio, Stride); > + SerialPortWriteRegister (BaseAddress, R_UART_BAUD_HIGH, > (UINT8)(Divisor >> 8), UseMmio, Stride); > + SerialPortWriteRegister (BaseAddress, R_UART_BAUD_LOW, > (UINT8)(Divisor & 0xff), UseMmio, Stride); > + > + // > + // Clear DLAB and configure Data Bits, Parity, and Stop Bits. > + // Strip reserved bits from line control value > + // > + Lcr =3D (UINT8)((LcrParity << 3) | (LcrStop << 2) | LcrData); > + SerialPortWriteRegister (BaseAddress, R_UART_LCR, (UINT8)(Lcr & 0x3F= ), > UseMmio, Stride); > + Count++; > + } > + > + return RETURN_SUCCESS; > +} > diff --git > a/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.inf > b/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.inf > new file mode 100644 > index 0000000000..1dbe107dbd > --- /dev/null > +++ > b/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.inf > @@ -0,0 +1,40 @@ > +## @file > +# SerialPortLib instance for UART information retrieved from bootloader= . > +# > +# Copyright (c) 2022, Intel Corporation. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D BaseSerialPortLibHob > + FILE_GUID =3D d8d22930-e8ec-469f-8184-5a069149b2f= f > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D SerialPortLib > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + > +[LibraryClasses] > + PcdLib > + IoLib > + HobLib > + TimerLib > + MemoryAllocationLib > + > +[Sources] > + BaseSerialPortLibHob.c > + > +[Pcd] > + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialLineControl > + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl > + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate > + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize > + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl > + > +[Guids] > + gUniversalPayloadSerialPortInfoGuid > -- > 2.30.2.windows.1