From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.70]) by mx.groups.io with SMTP id smtpd.web11.6154.1687781315036401220 for ; Mon, 26 Jun 2023 05:08:35 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=0GWXza1u; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.93.70, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jZnZY42EFSJlFmreOdzbYQHeeXsLx403VH0fplvqEylIa7GXjqqE2f8snzXD1w1hOeJMfwDSk0S71Y5tNpqueoMpqn2GjP/2aocle6bKVpESXOnmmv4BTU0wj0dZKMxY7UjtFNNkhqO9ZZWHPZ8RBW99JY20iAiR8cvuaf/QyAbxK3h/vqceXn8UvDkrvMlVPbgLyzPAPwgA2Suao491ZwttbT1YaWNWmG6DuFAdYedxGuojFNI35h2B9R05qS/9t5+hsdvkw0zDODMz028/vQybVngdmxgoE2cC11j1vKleq1BW5UdWrVRHtduJheuu9r5bsiMelkgiuYR188QwNQ== 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=dfz4RnzUp3CH30qJ+sJCktkVkR7qo1/Xp/1Jtc0y+EA=; b=mkn21WT8EFDo6LFNQDh6ghQv/97M/1rpL+GY4vcVgv6pgHwRoFyCO/l+N7hWsGJ1aCGoIrau2EmR5XHprR/3T2JNblCNsJ7bBSjwtAy9EFjGrgN6tyykUppoqO9HnAWU/KqZDlcY0Mh6WuVrr27mQZeSInV5n5oRb/SKuFDLb5Mk5YFlmy1lUK2a3wpELy7AebMXjD0qBTG4cuPyvT960zjas8HEb4uIStRc3YGVnnfqA5+T09nBGD76DFUQ4L5VjJJz81ERYA3tK6RyEHYBewcSxFmaCNJfGchdOh+8o9LTZDHtx+ALu1KCDlC9B6mpAQLJymMJHjVFMRQVXh1awA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dfz4RnzUp3CH30qJ+sJCktkVkR7qo1/Xp/1Jtc0y+EA=; b=0GWXza1uZxy+Huy9gzzUweuNlZQbQXa7q6S+Njqz1h4Z1t7y99rJKBOvBAejKbyWoRWYsb5Ni8l/RvgxgAtV5qib+tr7lKIP3mVO/WP9zerpkpzp6ZQKVXjbaGtwr3NiDSS4j/vIbnfzCmlA2XWFhdDyQpCxPU/VSjOd5p4a23s= Received: from IA1PR12MB6458.namprd12.prod.outlook.com (2603:10b6:208:3aa::22) by DM6PR12MB4895.namprd12.prod.outlook.com (2603:10b6:5:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 12:08:32 +0000 Received: from IA1PR12MB6458.namprd12.prod.outlook.com ([fe80::52d6:3130:de5e:c6da]) by IA1PR12MB6458.namprd12.prod.outlook.com ([fe80::52d6:3130:de5e:c6da%5]) with mapi id 15.20.6521.024; Mon, 26 Jun 2023 12:08:32 +0000 From: "Attar, AbdulLateef (Abdul Lateef)" To: "Chang, Abner" , "devel@edk2.groups.io" Subject: Re: [edk2-platforms][PATCH 2/2] AmdPlatformPkg/SimulatorSerialPortLibPort80: Simulator serial port lib Thread-Topic: [edk2-platforms][PATCH 2/2] AmdPlatformPkg/SimulatorSerialPortLibPort80: Simulator serial port lib Thread-Index: AQHZo+ECJUCQvC86SEKiP/w/QvlRva+dBhLA Date: Mon, 26 Jun 2023 12:08:32 +0000 Message-ID: References: <20230621013744.157-1-abner.chang@amd.com> <20230621013744.157-2-abner.chang@amd.com> In-Reply-To: <20230621013744.157-2-abner.chang@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=accb25cb-d6c8-45bd-9f0e-f8b88a88a6dc;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-06-26T12:08:27Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: IA1PR12MB6458:EE_|DM6PR12MB4895:EE_ x-ms-office365-filtering-correlation-id: 9a97283d-ee11-44cf-0297-08db763e0f72 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wUUPbiBBmqKjHFhWiHt/5L9z340yMZY9uhi6pmb1ecB7sZ4BQ5mjbfjW3nUkh8GH/sImChxbNHLbwKBseMfBfGX/eYefELkSJfQX46OlYF57P4dkMjPzn/EWsIBORxKpE4SckcZ+y8VT/BRolKXKATiYsv32gP8I/1NVGIvV8jaoJLhCdS5qyCWNH3czjpBanUa/keX643NY0pI+RkJm9eSKf5VU8bQIZlYYtVKqVXIqzoFbu/HEAQu4q45etnSoBHESyLsxqMHU6hGp4Vl0+nhxAjdKaFv2wOQiUsPMPMJrn2yZ6lQGGgIedLcaRVCS+w+C67Ts1TOtaMR/hgGvz6T7B7+5HuXH8guPQkefhMC0axySHkV/m881kkqFcciDZ26279MwAp9JnnbTaoOe98vytR2TZ3Kn7en/uj94MrRPANNBOoPD4XOFJ7mqpO3J9yU1NEer0Fd9NIpd2uiHF0/PS+Y18jytspeyNzAUExpHmv39qXnM9/2Sp15zeAK6Mv6eEKQwSbOc9F58QEoiyC1397cCqtrfCHCHXtIPePshOO4Rhx2inDixgDJmt6T4hw9i2W1Pp5KB60dkLSfnrifD5ZIItUFkbvZuWmzPyzeHpb3kQ/8fgrx+vxcwXjDrULQoZDIozyV9g1AqoaBxMw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6458.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(396003)(376002)(346002)(366004)(451199021)(19627235002)(110136005)(7696005)(478600001)(53546011)(33656002)(2906002)(9686003)(186003)(30864003)(6506007)(66476007)(66446008)(64756008)(71200400001)(66556008)(66946007)(316002)(76116006)(52536014)(8676002)(41300700001)(5660300002)(8936002)(38100700002)(122000001)(86362001)(55016003)(38070700005)(83380400001)(213903007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?k9QeBGESIzQHvqS4anIs8oN3c94E1C1DYJjCOHQ0jRNCS9a5Kt+eA1a1yGmP?= =?us-ascii?Q?wFd2ZD7oWdG5/GYUCanZVTfg2WhNY0g/v+vD7wV5JUu4KTJ2Wo6+UeUlrHMx?= =?us-ascii?Q?3AJ70Csb3gls/ooEeABm8x/b9aIL4uQZEDxkPYl9Opu0Ncu/Uj/oEL9bgVkG?= =?us-ascii?Q?pIvhW4yDhbKwNpgy/n6NuWENSiqq1OxihSx95/OXtj2G7YOnUqDLhitdboF+?= =?us-ascii?Q?7XWCdq4MbepYOvDsakkkMr+2xrEfifpUbidCffYD/01A1jUire+XGPsop0Iu?= =?us-ascii?Q?FAyhzP8Ee6pSTN0s8ETVHRPwnEmYjT5Z7OXt2Xo3lNxEK7MzyNG2hWXs9MSz?= =?us-ascii?Q?4r64Z+kIYYziOZCMVkzq8G6znnMNohqG5ULKpmDRt71GZpe05cFoidzqR4aG?= =?us-ascii?Q?o8lrzXLiAAI3zxBYZmz7E9peX+1omKHvJZY9SGOieNkIKxCN8XtKHbgEBueF?= =?us-ascii?Q?h9biEXEg32jhD4pYQ0zfkIvnty6Uxq/K5+F132UV2ekZMGauMNvJza4DH8H6?= =?us-ascii?Q?b8TA09JgWMU9ZB+0UM41AvpHGKM/B0KqklVtdi77FSe1H/vz7+965ZhRGWJt?= =?us-ascii?Q?HUsEXXr2RGx7xaIpI6BkgP+LTdlUH6kXQyY+R9GL/qy6KsM59uUC1du0or46?= =?us-ascii?Q?sGABDGmg+O6brMD0eyf5Ueu5uS3dZ+yImigncIIaDfkljp35pH9oZiL2O5sm?= =?us-ascii?Q?wvfYjf9Qg+MLAgZ2txOr9552rdhmpPXB607fw74AX47eQA6CL0BNR6UEFXvE?= =?us-ascii?Q?QJv26ZX+2MkHsHmXX982KdUBjyxcjEqBtXpa9SXDUNMKMZM5SU9LHXV9PUFJ?= =?us-ascii?Q?7xsRp6BEZJY3IN3ZCzoKWWNP4B7qwfZCfrPjP00qnIN5Iq1T8cAf9yo9MSUo?= =?us-ascii?Q?PraqUW6gj1BLI213DIIOucjXZLkJJYX7Iy72BCHG+cSkjBT3flWVU8KLnsbI?= =?us-ascii?Q?Un7h4P6pNVPemvxSzDONuPHLJVGIjyC82I72smJxFWzHrjDyRj5Vzm78BeUc?= =?us-ascii?Q?+lJ2DFIuwrpW5SlZJ1BmfXeQAjoc6RKruHbIkr/p14ud6reWRzN6lXPHgtEx?= =?us-ascii?Q?GGkJy3qYi1A2H2VT3vrBrnvIRhx8PD6t8hvnqKaxakz2+lbFpDhIuOnkRcp1?= =?us-ascii?Q?ao/djL/wSKuwloJzJUxJq7/CT5OAPT4j3qqEwuKYhKIKZEXFvuZwaA26pUsc?= =?us-ascii?Q?6Qjr2bQOy9DHM67eKHWTtw4/qnO4gjYqUa8A9dLhR+IgGbT7XekiS6nEJnKA?= =?us-ascii?Q?yeZyFx5eru4Cagk4APaPRNv0xzu372ujGPLkLHUnk6EX9MDefgtDbZSXSMxx?= =?us-ascii?Q?uoPYV+0vMzcjzvNglWFMifuIoXkaA2jEYVO404BqoXArNs+JnL3ya83TWvUL?= =?us-ascii?Q?Gy4MYQhv49qRai/KT32ckgD8crHNS+3PnRN97tm2snkWq7nL1bpPQAhBDlxb?= =?us-ascii?Q?sPXhusPG86XEciTFJ8CSNmfdMHWUms7r+wyUbq25E5DMS0y0BIHl7Yq8BwcT?= =?us-ascii?Q?HWVIHaZP9C+DK2SQ8BWouZ4ez1y2OMbwOum5KDwoSQ3svlAYG6Z/itsfJw?= =?us-ascii?Q?=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6458.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a97283d-ee11-44cf-0297-08db763e0f72 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jun 2023 12:08:32.2230 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5UsfwtCMaPoKyolTB/84wolRyJupyXB0pYjJqPlHHH78NEpmzczTjFyxdE4vkkPdePOnKJA1LZy3AdNdTlNoew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4895 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Reviewed-by: Abdul Lateef Attar -----Original Message----- From: Chang, Abner Sent: Wednesday, June 21, 2023 7:08 AM To: devel@edk2.groups.io Cc: Attar, AbdulLateef (Abdul Lateef) Subject: [edk2-platforms][PATCH 2/2] AmdPlatformPkg/SimulatorSerialPortLibP= ort80: Simulator serial port lib From: Abner Chang AMD simulator port 80 serial port library. Signed-off-by: Abner Chang Cc: Abdul Lateef Attar --- .../AMD/AmdPlatformPkg/AmdPlatformPkg.dsc | 71 ++++++ .../SimulatorSerialPortLibPort80.inf | 31 +++ .../SimulatorSerialPortLibPort80.c | 207 ++++++++++++++++++ 3 files changed, 309 insertions(+) create mode 100644 Platform/AMD/AmdPlatformPkg/Library/SimulatorSerialPort= LibPort80/SimulatorSerialPortLibPort80.inf create mode 100644 Platform/AMD/AmdPlatformPkg/Library/SimulatorSerialPort= LibPort80/SimulatorSerialPortLibPort80.c diff --git a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc b/Platform/AMD/= AmdPlatformPkg/AmdPlatformPkg.dsc index d3368c87ee..aa097bba09 100644 --- a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc +++ b/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc @@ -20,3 +20,74 @@ [Packages] AmdPlatformPkg/AmdPlatformPkg.dec + +!include MdePkg/MdeLibs.dsc.inc + +[LibraryClasses.Common] + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + +UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntr +yPoint.inf + +UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo +otServicesTableLib.inf + +UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/ +UefiRuntimeServicesTableLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + +DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/Base +DebugPrintErrorLevelLib.inf + + # + # Debug libraries + # + +DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/Base +DebugPrintErrorLevelLib.inf +!if $(TARGET) =3D=3D RELEASE + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!else + +DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.i +nf +!endif + + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroni + zationLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + + BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.i + nf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + + SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNu + ll.inf UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServ + icesLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTabl + eLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt + ryPoint.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiB + ootServicesTableLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib + /UefiRuntimeServicesTableLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + + # + # CryptLib + # + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf + + # + # Secureboot library + # + + SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/Secure + BootVariableLib.inf + SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableP + rovisionLib/SecureBootVariableProvisionLib.inf + + PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVar + Policy/PlatformPKProtectionLibVarPolicy.inf + + # + # Platform - Replace the modules in this section in platform DSC file. + # + + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempl + ate.inf + + # Simulator serial port 80 + + SerialPortLib|AmdPlatformPkg/Library/SimulatorSerialPortLibPort80/Simu + latorSerialPortLibPort80.inf + +[LibraryClasses.common.DXE_CORE, LibraryClasses.common.DXE_SMM_DRIVER, +LibraryClasses.common.SMM_CORE, LibraryClasses.common.DXE_DRIVER, +LibraryClasses.common.DXE_RUNTIME_DRIVER, +LibraryClasses.common.UEFI_DRIVER, +LibraryClasses.common.UEFI_APPLICATION] + +MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAl +locationLib.inf + +ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepo +rtStatusCodeLib.inf + +[Components] + +AmdPlatformPkg/Library/SimulatorSerialPortLibPort80/SimulatorSerialPort +LibPort80.inf + diff --git a/Platform/AMD/AmdPlatformPkg/Library/SimulatorSerialPortLibPort= 80/SimulatorSerialPortLibPort80.inf b/Platform/AMD/AmdPlatformPkg/Library/S= imulatorSerialPortLibPort80/SimulatorSerialPortLibPort80.inf new file mode 100644 index 0000000000..42f46f4c2c --- /dev/null +++ b/Platform/AMD/AmdPlatformPkg/Library/SimulatorSerialPortLibPort80/S +++ imulatorSerialPortLibPort80.inf @@ -0,0 +1,31 @@ +## @file +# Simlator port80 instance of serial port library functions. +# +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent # ## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D SimulatorSerialPortLibPort80 + FILE_GUID =3D 35217E20-489E-64F9-4E42-1EAFABE0A86F + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D SerialPortLib + +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + SimulatorSerialPortLibPort80.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + BaseLib + IoLib diff --git a/Platform/AMD/AmdPlatformPkg/Library/SimulatorSerialPortLibPort= 80/SimulatorSerialPortLibPort80.c b/Platform/AMD/AmdPlatformPkg/Library/Sim= ulatorSerialPortLibPort80/SimulatorSerialPortLibPort80.c new file mode 100644 index 0000000000..3a43760627 --- /dev/null +++ b/Platform/AMD/AmdPlatformPkg/Library/SimulatorSerialPortLibPort80/S +++ imulatorSerialPortLibPort80.c @@ -0,0 +1,207 @@ +/** @file + AMD simulator port80 serial port library functions. + + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +/** + Initialize the serial device hardware. + + If no initialization is required, then return RETURN_SUCCESS. + If the serial device was successfully initialized, then return RETURN_SU= CCESS. + 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 initialized= . + +**/ +RETURN_STATUS +EFIAPI +SerialPortInitialize ( + VOID + ) +{ + // Chipset defaults properly decoding port 80 to eSPI + return EFI_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 operation= failed. + If Buffer is NULL, then ASSERT(). + If NumberOfBytes is zero, then return 0. + + @param[in] Buffer The pointer to the data buffer to be writte= n. + @param[in] NumberOfBytes The number of bytes to written to the seria= l device. + + @retval 0 NumberOfBytes is 0. + @retval >0 The number of bytes written to the serial devic= e. + If this value is less than NumberOfBytes, then = the read operation failed. + +**/ +UINTN +EFIAPI +SerialPortWrite ( + IN UINT8 *Buffer, + IN UINTN NumberOfBytes + ) +{ + UINTN ByteCount; + + if ((Buffer =3D=3D NULL) || (NumberOfBytes =3D=3D 0)) { + return 0; + } + + IoWrite32 (0x80, SIGNATURE_32 ('R', 'T', 'S', '_')); + + ByteCount =3D NumberOfBytes; + for ( ; ByteCount !=3D 0; ByteCount--, Buffer++) { + IoWrite8 (0x80, *Buffer); + } + + IoWrite32 (0x80, SIGNATURE_32 ('D', 'N', 'E', '_')); + + return NumberOfBytes; +} + +/** + Read data from serial device and save the datas in buffer. + + Reads NumberOfBytes data bytes from a serial device into the buffer + specified by Buffer. The number of bytes actually read is returned. + If the return value is less than NumberOfBytes, then the rest operation = failed. + If Buffer is NULL, then ASSERT(). + If NumberOfBytes is zero, then return 0. + + @param[out] Buffer The pointer to the data buffer to store th= e data read from the serial device. + @param[in] NumberOfBytes The number of bytes which will be read. + + @retval 0 Read data failed; No data is to be read. + @retval >0 The actual number of bytes read from serial dev= ice. + +**/ +UINTN +EFIAPI +SerialPortRead ( + OUT UINT8 *Buffer, + IN UINTN NumberOfBytes + ) +{ + return 0; +} + +/** + 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 FALS= E is returned. + + @retval TRUE Data is waiting to be read from the serial devi= ce. + @retval FALSE There is no data waiting to be read from the se= rial device. + +**/ +BOOLEAN +EFIAPI +SerialPortPoll ( + VOID + ) +{ + return FALSE; +} + +/** + Sets the control bits on a serial device. + + @param[in] Control Sets the bits of Control that are sett= able. + + @retval RETURN_SUCCESS The new control bits were set on the seria= l device. + @retval RETURN_UNSUPPORTED The serial device does not support this op= eration. + @retval RETURN_DEVICE_ERROR The serial device is not functioning corre= ctly. + +**/ +RETURN_STATUS +EFIAPI +SerialPortSetControl ( + IN UINT32 Control + ) +{ + return RETURN_UNSUPPORTED; +} + +/** + Retrieve the status of the control bits on a serial device. + + @param[out] Control A pointer to return the current contr= ol signals from the serial device. + + @retval RETURN_SUCCESS The control bits were read from the serial= device. + @retval RETURN_UNSUPPORTED The serial device does not support this op= eration. + @retval RETURN_DEVICE_ERROR The serial device is not functioning corre= ctly. + +**/ +RETURN_STATUS +EFIAPI +SerialPortGetControl ( + OUT UINT32 *Control + ) +{ + return RETURN_UNSUPPORTED; +} + +/** + Sets the baud rate, receive FIFO depth, transmit/receice time out, +parity, + data bits, and stop bits on a serial device. + + @param[in,out] BaudRate The requested baud rate. A BaudRate val= ue of 0 will use the + device's default interface speed. + On output, the value actually set. + @param[in,out] ReveiveFifoDepth The requested depth of the FIFO on the = receive side of the + serial interface. A ReceiveFifoDepth va= lue of 0 will use + the device's default FIFO depth. + On output, the value actually set. + @param[in,out] Timeout The requested time out for a single cha= racter in microseconds. + This timeout applies to both the transm= it and receive side of the + interface. A Timeout value of 0 will us= e the device's default time + out value. + On output, the value actually set. + @param[in,out] Parity The type of parity to use on this seria= l device. A Parity value of + DefaultParity will use the device's def= ault parity value. + On output, the value actually set. + @param[in,out] DataBits The number of data bits to use on the s= erial device. A DataBits + vaule of 0 will use the device's defaul= t data bit setting. + On output, the value actually set. + @param[in,out] StopBits The number of stop bits to use on this = serial device. A StopBits + value of DefaultStopBits will use the d= evice's default number of + stop bits. + On output, the value actually set. + + @retval RETURN_SUCCESS The new attributes were set on the ser= ial device. + @retval RETURN_UNSUPPORTED The serial device does not support thi= s operation. + @retval RETURN_INVALID_PARAMETER One or more of the attributes has an u= nsupported value. + @retval RETURN_DEVICE_ERROR The serial device is not functioning c= orrectly. + +**/ +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 + ) +{ + return RETURN_UNSUPPORTED; +} -- 2.37.1.windows.1