/** Initialize and publish TPM items in ACPI table. @retval EFI_SUCCESS The TCG ACPI table is published successfully. @retval Others The TCG ACPI table is not published. **/ EFI_STATUS PublishAcpiTable ( VOID ) { EFI_STATUS Status; EFI_ACPI_TABLE_PROTOCOL *AcpiTable; UINTN TableKey; EFI_ACPI_DESCRIPTION_HEADER *Table; UINTN TableSize; Status = GetSectionFromFv ( &gEfiCallerIdGuid, EFI_SECTION_RAW, 0, (VOID **) &Table, &TableSize ); ASSERT_EFI_ERROR (Status); // // Measure to PCR[0] with event EV_POST_CODE ACPI DATA // TpmMeasureAndLogData( 0, EV_POST_CODE, EV_POSTCODE_INFO_ACPI_DATA, ACPI_DATA_LEN, Table, TableSize ); ASSERT (Table->OemTableId == SIGNATURE_64 ('T', 'p', 'm', '2', 'T', 'a', 'b', 'l')); CopyMem (Table->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (Table->OemId) ); mTcgNvs = AssignOpRegion (Table, SIGNATURE_32 ('T', 'N', 'V', 'S'), (UINT16) sizeof (TCG_NVS)); ASSERT (mTcgNvs != NULL); // // Publish the TPM ACPI table // Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable); ASSERT_EFI_ERROR (Status); TableKey = 0; Status = AcpiTable->InstallAcpiTable ( AcpiTable, Table, TableSize, &TableKey ); ASSERT_EFI_ERROR (Status); return Status; }
EFI_STATUS EFIAPI RegisterEmmc ( VOID ) { EFI_STATUS Status; EFI_HANDLE Handle; UINTN Index; if (mHiiSettings->AcpiPref == ACPIPREF_ACPI) { // // Load the SSDT table from a raw section in this FFS file. // for (Index = 0;; Index++) { Status = GetSectionFromFv (&gEfiCallerIdGuid, EFI_SECTION_RAW, Index, (VOID **)&mSsdt, &mSsdtSize); if (EFI_ERROR (Status)) { break; } if (mSsdt->OemTableId != EMMC_TABLE_ID) { continue; } // // Register for the ACPI table protocol // EfiCreateProtocolNotifyEvent (&gEfiAcpiTableProtocolGuid, TPL_CALLBACK, InstallAcpiTable, NULL, &mEventRegistration); break; } } Status = RegisterNonDiscoverableMmioDevice ( NonDiscoverableDeviceTypeSdhci, NonDiscoverableDeviceDmaTypeCoherent, NULL, &mSdMmcControllerHandle, 1, SYNQUACER_EMMC_BASE, SYNQUACER_EMMC_BASE_SZ); ASSERT_EFI_ERROR (Status); Handle = NULL; Status = gBS->InstallProtocolInterface (&Handle, &gEdkiiSdMmcOverrideProtocolGuid, EFI_NATIVE_INTERFACE, (VOID **)&mSdMmcOverride); ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; }
/** Initialize and publish TPM items in ACPI table. @retval EFI_SUCCESS The TCG ACPI table is published successfully. @retval Others The TCG ACPI table is not published. **/ EFI_STATUS PublishAcpiTable ( VOID ) { EFI_STATUS Status; EFI_ACPI_TABLE_PROTOCOL *AcpiTable; UINTN TableKey; EFI_ACPI_DESCRIPTION_HEADER *Table; UINTN TableSize; Status = GetSectionFromFv ( &gEfiCallerIdGuid, EFI_SECTION_RAW, 0, (VOID **) &Table, &TableSize ); ASSERT_EFI_ERROR (Status); ASSERT (Table->OemTableId == SIGNATURE_64 ('T', 'c', 'g', 'T', 'a', 'b', 'l', 'e')); mTcgNvs = AssignOpRegion (Table, SIGNATURE_32 ('T', 'N', 'V', 'S'), (UINT16) sizeof (TCG_NVS)); ASSERT (mTcgNvs != NULL); // // Publish the TPM ACPI table // Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable); ASSERT_EFI_ERROR (Status); TableKey = 0; Status = AcpiTable->InstallAcpiTable ( AcpiTable, Table, TableSize, &TableKey ); ASSERT_EFI_ERROR (Status); return Status; }
EFI_STATUS GetPciRom ( IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, IN EFI_HANDLE PciHandle, OUT VOID **RomImage, OUT UINTN *RomSize ) /*++ Routine Description: Return a PCI ROM image for the onboard device represented by PciHandle Arguments: This - Protocol instance pointer. PciHandle - PCI device to return the ROM image for. RomImage - PCI Rom Image for onboard device RomSize - Size of RomImage in bytes Returns: EFI_SUCCESS - RomImage is valid EFI_NOT_FOUND - No RomImage --*/ { EFI_STATUS Status; EFI_PCI_IO_PROTOCOL *PciIo; UINTN Segment; UINTN Bus; UINTN Device; UINTN Function; UINT16 VendorId; UINT16 DeviceId; UINT16 DeviceClass; UINTN TableIndex; Status = gBS->HandleProtocol ( PciHandle, &gEfiPciIoProtocolGuid, (VOID **) &PciIo ); if (EFI_ERROR (Status)) { return EFI_NOT_FOUND; } PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function); PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, 0x0A, 1, &DeviceClass); PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, 0, 1, &VendorId); PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, 2, 1, &DeviceId); // // Loop through table of video option rom descriptions // for (TableIndex = 0; mPciOptionRomTable[TableIndex].VendorId != 0xffff; TableIndex++) { // // See if the PCI device specified by PciHandle matches at device in mPciOptionRomTable // if (VendorId != mPciOptionRomTable[TableIndex].VendorId || DeviceId != mPciOptionRomTable[TableIndex].DeviceId || Segment != mPciOptionRomTable[TableIndex].Segment || Bus != mPciOptionRomTable[TableIndex].Bus || Device != mPciOptionRomTable[TableIndex].Device || Function != mPciOptionRomTable[TableIndex].Function) { continue; } Status = GetSectionFromFv ( &mPciOptionRomTable[TableIndex].FileName, EFI_SECTION_RAW, 0, RomImage, RomSize ); if (EFI_ERROR (Status)) { continue; } return EFI_SUCCESS; } return EFI_NOT_FOUND; }