From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id C726DAC09DC for ; Mon, 20 May 2024 11:00:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=bXKQXhu8EUtrt2GrESCaCqiXKlqRW7Mjh+oeTwtZ3rw=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1716202843; v=1; b=nHe26I25xFU0fmqPYRJHurcJIkvWdUU7W+Hf/dOn1RTGgRwGJnjS6I64AnoYWq0bip3x4/3u u+f+1nH9HTC/MrsiH7jYKe6JtRhO6ZWM3rIldC4xcgv2KvjBo8EsyRRujboWi/32rtj9zFlcv0a qgxAqz+lfgHQ0x3ujvIVvp2JxJxtHD9ynDPXRg4VCvCGl3qJGLidfuXlgm8aR/hUoR8+hq1M4Wm efzGJC/4qt/aI0FpHb5j7x2OUBAEJMhcWigj4dO9ywO0gWd/ansMLAz4dvrd5dZ6qfqiJ+j31A+ eq2KQeHuBzsMUq4ddbPJdVsjkAWiSpvnQsPAfRG6WwIEA== X-Received: by 127.0.0.2 with SMTP id 9dChYY7687511xfLmrAnI2x5; Mon, 20 May 2024 04:00:43 -0700 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.51]) by mx.groups.io with SMTP id smtpd.web10.57400.1716202841444747431 for ; Mon, 20 May 2024 04:00:41 -0700 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com (2603:10b6:408:200::8) by SJ0PR12MB5611.namprd12.prod.outlook.com (2603:10b6:a03:426::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Mon, 20 May 2024 11:00:35 +0000 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::9d67:b4b7:7bad:8c08]) by LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::9d67:b4b7:7bad:8c08%5]) with mapi id 15.20.7587.030; Mon, 20 May 2024 11:00:35 +0000 From: "Chang, Abner via groups.io" To: "Attar, AbdulLateef (Abdul Lateef)" , "devel@edk2.groups.io" CC: "Attar, AbdulLateef (Abdul Lateef)" , "Grimes, Paul" Subject: Re: [edk2-devel] [edk2-platforms] AmdPlatformPkg: Adds SmbiosCommonDxe driver Thread-Topic: [edk2-platforms] AmdPlatformPkg: Adds SmbiosCommonDxe driver Thread-Index: AQHaqp/W/bFO0dngt06vdF2VX/JK1bGf9ILQ Date: Mon, 20 May 2024 11:00:35 +0000 Message-ID: References: <258705f7a915516b3ad60c503c8e446e78070b0e.1716200614.git.AbdulLateef.Attar@amd.com> In-Reply-To: <258705f7a915516b3ad60c503c8e446e78070b0e.1716200614.git.AbdulLateef.Attar@amd.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ActionId=a0387358-ad2f-487b-853e-db245446e010;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ContentBits=0;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Enabled=true;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Method=Standard;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Name=AMD Internal Distribution Only;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SetDate=2024-05-20T11:00:08Z;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV8PR12MB9452:EE_|SJ0PR12MB5611:EE_ x-ms-office365-filtering-correlation-id: d813d2b0-acf5-44df-8103-08dc78bc1383 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?mAAfQ4UeaYgDX5+K4fAb3kH3wpS19tnxs6sJ3o1wQZuhDqg7Y6dCQ9nlNlzY?= =?us-ascii?Q?lmdlLSokjKavkMKk1nZVNDWLNpbACyQglHNHZrYkOi8nuto9DUUOYTSVyH35?= =?us-ascii?Q?JLpOCDAY+qZZFvvGxke9wUZAqfErytSBxMNnff9hdwBsk8ZDKOxPj7fNJp+z?= =?us-ascii?Q?AcpnjD+qXWNI8BSmrBzCt8xFMeumZmtY+v6dewLXpr3KWt3qDIqWWjOfpmE1?= =?us-ascii?Q?dy/l717XeB57lzExn9LINMzsdohrUuG841ho30a8QodoOyeVkgfjzXJYeo2+?= =?us-ascii?Q?PsVG7gyQae2vR3o2igdp8XKGdG8NIEeCkGRbOesDeXFboHVF078loHM9V07z?= =?us-ascii?Q?oL41edpPWH6JJw7p7lx7Qq06CUnuzNZYuamPF9hW8g7IePkQJXwHQH46Q+iE?= =?us-ascii?Q?D8Ew6dHflzEr6GegylfPNM+n5Yu2rcCib79aKJR5N/4tO/ARh5IO3BdySWzf?= =?us-ascii?Q?xJSzKGOC9+8cn8V0omRoeFIjgX/dXivt7IkI7bxsGtJ3fUzyE7kwBtlAgwgs?= =?us-ascii?Q?yvzR9XGp42JRB6Cj+JoRs6cic5Yzw3nlviQb4U6LXJsNlZOR9zROLiHMOuem?= =?us-ascii?Q?S4S66ou1qUtOWWkEfjDI5PqtJ6BeyBVKoBJLWf0k44Zr0JsuK2DWfJt0ZxWP?= =?us-ascii?Q?/Co7kiOadkk5LXFARZhCURvlfU4pntXEETztNoGu+Q7QSqQ6Ms6W8tMXtZMf?= =?us-ascii?Q?pyOX2HwC5T4DUnxPEpyF2rpAokkVfmm7dnYenr7zD9XHbPJ+DOnIjzm/RoxU?= =?us-ascii?Q?6z7HJ9nJF6aOFjkV2hVpvffkznaPoIf2xcZ4g7zou5syWRtZ3juizQv0s+6S?= =?us-ascii?Q?QHDGvLQJrPYVQ7gfARhOu+zNT13m9Cg8JjrcnCRIBX0LDZkn2SLFD0XwjN8I?= =?us-ascii?Q?9kOcBPQuw+CTP9W+EWIkDLzb+WISVrJyUpjaRGlXZ2nuvJN6dQ1B2s1/vz63?= =?us-ascii?Q?UOlE9w6sB73N9/IHGLk+Lj5LfguOsbvNSwGxJpmjC1yN9CY4+uSSSnbZJoER?= =?us-ascii?Q?N3JgEDIcGRHlPVpNbvIH+RrbzV64f56qNeimj1OwqbbVsQ9mIwy5CyaEjzAR?= =?us-ascii?Q?KlTh5/SZ6OI+tb4SCaQxCkIqq3xm/MROj9jGcAS3+wqiyyY5/xFf40MDPgdR?= =?us-ascii?Q?+wpiVYj2fjzFqfZ1dCiy8ffJI47gimtzIu9D08+YhWoFpmzuJFpSlHdUPM6g?= =?us-ascii?Q?6clRTSh4SEzLQY7tVRjFXLEgK9Hd4OkJ8iOn0pLUmm7M5rpCpLd14oxlRgBj?= =?us-ascii?Q?Phfx+PY2KgvfeN+xL9ER/fnavUHe6kymRzWCrBXukpGIkI2Rvb3hPjwaKqy3?= =?us-ascii?Q?wqUDoK1d++0UVYrkE8w93aO8PcdgdWdA1JY9IznT5VI62Q=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?gT0NxDIWMXX/N9ShM7j2BqVVjCv/6f8EQ5dgg3wMwEesytysDAmxKq+ZQhhb?= =?us-ascii?Q?SLx6FBrkz0/1oG0QW/G5b/DKL1oYESX0zme3UnYx5yeAmqwpj8YVZ4p57JQL?= =?us-ascii?Q?Tgt8i94vQaMu0zKYE5FGu9vWgtLYNdQKU18dwzeVSldLel33hYAHVk4G+gMR?= =?us-ascii?Q?bDh3pQENj1unV0rNXfMPmnzwcWTHhOL9bv5hpk0igUQ92eDLSpHJ5UL6mYTn?= =?us-ascii?Q?EI38Fndwk+RbfD2z3l4Su3Q4FkmgGDN0qFqvdjSRA79VofUe4yrrAyHRC475?= =?us-ascii?Q?Qh4dOxBOL8um7LTC1JwjcVssr6kwL3MOSUFvrBl7r6Gxva0dTgCPCti4jor9?= =?us-ascii?Q?LmOqbssgiHB+4WmVuAbum5T0wRVc4LEwUR2gBs5h/js9l01b0892N68swMee?= =?us-ascii?Q?xUc8w/E3KH4nauuyd9W3Rg5Aw39BTgaga8kTJ4FJLoRO63NluikzoG4RevYI?= =?us-ascii?Q?Asqj6nn/Oslx2TFFcW4eHkbHzAosb5rl7mYkvYqw+zhpVu7O7U4IuXQlONwi?= =?us-ascii?Q?ljir3lIRPrtbij1Opihb8V80XhgVtaLe5Z4gu62y2KJNnB5cjRTSEtk5lgnQ?= =?us-ascii?Q?CqRaiRU2Y5X7FT2m5GlOPKEe2HP+pjwokObu1nLAQmofoYrU1JNcEHbgpuan?= =?us-ascii?Q?+9bjn8cF6l79d3Cz03KHJHFiPeGTS227JwvtfknW8lbKKH7sj5PXDHCaCnSz?= =?us-ascii?Q?bp33pBvHc7t+vLMgbJkylTyT56y0Qgn9gegllfRSnegNYky+ItT33ne/yxE+?= =?us-ascii?Q?5eVkYUpqVoTzMF5+aep+Z+EdzpOA1L004hLKxb6JtsPGDcixxHRVtcXf6yXI?= =?us-ascii?Q?lzVRiAsAYTIr2rfWG1DXZkP6VGcQqJB4f3QtX8vBSEmDKvfmn0Oj60PQgKmD?= =?us-ascii?Q?jyHMSYTSNIcBYuGXwQGdSqHxudOISNb7xpIS5mMJhO11DLx00ssXB7qgs4I1?= =?us-ascii?Q?TJBhJqkC0q9ijv/yc0cHbNXHygE544FasxQiya+BiYg4zrb1dfmLTM+KQgiN?= =?us-ascii?Q?dxxIX0yCoClDtBCe3xgs09tnnAC16ByiEheBfjNtTvSQWHilmWZPxywXaLlv?= =?us-ascii?Q?3g7Fvs917DLBWRc5nYgN2MqNjlfuH87Tq5Tx2alJXNR75Kny26ml1CPxfLLc?= =?us-ascii?Q?x3HF7pVdm2B4YBTGL+2TzK8sYcuKEKZtPVFjyySegaQELmc+mwy5UoS0mWYb?= =?us-ascii?Q?2CccS9Oy33308VR4UJWJUn5r0PEOALCKYZ3iv2bSD4MknwKBrHQxfF78fWqk?= =?us-ascii?Q?2qL5TAAohS8gN+jXg/yqMgfveJMiMaM1fa5nTmjF1FbnSb5V/atFhSdnyijb?= =?us-ascii?Q?Z8DN/IEKax6N4taMMWoOfWnwRF1WoEzOoXIWvNXWtxWZDRjTHuoDNvhjNgjO?= =?us-ascii?Q?Cuma2MUw76LkOmkul6tQ4UIwgwz2f0cHVKTrTmP+4wILm9lQXMVrXQ8clmTn?= =?us-ascii?Q?LoQqLDhbl1F2auEspKfk4BS5jXd2/g9YFV4P+rq3FUrNwJwZA+2414jkoOmq?= =?us-ascii?Q?ZA2xV1a2y69MGfgTccVUs05xSbni220cw2JuYk20fFNjEltmZiUdeSkNhOgi?= =?us-ascii?Q?BF64rtpiKH8smQMnQoo=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV8PR12MB9452.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d813d2b0-acf5-44df-8103-08dc78bc1383 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 May 2024 11:00:35.6006 (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: hiMeZxZqbs3ZYR5GhGDkaJQnjF/oWlc/INTkBVSMukKsyEAtQoJtFn2aJ8d324jop+AEp4s1ELAfKYoTTzC6ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5611 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 20 May 2024 04:00:42 -0700 Resent-From: abner.chang@amd.com Reply-To: devel@edk2.groups.io,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: LIabvLTyaAaSLuShWlXATciNx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=nHe26I25; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io [AMD Official Use Only - AMD Internal Distribution Only] Already reviewed internally. Reviewed-by: Abner Chang > -----Original Message----- > From: Abdul Lateef Attar > Sent: Monday, May 20, 2024 6:24 PM > To: devel@edk2.groups.io > Cc: Attar, AbdulLateef (Abdul Lateef) ; Chang, > Abner ; Grimes, Paul > Subject: [edk2-platforms] AmdPlatformPkg: Adds SmbiosCommonDxe driver > > Adds SMBIOS common driver which generates various > tables for AMD platforms. > > Cc: Abner Chang > Cc: Paul Grimes > Signed-off-by: Abdul Lateef Attar > --- > .../AMD/AmdPlatformPkg/AmdPlatformPkg.dec | 63 ++++- > .../AMD/AmdPlatformPkg/AmdPlatformPkg.dsc | 3 +- > .../SmbiosCommonDxe/DefaultLomDevicePath.c | 130 ++++++++++ > .../Universal/SmbiosCommonDxe/SmbiosCommon.h | 210 > ++++++++++++++++ > .../SmbiosCommonDxe/SmbiosCommonDxe.inf | 76 ++++++ > .../SmbiosCommonDxe/SmbiosCommonEntryPoint.c | 148 +++++++++++ > .../Type11OemStringsFunction.c | 91 +++++++ > .../Type12SystemCfgOptionsFunction.c | 90 +++++++ > .../Type13BiosLanguageInfoFunction.c | 146 +++++++++++ > .../Type38IpmiDeviceInformation.c | 70 ++++++ > .../Type41OnboardDevExtInfoFunction.c | 237 ++++++++++++++++++ > .../Type8PortConnectorInfoFunction.c | 133 ++++++++++ > .../Type9SystemSlotInfoFunction.c | 94 +++++++ > 13 files changed, 1489 insertions(+), 2 deletions(-) > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLom > DevicePath.c > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCom > mon.h > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCom > monDxe.inf > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCom > monEntryPoint.c > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type11Oem > StringsFunction.c > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type12Syste > mCfgOptionsFunction.c > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type13BiosL > anguageInfoFunction.c > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type38Ipmi > DeviceInformation.c > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type41Onb > oardDevExtInfoFunction.c > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type8PortC > onnectorInfoFunction.c > create mode 100644 > Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type9Syste > mSlotInfoFunction.c > > diff --git a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dec > b/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dec > index 83f57f6d0a..787dac4cca 100644 > --- a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dec > +++ b/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dec > @@ -8,7 +8,7 @@ > # > ## > > -[Defines] > +[Defines] > DEC_SPECIFICATION =3D 1.27 > PACKAGE_NAME =3D AmdPlatformPkg > PACKAGE_GUID =3D 2CB1238B-18E2-4837-B714-9DAB2B30A3C2 > @@ -42,3 +42,64 @@ > # 3 - BT > # 4 - SSIF > > gAmdPlatformPkgTokenSpaceGuid.PcdIpmiInterfaceType|0|UINT8|0x00020 > 001 > + > + # > + # This PCD is mapped to AMD SMBIOS type 8 record structure > + # > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType8Number|0|UINT8|0 > x00020002 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType8|{0x0}|SMBIOS_PO > RT_CONNECTOR_RECORD_ARRAY|0x00020003 { > + > + Pcd/SmbiosPcd.h > + > + AmdPlatformPkg/AmdPlatformPkg.dec > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + } > + > + # > + # This PCD is mapped to AMD SMBIOS type 41 record structure > + # > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType41Number|0|UINT8| > 0x00020004 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType41|{0x0}|SMBIOS_O > NBOARD_DEV_EXT_INFO_ARRAY|0x00020005 { > + > + Pcd/SmbiosPcd.h > + > + AmdPlatformPkg/AmdPlatformPkg.dec > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + } > + > + # > + # These PCDs are mapped to AMD SMBIOS type 9 record structure > + # > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1| > {0x0}|MISC_SLOT_CHARACTERISTICS1|0x00020009 { > + > + IndustryStandard/SmBios.h > + } > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1. > CharacteristicsUnknown|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1. > Provides50Volts|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1. > Provides33Volts|1 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1. > SharedSlot|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1. > PcCard16Supported|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1. > CardBusSupported|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1. > ZoomVideoSupported|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1. > ModemRingResumeSupported|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2| > {0x0}|MISC_SLOT_CHARACTERISTICS2|0x0002000A { > + > + IndustryStandard/SmBios.h > + } > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2. > PmeSignalSupported|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2. > HotPlugDevicesSupported|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2. > SmbusSignalSupported|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2. > BifurcationSupported|1 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2. > AsyncSurpriseRemoval|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2. > FlexbusSlotCxl10Capable|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2. > FlexbusSlotCxl20Capable|0 > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2. > Reserved|0 > + > +[PcdsDynamic, PcdsDynamicEx] > + # SMBIOS > + > gAmdPlatformPkgTokenSpaceGuid.PcdType11OemStringsCount|0|UINT8|0x > 00030001 > + > gAmdPlatformPkgTokenSpaceGuid.PcdType11OemStrings|NULL|VOID*|0x00 > 030002 > + > gAmdPlatformPkgTokenSpaceGuid.PcdType12SystemCfgOptionsCount|0|UI > NT8|0x00030003 > + > gAmdPlatformPkgTokenSpaceGuid.PcdType12SystemCfgOptions|NULL|VOID > *|0x00030004 > diff --git a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc > b/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc > index 99dd5b341f..d11d3594e3 100644 > --- a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc > +++ b/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc > @@ -71,4 +71,5 @@ > AmdPlatformPkg/Universal/HiiConfigRouting/AmdConfigRouting.inf > AmdPlatformPkg/Universal/LogoDxe/JpegLogoDxe.inf > # Server platform JPEG logo driver > AmdPlatformPkg/Universal/LogoDxe/LogoDxe.inf = # > Server platfrom Bitmap logo driver > - AmdPlatformPkg/Universal/LogoDxe/S3LogoDxe.inf > \ No newline at end of file > + AmdPlatformPkg/Universal/LogoDxe/S3LogoDxe.inf > + AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommonDxe.inf > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLo > mDevicePath.c > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLo > mDevicePath.c > new file mode 100644 > index 0000000000..92c7aa5e07 > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLo > mDevicePath.c > @@ -0,0 +1,130 @@ > +/** @file > + This file contains the implementation of the DefaultLomDevicePath prot= ocol. > + The DefaultLomDevicePath protocol is used to identify the default LOM > device > + path for the system. The protocol is installed by the SmbiosCommonDxe > driver > + and is used by the BDS to identify the default LOM device path for the > system. > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights rese= rved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include "SmbiosCommon.h" > +#include > +#include > + > +EFI_HANDLE mBoardBdsHandle =3D NULL; > +BOARD_BDS_BOOT_FROM_DEVICE_PATH_PROTOCOL > mBootDevicePathProtocol; > + > +/** > + Find the Lan-On-Motherboard device path. Installs > BOARD_BDS_BOOT_FROM_DEVICE_PATH_PROTOCOL > + with the LOM device path protocol > + > + @retval EFI NOT_FOUND LOM device path is not found > + @retval EFI_SUCCESS LOM device path found > +**/ > +EFI_STATUS > +EFIAPI > +InstallLomDevicePath ( > + ) > +{ > + SMBIOS_ONBOARD_DEV_EXT_INFO_RECORD *DevExtInfoRecord; > + EFI_STATUS Status; > + EFI_HANDLE *PciHandles; > + UINTN PciHandlesSize; > + UINTN Index; > + EFI_PCI_IO_PROTOCOL *PciProtocol; > + PCI_IO_DEVICE *PciIoDevice; > + UINT8 NumberOfDevices; > + UINT8 DevIdx; > + UINTN SegmentNumber; > + UINTN BusNumber; > + UINTN DeviceNumber; > + UINTN FunctionNumber; > + > + NumberOfDevices =3D PcdGet8 (PcdAmdSmbiosType41Number); > + DevExtInfoRecord =3D (SMBIOS_ONBOARD_DEV_EXT_INFO_RECORD > *)PcdGetPtr (PcdAmdSmbiosType41); > + > + // No device entries found > + if (NumberOfDevices =3D=3D 0) { > + DEBUG ((DEBUG_INFO, "No onboard devices found.\n")); > + return EFI_NOT_FOUND; > + } > + > + // search through present on board devices, look for onboard ethernet > + for (DevIdx =3D 0; DevIdx < NumberOfDevices; DevIdx++) { > + if (AsciiStrCmp (DevExtInfoRecord->RefDesignationStr, "Onboard > Ethernet") =3D=3D 0) { > + break; > + } > + > + DevExtInfoRecord++; > + } > + > + // edge case, no Onboard Ethernet designator > + if (AsciiStrCmp (DevExtInfoRecord->RefDesignationStr, "Onboard > Ethernet") !=3D 0) { > + DEBUG ((DEBUG_INFO, "No Onboard ethernet SMBIOS designator > found!\n")); > + return EFI_NOT_FOUND; > + } > + > + Status =3D gBS->LocateHandleBuffer ( > + ByProtocol, > + &gEfiPciIoProtocolGuid, > + NULL, > + &PciHandlesSize, > + &PciHandles > + ); > + > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_INFO, "Can't locate gEfiPciIoProtocolGuid Protocol: St= atus > =3D %r\n\n", Status)); > + return Status; > + } > + > + for (Index =3D 0; Index < PciHandlesSize; Index++) { > + Status =3D gBS->HandleProtocol ( > + PciHandles[Index], > + &gEfiPciIoProtocolGuid, > + (VOID **)&PciProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_INFO, "ERROR - Status =3D %r when locating > PciIoProtocol\n", Status)); > + continue; > + } > + > + PciIoDevice =3D PCI_IO_DEVICE_FROM_PCI_IO_THIS (PciProtocol); > + Status =3D PciIoDevice->PciIo.GetLocation (&PciIoDevice->PciIo, > &SegmentNumber, &BusNumber, &DeviceNumber, &FunctionNumber); > + > + if ((PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS (SegmentNumber, > BusNumber, DeviceNumber, FunctionNumber, 2)) =3D=3D DevExtInfoRecord- > >DeviceId) && > + (PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS (SegmentNumber, > BusNumber, DeviceNumber, FunctionNumber, 0)) =3D=3D DevExtInfoRecord- > >VendorId)) > + { > + // Making Lan0 default for systems with two LANs > + if (FunctionNumber =3D=3D 0) { > + DEBUG ((DEBUG_INFO, "Found Onboard Device with DeviceID=3D0x%X, > VendorID=3D0x%X\n", DevExtInfoRecord->DeviceId, DevExtInfoRecord- > >VendorId)); > + Status =3D EFI_SUCCESS; > + // install device path protocol here > + mBootDevicePathProtocol.Device =3D PciIoDevi= ce->DevicePath; > + mBootDevicePathProtocol.IpmiBootDeviceSelectorType =3D > IPMI_BOOT_DEVICE_SELECTOR_PXE; > + Status =3D gBS->Inst= allProtocolInterface ( > + &mBo= ardBdsHandle, > + > &gBoardBdsBootFromDevicePathProtocolGuid, > + EFI_= NATIVE_INTERFACE, > + &mBo= otDevicePathProtocol > + ); > + if (!EFI_ERROR (Status)) { > + DEBUG ((DEBUG_INFO, "BoardBdsBootFromDevicePathProtocol > installed successfully\n")); > + } > + > + break; > + } > + } > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo > mmon.h > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo > mmon.h > new file mode 100644 > index 0000000000..770053e42b > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo > mmon.h > @@ -0,0 +1,210 @@ > +/** @file > + AMD Smbios common header file. > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights rese= rved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef SMBIOS_COMMON_DRIVER_H_ > +#define SMBIOS_COMMON_DRIVER_H_ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/** > + Add an SMBIOS record. > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instance. > + @param[out] SmbiosHandle A unique handle will be assigned to = the > SMBIOS record. > + @param[in] Record The data for the fixed portion of th= e SMBIOS > record. The format of the record is > + determined by EFI_SMBIOS_TABLE_HEADER.Ty= pe. The size of > the formatted area is defined > + by EFI_SMBIOS_TABLE_HEADER.Length and ei= ther followed > by a double-null (0x0000) or > + a set of null terminated strings and a n= ull. > + > + @retval EFI_SUCCESS Record was added. > + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of > system resources. > + > +**/ > +EFI_STATUS > +AddCommonSmbiosRecord ( > + IN EFI_SMBIOS_PROTOCOL *Smbios, > + OUT EFI_SMBIOS_HANDLE *SmbiosHandle, > + IN EFI_SMBIOS_TABLE_HEADER *Record > + ); > + > +/** > + This function gets the Bus, Device and Segment number of a PCI device > when Vendor ID, Device ID and instance > + are provided. > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + @param[in] VendorId Vendor ID of the PCI device to = be provided. > + @param[in] DeviceId Device ID of the PCI device to = be provided > + @param[out] Instance Instance of the PCI device. If= more than > one devices with same vendor > + and device ID is present, instance = number is used. > + @param[out] Segment Segment number of the PCI devi= ce is > assigned. > + @param[out] Bus Bus number of the PCI device i= s assigned. > + @param[out] Device Device number of the PCI devic= e is assigned. > + @param[out] Functions Bits 0-7 of the Functions vari= able > correspond to respective function numbers. > + @param[out] DeviceFound Set to 1 if the device is foun= d. > + > + @retval EFI_SUCCESS All parameters were valid. > +**/ > +EFI_STATUS > +EFIAPI > +GetBusDeviceInfo ( > + IN UINT16 *VendorId, > + IN UINT16 *DeviceId, > + IN UINT8 *Instance, > + OUT UINT16 *Segment, > + OUT UINT8 *Bus, > + OUT UINT8 *Device, > + OUT UINT8 *Functions, > + OUT UINT8 *DeviceFound > + ); > + > +/** > + PciEnumerationComplete Protocol notification event handler. > + > + @param[in] Event Event whose notification function is being invoked= . > + @param[in] Context Pointer to the notification function's context. > +**/ > +VOID > +EFIAPI > +OnPciEnumerationComplete ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ); > + > +/** > + This function updates IPMI Device information changes to the contents = of > the > + Table Type 38. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_UNSUPPORTED Unexpected RecordType value. > +**/ > +EFI_STATUS > +EFIAPI > +IpmiDeviceInformation ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ); > + > +/** > + This function checks for system slot info and adds smbios record (Type= 9). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > + > +**/ > +EFI_STATUS > +EFIAPI > +SystemSlotInfoFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ); > + > +/** > + This function adds port connector information smbios record (Type 8). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > +**/ > +EFI_STATUS > +EFIAPI > +PortConnectorInfoFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ); > + > +/** > + This function adds OEM strings smbios record (Type 11). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > +**/ > +EFI_STATUS > +EFIAPI > +OemStringsFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ); > + > +/** > + This function adds System Configuration Options record (Type 12). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > +**/ > +EFI_STATUS > +EFIAPI > +SystemCfgOptionsFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ); > + > +/** > + This function adds bios language information smbios record (Type 13). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > + @retval EFI_NOT_FOUND Not able to locate PlatformLanguage= . > + > +**/ > +EFI_STATUS > +EFIAPI > +BiosLanguageInfoFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ); > + > +/** > + This function adds onboard devices extended information smbios record > (Type 41). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > +**/ > +EFI_STATUS > +EFIAPI > +OnboardDevExtInfoFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ); > + > +/** > + Find the Lan-On-Motherboard device path. Installs > BOARD_BDS_BOOT_FROM_DEVICE_PATH_PROTOCOL > + with the LOM device path protocol > + > + @retval EFI NOT_FOUND LOM device path is not found > + @retval EFI_SUCCESS LOM device path found > +**/ > +EFI_STATUS > +EFIAPI > +InstallLomDevicePath ( > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI EFI_COMMON_SMBIOS_DATA_FUNCTION)( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ); > + > +typedef struct { > + EFI_COMMON_SMBIOS_DATA_FUNCTION *Function; > +} EFI_COMMON_SMBIOS_DATA; > +#endif // SMBIOS_COMMON_DRIVER_H_ > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo > mmonDxe.inf > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo > mmonDxe.inf > new file mode 100644 > index 0000000000..e3d296192c > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo > mmonDxe.inf > @@ -0,0 +1,76 @@ > +## @file > +# AMD common SMBIOS DXE library Description File > +# > +# 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 SmbiosCommonDxe > + FILE_GUID =3D 2546E2B4-8629-47C3-A294-91E244936CB= E > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D SmbiosCommonEntryPoint > + > +# > +# The following information is for reference only and not required by th= e build > tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +[Sources] > + SmbiosCommon.h > + SmbiosCommonEntryPoint.c > + Type38IpmiDeviceInformation.c > + Type9SystemSlotInfoFunction.c > + Type8PortConnectorInfoFunction.c > + Type11OemStringsFunction.c > + Type12SystemCfgOptionsFunction.c > + Type13BiosLanguageInfoFunction.c > + Type41OnboardDevExtInfoFunction.c > + DefaultLomDevicePath.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + AmdPlatformPkg/AmdPlatformPkg.dec > + BoardModulePkg/BoardModulePkg.dec > + > +[LibraryClasses] > + BaseLib > + BaseMemoryLib > + DebugLib > + DevicePathLib > + HobLib > + MemoryAllocationLib > + PcdLib > + UefiDriverEntryPoint > + UefiLib > + PlatformSocLib > + > +[Protocols] > + gEfiSmbiosProtocolGuid ## PROTOCOL ALWAYS_CONSUM= ED > + gEfiPciEnumerationCompleteProtocolGuid ## CONSUMES > + gEfiPciIoProtocolGuid ## CONSUMES > + gBoardBdsBootFromDevicePathProtocolGuid ## PRODUCES > + > +[Pcd] > + gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType8 = ## > CONSUMES > + gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType8Number > ## CONSUMES > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics1 > ## CONSUMES > + > gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType9SlotCharacteristics2 > ## CONSUMES > + gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType41 = ## > CONSUMES > + gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType41Number > ## CONSUMES > + gAmdPlatformPkgTokenSpaceGuid.PcdIpmiInterfaceType = ## > CONSUMES > + gAmdPlatformPkgTokenSpaceGuid.PcdType11OemStringsCount = ## > CONSUMES > + gAmdPlatformPkgTokenSpaceGuid.PcdType11OemStrings = ## > CONSUMES > + gAmdPlatformPkgTokenSpaceGuid.PcdType12SystemCfgOptionsCount > ## CONSUMES > + gAmdPlatformPkgTokenSpaceGuid.PcdType12SystemCfgOptions = ## > CONSUMES > + gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes > ## CONSUMES > + gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang = ## > CONSUMES > + gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress = ## > CONSUMES > + > +[Depex] > + gEfiSmbiosProtocolGuid > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo > mmonEntryPoint.c > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo > mmonEntryPoint.c > new file mode 100644 > index 0000000000..eaa66be454 > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo > mmonEntryPoint.c > @@ -0,0 +1,148 @@ > +/** @file > + AMD Smbios Common DXE entry point. > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights rese= rved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > +#include "SmbiosCommon.h" > + > +EFI_COMMON_SMBIOS_DATA mSmbiosCommonDataFuncTable[] =3D { > + { &IpmiDeviceInformation }, > + { &SystemSlotInfoFunction }, > + { &PortConnectorInfoFunction }, > + { &OemStringsFunction }, > + { &SystemCfgOptionsFunction }, > + { &BiosLanguageInfoFunction } > +}; > + > +/** > + Add an SMBIOS record. > + > + @param Smbios The EFI_SMBIOS_PROTOCOL instance. > + @param SmbiosHandle A unique handle will be assigned to the > SMBIOS record. > + @param Record The data for the fixed portion of the SM= BIOS > record. The format of the record is > + determined by EFI_SMBIOS_TABLE_HEADER.Ty= pe. The size of > the formatted area is defined > + by EFI_SMBIOS_TABLE_HEADER.Length and ei= ther followed > by a double-null (0x0000) or > + a set of null terminated strings and a n= ull. > + > + @retval EFI_SUCCESS Record was added. > + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of > system resources. > + > +**/ > +EFI_STATUS > +AddCommonSmbiosRecord ( > + IN EFI_SMBIOS_PROTOCOL *Smbios, > + OUT EFI_SMBIOS_HANDLE *SmbiosHandle, > + IN EFI_SMBIOS_TABLE_HEADER *Record > + ) > +{ > + *SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; > + return Smbios->Add ( > + Smbios, > + NULL, > + SmbiosHandle, > + Record > + ); > +} > + > +/** > + PciEnumerationComplete Protocol notification event handler. > + > + @param[in] Event Event whose notification function is being invoked= . > + @param[in] Context Pointer to the notification function's context. > +**/ > +VOID > +EFIAPI > +OnPciEnumerationComplete ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS EfiStatus; > + EFI_SMBIOS_PROTOCOL *Smbios; > + > + EfiStatus =3D gBS->LocateProtocol ( > + &gEfiSmbiosProtocolGuid, > + NULL, > + (VOID **)&Smbios > + ); > + if (EFI_ERROR (EfiStatus)) { > + DEBUG ((DEBUG_ERROR, "Could not locate SMBIOS protocol. %r\n", > EfiStatus)); > + } > + > + // Install Type 41 when PCI enumeration is complete > + EfiStatus =3D OnboardDevExtInfoFunction (Smbios); > + if (EFI_ERROR (EfiStatus)) { > + DEBUG (( > + DEBUG_ERROR, > + "Skip installing SMBIOS Table 41, ReturnStatus=3D%r\n", > + EfiStatus > + )); > + } > + > + EfiStatus =3D InstallLomDevicePath (); > +} > + > +/** > + EFI driver entry point. This driver parses mSmbiosCommonDataFuncTable > + structure and generates common platform smbios records. > + > + @param ImageHandle Handle for the image of this driver > + @param SystemTable Pointer to the EFI System Table > + > + @retval EFI_SUCCESS The data was successfully stored. > + > +**/ > +EFI_STATUS > +EFIAPI > +SmbiosCommonEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + UINTN Index; > + EFI_STATUS EfiStatus; > + EFI_SMBIOS_PROTOCOL *Smbios; > + EFI_EVENT ProtocolNotifyEvent; > + VOID *Registration; > + > + DEBUG ((DEBUG_INFO, "%a: Entry.\n", __func__)); > + > + EfiStatus =3D gBS->LocateProtocol ( > + &gEfiSmbiosProtocolGuid, > + NULL, > + (VOID **)&Smbios > + ); > + if (EFI_ERROR (EfiStatus)) { > + DEBUG ((DEBUG_ERROR, "Could not locate SMBIOS protocol. %r\n", > EfiStatus)); > + return EfiStatus; > + } > + > + ProtocolNotifyEvent =3D EfiCreateProtocolNotifyEvent ( > + &gEfiPciEnumerationCompleteProtocolGuid, > + TPL_CALLBACK, > + OnPciEnumerationComplete, > + NULL, > + &Registration > + ); > + if (ProtocolNotifyEvent =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "Could not create PCI enumeration complete > event\n")); > + } > + > + for (Index =3D 0; Index < sizeof (mSmbiosCommonDataFuncTable)/sizeof > (mSmbiosCommonDataFuncTable[0]); ++Index) { > + EfiStatus =3D (*mSmbiosCommonDataFuncTable[Index].Function)(Smbios); > + if (EFI_ERROR (EfiStatus)) { > + // Continue installing remaining tables if one table fails. > + DEBUG (( > + DEBUG_ERROR, > + "Skip installing SMBIOS Table Index=3D%d, ReturnStatus=3D%r\n", > + Index, > + EfiStatus > + )); > + continue; > + } > + } > + > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type11Oe > mStringsFunction.c > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type11Oe > mStringsFunction.c > new file mode 100644 > index 0000000000..53e7a57355 > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type11Oe > mStringsFunction.c > @@ -0,0 +1,91 @@ > +/** @file > + AMD SMBIOS Type 11 Record > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights rese= rved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > +#include "SmbiosCommon.h" > + > +/** > + This function adds OEM strings smbios record (Type 11). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > +**/ > +EFI_STATUS > +EFIAPI > +OemStringsFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ) > +{ > + EFI_STATUS Status; > + EFI_SMBIOS_HANDLE SmbiosHandle; > + SMBIOS_TABLE_TYPE11 *SmbiosRecord; > + UINT8 OemStrCount; > + UINTN OemStrLen; > + UINTN OemStrListSize; > + CHAR8 *OemStrPtr; > + UINT8 Idx; > + UINTN StringOffset; > + > + Status =3D EFI_SUCCESS; > + SmbiosRecord =3D NULL; > + OemStrListSize =3D 0; > + > + if (Smbios =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + // Get number of OEM strings > + OemStrCount =3D PcdGet8 (PcdType11OemStringsCount); > + > + // Calculate size of all OEM Strings > + OemStrPtr =3D (CHAR8 *)PcdGetPtr (PcdType11OemStrings); > + for (Idx =3D 0; Idx < OemStrCount; Idx++) { > + OemStrLen =3D AsciiStrSize (OemStrPtr); > + OemStrPtr +=3D OemStrLen; > + OemStrListSize +=3D OemStrLen; > + } > + > + // Allocate memory for Type11 record > + SmbiosRecord =3D AllocateZeroPool ( > + sizeof (SMBIOS_TABLE_TYPE11) + OemStrListSize + 1 > + ); > + > + if (SmbiosRecord =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_OEM_STRINGS; > + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE11); > + SmbiosRecord->Hdr.Handle =3D 0; > + SmbiosRecord->StringCount =3D OemStrCount; > + > + StringOffset =3D SmbiosRecord->Hdr.Length; > + > + // Append strings at the end > + OemStrPtr =3D (CHAR8 *)PcdGetPtr (PcdType11OemStrings); > + for (Idx =3D 0; Idx < OemStrCount; Idx++) { > + OemStrLen =3D AsciiStrSize (OemStrPtr); > + CopyMem ( > + (UINT8 *)SmbiosRecord + StringOffset, > + OemStrPtr, > + OemStrLen > + ); > + OemStrPtr +=3D OemStrLen; > + StringOffset +=3D OemStrLen; > + } > + > + Status =3D AddCommonSmbiosRecord ( > + Smbios, > + &SmbiosHandle, > + (EFI_SMBIOS_TABLE_HEADER *)SmbiosRecord > + ); > + > + FreePool (SmbiosRecord); > + > + return Status; > +} > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type12Sy > stemCfgOptionsFunction.c > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type12Sy > stemCfgOptionsFunction.c > new file mode 100644 > index 0000000000..befb122372 > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type12Sy > stemCfgOptionsFunction.c > @@ -0,0 +1,90 @@ > +/** @file > + AMD SMBIOS Type 12 Record > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights rese= rved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > +#include "SmbiosCommon.h" > + > +/** > + This function adds System Configuration Options record (Type 12). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > +**/ > +EFI_STATUS > +EFIAPI > +SystemCfgOptionsFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ) > +{ > + EFI_STATUS Status; > + EFI_SMBIOS_HANDLE SmbiosHandle; > + SMBIOS_TABLE_TYPE12 *SmbiosRecord; > + UINT8 SystemCfgOptionsCount; > + UINTN SystemCfgOptionsLen; > + UINTN SystemCfgOptionsListSize; > + CHAR8 *SystemCfgOptionsPtr; > + UINT8 Idx; > + UINTN StringOffset; > + > + Status =3D EFI_SUCCESS; > + SmbiosRecord =3D NULL; > + SystemCfgOptionsListSize =3D 0; > + > + if (Smbios =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + // Get number of System Configuration Options > + SystemCfgOptionsCount =3D PcdGet8 (PcdType12SystemCfgOptionsCount); > + > + // Calculate size of all Strings > + SystemCfgOptionsPtr =3D (CHAR8 *)PcdGetPtr > (PcdType12SystemCfgOptions); > + for (Idx =3D 0; Idx < SystemCfgOptionsCount; Idx++) { > + SystemCfgOptionsLen =3D AsciiStrSize (SystemCfgOptionsPtr); > + SystemCfgOptionsPtr +=3D SystemCfgOptionsLen; > + SystemCfgOptionsListSize +=3D SystemCfgOptionsLen; > + } > + > + // Allocate memory for Type12 record > + SmbiosRecord =3D AllocateZeroPool ( > + sizeof (SMBIOS_TABLE_TYPE12) + SystemCfgOptionsListSi= ze + 1 > + ); > + > + if (SmbiosRecord =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + SmbiosRecord->Hdr.Type =3D > SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS; > + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE12); > + SmbiosRecord->Hdr.Handle =3D 0; > + SmbiosRecord->StringCount =3D SystemCfgOptionsCount; > + > + StringOffset =3D SmbiosRecord->Hdr.Length; > + > + // Append strings at the end > + SystemCfgOptionsPtr =3D (CHAR8 *)PcdGetPtr > (PcdType12SystemCfgOptions); > + for (Idx =3D 0; Idx < SystemCfgOptionsCount; Idx++) { > + SystemCfgOptionsLen =3D AsciiStrSize (SystemCfgOptionsPtr); > + CopyMem ( > + (UINT8 *)SmbiosRecord + StringOffset, > + SystemCfgOptionsPtr, > + SystemCfgOptionsLen > + ); > + SystemCfgOptionsPtr +=3D SystemCfgOptionsLen; > + StringOffset +=3D SystemCfgOptionsLen; > + } > + > + Status =3D AddCommonSmbiosRecord ( > + Smbios, > + &SmbiosHandle, > + (EFI_SMBIOS_TABLE_HEADER *)SmbiosRecord > + ); > + FreePool (SmbiosRecord); > + > + return Status; > +} > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type13Bio > sLanguageInfoFunction.c > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type13Bi > osLanguageInfoFunction.c > new file mode 100644 > index 0000000000..7d3ada2769 > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type13Bi > osLanguageInfoFunction.c > @@ -0,0 +1,146 @@ > +/** @file > + AMD SMBIOS Type 13 Record > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights rese= rved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > +#include "SmbiosCommon.h" > + > +/** > + This function adds bios language information smbios record (Type 13). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > + @retval EFI_NOT_FOUND Not able to locate PlatformLanguage= . > + > +**/ > +EFI_STATUS > +EFIAPI > +BiosLanguageInfoFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ) > +{ > + EFI_STATUS Status; > + EFI_SMBIOS_HANDLE SmbiosHandle; > + SMBIOS_TABLE_TYPE13 *SmbiosRecord; > + UINTN TotalSize; > + UINTN StringOffset; > + UINTN VarSize; > + UINTN Idx; > + UINT8 NumSupportedLang; > + UINT8 CurrLangIdx; > + CHAR8 *CurrLang; > + CHAR8 *SupportedLang; > + CHAR8 *LangStr; > + > + if (Smbios =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + CurrLang =3D NULL; > + SupportedLang =3D NULL; > + > + // Get the current language. > + Status =3D GetEfiGlobalVariable2 ( > + L"PlatformLang", > + (void **)&CurrLang, > + &VarSize > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Failed to get PlatformLang: %r\n", Status)); > + > + VarSize =3D AsciiStrSize ( > + (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLang) > + ); > + CurrLang =3D AllocateCopyPool ( > + VarSize, > + (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLang) > + ); > + ASSERT (CurrLang !=3D NULL); > + } > + > + // Get the list of supported languages. > + Status =3D GetEfiGlobalVariable2 ( > + L"PlatformLangCodes", > + (void **)&SupportedLang, > + &VarSize > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Failed to get PlatformLangCodes: %r\n", > Status)); > + > + VarSize =3D AsciiStrSize ( > + (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLangCo= des) > + ); > + SupportedLang =3D AllocateCopyPool ( > + VarSize, > + (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatform= LangCodes) > + ); > + ASSERT (SupportedLang !=3D NULL); > + } > + > + // Calculate number of supported languages and index of current langua= ge > in list. > + CurrLangIdx =3D 0; > + NumSupportedLang =3D 0; > + LangStr =3D SupportedLang; > + > + for (Idx =3D 0; Idx < VarSize; Idx++) { > + if ((SupportedLang[Idx] =3D=3D ';') || (SupportedLang[Idx] =3D=3D '\= 0')) { > + // Found a language string, increment the language count. > + NumSupportedLang++; > + > + // Replace string separator with null termination. > + SupportedLang[Idx] =3D '\0'; > + if (!AsciiStrCmp (LangStr, CurrLang)) { > + CurrLangIdx =3D NumSupportedLang; > + } > + > + // Point LangStr to next string in list. > + LangStr =3D &SupportedLang[Idx + 1]; > + } > + } > + > + if (CurrLangIdx =3D=3D 0) { > + DEBUG ((DEBUG_ERROR, "Failed to locate PlatformLang in > PlatformLangCode.\n")); > + Status =3D EFI_NOT_FOUND; > + } else { > + // Calculate record size and allocate memory for smbios record. > + TotalSize =3D sizeof (SMBIOS_TABLE_TYPE13) + VarSize + 1; > + > + SmbiosRecord =3D AllocateZeroPool (TotalSize); > + if (SmbiosRecord =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + } else { > + // Fill record data and strings. > + SmbiosRecord->Hdr.Type =3D > SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION; > + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE13= ); > + SmbiosRecord->Hdr.Handle =3D 0; > + SmbiosRecord->InstallableLanguages =3D NumSupportedLang; > + SmbiosRecord->Flags =3D 1; // Abbreviated Format. > + SmbiosRecord->CurrentLanguages =3D CurrLangIdx; > + > + // Add strings to bottom of data block > + StringOffset =3D SmbiosRecord->Hdr.Length; > + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SupportedLang, > VarSize); > + > + Status =3D AddCommonSmbiosRecord ( > + Smbios, > + &SmbiosHandle, > + (EFI_SMBIOS_TABLE_HEADER *)SmbiosRecord > + ); > + FreePool (SmbiosRecord); > + } > + } > + > + if (CurrLang !=3D NULL) { > + FreePool (CurrLang); > + } > + > + if (SupportedLang !=3D NULL) { > + FreePool (SupportedLang); > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type38Ip > miDeviceInformation.c > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type38Ip > miDeviceInformation.c > new file mode 100644 > index 0000000000..e2ad2ddb3d > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type38Ip > miDeviceInformation.c > @@ -0,0 +1,70 @@ > +/** @file > + AMD SMBIOS Type 38 Record > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights rese= rved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > +#include "SmbiosCommon.h" > + > +/** > + This function updates IPMI Device information changes to the contents = of > the > + Table Type 38. > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL protocol instance. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_UNSUPPORTED Unexpected RecordType value. > +**/ > +EFI_STATUS > +EFIAPI > +IpmiDeviceInformation ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ) > +{ > + EFI_STATUS Status; > + EFI_SMBIOS_HANDLE SmbiosHandle; > + SMBIOS_TABLE_TYPE38 *SmbiosRecord; > + > + // > + // Two zeros following the last string. > + // > + SmbiosRecord =3D AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE38) + 1 + = 1); > + if (SmbiosRecord =3D=3D NULL) { > + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); > + return EFI_OUT_OF_RESOURCES; > + } > + > + SmbiosRecord->Hdr.Type =3D > EFI_SMBIOS_TYPE_IPMI_DEVICE_INFORMATION; > + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE38); > + SmbiosRecord->Hdr.Handle =3D 0; > + > + switch (FixedPcdGet8 (PcdIpmiInterfaceType)) { > + case IPMIDeviceInfoInterfaceTypeKCS: > + SmbiosRecord->InterfaceType =3D IPMIDeviceInfoInterfac= eTypeKCS; > + SmbiosRecord->IPMISpecificationRevision =3D 0x20; // IPMI v2.0 > + SmbiosRecord->I2CSlaveAddress =3D 0x00; // not used in K= CS interface > + SmbiosRecord->NVStorageDeviceAddress =3D 0xFF; > + // KCS port number base and set LSB bit 1 to mark IO ADDRESS space > + SmbiosRecord->BaseAddress =3D FixedPcdGet16 > (PcdIpmiKcsIoBaseAddress) | 0x1; > + SmbiosRecord->BaseAddressModifier_InterruptInfo =3D 0x00; > + SmbiosRecord->InterruptNumber =3D 0x00; > + // > + // Now we have got the full smbios record, > + // call smbios protocol to add this record. > + // > + Status =3D AddCommonSmbiosRecord ( > + Smbios, > + &SmbiosHandle, > + (EFI_SMBIOS_TABLE_HEADER *)SmbiosRecord > + ); > + break; > + default: > + // Do not add table > + Status =3D EFI_UNSUPPORTED; > + break; > + } > + > + FreePool (SmbiosRecord); > + return Status; > +} > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type41On > boardDevExtInfoFunction.c > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type41On > boardDevExtInfoFunction.c > new file mode 100644 > index 0000000000..cbd4c75eaf > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type41On > boardDevExtInfoFunction.c > @@ -0,0 +1,237 @@ > +/** @file > + AMD SMBIOS Type 41 Record > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights res= erved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > +#include > +#include "SmbiosCommon.h" > + > +#define MSR_MMIO_CFG_BASE 0xC0010058ul // MMIO > Configuration Base Address Register > + > +/** > + This function adds onboard devices extended information smbios record > (Type 41). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > +**/ > +EFI_STATUS > +EFIAPI > +OnboardDevExtInfoFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ) > +{ > + EFI_STATUS Status; > + EFI_SMBIOS_HANDLE SmbiosHandle; > + SMBIOS_TABLE_TYPE41 *SmbiosRecord; > + SMBIOS_ONBOARD_DEV_EXT_INFO_RECORD *DevExtInfoRecord; > + UINT8 DevIdx; > + UINT8 Idx; > + UINT8 NumberOfDevices; > + UINTN StringOffset; > + CHAR8 *RefDesStr; > + UINTN RefDesStrLen; > + UINT16 SegmentNum; > + UINT8 BusNum; > + UINT8 DevNum; > + UINT8 Functions; > + UINT8 DeviceFound; > + > + if (Smbios =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + // Get the total number of onboard devices. > + NumberOfDevices =3D PcdGet8 (PcdAmdSmbiosType41Number); > + DEBUG ((DEBUG_INFO, "%a: Total number of AMD SMBIOS type41 PCD > structure %d.\n", __func__, NumberOfDevices)); > + DevExtInfoRecord =3D (SMBIOS_ONBOARD_DEV_EXT_INFO_RECORD > *)PcdGetPtr (PcdAmdSmbiosType41); > + > + // No device entries found > + if (NumberOfDevices =3D=3D 0) { > + DEBUG ((DEBUG_INFO, "No onboard devices found.\n")); > + return EFI_NOT_FOUND; > + } > + > + // Generate type41 smbios record for each device and add it to Smbios > table. > + for (DevIdx =3D 0; DevIdx < NumberOfDevices; DevIdx++) { > + DEBUG ((DEBUG_MANAGEABILITY, "Device number %d:\n", DevIdx)); > + // Check whether reference designation strings are present. > + if (DevExtInfoRecord->ReferenceDesignation !=3D 0) { > + RefDesStr =3D DevExtInfoRecord->RefDesignationStr; > + RefDesStrLen =3D AsciiStrLen (RefDesStr) + 1; > + } else { > + RefDesStr =3D NULL; > + RefDesStrLen =3D 1; > + } > + > + DEBUG ((DEBUG_MANAGEABILITY, " - ReferenceDesignation =3D %d\n", > DevExtInfoRecord->ReferenceDesignation)); > + DEBUG ((DEBUG_MANAGEABILITY, " - DeviceType =3D %d\n", > DevExtInfoRecord->DeviceType)); > + DEBUG ((DEBUG_MANAGEABILITY, " - DeviceEnabled =3D %d\n", > DevExtInfoRecord->DeviceEnabled)); > + DEBUG ((DEBUG_MANAGEABILITY, " - DeviceTypeInstance =3D %d\n", > DevExtInfoRecord->DeviceTypeInstance)); > + DEBUG ((DEBUG_MANAGEABILITY, " - VendorId =3D %x\n", > DevExtInfoRecord->VendorId)); > + DEBUG ((DEBUG_MANAGEABILITY, " - DeviceId =3D %x\n", DevExtInfoRecor= d- > >DeviceId)); > + DEBUG ((DEBUG_MANAGEABILITY, " - RefDesignationStr =3D %a\n", > DevExtInfoRecord->RefDesignationStr)); > + > + Status =3D GetBusDeviceInfo ( > + &DevExtInfoRecord->VendorId, > + &DevExtInfoRecord->DeviceId, > + &DevExtInfoRecord->DeviceTypeInstance, > + &SegmentNum, > + &BusNum, > + &DevNum, > + &Functions, > + &DeviceFound > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Could not get SBDF details for idx %d\n", > DevIdx)); > + continue; > + } > + > + // Device not present > + if (DeviceFound =3D=3D 0) { > + Status =3D EFI_NOT_FOUND; > + DEBUG (( > + DEBUG_ERROR, > + "No onboard device found matching VendorId: %x DeviceId: %x\n", > + DevExtInfoRecord->VendorId, > + DevExtInfoRecord->DeviceId > + )); > + continue; > + } > + > + // Create one record for each function in a multi-function device > + for (Idx =3D 0; Idx <=3D 7; Idx++) { > + if ((Functions >> Idx) & 0x1) { > + SmbiosRecord =3D NULL; > + SmbiosRecord =3D AllocateZeroPool ( > + sizeof (SMBIOS_TABLE_TYPE41) + RefDesStrLen + 1 > + ); > + if (SmbiosRecord =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + return Status; > + } else { > + SmbiosRecord->Hdr.Type =3D > SMBIOS_TYPE_ONBOARD_DEVICES_EXTENDED_INFORMATION; > + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TY= PE41); > + SmbiosRecord->Hdr.Handle =3D 0; > + SmbiosRecord->ReferenceDesignation =3D DevExtInfoRecord- > >ReferenceDesignation; > + SmbiosRecord->DeviceType =3D (DevExtInfoRecord->Devi= ceEnabled > << 7) | DevExtInfoRecord->DeviceType; > + SmbiosRecord->DeviceTypeInstance =3D DevExtInfoRecord- > >DeviceTypeInstance; > + SmbiosRecord->SegmentGroupNum =3D SegmentNum; > + SmbiosRecord->BusNum =3D BusNum; > + SmbiosRecord->DevFuncNum =3D (DevNum << 3) + Idx; > + > + // Add strings to bottom of data block > + StringOffset =3D SmbiosRecord->Hdr.Length; > + CopyMem ( > + (UINT8 *)SmbiosRecord + StringOffset, > + RefDesStr, > + RefDesStrLen > + ); > + StringOffset +=3D RefDesStrLen; > + > + Status =3D AddCommonSmbiosRecord ( > + Smbios, > + &SmbiosHandle, > + (EFI_SMBIOS_TABLE_HEADER *)SmbiosRecord > + ); > + FreePool (SmbiosRecord); > + } > + } > + } > + > + DevExtInfoRecord++; > + } > + > + return Status; > +} > + > +/** > + This function gets the Bus, Device and Segment number of a PCI device > when Vendor ID, Device ID and instance > + are provided. > + > + @param[in] VendorId Vendor ID of the PCI device to be provided= . > + @param[in] DeviceId Device ID of the PCI device to be provided > + @param[in] Instance Instance of the PCI device. If more than o= ne > devices with same vendor > + and device ID is present, instance number = is used. > + @param[out] Segment Segment number of the PCI device is assign= ed. > + @param[out] Bus Bus number of the PCI device is assigned. > + @param[out] Device Device number of the PCI device is assigne= d. > + @param[out] Functions Bits 0-7 of the Functions variable corresp= ond to > respective function numbers. > + @param[out] DeviceFound Set to 1 if the device is found. > + > + @retval EFI_SUCCESS All parameters were valid. > +**/ > +EFI_STATUS > +EFIAPI > +GetBusDeviceInfo ( > + IN UINT16 *VendorId, > + IN UINT16 *DeviceId, > + IN UINT8 *Instance, > + OUT UINT16 *Segment, > + OUT UINT8 *Bus, > + OUT UINT8 *Device, > + OUT UINT8 *Functions, > + OUT UINT8 *DeviceFound > + ) > +{ > + UINT16 SegIdx; > + UINT8 BusIdx; > + UINT16 BusIdx16; > + UINT8 DevIdx; > + UINT8 FuncIdx; > + UINT8 InstanceCount; > + UINT16 MaxSegments; > + UINT8 BusRangeIdentifier; > + > + InstanceCount =3D *Instance; > + *DeviceFound =3D 0; > + > + BusRangeIdentifier =3D (AsmReadMsr64 (MSR_MMIO_CFG_BASE) >> 2) & > 0xF; > + if ( BusRangeIdentifier <=3D 0x8 ) { > + MaxSegments =3D 1; > + } else if ((BusRangeIdentifier >=3D 0x9) && (BusRangeIdentifier <=3D 0= xF)) { > + MaxSegments =3D 1 << (BusRangeIdentifier - 0x8); > + } > + > + for (SegIdx =3D 0; SegIdx < MaxSegments; SegIdx++ ) { > + for (BusIdx16 =3D 0; BusIdx16 <=3D 255; BusIdx16++) { > + BusIdx =3D (UINT8)BusIdx16; > + for (DevIdx =3D 0; DevIdx < 32; DevIdx++) { > + if ((PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS (SegIdx, BusIdx, > DevIdx, 0, 2)) =3D=3D *DeviceId) && > + (PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS (SegIdx, BusIdx, > DevIdx, 0, 0)) =3D=3D *VendorId)) > + { > + *DeviceFound =3D 1; > + *Functions =3D 0; > + if (InstanceCount > 1) { > + *DeviceFound =3D 0; > + InstanceCount--; > + continue; > + } else { > + *Bus =3D BusIdx; > + *Device =3D DevIdx; > + *Segment =3D SegIdx; > + *Functions |=3D 1; > + for (FuncIdx =3D 1; FuncIdx < 8; FuncIdx++) { > + if ((PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS (SegIdx, Bu= sIdx, > DevIdx, FuncIdx, 2)) =3D=3D *DeviceId) && > + (PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS (SegIdx, Bu= sIdx, > DevIdx, FuncIdx, 0)) =3D=3D *VendorId)) > + { > + *Functions |=3D (1 << FuncIdx); > + } > + } > + > + return EFI_SUCCESS; > + } > + } > + } > + > + if (BusIdx =3D=3D 255) { > + break; > + } > + } > + } > + > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type8Port > ConnectorInfoFunction.c > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type8Port > ConnectorInfoFunction.c > new file mode 100644 > index 0000000000..844529d1f0 > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type8Port > ConnectorInfoFunction.c > @@ -0,0 +1,133 @@ > +/** @file > + AMD SMBIOS Type 8 Record > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights rese= rved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > +#include > +#include "SmbiosCommon.h" > + > +/** > + This function adds port connector information smbios record (Type 8). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > +**/ > +EFI_STATUS > +EFIAPI > +PortConnectorInfoFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ) > +{ > + EFI_STATUS Status; > + EFI_SMBIOS_HANDLE SmbiosHandle; > + SMBIOS_TABLE_TYPE8 *SmbiosRecord; > + SMBIOS_PORT_CONNECTOR_RECORD *PortConnRecord; > + UINT8 PortIdx; > + UINT8 NumberOfPortConnector; > + UINTN StringOffset; > + CHAR8 *IntPortConDesStr; > + UINTN IntPortConDesStrLen; > + CHAR8 *ExtPortConDesStr; > + UINTN ExtPortConDesStrLen; > + > + if (Smbios =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + // Get the total number of port connectors. > + NumberOfPortConnector =3D PcdGet8 (PcdAmdSmbiosType8Number); > + DEBUG ((DEBUG_INFO, "%a: Total number of AMD SMBIOS type8 PCD > structure %d.\n", __func__, NumberOfPortConnector)); > + PortConnRecord =3D (SMBIOS_PORT_CONNECTOR_RECORD *)PcdGetPtr > (PcdAmdSmbiosType8); > + > + if (NumberOfPortConnector =3D=3D 0) { > + DEBUG ((DEBUG_INFO, "No port connectors found.\n")); > + return EFI_NOT_FOUND; > + } > + > + // Generate type8 smbios record for each connector and add it to Smbio= s > table. > + for (PortIdx =3D 0; PortIdx < NumberOfPortConnector; PortIdx++) { > + DEBUG ((DEBUG_MANAGEABILITY, "Port %d:\n", PortIdx)); > + // Check whether Port connector designator strings are present or no= t. > + if (PortConnRecord->Type8Data.InternalReferenceDesignator !=3D 0) { > + IntPortConDesStr =3D PortConnRecord->DesinatorStr.IntDesignator= Str; > + IntPortConDesStrLen =3D AsciiStrLen (IntPortConDesStr) + 1; > + DEBUG ((DEBUG_MANAGEABILITY, "-- DesinatorStr.IntDesignatorStr =3D > %a\n", IntPortConDesStr)); > + } else { > + IntPortConDesStr =3D NULL; > + IntPortConDesStrLen =3D 0; > + } > + > + if (PortConnRecord->Type8Data.ExternalReferenceDesignator !=3D 0) { > + ExtPortConDesStr =3D PortConnRecord->DesinatorStr.ExtDesignator= Str; > + ExtPortConDesStrLen =3D AsciiStrLen (ExtPortConDesStr) + 1; > + DEBUG ((DEBUG_MANAGEABILITY, "-- DesinatorStr.ExtDesignatorStr =3D > %a\n", ExtPortConDesStr)); > + } else { > + ExtPortConDesStr =3D NULL; > + ExtPortConDesStrLen =3D 0; > + } > + > + SmbiosRecord =3D NULL; > + SmbiosRecord =3D AllocateZeroPool ( > + sizeof (SMBIOS_TABLE_TYPE8) + IntPortConDesStrLen + > ExtPortConDesStrLen + 1 > + ); > + > + if (SmbiosRecord =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + return Status; > + } else { > + SmbiosRecord->Hdr.Type =3D > SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION; > + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE8); > + SmbiosRecord->Hdr.Handle =3D 0; > + > + SmbiosRecord->InternalReferenceDesignator =3D > + PortConnRecord->Type8Data.InternalReferenceDesignator; > + SmbiosRecord->InternalConnectorType =3D > + PortConnRecord->Type8Data.InternalConnectorType; > + SmbiosRecord->ExternalReferenceDesignator =3D > + PortConnRecord->Type8Data.ExternalReferenceDesignator; > + SmbiosRecord->ExternalConnectorType =3D > + PortConnRecord->Type8Data.ExternalConnectorType; > + SmbiosRecord->PortType =3D > + PortConnRecord->Type8Data.PortType; > + DEBUG ((DEBUG_MANAGEABILITY, " - InternalReferenceDesignator =3D > %d\n", SmbiosRecord->InternalReferenceDesignator)); > + DEBUG ((DEBUG_MANAGEABILITY, " - InternalConnectorType =3D %d\n", > SmbiosRecord->InternalConnectorType)); > + DEBUG ((DEBUG_MANAGEABILITY, " - ExternalReferenceDesignator =3D > %d\n", SmbiosRecord->ExternalReferenceDesignator)); > + DEBUG ((DEBUG_MANAGEABILITY, " - ExternalConnectorType =3D %d\n", > SmbiosRecord->ExternalConnectorType)); > + DEBUG ((DEBUG_MANAGEABILITY, " - PortType =3D %d\n", SmbiosRecord- > >PortType)); > + > + // Add strings to bottom of data block > + StringOffset =3D SmbiosRecord->Hdr.Length; > + if (IntPortConDesStr !=3D NULL) { > + CopyMem ( > + (UINT8 *)SmbiosRecord + StringOffset, > + IntPortConDesStr, > + IntPortConDesStrLen > + ); > + StringOffset +=3D IntPortConDesStrLen; > + } > + > + if (ExtPortConDesStr !=3D NULL) { > + CopyMem ( > + (UINT8 *)SmbiosRecord + StringOffset, > + ExtPortConDesStr, > + ExtPortConDesStrLen > + ); > + } > + > + Status =3D AddCommonSmbiosRecord ( > + Smbios, > + &SmbiosHandle, > + (EFI_SMBIOS_TABLE_HEADER *)SmbiosRecord > + ); > + FreePool (SmbiosRecord); > + } > + > + PortConnRecord++; > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type9Syst > emSlotInfoFunction.c > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type9Syst > emSlotInfoFunction.c > new file mode 100644 > index 0000000000..568f44b427 > --- /dev/null > +++ > b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/Type9Syst > emSlotInfoFunction.c > @@ -0,0 +1,94 @@ > +/** @file > + AMD SMBIOS Type 9 Record > + > + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights rese= rved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > +#include > +#include "SmbiosCommon.h" > +#include > + > +/** > + This function checks for system slot info and adds smbios record (Type= 9). > + > + @param[in] Smbios The EFI_SMBIOS_PROTOCOL instanc= e. > + > + @retval EFI_SUCCESS All parameters were valid. > + @retval EFI_OUT_OF_RESOURCES Resource not available. > + > +**/ > +EFI_STATUS > +EFIAPI > +SystemSlotInfoFunction ( > + IN EFI_SMBIOS_PROTOCOL *Smbios > + ) > +{ > + EFI_STATUS Status; > + EFI_SMBIOS_HANDLE SmbiosHandle; > + SMBIOS_TABLE_TYPE9 *SmbiosRecord; > + UINTN SystemSlotCount; > + SMBIOS_TABLE_TYPE9 *SystemSlotInfo; > + UINTN Index; > + CHAR8 SlotDesignationStr[SMBIOS_STRING_MAX_LENG= TH]; > + SMBIOS_TABLE_TYPE9_EXTENDED SmbiosRecordExtended; > + UINTN SlotDesStrLen; > + UINTN TotalSize; > + > + if (Smbios =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + SystemSlotInfo =3D NULL; > + SystemSlotCount =3D 0; > + // Invoke GetSystemSlotInfo function to get the number of system slots= . > + Status =3D GetSystemSlotInfo (&SystemSlotInfo, &SystemSlotCount); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + for (Index =3D 0; Index < SystemSlotCount; Index++) { > + SlotDesStrLen =3D AsciiSPrint ( > + SlotDesignationStr, > + SMBIOS_STRING_MAX_LENGTH, > + "PCIE-%d", > + SystemSlotInfo[Index].SlotID > + ); > + // Two zeros following the last string. > + TotalSize =3D sizeof (SMBIOS_TABLE_TYPE9) + sizeof > (SMBIOS_TABLE_TYPE9_EXTENDED) + SlotDesStrLen + 2; > + SmbiosRecord =3D NULL; > + SmbiosRecord =3D AllocateZeroPool (TotalSize); > + if (SmbiosRecord =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + } else { > + CopyMem (SmbiosRecord, &SystemSlotInfo[Index], sizeof > (SMBIOS_TABLE_TYPE9)); > + SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_SYSTEM_SLOT= S; > + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TY= PE9) + > sizeof (SMBIOS_TABLE_TYPE9_EXTENDED); > + SmbiosRecord->Hdr.Handle =3D 0; > + SmbiosRecord->SlotDesignation =3D 1; > + SmbiosRecordExtended.SlotHeight =3D SlotHeightUnknown; > + SmbiosRecordExtended.SlotPitch =3D 0; > + SmbiosRecordExtended.SlotPhysicalWidth =3D SmbiosRecord- > >SlotDataBusWidth; > + CopyMem (&SmbiosRecord->SlotCharacteristics1, PcdGetPtr > (PcdAmdSmbiosType9SlotCharacteristics1), sizeof > (MISC_SLOT_CHARACTERISTICS1)); > + CopyMem (&SmbiosRecord->SlotCharacteristics2, PcdGetPtr > (PcdAmdSmbiosType9SlotCharacteristics2), sizeof > (MISC_SLOT_CHARACTERISTICS2)); > + CopyMem ((UINT8 *)SmbiosRecord->PeerGroups + SmbiosRecord- > >PeerGroupingCount * sizeof (SmbiosRecord->PeerGroups), (UINT8 > *)&SmbiosRecordExtended, sizeof (SMBIOS_TABLE_TYPE9_EXTENDED)); > + CopyMem ((UINT8 *)SmbiosRecord + SmbiosRecord->Hdr.Length, > SlotDesignationStr, SlotDesStrLen); > + Status =3D AddCommonSmbiosRecord ( > + Smbios, > + &SmbiosHandle, > + (EFI_SMBIOS_TABLE_HEADER *)SmbiosRecord > + ); > + if (EFI_ERROR (Status)) { > + FreePool (SmbiosRecord); > + break; > + } > + > + if (SmbiosRecord !=3D NULL) { > + FreePool (SmbiosRecord); > + } > + } > + } > + > + FreePool (SystemSlotInfo); > + return EFI_SUCCESS; > +} > -- > 2.34.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 (#119081): https://edk2.groups.io/g/devel/message/119081 Mute This Topic: https://groups.io/mt/106200547/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-