From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.32.121; helo=nam01-sn1-obe.outbound.protection.outlook.com; envelope-from=christopher.co@microsoft.com; receiver=edk2-devel@lists.01.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0121.outbound.protection.outlook.com [104.47.32.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1F2C2210BFF7B for ; Sat, 21 Jul 2018 18:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=crS27uu3D8ltKT30Pk4PXRfMMQuW9ss1tt/7m0CWaPk=; b=IPvchgsk0zjVCNl6dpHq1K4xUAT5V5dlZy/uvtc5YAkRYOwCQddzSnA4kCCGicA7FXveySe7SUgYzJDnuh2CT9VXeLnLFXR12i9V+exefoFKOGGO6EAXQ3L0JDv1nWuZBl2DJHlhEN6yab9ofKuXFHFEdE9u37DvajS+nERyUBQ= Received: from DM5PR2101MB1128.namprd21.prod.outlook.com (52.132.133.20) by DM5PR2101MB0998.namprd21.prod.outlook.com (52.132.133.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.995.1; Sun, 22 Jul 2018 01:30:34 +0000 Received: from DM5PR2101MB1128.namprd21.prod.outlook.com ([fe80::b4d3:dabb:9372:9740]) by DM5PR2101MB1128.namprd21.prod.outlook.com ([fe80::b4d3:dabb:9372:9740%3]) with mapi id 15.20.1017.000; Sun, 22 Jul 2018 01:30:34 +0000 From: Chris Co To: "edk2-devel@lists.01.org" CC: Michael D Kinney , Ard Biesheuvel , Leif Lindholm Thread-Topic: [PATCH edk2-platforms 1/4] Platform/Solidrun: Add Hummingboard SmBios Thread-Index: AQHUIVuVMzcpjlw1/0CNTDKx+vZL/A== Date: Sun, 22 Jul 2018 01:30:34 +0000 Message-ID: <20180722013021.10788-2-christopher.co@microsoft.com> References: <20180722013021.10788-1-christopher.co@microsoft.com> In-Reply-To: <20180722013021.10788-1-christopher.co@microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MWHPR14CA0020.namprd14.prod.outlook.com (2603:10b6:300:ae::30) To DM5PR2101MB1128.namprd21.prod.outlook.com (2603:10b6:4:a8::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2001:4898:80e8:9:354a:3e34:47dd:ceb4] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0998; 6:1PfyzvzcOI96wmbG0NwuxU4wjX5Ua5wYqefnyS2BLrn6+vNMp1+6Jk0q1b0Ghg27ZYtcyaLA+pKtw4ETJIGhdZvmY6CZnCxqsHC5NZbDcaNBngG6mAxVMX8p49ebNds0k8de9pUprdIL65yz8tbl3d5In32S21a5ZfFFP6Pzx0yP26jqvhddq+57yreLQMduEwGdBc3dUcODI3U2JVWtKyL/dZCeJu4no9PWGHUhvzRKYIrhT3QqEpfovBfRvZHh5bZQDKmMIZ75ml18JwnScsYja7b+zzzhzWQGmvTeMXWFIFCcBztNmO2ggald77DCpkbdihRW8dmAYAk81fzeic7Jnk0EFy3cG4EneQS6YcAbe+Wemx5ohYMFPVsifPJzkfCur2nSavithEcOvddsDaIaJqrQj4ej2nDpKBb6Q2ktsRMWKXSCLm+ZQFx4QQY78e9z3PckpvlyNm8kkxgm+A==; 5:aZcEHlrAqbhtVJeRwGCiBJ2PjrPyHXG/fK3V1D8oyw9Y9yl8TDBQjgVMea9ORsRaWnZEQ7viA4FGVgGRY42MLQvCWl5IqFf3mefJVDXShWW8f5rard8q2U9d1jP8tzM67fCxmeulqYTGtreHUQuTe+GaK8/q4ueWu74h11S/I+w=; 7:hBtBYsgMKRFiQqDWtSgyw56G46628+MrLOX3DhJZf8gz/0h9qbUZw1pSwTxnQceuPwTD/tFfpl2L0honKd8kentKrPqkLOclxJgWN0l7wJXzNtCnt/xodW7nxKamRnBmgRe4YBr7lOgseLs4KlICbFltpWizw/AcSSnsY1gcibytFW5jJzaJYREIcwbLdUZ8v4l/7mnGWp5l/PhCE1DVRyhsy5q6wxs0oH8Df7JjYajClhvZyd/FPel5UfAkxrsK x-ms-office365-filtering-correlation-id: de19e38d-d397-4246-1dc6-08d5ef72b836 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7193020); SRVR:DM5PR2101MB0998; x-ms-traffictypediagnostic: DM5PR2101MB0998: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Christopher.Co@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231311)(944501410)(52105095)(2018427008)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:DM5PR2101MB0998; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0998; x-forefront-prvs: 0741C77572 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6029001)(346002)(366004)(376002)(396003)(39860400002)(136003)(40224003)(199004)(189003)(53376002)(19627235002)(256004)(15188155005)(105586002)(2906002)(14444005)(106356001)(76176011)(1076002)(72206003)(5250100002)(7736002)(186003)(5660300001)(99286004)(4326008)(305945005)(46003)(2900100001)(2616005)(53936002)(81156014)(81166006)(6512007)(14454004)(6306002)(86612001)(2351001)(11346002)(102836004)(2501003)(25786009)(6486002)(446003)(68736007)(16200700003)(53946003)(5640700003)(966005)(54906003)(476003)(10090500001)(486006)(478600001)(6116002)(386003)(6506007)(36756003)(16799955002)(6916009)(10290500003)(6436002)(316002)(22452003)(8936002)(52116002)(8676002)(575784001)(97736004)(86362001)(559001)(579004)(569006); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0998; H:DM5PR2101MB1128.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 0hX9oUAWmgesfis1xyTwvR9jLwXjz6sSPrP1Oq50lQJB747V3sZP8tSLbhDe4fzFVY74iEskf1bIj0RAXupRvNGiPbLOql+PkXP6fTeoF54arLmf3RJjVvcEhvukE3+fKVwj67ylN4fg8AKWVv+JLzgbvlnK8yb6FY2Qgp+c7X6BHGDPY/SlASeYaf+z7P/XDDJ+ejyeCSwDl/wlx0XTqj7M9/IGz6PsVPqwRkKtAwW4qkFUqOADIDTGtp1D9y8PEMaPGp0S5dSSvokcJij3mjpv3k3/Fnp0c5BA9HUydGKHh/+hQ6IKzQ2JAnd9czzeAMdutp6DJjuntd/tc6Mk6zHDGE5gZBH9F6zyiD4ZKvA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: de19e38d-d397-4246-1dc6-08d5ef72b836 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jul 2018 01:30:34.3771 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0998 Subject: [PATCH edk2-platforms 1/4] Platform/Solidrun: Add Hummingboard SmBios X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2018 01:30:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable This adds SMBIOS support for SolidRun's i.MX6Q Hummingboard Edge. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christopher Co Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Leif Lindholm --- Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Drivers/PlatformSmbiosDxe/Pla= tformSmbiosDxe.c | 801 ++++++++++++++++++++ Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Drivers/PlatformSmbiosDxe/Pla= tformSmbiosDxe.inf | 54 ++ 2 files changed, 855 insertions(+) diff --git a/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Drivers/PlatformS= mbiosDxe/PlatformSmbiosDxe.c b/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB= /Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c new file mode 100644 index 000000000000..3d9632814b7f --- /dev/null +++ b/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Drivers/PlatformSmbiosDx= e/PlatformSmbiosDxe.c @@ -0,0 +1,801 @@ +/** @file + + Copyright (c) 2012, Apple Inc. All rights reserved.
+ Copyright (c) 2013 Linaro.org + Copyright (c), Microsoft Corporation. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + + Static SMBIOS Table for the SolidRun HummingBoard-Edge iMX6 Quad platfor= m + Derived from EmulatorPkg package + + Note SMBIOS 2.7.1 Required structures: + BIOS Information (Type 0) + System Information (Type 1) + Board Information (Type 2) + System Enclosure (Type 3) + Processor Information (Type 4) - CPU Driver + Cache Information (Type 7) - For cache that is external to processor + System Slots (Type 9) - If system has slots + Physical Memory Array (Type 16) + Memory Device (Type 17) - For each socketed system-memory Device + Memory Array Mapped Address (Type 19) - One per contiguous block per P= hysical Memroy Array + System Boot Information (Type 32) + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +SMBIOS_TABLE_TYPE0 mBIOSInfoType0 =3D { + { EFI_SMBIOS_TYPE_BIOS_INFORMATION, sizeof (SMBIOS_TABLE_TYPE0), 0 }, + 1, // Vendor String + 2, // BiosVersion String + 0xE000, // BiosSegment + 3, // BiosReleaseDate String + 0x7F, // BiosSize + { // BiosCharacteristics + 0, // Reserved :2; + 0, // Unknown :1; + 0, // BiosCharacteristicsNotSupported :1; + 0, // IsaIsSupported :1; + 0, // McaIsSupported :1; + 0, // EisaIsSupported :1; + 0, // PciIsSupported :1; + 0, // PcmciaIsSupported :1; + 0, // PlugAndPlayIsSupported :1; + 0, // ApmIsSupported :1; + 1, // BiosIsUpgradable :1; + 1, // BiosShadowingAllowed :1; + 0, // VlVesaIsSupported :1; + 0, // EscdSupportIsAvailable :1; + 0, // BootFromCdIsSupported :1; + 1, // SelectableBootIsSupported :1; + 0, // RomBiosIsSocketed :1; + 0, // BootFromPcmciaIsSupported :1; + 0, // EDDSpecificationIsSupported :1; + 0, // JapaneseNecFloppyIsSupported :1; + 0, // JapaneseToshibaFloppyIsSupported :1; + 0, // Floppy525_360IsSupported :1; + 0, // Floppy525_12IsSupported :1; + 0, // Floppy35_720IsSupported :1; + 0, // Floppy35_288IsSupported :1; + 0, // PrintScreenIsSupported :1; + 0, // Keyboard8042IsSupported :1; + 0, // SerialIsSupported :1; + 0, // PrinterIsSupported :1; + 0, // CgaMonoIsSupported :1; + 0, // NecPc98 :1; + 0 // ReservedForVendor :32; + }, + { // BIOSCharacteristicsExtensionBytes[] + 0x81, // AcpiIsSupported :1; + // UsbLegacyIsSupported :1; + // AgpIsSupported :1; + // I2OBootIsSupported :1; + // Ls120BootIsSupported :1; + // AtapiZipDriveBootIsSupported :1; + // Boot1394IsSupported :1; + // SmartBatteryIsSupported :1; + 0x0e, // BiosBootSpecIsSupported :1; + // FunctionKeyNetworkBootIsSupported :1; + // TargetContentDistributionEnabled :1; + // UefiSpecificationSupported :1; + // VirtualMachineSupported :1; + // ExtensionByte2Reserved :3; + }, + 0x00, // SystemBiosMajorRelease + 0x01, // SystemBiosMinorRelease + 0xFF, // EmbeddedControllerFirmwareMajorRelease + 0xFF, // EmbeddedControllerFirmwareMinorRelease +}; + +CHAR8 *mBIOSInfoType0Strings[] =3D { + "To be filled by O.E.M.", // Vendor String + "0.1", // BiosVersion String + __DATE__, // BiosReleaseDate String + NULL +}; + +SMBIOS_TABLE_TYPE1 mSysInfoType1 =3D { + { EFI_SMBIOS_TYPE_SYSTEM_INFORMATION, sizeof (SMBIOS_TABLE_TYPE1), 0 }, + 1, // Manufacturer String + 2, // ProductName String + 3, // Version String + 4, // SerialNumber String + { 0x25EF0280, 0xEC82, 0x42B0, { 0x8F, 0xB6, 0x10, 0xAD, 0xCC, 0xC6, 0x7C= , 0x02 } }, + SystemWakeupTypePowerSwitch, + 5, // SKUNumber String + 6, // Family String +}; +CHAR8 *mSysInfoType1Strings[] =3D { + "SolidRun", + "HummingBoard-Edge i4Pro", + "2.0", + "System Serial#", + "hb04w-e-110-00-004-0", + "edk2", + NULL +}; + +SMBIOS_TABLE_TYPE2 mBoardInfoType2 =3D { + { EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION, sizeof (SMBIOS_TABLE_TYPE2), 0 = }, + 1, // Manufacturer String + 2, // ProductName String + 3, // Version String + 4, // SerialNumber String + 5, // AssetTag String + { // FeatureFlag + 1, // Motherboard :1; + 0, // RequiresDaughterCard :1; + 0, // Removable :1; + 0, // Replaceable :1; + 0, // HotSwappable :1; + 0, // Reserved :3; + }, + 6, // LocationInChassis String + 0, // ChassisHandle; + BaseBoardTypeMotherBoard, // BoardType; + 0, // NumberOfContainedObjectHandles; + { 0 } // ContainedObjectHandles[1]; +}; +CHAR8 *mBoardInfoType2Strings[] =3D { + "SolidRun", + "HummingBoard-Edge i4Pro", + "2.0", + "Base Board Serial#", + "Base Board Asset Tag#", + "hb04w-e-110-00-004-0", + NULL +}; + +SMBIOS_TABLE_TYPE3 mEnclosureInfoType3 =3D { + { EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, sizeof (SMBIOS_TABLE_TYPE3), 0 }, + 1, // Manufacturer String + MiscChassisTypeOther, // Type; + 2, // Version String + 3, // SerialNumber String + 4, // AssetTag String + ChassisStateSafe, // BootupState; + ChassisStateSafe, // PowerSupplyState; + ChassisStateSafe, // ThermalState; + ChassisSecurityStatusNone, // SecurityStatus; + { 0, 0, 0, 0 }, // OemDefined[4]; + 0, // Height; + 0, // NumberofPowerCords; + 0, // ContainedElementCount; + 0, // ContainedElementRecordLength; + { { 0 } }, // ContainedElements[1]; +}; +CHAR8 *mEnclosureInfoType3Strings[] =3D { + "SolidRun", + "2.0", + "Chassis Board Serial#", + "Chassis Board Asset Tag#", + NULL +}; + +SMBIOS_TABLE_TYPE4 mProcessorInfoType4 =3D { + { EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE4), 0}= , + 1, // Socket String; + CentralProcessor, // ProcessorType; + ProcessorFamilyIndicatorFamily2, // ProcessorFamily; + 2, // ProcessorManufacture String; + { // ProcessorId; + { // PROCESSOR_SIGNATURE + 0, // ProcessorSteppingId:4; + 0, // ProcessorModel: 4; + 0, // ProcessorFamily: 4; + 0, // ProcessorType: 2; + 0, // ProcessorReserved1: 2; + 0, // ProcessorXModel: 4; + 0, // ProcessorXFamily: 8; + 0, // ProcessorReserved2: 4; + }, + { // PROCESSOR_FEATURE_FLAGS + 0, // ProcessorFpu :1; + 0, // ProcessorVme :1; + 0, // ProcessorDe :1; + 0, // ProcessorPse :1; + 0, // ProcessorTsc :1; + 0, // ProcessorMsr :1; + 0, // ProcessorPae :1; + 0, // ProcessorMce :1; + 0, // ProcessorCx8 :1; + 0, // ProcessorApic :1; + 0, // ProcessorReserved1 :1; + 0, // ProcessorSep :1; + 0, // ProcessorMtrr :1; + 0, // ProcessorPge :1; + 0, // ProcessorMca :1; + 0, // ProcessorCmov :1; + 0, // ProcessorPat :1; + 0, // ProcessorPse36 :1; + 0, // ProcessorPsn :1; + 0, // ProcessorClfsh :1; + 0, // ProcessorReserved2 :1; + 0, // ProcessorDs :1; + 0, // ProcessorAcpi :1; + 0, // ProcessorMmx :1; + 0, // ProcessorFxsr :1; + 0, // ProcessorSse :1; + 0, // ProcessorSse2 :1; + 0, // ProcessorSs :1; + 0, // ProcessorReserved3 :1; + 0, // ProcessorTm :1; + 0, // ProcessorReserved4 :2; + } + }, + 3, // ProcessorVersion String; + { // Voltage; + 1, // ProcessorVoltageCapability5V :1; + 1, // ProcessorVoltageCapability3_3V :1; + 1, // ProcessorVoltageCapability2_9V :1; + 0, // ProcessorVoltageCapabilityReserved :1; + 0, // ProcessorVoltageReserved :3; + 0 // ProcessorVoltageIndicateLegacy :1; + }, + 0, // ExternalClock; + 1200, // MaxSpeed; + 792, // CurrentSpeed; + 0x41, // Status; + ProcessorUpgradeOther, // ProcessorUpgrade; + 0, // L1CacheHandle; + 0, // L2CacheHandle; + 0, // L3CacheHandle; + 4, // SerialNumber; + 5, // AssetTag; + 6, // PartNumber; + 0, // CoreCount; + 0, // EnabledCoreCount; + 0, // ThreadCount; + 0, // ProcessorCharacteristics; + ProcessorFamilyARMv7, // ProcessorFamily2; +}; + +CHAR8 *mProcessorInfoType4Strings[] =3D { + "SoM", + "NXP", + "i.MX 6Quad", + "1.0", + "1.0", + "1.0", + NULL +}; + +SMBIOS_TABLE_TYPE7 mCacheInfoType7I1 =3D { + { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 }, + 1, // SocketDesignation String + 0x018A, // Cache Configuration + 0x0020, // Maximum Size 32k + 0x0020, // Install Size 32k + { // Supported SRAM Type + 0, //Other :1 + 0, //Unknown :1 + 0, //NonBurst :1 + 1, //Burst :1 + 0, //PiplelineBurst :1 + 1, //Synchronous :1 + 0, //Asynchronous :1 + 0 //Reserved :9 + }, + { // Current SRAM Type + 0, //Other :1 + 0, //Unknown :1 + 0, //NonBurst :1 + 1, //Burst :1 + 0, //PiplelineBurst :1 + 1, //Synchronous :1 + 0, //Asynchronous :1 + 0 //Reserved :9 + }, + 0, // Cache Speed unknown + CacheErrorMultiBit, // Error Correction Multi + CacheTypeInstruction, // System Cache Type + CacheAssociativity2Way // Associativity +}; +CHAR8 *mCacheInfoType7I1Strings[] =3D { + "L1 ICache", + NULL +}; + +SMBIOS_TABLE_TYPE7 mCacheInfoType7D1 =3D { + { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 }, + 1, // SocketDesignation String + 0x018A, // Cache Configuration + 0x0020, // Maximum Size 32k + 0x0020, // Install Size 32k + { // Supported SRAM Type + 0, //Other :1 + 0, //Unknown :1 + 0, //NonBurst :1 + 1, //Burst :1 + 0, //PiplelineBurst :1 + 1, //Synchronous :1 + 0, //Asynchronous :1 + 0 //Reserved :9 + }, + { // Current SRAM Type + 0, //Other :1 + 0, //Unknown :1 + 0, //NonBurst :1 + 1, //Burst :1 + 0, //PiplelineBurst :1 + 1, //Synchronous :1 + 0, //Asynchronous :1 + 0 //Reserved :9 + }, + 0, // Cache Speed unknown + CacheErrorMultiBit, // Error Correction Multi + CacheTypeData, // System Cache Type + CacheAssociativity2Way // Associativity +}; +CHAR8 *mCacheInfoType7D1Strings[] =3D { + "L1 DCache", + NULL +}; + +SMBIOS_TABLE_TYPE7 mCacheInfoType7U2 =3D { + { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 }, + 1, // SocketDesignation String + 0x018A, // Cache Configuration + 0x0400, // Maximum Size 1M + 0x0400, // Install Size 1M + { // Supported SRAM Type + 0, //Other :1 + 0, //Unknown :1 + 0, //NonBurst :1 + 1, //Burst :1 + 0, //PiplelineBurst :1 + 1, //Synchronous :1 + 0, //Asynchronous :1 + 0 //Reserved :9 + }, + { // Current SRAM Type + 0, //Other :1 + 0, //Unknown :1 + 0, //NonBurst :1 + 1, //Burst :1 + 0, //PiplelineBurst :1 + 1, //Synchronous :1 + 0, //Asynchronous :1 + 0 //Reserved :9 + }, + 0, // Cache Speed unknown + CacheErrorMultiBit, // Error Correction Multi + CacheTypeUnified, // System Cache Type + CacheAssociativity2Way // Associativity +}; +CHAR8 *mCacheInfoType7U2Strings[] =3D { + "L2 UCache (PL310)", + NULL +}; + +SMBIOS_TABLE_TYPE9 mSysSlotInfoType9 =3D { + { EFI_SMBIOS_TYPE_SYSTEM_SLOTS, sizeof (SMBIOS_TABLE_TYPE9), 0 }, + 1, // SlotDesignation String + SlotTypeOther, // SlotType; + SlotDataBusWidthOther, // SlotDataBusWidth; + SlotUsageAvailable, // CurrentUsage; + SlotLengthOther, // SlotLength; + 0, // SlotID; + { // SlotCharacteristics1; + 1, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 0, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + }, + { // SlotCharacteristics2; + 0, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 0, // SmbusSignalSupported :1; + 0, // Reserved :5; + }, + 0, // SegmentGroupNum; + 0, // BusNum; + 0, // DevFuncNum; +}; +CHAR8 *mSysSlotInfoType9Strings[] =3D { + "SD Card", + NULL +}; + +SMBIOS_TABLE_TYPE16 mPhyMemArrayInfoType16 =3D { + { EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, sizeof (SMBIOS_TABLE_TYPE16), 0= }, + MemoryArrayLocationSystemBoard, // Location; + MemoryArrayUseSystemMemory, // Use; + MemoryErrorCorrectionUnknown, // MemoryErrorCorrection; + 0x80000000, // MaximumCapacity (2 GB); + 0xFFFE, // MemoryErrorInformationHandle; + 1, // NumberOfMemoryDevices; + 0x80000000ULL, // ExtendedMaximumCapacity (2 GB) +}; +CHAR8 *mPhyMemArrayInfoType16Strings[] =3D { + NULL +}; + +SMBIOS_TABLE_TYPE17 mMemDevInfoType17 =3D { + { EFI_SMBIOS_TYPE_MEMORY_DEVICE, sizeof (SMBIOS_TABLE_TYPE17), 0 }, + 0, // MemoryArrayHandle; Matches SMBIOS_TABLE_TYPE16.Handle, se= e PhyMemArrayInfoUpdateSmbiosType16() + 0xFFFE, // MemoryErrorInformationHandle; + 0xFFFF, // TotalWidth; + 0xFFFF, // DataWidth; + 0x0800, // Size; // When bit 15 is 0: Size in MB + // When bit 15 is 1: Size in KB, and continues in E= xtendedSize + MemoryFormFactorUnknown, // FormFactor; + 0xff, // DeviceSet; + 1, // DeviceLocator String + 2, // BankLocator String + MemoryTypeDram, // MemoryType; + { // TypeDetail; + 0, // Reserved :1; + 0, // Other :1; + 1, // Unknown :1; + 0, // FastPaged :1; + 0, // StaticColumn :1; + 0, // PseudoStatic :1; + 0, // Rambus :1; + 0, // Synchronous :1; + 0, // Cmos :1; + 0, // Edo :1; + 0, // WindowDram :1; + 0, // CacheDram :1; + 0, // Nonvolatile :1; + 0, // Registered :1; + 0, // Unbuffered :1; + 0, // Reserved1 :1; + }, + 0, // Speed; + 3, // Manufacturer String + 0, // SerialNumber String + 0, // AssetTag String + 0, // PartNumber String + 0, // Attributes; + 0, // ExtendedSize; + 0, // ConfiguredMemoryClockSpeed; +}; +CHAR8 *mMemDevInfoType17Strings[] =3D { + "OS Virtual Memory", + "malloc", + "OSV", + NULL +}; + +SMBIOS_TABLE_TYPE19 mMemArrMapInfoType19 =3D { + { EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, sizeof (SMBIOS_TABLE_TYPE= 19), 0 }, + 0x10000000, // StartingAddress; + 0x8fffffff, // EndingAddress; + 0, // MemoryArrayHandle; + 1, // PartitionWidth; + 0, // ExtendedStartingAddress; + 0, // ExtendedEndingAddress; +}; +CHAR8 *mMemArrMapInfoType19Strings[] =3D { + NULL +}; + +SMBIOS_TABLE_TYPE32 mBootInfoType32 =3D { + { EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, sizeof (SMBIOS_TABLE_TYPE32),= 0 }, + { 0, 0, 0, 0, 0, 0 }, // Reserved[6]; + BootInformationStatusNoError // BootStatus +}; + +CHAR8 *mBootInfoType32Strings[] =3D { + NULL +}; + +/** + + Create SMBIOS record. + + Converts a fixed SMBIOS structure and an array of pointers to strings in= to + an SMBIOS record where the strings are cat'ed on the end of the fixed re= cord + and terminated via a double NULL and add to SMBIOS table. + + @param Template Fixed SMBIOS structure, required. + @param StringPack Array of strings to convert to an SMBIOS string pack= . + NULL is OK. + @param DataSmbiosHandle The new SMBIOS record handle . + NULL is OK. +**/ +EFI_STATUS +EFIAPI +LogSmbiosData ( + IN EFI_SMBIOS_TABLE_HEADER *Template, + IN CHAR8 **StringPack, + OUT EFI_SMBIOS_HANDLE *DataSmbiosHandle + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_PROTOCOL *Smbios; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_SMBIOS_TABLE_HEADER *Record; + UINTN Index; + UINTN StringSize; + UINTN Size; + CHAR8 *Str; + + Status =3D gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)= &Smbios); + if (EFI_ERROR (Status)) { + return Status; + } + + // Calculate the size of the fixed record and optional string pack + Size =3D Template->Length; + if (StringPack =3D=3D NULL) { + // At least a double null is required + Size +=3D 2; + } else { + for (Index =3D 0; StringPack[Index] !=3D NULL; Index++) { + StringSize =3D AsciiStrSize (StringPack[Index]); + Size +=3D StringSize; + } + if (StringPack[0] =3D=3D NULL) { + // At least a double null is required + Size +=3D 1; + } + + // Don't forget the terminating double null + Size +=3D 1; + } + + // Copy over Template + Record =3D (EFI_SMBIOS_TABLE_HEADER *)AllocateZeroPool (Size); + if (Record =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + CopyMem (Record, Template, Template->Length); + + // Append string pack + Str =3D ((CHAR8 *)Record) + Record->Length; + + for (Index =3D 0; StringPack[Index] !=3D NULL; Index++) { + StringSize =3D AsciiStrSize (StringPack[Index]); + CopyMem (Str, StringPack[Index], StringSize); + Str +=3D StringSize; + } + + *Str =3D 0; + SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; + Status =3D Smbios->Add ( + Smbios, + gImageHandle, + &SmbiosHandle, + Record + ); + if ((Status =3D=3D EFI_SUCCESS) && (DataSmbiosHandle !=3D NULL)) { + *DataSmbiosHandle =3D SmbiosHandle; + } + + ASSERT_EFI_ERROR (Status); + FreePool (Record); + return Status; +} + +VOID +BIOSInfoUpdateSmbiosType0 ( + VOID + ) +{ + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mBIOSInfoType0, mBIOSInfoType= 0Strings, NULL); +} + +VOID +I64ToHexString( + IN OUT CHAR8* TargetStringSz, + IN UINT32 TargetStringSize, + IN UINT64 Value + ) +{ + static CHAR8 ItoH[] =3D { '0','1','2','3','4','5','6','7','8','9','A',= 'B','C','D','E','F' }; + UINT8 StringInx; + INT8 NibbleInx; + + ZeroMem((void*)TargetStringSz, TargetStringSize); + + // + // Convert each nibble to hex string, starting from + // the highest non-zero nibble. + // + StringInx =3D 0; + for (NibbleInx =3D sizeof(UINT64) * 2; NibbleInx > 0; --NibbleInx) { + UINT64 NibbleMask =3D (((UINT64)0xF) << ((NibbleInx - 1) * 4)); + UINT8 Nibble =3D (UINT8)((Value & NibbleMask) >> ((NibbleInx - 1) = * 4)); + + ASSERT(Nibble <=3D 0xF); + + if (StringInx < (TargetStringSize-1)) { + TargetStringSz[StringInx++] =3D ItoH[Nibble]; + } else { + break; + } + } +} + +UINT64 ObtainPlatformId(VOID) +{ + UINT64 BoardSerial=3D(UINT64)0; + + // see iMX6 reference manual section 46.5.10 for OTP CFG registers desc= ription + const UINT32 RegOCOTP_CFG0Addr=3D0x021BC410; // OTP Bank0 Word1 contain= s lower 32 bits of the Unique ID and SJC_CHALLENGE field + const UINT32 RegOCOTP_CFG1Addr=3D0x021BC420; // OTP Bank0 Word2 contain= s upper 32 bits of the Unique ID and SJC_CHALLENGE field + BoardSerial =3D ((UINT64)(MmioRead32(RegOCOTP_CFG1Addr))) << 32; + BoardSerial =3D BoardSerial | ((UINT64)(MmioRead32(RegOCOTP_CFG0Addr)))= ; + + DEBUG((DEBUG_INFO, "Hummingboard Edge ser no %08X%08Xh \r\n", (UINT32)(= BoardSerial>>32), (UINT32)BoardSerial)); + return BoardSerial; +} + +VOID +SysInfoUpdateSmbiosType1 ( + VOID + ) +{ + UINT64 BoardSerial=3D(UINT64)0; + UINT32 Bank0Word3=3D0; + static CHAR8 BoardSerialString[sizeof(BoardSerial) * 2 + 1]=3D{0x00}; + int k=3D0; + + const UINT32 RegOCOTP_CFG2Addr=3D0x021BC430; + BoardSerial =3D ObtainPlatformId(); + + // Update the Smbios Type1 information with the board serial string + I64ToHexString(&BoardSerialString[0], sizeof(BoardSerialString), BoardS= erial); + mSysInfoType1Strings[mSysInfoType1.SerialNumber - 1] =3D &BoardSerialSt= ring[0]; + + Bank0Word3 =3D MmioRead32(RegOCOTP_CFG2Addr); + // Construct string to make UUID: fixed prefix + board serial number pr= inted in hex + mSysInfoType1.Uuid.Data1=3D((UINT32)'H'<<24) | ((UINT32)'M'<<16) | ((UI= NT32)'B'<<8) | (UINT32)'E' ; + mSysInfoType1.Uuid.Data2=3D(UINT16)Bank0Word3; + mSysInfoType1.Uuid.Data3=3D(UINT16)(Bank0Word3>>16); + + for(k=3D7; k>=3D0; k--) { + mSysInfoType1.Uuid.Data4[7-k]=3D(UINT8)(BoardSerial>>(k*8)); + } + + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mSysInfoType1, mSysInfoType1S= trings, NULL); + +} + +VOID +BoardInfoUpdateSmbiosType2 ( + VOID + ) +{ + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mBoardInfoType2, mBoardInfoTy= pe2Strings, NULL); +} + +VOID +EnclosureInfoUpdateSmbiosType3 ( + VOID + ) +{ + UINT8 ChassisSerialNo=3D0xFF; + static CHAR8 ChassisBoardSerialString[sizeof(ChassisSerialNo) * 2 + 1]= =3D{0x00}; + + // Generate chassis number from same platform id. + ChassisSerialNo =3D (UINT8)(ObtainPlatformId() >> 40); + DEBUG((DEBUG_INFO, "Chassis Board Serial %02Xh \r\n", ChassisSerialNo)); + + I64ToHexString(&ChassisBoardSerialString[0], sizeof(ChassisBoardSerialSt= ring), ChassisSerialNo); + mEnclosureInfoType3Strings[mEnclosureInfoType3.SerialNumber - 1] =3D &Ch= assisBoardSerialString[0]; + + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mEnclosureInfoType3, mEnclosu= reInfoType3Strings, NULL); +} + +VOID +ProcessorInfoUpdateSmbiosType4 ( + IN UINTN MaxCpus + ) +{ + mProcessorInfoType4.CoreCount =3D (UINT8) MaxCpus; + mProcessorInfoType4.EnabledCoreCount =3D (UINT8) MaxCpus; + mProcessorInfoType4.ThreadCount =3D (UINT8) MaxCpus; + + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mProcessorInfoType4, mProcess= orInfoType4Strings, NULL); +} + +VOID +CacheInfoUpdateSmbiosType7 ( + VOID + ) +{ + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCacheInfoType7I1, mCacheInfo= Type7I1Strings, NULL); + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCacheInfoType7D1, mCacheInfo= Type7D1Strings, NULL); + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCacheInfoType7U2, mCacheInfo= Type7U2Strings, NULL); +} + +VOID +SysSlotInfoUpdateSmbiosType9 ( + VOID + ) +{ + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mSysSlotInfoType9, mSysSlotIn= foType9Strings, NULL); +} + +VOID +PhyMemArrayInfoUpdateSmbiosType16 ( + VOID + ) +{ + EFI_SMBIOS_HANDLE MemArraySmbiosHandle; + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mPhyMemArrayInfoType16, mPhyM= emArrayInfoType16Strings, &MemArraySmbiosHandle); + + // Update the memory device information + mMemDevInfoType17.MemoryArrayHandle =3D MemArraySmbiosHandle; +} + +VOID +MemDevInfoUpdateSmbiosType17 ( + VOID + ) +{ + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mMemDevInfoType17, mMemDevInf= oType17Strings, NULL); +} + +VOID +MemArrMapInfoUpdateSmbiosType19 ( + VOID + ) +{ + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mMemArrMapInfoType19, mMemArr= MapInfoType19Strings, NULL); +} + +VOID +BootInfoUpdateSmbiosType32 ( + VOID + ) +{ + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mBootInfoType32, mBootInfoTyp= e32Strings, NULL); +} + +EFI_STATUS +EFIAPI +PlatformSmbiosDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + BIOSInfoUpdateSmbiosType0(); + + SysInfoUpdateSmbiosType1(); + + BoardInfoUpdateSmbiosType2(); + + EnclosureInfoUpdateSmbiosType3(); + + ProcessorInfoUpdateSmbiosType4 (FixedPcdGet32(PcdCoreCount)); + + CacheInfoUpdateSmbiosType7(); + + SysSlotInfoUpdateSmbiosType9(); + + PhyMemArrayInfoUpdateSmbiosType16(); + + MemDevInfoUpdateSmbiosType17(); + + MemArrMapInfoUpdateSmbiosType19(); + + BootInfoUpdateSmbiosType32(); + + return EFI_SUCCESS; +} diff --git a/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Drivers/PlatformS= mbiosDxe/PlatformSmbiosDxe.inf b/Platform/SolidRun/HummingboardEdge_iMX6Q_2= GB/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf new file mode 100644 index 000000000000..4efcd76ffb47 --- /dev/null +++ b/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Drivers/PlatformSmbiosDx= e/PlatformSmbiosDxe.inf @@ -0,0 +1,54 @@ +#/** @file +# +# Copyright (c) 2013 Linaro.org +# Copyright (c), Microsoft Corporation. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may = be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +# +#**/ + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PlatformSmbiosDxe + FILE_GUID =3D 3847D23F-1D95-4772-B60C-4BBFBC4D532F + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PlatformSmbiosDriverEntryPoint + +[Sources] + PlatformSmbiosDxe.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + Silicon/NXP/iMX6Pkg/iMX6Pkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + MemoryAllocationLib + BaseMemoryLib + BaseLib + UefiLib + UefiDriverEntryPoint + IoLib + DebugLib + IoLib + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL SOMETIMES_CONSU= MED + +[Guids] + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PcdCoreCount + +[Depex] + gEfiSmbiosProtocolGuid --=20 2.16.2.gvfs.1.33.gf5370f1