From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.2244.1571052477282270881 for ; Mon, 14 Oct 2019 04:27:57 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=019022927c=abner.chang@hpe.com) Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9EBQROv020893; Mon, 14 Oct 2019 11:27:56 GMT Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) by mx0b-002e3701.pphosted.com with ESMTP id 2vknk8u9nm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Oct 2019 11:27:55 +0000 Received: from G1W8106.americas.hpqcorp.net (g1w8106.austin.hp.com [16.193.72.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2352.austin.hpe.com (Postfix) with ESMTPS id 0434662; Mon, 14 Oct 2019 11:27:54 +0000 (UTC) Received: from G9W8670.americas.hpqcorp.net (16.220.49.29) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 14 Oct 2019 11:27:55 +0000 Received: from G2W6311.americas.hpqcorp.net (16.197.64.53) by G9W8670.americas.hpqcorp.net (16.220.49.29) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 14 Oct 2019 11:27:54 +0000 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (15.241.52.11) by G2W6311.americas.hpqcorp.net (16.197.64.53) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 14 Oct 2019 11:27:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jvZXx+mB84bRgvSuphPKn3NDfIx/Sm4Zg5berZgbsmEM/oNcrx809Ta1sekLCWsHRlKzfuX24/KeY8HnlxHaogwO+ko3Bqry4hBY9ePIGUWI5bmqApRn4hNPuBAXicyrdrY6QJb2c2yqFaBWHpMkKkKbORdA6dxRIUqJoRSD7/8ki/gCTiDrSdqc9xjX1h6glU7Kl3A5R2HIuw8Vw9ahH1YveCjl9yJgRHsA9gq1U0p+zVSIsEXfliFQJNfAf7JPDdHARQNcHG9hDa3l3/6eEBIekyMblBjop7mZ5Hc5rNhKWcERTZA9vrAarV6o2102PRoFVX7SvjUptJduoHHUBw== 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-SenderADCheck; bh=rsgWxveVaZOFaYrvjUPfNjMPaUG2ZC6gcckscCtQi4c=; b=ld/GRzieTAHaPcuJOhxyDZpWGutkD0DIxdVDt0y0tH8p8AKBkf9r3VkyzxffUo/Jt4P4urSE8ELXpv4xaVQ2HWewXq7P1XEoH0IwRRUdBisH2f98yDaNjBvqBRG0EeNAjG6z0FfwMYhNbCojg3S30kqXZrZHw8g6bHHSwkpwYD/cVELCxQOxIGE4QkWBhb2bxuG/Flz44l7v/NyZ11JzAe8PKfIcKA9S5Wy6ZT2SanlWFKsB6U72H+enggRssefUn+9VpKbpVhiEY1g4gwsPYPBdL3zq6udIbx8WTh332d05FmW+IxMJgYRrUKpetYxNQHzTaiowVuwFFh6E2nOzHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from CS1PR8401MB1192.NAMPRD84.PROD.OUTLOOK.COM (10.169.12.151) by CS1PR8401MB0616.NAMPRD84.PROD.OUTLOOK.COM (10.169.14.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Mon, 14 Oct 2019 11:27:52 +0000 Received: from CS1PR8401MB1192.NAMPRD84.PROD.OUTLOOK.COM ([fe80::4fb:84b9:76e6:1cde]) by CS1PR8401MB1192.NAMPRD84.PROD.OUTLOOK.COM ([fe80::4fb:84b9:76e6:1cde%8]) with mapi id 15.20.2347.023; Mon, 14 Oct 2019 11:27:51 +0000 From: "Abner Chang" To: Leif Lindholm , "devel@edk2.groups.io" Subject: Re: [edk2-devel] [edk2-staging/RISC-V-V2 PATCH v2 26/29] RiscVPkg/SmbiosDxe: Generic SMBIOS DXE driver for RISC-V platforms. Thread-Topic: [edk2-devel] [edk2-staging/RISC-V-V2 PATCH v2 26/29] RiscVPkg/SmbiosDxe: Generic SMBIOS DXE driver for RISC-V platforms. Thread-Index: AQHVcaq04teOym6U2k2Rb+6Y4bUfNadE3KWAgBU/hIA= Date: Mon, 14 Oct 2019 11:27:51 +0000 Message-ID: References: <1569198715-31552-1-git-send-email-abner.chang@hpe.com> <1569198715-31552-28-git-send-email-abner.chang@hpe.com> <20190930223959.GJ25504@bivouac.eciton.net> In-Reply-To: <20190930223959.GJ25504@bivouac.eciton.net> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.242.247.131] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b9082e36-d71c-45e5-613a-08d750998cdc x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: CS1PR8401MB0616: x-ms-exchange-purlcount: 2 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:13; x-forefront-prvs: 01901B3451 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(346002)(376002)(366004)(39860400002)(136003)(40224003)(13464003)(199004)(189003)(5660300002)(66066001)(52536014)(11346002)(476003)(2906002)(2501003)(966005)(186003)(53546011)(229853002)(26005)(19627235002)(478600001)(30864003)(486006)(446003)(110136005)(316002)(6506007)(102836004)(7696005)(76116006)(71190400001)(86362001)(33656002)(66946007)(9686003)(6116002)(66556008)(256004)(3846002)(66476007)(76176011)(71200400001)(6246003)(64756008)(99286004)(66446008)(6436002)(81156014)(6306002)(14444005)(8676002)(55016002)(8936002)(14454004)(81166006)(25786009)(305945005)(74316002)(7736002)(41533002)(569006);DIR:OUT;SFP:1102;SCL:1;SRVR:CS1PR8401MB0616;H:CS1PR8401MB1192.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: s4br8gfAY5swPhphInO2yBsbggeL/5KD6/SFVfi2ByuAg7rXBX3yzGxRs6YBXgFvkfCr5TcPXCAME32GO1dgQx1vbKjhBSsq63fO/JpxC7vLauN0TouZyI2wOk0AckgshzFsmO6yg3WOcXuUOZFH2Vj+oAI9+Fx9BCJkmnVyDzRHgxfwT8mkRNe7RkTvmg/kIjBb1of5NV3D5H9mOxkJ+23srULu+zdmZJKTnNOwsuS0/Zwi3w2jtk13D4Hbw5BewL+75iXH1z58VoKy0OeOhRgykaXaBCfHnxZE6zvpbcdMm1vfZ6yDXoN4E/e6q2Gu6TYbDfYaqqInoA8aucLjbbPC6LG6VW5b5IZCUhRii3FOyWFHZu1i5JLPVot66Mst8JlA2KlNpN8pcg4AGRoxTI6J9Lxr7s/461DlrO17tmZF1wXyE0G8iOumIn4oLyZXG5VkDMmmzl0Pcoy24rCkhw== x-ms-exchange-transport-forked: True X-MS-Exchange-CrossTenant-Network-Message-Id: b9082e36-d71c-45e5-613a-08d750998cdc X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2019 11:27:51.8086 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oYslqVMvnzogoaGjOmh/YaI3DK0A1d5pSgFC8MyAvb0CNZRr2HPsyBeQWKzmuQgZcNpmmbSU46UgLsjLsIihqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0616 X-OriginatorOrg: hpe.com X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-14_07:2019-10-11,2019-10-14 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 clxscore=1015 mlxscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1910140112 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Leif Lindholm [mailto:leif.lindholm@linaro.org] > Sent: Tuesday, October 1, 2019 6:40 AM > To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist) > > Subject: Re: [edk2-devel] [edk2-staging/RISC-V-V2 PATCH v2 26/29] > RiscVPkg/SmbiosDxe: Generic SMBIOS DXE driver for RISC-V platforms. >=20 > On Mon, Sep 23, 2019 at 08:31:52AM +0800, Abner Chang wrote: > > RISC-V generic SMBIOS DXE driver for building up SMBIOS type 4, type 7 > > and type 44 records. > > > > Signed-off-by: Abner Chang > > --- > > RiscVPkg/Include/ProcessorSpecificDataHob.h | 95 ++++++ > > RiscVPkg/Include/SmbiosProcessorSpecificData.h | 58 ++++ > > RiscVPkg/RiscVPkg.dec | 6 + > > RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.c | 339 > +++++++++++++++++++++ > > RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.h | 32 ++ > > RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf | 58 ++++ > > RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.uni | 12 + > > .../Universal/SmbiosDxe/RiscVSmbiosDxeExtra.uni | 13 + > > 8 files changed, 613 insertions(+) > > create mode 100644 RiscVPkg/Include/ProcessorSpecificDataHob.h > > create mode 100644 RiscVPkg/Include/SmbiosProcessorSpecificData.h > > create mode 100644 RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.c > > create mode 100644 RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.h > > create mode 100644 RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf > > create mode 100644 RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.uni > > create mode 100644 > > RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxeExtra.uni > > > > diff --git a/RiscVPkg/Include/ProcessorSpecificDataHob.h > > b/RiscVPkg/Include/ProcessorSpecificDataHob.h > > new file mode 100644 > > index 0000000..6798a9d > > --- /dev/null > > +++ b/RiscVPkg/Include/ProcessorSpecificDataHob.h >=20 > None of the things defined in here are HOBs, they are structures to hold > information that will be put into HOBs. > Can we merge all of these definitions into SmbiosProcessorSpecificData.h > and delete this file? No. SmbiosProcessorSpecificData.h defines the structure declared in RISC-V= SMBIOS processor specific data spec (https://github.com/riscv/riscv-smbios= ). ProcessorSpecificDataHob is the implementation to deliver processor inform= ation in HOB for building SMBIOS type 44 record. I would like to keep these two files separately. >=20 > > @@ -0,0 +1,95 @@ > > +/** @file > > + Definition of Processor Specific Data HOB. > > + > > + Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All > > + rights reserved.
> > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > +#ifndef _RISC_V_PROCESSOR_SPECIFIC_DATA_HOB_H_ > > +#define _RISC_V_PROCESSOR_SPECIFIC_DATA_HOB_H_ >=20 > Please drop leading _. >=20 > > + > > +#include >=20 > This file also uses Uefi.h, please include it, so we don't depend on oth= er files > pulling it in for us. >=20 > > + > > +#define TO_BE_FILLED 0 > > +#define TO_BE_FILLED_BY_VENDOR 0 > > +#define TO_BE_FILLED_BY_RISC_V_SMBIOS_DXE_DRIVER 0 #define > > +TO_BE_FILLED_BY_CODE 0 >=20 > These defines are never used, please drop, These definitions are used in platform code to indicates the value is not = set correctly and should be set by certain code. >=20 > > + > > +#pragma pack(1) > > + > > +/// > > +/// RISC-V processor specific data HOB /// typedef struct { > > + EFI_GUID ParentPrcessorGuid; > > + UINTN ParentProcessorUid; > > + EFI_GUID CoreGuid; > > + VOID *Context; // The additional information of this cor= e which > > + // built in PEI phase and carried to DXE = phase. > > + // The content is pocessor or platform sp= ecific. > > + SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA ProcessorSpecificData; } > > +RISC_V_PROCESSOR_SPECIFIC_DATA_HOB; > > + > > +/// > > +/// RISC-V SMBIOS type 4 (Processor) GUID data HOB /// typedef struct > > +{ > > + EFI_GUID PrcessorGuid; > > + UINTN ProcessorUid; > > + SMBIOS_TABLE_TYPE4 SmbiosType4Processor; > > + UINT16 EndingZero; >=20 > Please align indentation of struct members. >=20 > > +} RISC_V_PROCESSOR_TYPE4_DATA_HOB; > > + > > +#define RISC_V_CACHE_INFO_NOT_PROVIDED 0xFFFF > > + > > +#define RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_MASK 0x7 > > + #define RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_1 0x01 > > + #define RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_2 0x02 > > + #define RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_3 0x03 > > + > > +#define RISC_V_CACHE_CONFIGURATION_SOCKET_BIT_POSITION 3 > #define > > +RISC_V_CACHE_CONFIGURATION_SOCKET_MASK (0x1 << > > +RISC_V_CACHE_CONFIGURATION_SOCKET_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_SOCKET_SOCKETED (0x1 << > > +RISC_V_CACHE_CONFIGURATION_SOCKET_BIT_POSITION) > > + > > +#define RISC_V_CACHE_CONFIGURATION_LOCATION_BIT_POSITION 5 > #define > > +RISC_V_CACHE_CONFIGURATION_LOCATION_MASK (0x3 << > > +RISC_V_CACHE_CONFIGURATION_LOCATION_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_LOCATION_INTERNAL (0x0 > << > > +RISC_V_CACHE_CONFIGURATION_LOCATION_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_LOCATION_EXTERNAL (0x1 > << > > +RISC_V_CACHE_CONFIGURATION_LOCATION_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_LOCATION_RESERVED (0x2 > << > > +RISC_V_CACHE_CONFIGURATION_LOCATION_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_LOCATION_UNKNOWN (0x3 > << > > +RISC_V_CACHE_CONFIGURATION_LOCATION_BIT_POSITION) > > + > > +#define RISC_V_CACHE_CONFIGURATION_ENABLE_BIT_POSITION 7 > > +#define RISC_V_CACHE_CONFIGURATION_ENABLE_MASK (0x1 << > RISC_V_CACHE_CONFIGURATION_ENABLE_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_ENABLED (0x1 << > RISC_V_CACHE_CONFIGURATION_ENABLE_BIT_POSITION) > > + > > +#define RISC_V_CACHE_CONFIGURATION_MODE_BIT_POSITION 8 > > +#define RISC_V_CACHE_CONFIGURATION_MODE_MASK (0x3 << > RISC_V_CACHE_CONFIGURATION_MODE_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_MODE_WT (0x0 << > RISC_V_CACHE_CONFIGURATION_MODE_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_MODE_WB (0x1 << > RISC_V_CACHE_CONFIGURATION_MODE_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_MODE_VARIES (0x2 << > RISC_V_CACHE_CONFIGURATION_MODE_BIT_POSITION) > > + #define RISC_V_CACHE_CONFIGURATION_MODE_UNKNOWN (0x3 << > > +RISC_V_CACHE_CONFIGURATION_MODE_BIT_POSITION) > > +/// > > +/// RISC-V SMBIOS type 7 (Cache) GUID data HOB /// typedef struct { > > + EFI_GUID PrcessorGuid; > > + UINTN ProcessorUid; > > + SMBIOS_TABLE_TYPE7 SmbiosType7Cache; > > + UINT16 EndingZero; > > +} RISC_V_PROCESSOR_TYPE7_DATA_HOB; > > + > > +/// > > +/// RISC-V SMBIOS type 7 (Cache) GUID data HOB /// typedef struct { > > + RISC_V_PROCESSOR_TYPE4_DATA_HOB *Processor; > > + RISC_V_PROCESSOR_TYPE7_DATA_HOB *L1InstCache; > > + RISC_V_PROCESSOR_TYPE7_DATA_HOB *L1DataCache; > > + RISC_V_PROCESSOR_TYPE7_DATA_HOB *L2Cache; > > + RISC_V_PROCESSOR_TYPE7_DATA_HOB *L3Cache; } > > +RISC_V_PROCESSOR_SMBIOS_DATA_HOB; >=20 > I don't see this structure being used anywhere - can it be deleted? Used in platform code to build up processor information in HOB. >=20 > > + > > +#pragma pack() > > + > > +#endif > > diff --git a/RiscVPkg/Include/SmbiosProcessorSpecificData.h > > b/RiscVPkg/Include/SmbiosProcessorSpecificData.h > > new file mode 100644 > > index 0000000..36aa4ab > > --- /dev/null > > +++ b/RiscVPkg/Include/SmbiosProcessorSpecificData.h > > @@ -0,0 +1,58 @@ > > +/** @file > > + Industry Standard Definitions of RISC-V Processor Specific data > > +defined in > > + below link for complaiant with SMBIOS Table Specification v3.3.0. > > + https://github.com/riscv/riscv-smbios > > + > > + Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All > > + rights reserved.
> > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > +#ifndef _SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA_H_ > > +#define _SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA_H_ >=20 > Drop leading _. >=20 > > + > > +#include > > + > > +#include > > + > > +#pragma pack(1) > > + > > +typedef enum{ > > + RegisterUnsupported =3D 0x00, > > + RegisterLen32 =3D 0x01, > > + RegisterLen64 =3D 0x02, > > + RegisterLen128 =3D 0x03 > > +} RISC_V_REGISTER_LENGTH; > > + > > +#define SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA_REVISION 0x100 > > + > > +#define SMBIOS_RISC_V_PSD_MACHINE_MODE_SUPPORTED (0x01 << > 0) > > +#define SMBIOS_RISC_V_PSD_SUPERVISOR_MODE_SUPPORTED (0x01 > << 2) > > +#define SMBIOS_RISC_V_PSD_USER_MODE_SUPPORTED (0x01 << 3) > > +#define SMBIOS_RISC_V_PSD_DEBUG_MODE_SUPPORTED (0x01 << 7) > > + > > +/// > > +/// RISC-V processor specific data for SMBIOS type 44 /// typedef > > +struct { > > + UINT16 Revision; > > + UINT8 Length; > > + RISCV_UINT128 HartId; > > + UINT8 BootHartId; > > + RISCV_UINT128 MachineVendorId; > > + RISCV_UINT128 MachineArchId; > > + RISCV_UINT128 MachineImplId; > > + UINT32 InstSetSupported; > > + UINT8 PrivilegeModeSupported; > > + RISCV_UINT128 MModeExcepDelegation; > > + RISCV_UINT128 MModeInterruptDelegation; > > + UINT8 HartXlen; > > + UINT8 MachineModeXlen; > > + UINT8 Reserved; > > + UINT8 SupervisorModeXlen; > > + UINT8 UserModeXlen; > > +} SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA; > > + > > +#pragma pack() > > +#endif > > + > > diff --git a/RiscVPkg/RiscVPkg.dec b/RiscVPkg/RiscVPkg.dec index > > a91392f..b316223 100644 > > --- a/RiscVPkg/RiscVPkg.dec > > +++ b/RiscVPkg/RiscVPkg.dec > > @@ -24,6 +24,12 @@ > > gUefiRiscVPkgTokenSpaceGuid =3D { 0x4261e9c8, 0x52c0, 0x4b34, { > > 0x85, 0x3d, 0x48, 0x46, 0xea, 0xd3, 0xb7, 0x2c}} > > > > [PcdsFixedAtBuild] > > + # Processor Specific Data GUID HOB GUID > > + > gUefiRiscVPkgTokenSpaceGuid.PcdProcessorSpecificDataGuidHobGuid|{0x2 > > + 0, 0x72, 0xD5, 0x2F, 0xCF, 0x3C, 0x4C, 0xBC, 0xB1, 0x65, 0x94, 0x90, > > + 0xDC, 0xF2, 0xFA, 0x93}|VOID*|0x00001000 > > + gUefiRiscVPkgTokenSpaceGuid.PcdProcessorSmbiosGuidHobGuid|{0x0F, > > + 0x34, 0x00, 0x92, 0x04, 0x12, 0x45, 0x4A, 0x9C, 0x11, 0xB8, 0x8B, > > + 0xDF, 0xC6, 0xFA, 0x6F}|VOID*|0x00001001 > > + > gUefiRiscVPkgTokenSpaceGuid.PcdProcessorSmbiosType4GuidHobGuid|{0x > 5B > > + , 0x36, 0xEA, 0x23, 0x79, 0x6D, 0x4F, 0xCF, 0x9C, 0x22, 0x25, 0xC0, > > + 0x89, 0x8C, 0x25, 0xB9}|VOID*|0x00001002 > > + > gUefiRiscVPkgTokenSpaceGuid.PcdProcessorSmbiosType7GuidHobGuid|{0x > BF > > + , 0xB4, 0x6D, 0x1B, 0x7E, 0x10, 0x47, 0x44, 0xB8, 0xBD, 0xFF, 0x1E, > > + 0xDD, 0xDF, 0x71, 0x65}|VOID*|0x00001003 > > + > > # > > # 1000000000 > > # PcdRiscVMachineTimerTickInNanoSecond =3D > > --------------------------------------- > > diff --git a/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.c > > b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.c > > new file mode 100644 > > index 0000000..032f559 > > --- /dev/null > > +++ b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.c > > @@ -0,0 +1,339 @@ > > +/** @file > > + RISC-V generic SMBIOS DXE driver to build up SMBIOS type 4, type 7 = and > type 44 records. > > + > > + Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All > > + rights reserved.
> > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include "RiscVSmbiosDxe.h" > > + > > +#define RISCV_SMBIOS_DEBUG_INFO 1 >=20 > I would greatly prefer if we could drop this and If there's still active > development of the tables, I can go along with keeping it while on the - > staging branch, but it needs to go before the port is merged to edk2 mas= ter. > You can use DEBUG_VERBOSE instead. >=20 > > + > > +EFI_SMBIOS_PROTOCOL *Smbios; >=20 > mSmBios. And STATIC. >=20 > > + > > +/** > > + This function builds SMBIOS type 7 record according to > > + the given RISC_V_PROCESSOR_TYPE7_DATA_HOB. > > + > > + @param Type4DataHob Pointer to > RISC_V_PROCESSOR_TYPE4_DATA_HOB > > + @param Type7DataHob Pointer to > RISC_V_PROCESSOR_TYPE7_DATA_HOB > > + @param SmbiosHandle Pointer to SMBIOS_HANDLE > > + > > + @retval EFI_STATUS > > + > > +**/ > > +static >=20 > STATIC >=20 > > +EFI_STATUS > > +BuildSmbiosType7 ( > > + IN RISC_V_PROCESSOR_TYPE4_DATA_HOB *Type4DataHob, IN > > +RISC_V_PROCESSOR_TYPE7_DATA_HOB *Type7DataHob, OUT > SMBIOS_HANDLE > > +*SmbiosHandle > > +) > > +{ > > + EFI_STATUS Status; > > + SMBIOS_HANDLE Handle; > > + > > + if (!CompareGuid (&Type4DataHob->PrcessorGuid, &Type7DataHob- > >PrcessorGuid) || > > + Type4DataHob->ProcessorUid !=3D Type7DataHob->ProcessorUid) { > > + return EFI_INVALID_PARAMETER; > > + } > > + Handle =3D SMBIOS_HANDLE_PI_RESERVED; > > + Type7DataHob->SmbiosType7Cache.Hdr.Type =3D > > +SMBIOS_TYPE_CACHE_INFORMATION; > > + Type7DataHob->SmbiosType7Cache.Hdr.Length =3D > > +sizeof(SMBIOS_TABLE_TYPE7); > > + Type7DataHob->SmbiosType7Cache.Hdr.Handle =3D 0; > > + Type7DataHob->EndingZero =3D 0; > > + Status =3D Smbios->Add (Smbios, NULL, &Handle, > > +&Type7DataHob->SmbiosType7Cache.Hdr); > > + if (EFI_ERROR(Status)) { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: Fail to add SMBIOS > Type 7\n")); > > + return Status; > > + } > > + DEBUG ((DEBUG_INFO, "[RISC-V SMBIOS Builder]: SMBIOS Type 7 was > > +added. SMBIOS Handle: 0x%x\n", Handle)); #if > RISCV_SMBIOS_DEBUG_INFO > > + DEBUG ((DEBUG_INFO, " Cache belone to proce= ssor GUID: > %g\n", &Type7DataHob->PrcessorGuid)); > > + DEBUG ((DEBUG_INFO, " Cache belone processo= r UID: > %d\n", Type7DataHob->ProcessorUid)); > > + DEBUG ((DEBUG_INFO, " > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= = =3D=3D=3D=3D=3D=3D\n")); > > + DEBUG ((DEBUG_INFO, " Socket Designation: %= d\n", > Type7DataHob->SmbiosType7Cache.SocketDesignation)); > > + DEBUG ((DEBUG_INFO, " Cache Configuration: = 0x%x\n", > Type7DataHob->SmbiosType7Cache.CacheConfiguration)); > > + DEBUG ((DEBUG_INFO, " Maximum Cache Size: 0= x%x\n", > Type7DataHob->SmbiosType7Cache.MaximumCacheSize)); > > + DEBUG ((DEBUG_INFO, " Installed Size: 0x%x\= n", > Type7DataHob->SmbiosType7Cache.InstalledSize)); > > + DEBUG ((DEBUG_INFO, " Supported SRAM Type: = 0x%x\n", > Type7DataHob->SmbiosType7Cache.SupportedSRAMType)); > > + DEBUG ((DEBUG_INFO, " Current SRAMT ype: 0x= %x\n", > Type7DataHob->SmbiosType7Cache.CurrentSRAMType)); > > + DEBUG ((DEBUG_INFO, " Cache Speed: 0x%x\n", > Type7DataHob->SmbiosType7Cache.CacheSpeed)); > > + DEBUG ((DEBUG_INFO, " Error Correction Type= : 0x%x\n", > Type7DataHob->SmbiosType7Cache.ErrorCorrectionType)); > > + DEBUG ((DEBUG_INFO, " System Cache Type: 0x= %x\n", > Type7DataHob->SmbiosType7Cache.SystemCacheType)); > > + DEBUG ((DEBUG_INFO, " Associativity: 0x%x\n= ", > Type7DataHob->SmbiosType7Cache.Associativity)); > > +#endif > > + > > + *SmbiosHandle =3D Handle; > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + This function builds SMBIOS type 4 record according to > > + the given RISC_V_PROCESSOR_TYPE4_DATA_HOB. > > + > > + @param Type4DataHob Pointer to > RISC_V_PROCESSOR_TYPE4_DATA_HOB > > + @param SmbiosHandle Pointer to SMBIOS_HANDLE > > + > > + @retval EFI_STATUS > > + > > +**/ > > +static > > +EFI_STATUS > > +BuildSmbiosType4 ( > > + IN RISC_V_PROCESSOR_TYPE4_DATA_HOB *Type4DataHob, > > + OUT SMBIOS_HANDLE *SmbiosHandle > > + ) > > +{ > > + EFI_HOB_GUID_TYPE *GuidHob; >=20 > The code would be more readable if this was called something like Type7H= ob. >=20 > > + RISC_V_PROCESSOR_TYPE7_DATA_HOB *Type7HobData; > SMBIOS_HANDLE > > + Cache; SMBIOS_HANDLE Processor; EFI_STATUS Status; > > + > > + DEBUG ((DEBUG_INFO, "[RISC-V SMBIOS Builder]: Building Type > > + 4.\n")); >=20 > Again, please avoid the custom [] message tags - add %a __FUNCTION__ > where helpul. Throughout. >=20 > > + DEBUG ((DEBUG_INFO, " Processor GUID: %g\n"= , > &Type4DataHob->PrcessorGuid)); > > + DEBUG ((DEBUG_INFO, " Processor UUID: %d\n"= , > Type4DataHob->ProcessorUid)); > > + > > + Type4DataHob->SmbiosType4Processor.L1CacheHandle =3D > > + RISC_V_CACHE_INFO_NOT_PROVIDED; > > + Type4DataHob->SmbiosType4Processor.L2CacheHandle =3D > > + RISC_V_CACHE_INFO_NOT_PROVIDED; > > + Type4DataHob->SmbiosType4Processor.L3CacheHandle =3D > > + RISC_V_CACHE_INFO_NOT_PROVIDED; GuidHob =3D > (EFI_HOB_GUID_TYPE > > + *)GetFirstGuidHob ((EFI_GUID > > + *)PcdGetPtr(PcdProcessorSmbiosType7GuidHobGuid)); > > + if (GuidHob =3D=3D NULL) { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: No RISC-V SMBIOS > Type7 data HOB found.\n")); > > + return EFI_NOT_FOUND; > > + } > > + // > > + // Go through each RISC_V_PROCESSOR_TYPE4_DATA_HOB for multiple > processors. > > + // > > + do { > > + Type7HobData =3D (RISC_V_PROCESSOR_TYPE7_DATA_HOB > *)GET_GUID_HOB_DATA (GuidHob); > > + Status =3D BuildSmbiosType7 (Type4DataHob, Type7HobData, &Cache); > > + if (EFI_ERROR (Status)) { > > + return Status; > > + } > > + if ((Type7HobData->SmbiosType7Cache.SystemCacheType & > RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_MASK) =3D=3D > > + RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_1) { > > + Type4DataHob->SmbiosType4Processor.L1CacheHandle =3D Cache; > > + } else if ((Type7HobData->SmbiosType7Cache.SystemCacheType & > RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_MASK) =3D=3D > > + RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_2) { > > + Type4DataHob->SmbiosType4Processor.L2CacheHandle =3D Cache; > > + } else if ((Type7HobData->SmbiosType7Cache.SystemCacheType & > RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_MASK) =3D=3D > > + RISC_V_CACHE_CONFIGURATION_CACHE_LEVEL_3) { > > + Type4DataHob->SmbiosType4Processor.L3CacheHandle =3D Cache; > > + } else { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: Improper cache > level of SMBIOS handle %d\n", Cache)); > > + } > > + GuidHob =3D GetNextGuidHob((EFI_GUID > > + *)PcdGetPtr(PcdProcessorSmbiosType7GuidHobGuid), > > + GET_NEXT_HOB(GuidHob)); } while (GuidHob !=3D NULL); > > + > > + // > > + // Build SMBIOS Type 4 record > > + // > > + Processor =3D SMBIOS_HANDLE_PI_RESERVED; > > + Type4DataHob->SmbiosType4Processor.Hdr.Type =3D > > +SMBIOS_TYPE_PROCESSOR_INFORMATION; > > + Type4DataHob->SmbiosType4Processor.Hdr.Length =3D > > +sizeof(SMBIOS_TABLE_TYPE4); > > + Type4DataHob->SmbiosType4Processor.Hdr.Handle =3D 0; > > + Type4DataHob->EndingZero =3D 0; > > + Status =3D Smbios->Add (Smbios, NULL, &Processor, > > +&Type4DataHob->SmbiosType4Processor.Hdr); > > + if (EFI_ERROR(Status)) { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: Fail to add SMBIOS > Type 4\n")); > > + return Status; > > + } > > + DEBUG ((DEBUG_INFO, "[RISC-V SMBIOS Builder]: SMBIOS Type 4 was > > +added. SMBIOS Handle: 0x%x\n", Processor)); #if > RISCV_SMBIOS_DEBUG_INFO > > + DEBUG ((DEBUG_INFO, " Socket StringID: %d\n= ", > Type4DataHob->SmbiosType4Processor.Socket)); > > + DEBUG ((DEBUG_INFO, " Processor Type: 0x%x\= n", > Type4DataHob->SmbiosType4Processor.ProcessorType)); > > + DEBUG ((DEBUG_INFO, " Processor Family: 0x%= x\n", > Type4DataHob->SmbiosType4Processor.ProcessorFamily)); > > + DEBUG ((DEBUG_INFO, " Processor Manufacture= StringID: > %d\n", Type4DataHob->SmbiosType4Processor.ProcessorManufacture)); > > + DEBUG ((DEBUG_INFO, " Processor Id: 0x%x:0x= %x\n", \ > > + Type4DataHob->SmbiosType4Processor.ProcessorId.Signature, > Type4DataHob->SmbiosType4Processor.ProcessorId.FeatureFlags)); > > + DEBUG ((DEBUG_INFO, " Processor Version Str= ingID: %d\n", > Type4DataHob->SmbiosType4Processor.ProcessorVersion)); > > + DEBUG ((DEBUG_INFO, " Voltage: 0x%x\n", Typ= e4DataHob- > >SmbiosType4Processor.Voltage)); > > + DEBUG ((DEBUG_INFO, " External Clock: 0x%x\= n", > Type4DataHob->SmbiosType4Processor.ExternalClock)); > > + DEBUG ((DEBUG_INFO, " Max Speed: 0x%x\n", > Type4DataHob->SmbiosType4Processor.MaxSpeed)); > > + DEBUG ((DEBUG_INFO, " Current Speed: 0x%x\n= ", > Type4DataHob->SmbiosType4Processor.CurrentSpeed)); > > + DEBUG ((DEBUG_INFO, " Status: 0x%x\n", Type= 4DataHob- > >SmbiosType4Processor.Status)); > > + DEBUG ((DEBUG_INFO, " ProcessorUpgrade: 0x%= x\n", > Type4DataHob->SmbiosType4Processor.ProcessorUpgrade)); > > + DEBUG ((DEBUG_INFO, " L1 Cache Handle: 0x%x= \n", > Type4DataHob->SmbiosType4Processor.L1CacheHandle)); > > + DEBUG ((DEBUG_INFO, " L2 Cache Handle: > 0x%x\n",Type4DataHob->SmbiosType4Processor.L2CacheHandle)); > > + DEBUG ((DEBUG_INFO, " L3 Cache Handle: 0x%x= \n", > Type4DataHob->SmbiosType4Processor.L3CacheHandle)); > > + DEBUG ((DEBUG_INFO, " Serial Number StringI= D: %d\n", > Type4DataHob->SmbiosType4Processor.SerialNumber)); > > + DEBUG ((DEBUG_INFO, " Asset Tag StringID: %= d\n", > Type4DataHob->SmbiosType4Processor.AssetTag)); > > + DEBUG ((DEBUG_INFO, " Part Number StringID:= %d\n", > Type4DataHob->SmbiosType4Processor.PartNumber)); > > + DEBUG ((DEBUG_INFO, " Core Count: %d\n", Ty= pe4DataHob- > >SmbiosType4Processor.CoreCount)); > > + DEBUG ((DEBUG_INFO, " Enabled CoreCount: %d= \n", > Type4DataHob->SmbiosType4Processor.EnabledCoreCount)); > > + DEBUG ((DEBUG_INFO, " Thread Count: %d\n", > Type4DataHob->SmbiosType4Processor.ThreadCount)); > > + DEBUG ((DEBUG_INFO, " Processor Characteris= tics: 0x%x\n", > Type4DataHob->SmbiosType4Processor.ProcessorCharacteristics)); > > + DEBUG ((DEBUG_INFO, " Processor Family2: 0x= %x\n", > Type4DataHob->SmbiosType4Processor.ProcessorFamily2)); > > + DEBUG ((DEBUG_INFO, " Core Count 2: %d\n", > Type4DataHob->SmbiosType4Processor.CoreCount2)); > > + DEBUG ((DEBUG_INFO, " Enabled CoreCount : %= d\n", > Type4DataHob->SmbiosType4Processor.EnabledCoreCount2)); > > + DEBUG ((DEBUG_INFO, " Thread Count 2: %d\n"= , > Type4DataHob->SmbiosType4Processor.ThreadCount2)); > > +#endif > > + > > + *SmbiosHandle =3D Processor; > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + This function builds SMBIOS type 44 record according.. > > + > > + @param Type4DataHob Pointer to > RISC_V_PROCESSOR_TYPE4_DATA_HOB > > + @param Type4Handle SMBIOS handle of type 4 > > + > > + @retval EFI_STATUS > > + > > +**/ > > +EFI_STATUS > > +BuildSmbiosType44 ( > > + IN RISC_V_PROCESSOR_TYPE4_DATA_HOB *Type4DataHob, > > + IN SMBIOS_HANDLE Type4Handle > > + ) > > +{ > > + EFI_HOB_GUID_TYPE *GuidHob; >=20 > ProcessorSpecificDataHob? Or Type44Hob? >=20 > > + RISC_V_PROCESSOR_SPECIFIC_DATA_HOB *ProcessorSpecificData; > > + SMBIOS_HANDLE RiscVType44; > > + SMBIOS_TABLE_TYPE44 *Type44Ptr; > > + EFI_STATUS Status; > > + > > + DEBUG ((DEBUG_INFO, "[RISC-V SMBIOS Builder]: Building Type 44 > > +for...\n")); #if RISCV_SMBIOS_DEBUG_INFO > > + DEBUG ((DEBUG_INFO, " Processor GUID: %g\n"= , > &Type4DataHob->PrcessorGuid)); > > + DEBUG ((DEBUG_INFO, " Processor UUID: %d\n"= , > Type4DataHob->ProcessorUid)); > > +#endif > > + > > + GuidHob =3D (EFI_HOB_GUID_TYPE *)GetFirstGuidHob ((EFI_GUID > > + *)PcdGetPtr(PcdProcessorSpecificDataGuidHobGuid)); > > + if (GuidHob =3D=3D NULL) { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: No > RISC_V_PROCESSOR_SPECIFIC_DATA_HOB found.\n")); > > + return EFI_NOT_FOUND; > > + } > > + // > > + // Go through each RISC_V_PROCESSOR_SPECIFIC_DATA_HOB for > multiple cores. > > + // > > + do { > > + ProcessorSpecificData =3D (RISC_V_PROCESSOR_SPECIFIC_DATA_HOB > *)GET_GUID_HOB_DATA (GuidHob); > > + if (!CompareGuid (&ProcessorSpecificData->ParentPrcessorGuid, > &Type4DataHob->PrcessorGuid) || > > + ProcessorSpecificData->ParentProcessorUid !=3D Type4DataHob- > >ProcessorUid) { > > + GuidHob =3D GetNextGuidHob((EFI_GUID > *)PcdGetPtr(PcdProcessorSpecificDataGuidHobGuid), > GET_NEXT_HOB(GuidHob)); > > + if (GuidHob =3D=3D NULL) { > > + break; > > + } > > + continue; > > + } > > + > > +#if RISCV_SMBIOS_DEBUG_INFO > > + DEBUG ((DEBUG_INFO, > "[ =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n")); > > + DEBUG ((DEBUG_INFO, "[ Core GUID: %g\n", > &ProcessorSpecificData->CoreGuid)); > > +#endif > > + > > + Type44Ptr =3D AllocateZeroPool(sizeof(SMBIOS_TABLE_TYPE44) + > sizeof(SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA) + 2); // Two ending > zero. > > + if (Type44Ptr =3D=3D NULL) { > > + return EFI_NOT_FOUND; > > + } > > + Type44Ptr->Hdr.Type =3D > SMBIOS_TYPE_PROCESSOR_ADDITIONAL_INFORMATION; > > + Type44Ptr->Hdr.Handle =3D 0; > > + Type44Ptr->Hdr.Length =3D sizeof(SMBIOS_TABLE_TYPE44) + > sizeof(SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA); > > + Type44Ptr->RefHandle =3D Type4Handle; > > + Type44Ptr->ProcessorSpecificBlock.Length =3D > sizeof(SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA); > > + Type44Ptr->ProcessorSpecificBlock.ProcessorArchType =3D > Type4DataHob->SmbiosType4Processor.ProcessorFamily2 - > > + ProcessorFa= milyRiscvRV32 + \ > > + ProcessorSp= ecificBlockArchTypeRiscVRV32; > > + CopyMem ((VOID *)(Type44Ptr + 1), (VOID > > + *)&ProcessorSpecificData->ProcessorSpecificData, sizeof > > + (SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA)); > > + > > +#if RISCV_SMBIOS_DEBUG_INFO > > + DEBUG ((DEBUG_INFO, "[ Core type: %d\n", T= ype44Ptr- > >ProcessorSpecificBlock.ProcessorArchType)); > > + DEBUG ((DEBUG_INFO, " HartId =3D 0x%x\n= ", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >HartId.Value64_L)); > > + DEBUG ((DEBUG_INFO, " Is Boot Hart? =3D= 0x%x\n", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >BootHartId)); > > + DEBUG ((DEBUG_INFO, " PrivilegeModeSupp= orted =3D > 0x%x\n", ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + > 1))->PrivilegeModeSupported)); > > + DEBUG ((DEBUG_INFO, " MModeExcepDelegat= ion =3D > 0x%x\n", ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + > 1))->MModeExcepDelegation.Value64_L)); > > + DEBUG ((DEBUG_INFO, " MModeInterruptDel= egation =3D > 0x%x\n", ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + > 1))->MModeInterruptDelegation.Value64_L)); > > + DEBUG ((DEBUG_INFO, " HartXlen =3D 0x%x= \n", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >HartXlen)); > > + DEBUG ((DEBUG_INFO, " MachineModeXlen = =3D 0x%x\n", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >MachineModeXlen)); > > + DEBUG ((DEBUG_INFO, " SupervisorModeXle= n =3D 0x%x\n", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >SupervisorModeXlen)); > > + DEBUG ((DEBUG_INFO, " UserModeXlen =3D = 0x%x\n", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >UserModeXlen)); > > + DEBUG ((DEBUG_INFO, " InstSetSupported = = =3D 0x%x\n", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >InstSetSupported)); > > + DEBUG ((DEBUG_INFO, " MachineVendorId = =3D 0x%x\n", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >MachineVendorId.Value64_L)); > > + DEBUG ((DEBUG_INFO, " MachineArchId =3D= 0x%x\n", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >MachineArchId.Value64_L)); > > + DEBUG ((DEBUG_INFO, " MachineImplId =3D= 0x%x\n", > ((SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA *)(Type44Ptr + 1))- > >MachineImplId.Value64_L)); > > +#endif > > + > > + // > > + // Add to SMBIOS table. > > + // > > + RiscVType44 =3D SMBIOS_HANDLE_PI_RESERVED; > > + Status =3D Smbios->Add (Smbios, NULL, &RiscVType44, &Type44Ptr->H= dr); > > + if (EFI_ERROR(Status)) { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: Fail to add SMBI= OS > Type 44\n")); > > + return Status; > > + } > > + DEBUG ((DEBUG_INFO, "[RISC-V SMBIOS Builder]: SMBIOS Type 44 was > > + added. SMBIOS Handle: 0x%x\n", RiscVType44)); > > + > > + GuidHob =3D GetNextGuidHob((EFI_GUID > > +*)PcdGetPtr(PcdProcessorSpecificDataGuidHobGuid), > > +GET_NEXT_HOB(GuidHob)); > > + } while (GuidHob !=3D NULL); > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Entry point of RISC-V SMBIOS builder. > > + > > + @param ImageHandle Image handle this driver. > > + @param SystemTable Pointer to the System Table. > > + > > + @retval EFI_SUCCESS Thread can be successfully created > > + @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data > structure > > + @retval EFI_DEVICE_ERROR Cannot create the thread > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +RiscVSmbiosBuilderEntry ( > > + IN EFI_HANDLE ImageHandle, > > + IN EFI_SYSTEM_TABLE *SystemTable > > + ) > > +{ > > + EFI_STATUS Status; > > + EFI_HOB_GUID_TYPE *GuidHob; >=20 > Type4Hob? >=20 > > + RISC_V_PROCESSOR_TYPE4_DATA_HOB *Type4HobData; > SMBIOS_HANDLE > > + Processor; > > + > > + DEBUG ((DEBUG_INFO, "[RISC-V SMBIOS Builder]: %a entry\n", > > + __FUNCTION__)); > > + > > + Status =3D gBS->LocateProtocol ( > > + &gEfiSmbiosProtocolGuid, > > + NULL, > > + (VOID **)&Smbios > > + ); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: Locate SMBIOS > Protocol fail\n")); > > + return Status; > > + } > > + GuidHob =3D (EFI_HOB_GUID_TYPE *)GetFirstGuidHob ((EFI_GUID > > + *)PcdGetPtr(PcdProcessorSmbiosType4GuidHobGuid)); > > + if (GuidHob =3D=3D NULL) { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: No RISC-V SMBIOS > information found.\n")); > > + return EFI_NOT_FOUND; > > + } > > + Type4HobData =3D (RISC_V_PROCESSOR_TYPE4_DATA_HOB > *)GET_GUID_HOB_DATA > > + (GuidHob); Status =3D EFI_NOT_FOUND; // // Go through each > > + RISC_V_PROCESSOR_TYPE4_DATA_HOB for multiple processors. > > + // > > + do { > > + Status =3D BuildSmbiosType4 (Type4HobData, &Processor); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: No RISC-V SMBIOS > type 4 created.\n")); > > + ASSERT (FALSE); > > + } > > + Status =3D BuildSmbiosType44 (Type4HobData, Processor); > > + if (EFI_ERROR (Status)) { > > + DEBUG ((DEBUG_ERROR, "[RISC-V SMBIOS Builder]: No RISC-V SMBIOS > type 44 found.\n")); > > + ASSERT (FALSE); > > + } > > + > > + GuidHob =3D GetNextGuidHob((EFI_GUID > > +*)PcdGetPtr(PcdProcessorSmbiosType4GuidHobGuid), > > +GET_NEXT_HOB(GuidHob)); > > + } while (GuidHob !=3D NULL); > > + DEBUG ((DEBUG_INFO, "[RISC-V SMBIOS Builder]: %a exit\n", > > +__FUNCTION__)); > > + return Status; > > +} > > + > > diff --git a/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.h > > b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.h > > new file mode 100644 > > index 0000000..dfa1fc6 > > --- /dev/null > > +++ b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.h > > @@ -0,0 +1,32 @@ > > +/** @file > > + RISC-V SMBIOS Builder DXE module header file. > > + > > + Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All > > + rights reserved.
> > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef _RISC_V_SMBIOS_DXE_H_ > > +#define _RISC_V_SMBIOS_DXE_H_ > > + > > +#include > > + > > +#include > > +#include > > + > > +#include #include > > + > > +#include #include > > +#include #include > > + #include > > +#include #include > > + > > +#include #include > > + >=20 > Please move all of these include statements to the files that actually u= se > them, then delete this file. >=20 > > + > > +#endif > > + > > diff --git a/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf > > b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf > > new file mode 100644 > > index 0000000..59b814a > > --- /dev/null > > +++ b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.inf > > @@ -0,0 +1,58 @@ > > +## @file > > +# RISC-V SMBIOS DXE module. > > +# > > +# Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All > > +rights reserved.
# # SPDX-License-Identifier: > > +BSD-2-Clause-Patent # ## > > + > > +[Defines] > > + INF_VERSION =3D 0x0001001b > > + BASE_NAME =3D RiscVSmbiosDxe > > + MODULE_UNI_FILE =3D RiscVSmbiosDxe.uni > > + FILE_GUID =3D 5FC01647-AADD-42E1-AD99-DF4CB89F= 5A92 > > + MODULE_TYPE =3D DXE_DRIVER > > + VERSION_STRING =3D 1.0 > > + ENTRY_POINT =3D RiscVSmbiosBuilderEntry > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + MdeModulePkg/MdeModulePkg.dec >=20 > Please sort alphabetically. >=20 > / > Leif >=20 > > + RiscVPkg/RiscVPkg.dec > > + > > +[LibraryClasses] > > + BaseLib > > + BaseMemoryLib > > + CpuLib > > + DebugLib > > + DxeServicesTableLib > > + HobLib > > + MemoryAllocationLib > > + UefiBootServicesTableLib > > + UefiDriverEntryPoint > > + UefiLib > > + > > +[Sources] > > + RiscVSmbiosDxe.c > > + RiscVSmbiosDxe.h > > + > > +[Protocols] > > + gEfiSmbiosProtocolGuid # Consumed > > + > > +[Guids] > > + > > + > > +[Pcd] > > + > > +[FixedPcd] > > + gUefiRiscVPkgTokenSpaceGuid.PcdProcessorSmbiosGuidHobGuid > > + gUefiRiscVPkgTokenSpaceGuid.PcdProcessorSmbiosType4GuidHobGuid > > + gUefiRiscVPkgTokenSpaceGuid.PcdProcessorSmbiosType7GuidHobGuid > > + gUefiRiscVPkgTokenSpaceGuid.PcdProcessorSpecificDataGuidHobGuid > > + > > +[Depex] > > + gEfiSmbiosProtocolGuid > > + > > +[UserExtensions.TianoCore."ExtraFiles"] > > + RiscVSmbiosDxeExtra.uni > > diff --git a/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.uni > > b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.uni > > new file mode 100644 > > index 0000000..1bffe09 > > --- /dev/null > > +++ b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxe.uni > > @@ -0,0 +1,12 @@ > > +// /** @file > > +// > > +// Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All > > +rights reserved.
// // SPDX-License-Identifier: > > +BSD-2-Clause-Patent // // **/ > > + > > +#string STR_MODULE_ABSTRACT #language en-US "RISC-V > Processor SMBIOS Builder" > > + > > +#string STR_MODULE_DESCRIPTION #language en-US "Build RISC-V > Processor SMBIOS Type 4, 7, 44 records." > > + > > diff --git a/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxeExtra.uni > > b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxeExtra.uni > > new file mode 100644 > > index 0000000..4b37ca2 > > --- /dev/null > > +++ b/RiscVPkg/Universal/SmbiosDxe/RiscVSmbiosDxeExtra.uni > > @@ -0,0 +1,13 @@ > > +// /** @file > > +// RISC-V SMBIOS Builder Localized Strings and Content // // > > +Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All > > +rights reserved.
// // SPDX-License-Identifier: > > +BSD-2-Clause-Patent // // **/ > > + > > +#string STR_PROPERTIES_MODULE_NAME > > +#language en-US > > +"RISC-V SMBIOS Record Builder DXE Driver" > > + > > -- > > 2.7.4 > > > > > >=20 > >