Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

Commit

Permalink
WhitleyOpenBoardPkg/StaticSkuDataDxe: Add open source driver
Browse files Browse the repository at this point in the history
This driver provides data for boards patching AML, PIRQ, and MP tables.

Cc: Nate DeSimone <[email protected]>
Cc: Chasel Chiu <[email protected]>
Signed-off-by: Isaac Oram <[email protected]>
Reviewed-by: Nate DeSimone <[email protected]>
  • Loading branch information
iworam committed Feb 9, 2022
1 parent 16ea1b3 commit d1e809a
Show file tree
Hide file tree
Showing 11 changed files with 536 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/** @file
UBA Mp table Update Library Header File.
@copyright
Copyright 2008 - 2015 Intel Corporation. <BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef _UBA_MP_TABLE_UPDATE_LIB_H
#define _UBA_MP_TABLE_UPDATE_LIB_H

#include <Base.h>
#include <Uefi.h>

#include <PlatDevData.h>

#define PLATFORM_MP_TABLE_UPDATE_SIGNATURE SIGNATURE_32 ('U', 'M', 'P', 'T')
#define PLATFORM_MP_TABLE_UPDATE_VERSION 0x01

// {0FF8A1CF-A0AB-4ac0-BFC9-34A78F68DD8A}
#define PLATFORM_MP_TABLE_CONFIG_DATA_GUID \
{ 0xff8a1cf, 0xa0ab, 0x4ac0, { 0xbf, 0xc9, 0x34, 0xa7, 0x8f, 0x68, 0xdd, 0x8a } };


typedef struct {
UINT32 Signature;
UINT32 Version;

DEVICE_DATA *DeviceDataPtr;

} PLATFORM_MP_UPDATE_TABLE;

EFI_STATUS
PlatformGetMpTableDataPointer (
IN DEVICE_DATA **DeviceData
);

STATIC EFI_GUID gPlatformMpTableConfigDataGuid =PLATFORM_MP_TABLE_CONFIG_DATA_GUID;

#endif //_UBA_MP_TABLE_UPDATE_LIB_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/** @file
UBA PirqData Update Library Header File.
@copyright
Copyright 2008 - 2014 Intel Corporation. <BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef _UBA_PIRQ_UPDATE_LIB_H
#define _UBA_PIRQ_UPDATE_LIB_H

#include <Base.h>
#include <Uefi.h>

#include <PlatPirqData.h>

#define PLATFORM_PIRQ_UPDATE_SIGNATURE SIGNATURE_32 ('P', 'I', 'R', 'Q')
#define PLATFORM_PIRQ_UPDATE_VERSION 0x01


// {4C1F48A5-C976-4d90-9F03-8E9B1C327FCF}
#define PLATFORM_PIRQ_CONFIG_DATA_GUID \
{ 0x4c1f48a5, 0xc976, 0x4d90, { 0x9f, 0x3, 0x8e, 0x9b, 0x1c, 0x32, 0x7f, 0xcf } }


typedef struct {
UINT32 Signature;
UINT32 Version;

PLATFORM_PIRQ_DATA *PirqDataPtr;

} PLATFORM_PIRQ_UPDATE_TABLE;

EFI_STATUS
PlatformGetPirqDataPointer (
IN PLATFORM_PIRQ_DATA **PirqData
);

STATIC EFI_GUID gPlatformPirqConfigDataGuid = PLATFORM_PIRQ_CONFIG_DATA_GUID;

#endif //_UBA_PIRQ_UPDATE_LIB_H
5 changes: 5 additions & 0 deletions Platform/Intel/WhitleyOpenBoardPkg/Uba/UbaDxeRpBoards.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

#
# Currently shared by all platforms
#
INF $(RP_PKG)/Uba/UbaMain/StaticSkuDataDxe/StaticSkuDataDxe.inf

#
# Platform TypeWilsonCityRP
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/** @file
ACPI static data update.
@copyright
Copyright 2013 - 2022 Intel Corporation. <BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include "StaticSkuDataDxe.h"
#include <Library/UbaAcpiUpdateLib.h>

#include "AmlOffsetTable.c" // Generated in PreBuild step

#include <Library/HobLib.h>
#include <Guid/PlatformInfo.h>

ACPI_FIX_UPDATE_TABLE FixupTableUpdate10nm =
{
PLATFORM_ACPI_FIX_UPDATE_SIGNATURE,
PLATFORM_ACPI_FIX_UPDATE_VERSION,
&DSDT_EPRP10NM_OffsetTable
};

EFI_STATUS
InstallAcpiFixupTableData (
IN UBA_CONFIG_DATABASE_PROTOCOL *UbaConfigProtocol
)
{
EFI_STATUS Status = EFI_SUCCESS;
EFI_HOB_GUID_TYPE *GuidHob;
EFI_PLATFORM_INFO *PlatformInfo;
ACPI_FIX_UPDATE_TABLE *PtrTable;
UINT32 TableSize;

GuidHob = GetFirstGuidHob (&gEfiPlatformInfoGuid);
ASSERT (GuidHob != NULL);
if (GuidHob == NULL) {
return EFI_NOT_FOUND;
}
PlatformInfo = GET_GUID_HOB_DATA (GuidHob);

PtrTable = &FixupTableUpdate10nm;
TableSize = sizeof(FixupTableUpdate10nm);
DEBUG ((DEBUG_INFO, "UBA: Loading Acpi table for ICX\n"));

Status = UbaConfigProtocol->AddData (
UbaConfigProtocol,
&gPlatformAcpiFixTableGuid,
PtrTable,
TableSize
);
return Status;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/** @file
Device data installation.
@copyright
Copyright 2014 - 2022 Intel Corporation. <BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include "StaticSkuDataDxe.h"

#include <Library/UbaPirqUpdateLib.h>
#include <Library/UbaMpTableUpdateLib.h>

#include <PlatPirqData.h>
#include <PlatDevData.h>

#include <Library/HobLib.h>
#include <Guid/PlatformInfo.h>

extern PLATFORM_PIRQ_DATA mPlatformPirqDataPlatformSRP10nm;

PLATFORM_PIRQ_UPDATE_TABLE PirqUpdate10nm =
{
PLATFORM_PIRQ_UPDATE_SIGNATURE,
PLATFORM_PIRQ_UPDATE_VERSION,
&mPlatformPirqDataPlatformSRP10nm
};

EFI_STATUS
InstallPirqData (
IN UBA_CONFIG_DATABASE_PROTOCOL *UbaConfigProtocol
)
{
EFI_STATUS Status = EFI_SUCCESS;
PLATFORM_PIRQ_UPDATE_TABLE *PtrTable;
UINT32 TableSize;
EFI_HOB_GUID_TYPE *GuidHob;
EFI_PLATFORM_INFO *PlatformInfo;

GuidHob = GetFirstGuidHob (&gEfiPlatformInfoGuid);
ASSERT (GuidHob != NULL);
if (GuidHob == NULL) {
return EFI_NOT_FOUND;
}
PlatformInfo = GET_GUID_HOB_DATA (GuidHob);

PtrTable = &PirqUpdate10nm;
TableSize = sizeof(PirqUpdate10nm);
DEBUG ((DEBUG_ERROR, "UBA: Loading Pirqupdate table for ICX\n"));

Status = UbaConfigProtocol->AddData (
UbaConfigProtocol,
&gPlatformPirqConfigDataGuid,
PtrTable,
TableSize
);
return Status;
}

extern DEVICE_DATA mDeviceDataPlatformSRP10nm;

PLATFORM_MP_UPDATE_TABLE MpTableUpdate10nm =
{
PLATFORM_MP_TABLE_UPDATE_SIGNATURE,
PLATFORM_MP_TABLE_UPDATE_VERSION,
&mDeviceDataPlatformSRP10nm
};

EFI_STATUS
InstallMpTableData (
IN UBA_CONFIG_DATABASE_PROTOCOL *UbaConfigProtocol
)
{
EFI_STATUS Status = EFI_SUCCESS;
PLATFORM_MP_UPDATE_TABLE *PtrTable;
UINT32 TableSize;
EFI_HOB_GUID_TYPE *GuidHob;
EFI_PLATFORM_INFO *PlatformInfo;

GuidHob = GetFirstGuidHob (&gEfiPlatformInfoGuid);
ASSERT (GuidHob != NULL);
if (GuidHob == NULL) {
return EFI_NOT_FOUND;
}
PlatformInfo = GET_GUID_HOB_DATA (GuidHob);

PtrTable = &MpTableUpdate10nm;
TableSize = sizeof(MpTableUpdate10nm);
DEBUG ((DEBUG_ERROR, "UBA: Loading MpTableupdate table for ICX\n"));

Status = UbaConfigProtocol->AddData (
UbaConfigProtocol,
&gPlatformMpTableConfigDataGuid,
PtrTable,
TableSize
);

return Status;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/** @file
@copyright
Copyright 2017 - 2018 Intel Corporation. <BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include <PlatPirqData.h>
#include <PlatDevData.h>
#include <IndustryStandard/LegacyBiosMpTable.h>

#ifndef V_INTEL_VID
#define V_INTEL_VID 0x8086
#endif // #ifndef V_INTEL_VID

//
// Describes Local APICs' connections.
//
STATIC DEVICE_DATA_HW_LOCAL_INT DeviceDataHwLocalInt1[] = {
{
{{0},{{0xFF,0},{0xFF,0},{0xFF,0}}},
0x00,
0xff,
0x00,
EfiLegacyMpTableEntryLocalIntTypeExtInt,
EfiLegacyMpTableEntryLocalIntFlagsPolaritySpec,
EfiLegacyMpTableEntryLocalIntFlagsTriggerSpec
},
{
{{0},{{0xFF,0},{0xFF,0},{0xFF,0}}},
0x00,
0xff,
0x01,
EfiLegacyMpTableEntryLocalIntTypeInt,
EfiLegacyMpTableEntryLocalIntFlagsPolaritySpec,
EfiLegacyMpTableEntryLocalIntFlagsTriggerSpec
},
};

//
// Describes system's address space mapping, specific to the system.
//
STATIC DEVICE_DATA_HW_ADDR_SPACE_MAPPING DeviceDataHwAddrSpace1[] = {
//
// Legacy IO addresses.
//
{ {0}, EfiLegacyMpTableEntryExtSysAddrSpaceMappingIo, 0x0000, 0x1000 },
};

//
// IRQ priority
//
STATIC EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY IrqPriorityTable1[] = {
{11, 0},
{10, 0},
{9, 0},
{5, 0},
{0, 0},
{0, 0},
{0, 0}
};

//
// Note : UpdateBusNumbers updates the bus numeber
//
STATIC EFI_LEGACY_PIRQ_TABLE PirqTableHead1 [] = {
{
{
EFI_PIRQ_TABLE_SIGNATURE,
00,
01,
0000,
00,
00,
0000,
V_INTEL_VID,
30,
00000000,
{00,
00,
00,
00,
00,
00,
00,
00,
00,
00,
00},
00
}
}
};

//
// Instantiation of the system device data.
//
DEVICE_DATA mDeviceDataPlatformSRP10nm = {
DeviceDataHwLocalInt1, sizeof (DeviceDataHwLocalInt1) / sizeof (DeviceDataHwLocalInt1[0]),
DeviceDataHwAddrSpace1, sizeof (DeviceDataHwAddrSpace1)/ sizeof (DeviceDataHwAddrSpace1[0])
};

//
// Instantiation of platform PIRQ data.
//
PLATFORM_PIRQ_DATA mPlatformPirqDataPlatformSRP10nm = {
IrqPriorityTable1, sizeof(IrqPriorityTable1) / sizeof(IrqPriorityTable1[0]),
PirqTableHead1, sizeof(PirqTableHead1) / sizeof(PirqTableHead1[0])
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# **Generating ACPI AML Offset table**

The StaticSkuDataDxe driver includes AmlOffsetTable.c which contains the AML offset table. This Readme captures the build process for this file.

edk2-platforms/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py drives the build since ACPI tables are expected to be board specific.

The AmlOffsetTable.c file is generated in two key steps:
1. Generate the *Dsdt*.offsets.h where *Dsdt* is the DSDT ASL file name specific for this build. For WilsonCityRvp:
* The DSDT is WhitleyOpenBoardPkg/Features/Acpi/AcpiTables/Dsdt/EPRPPlatform10nm.asl
* The generated file is Build/WhitleyOpenBoardPkg/DEBUG_VS2015x86/X64/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets/AmlOffsets/OUTPUT/WhitleyOpenBoardPkg/Features/Acpi/AcpiTables/Dsdt/EPRPPlatform10nm.offset.h
* These are customized in the build_config.cfg file
2. Generate the AmlOffsetTable.c using the AmlGenOffset.py script from the MinPlatformPkg. For WilsonCityRvp:
* Script is at edk2-platforms/Platform/Intel/MinPlatformPkg/Tools/AmlGenOffset/AmlGenOffset.py
* Input is Build/WhitleyOpenBoardPkg/DEBUG_VS2015x86/X64/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets/AmlOffsets/OUTPUT/WhitleyOpenBoardPkg/Features/Acpi/AcpiTables/Dsdt/EPRPPlatform10nm.offset.h
* Output is edk2-platforms/Platform/Intel/WhitleyOpenBoardPkg/Uba/UbaMain/StaticSkuDataDxe/AmlOffsetTable.c

Common Issues:
* The same iasl compiler version must be used to build the AML offset table and to build the DSDT.
* The Board/*AmlOffsets*.dsc file name, Board/*AmlOffsets* directory name, Board/AmlOffsets/*AmlOffsets*.inf file name, and the BASE_NAME in *AmlOffsets*.inf must all match exactly.
Loading

0 comments on commit d1e809a

Please sign in to comment.