39 IN EFI_LOCATE_ACPI_CHECK CheckAcpiTableFunction
45 UINTN NumberOfHandles;
55 BOOLEAN FoundAcpiFile;
57 FoundAcpiFile =
FALSE;
60 Status =
gBS->LocateProtocol (
61 &gEfiAcpiTableProtocolGuid,
63 (VOID **)&AcpiProtocol
65 if (EFI_ERROR (Status)) {
73 Status =
gBS->LocateHandleBuffer (
75 &gEfiFirmwareVolume2ProtocolGuid,
80 if (EFI_ERROR (Status)) {
85 for (Index = 0; Index < NumberOfHandles; Index++) {
90 Status =
gBS->HandleProtocol (
92 &gEfiFirmwareVolume2ProtocolGuid,
95 if (EFI_ERROR (Status)) {
96 goto FREE_HANDLE_BUFFER;
104 Status = FvInstance->ReadSection (
114 if (EFI_ERROR (Status)) {
118 FoundAcpiFile =
TRUE;
122 ASSERT (SectionSize >= AcpiTableSize);
126 "- Found '%c%c%c%c' ACPI Table\n",
134 if (CheckAcpiTableFunction !=
NULL) {
142 Status = AcpiProtocol->InstallAcpiTable (
151 gBS->FreePool (AcpiTable);
162 gBS->FreePool (HandleBuffer);
164 return (FoundAcpiFile ?
EFI_SUCCESS : EFI_NOT_FOUND);
199 IN OUT UINT8 *Buffer,
203 UINTN ChecksumOffset;
205 if ((Buffer ==
NULL) || (Size == 0)) {
206 return EFI_INVALID_PARAMETER;
214 Buffer[ChecksumOffset] = 0;
245 IN UINT32 TableSignature,
253 EFI_ACPI_TABLE_VERSION TableVersion;
256 if ( (AcpiSdtProtocol ==
NULL)
258 || (TableKey ==
NULL))
260 return EFI_INVALID_PARAMETER;
270 while (!EFI_ERROR (Status)) {
271 Status = AcpiSdtProtocol->GetAcpiTable (
277 if (!EFI_ERROR (Status)) {
310 IN EFI_ACPI_HANDLE TableHandle,
311 IN CHAR8 *AsciiObjectPath,
316 EFI_ACPI_HANDLE ObjectHandle;
317 EFI_ACPI_HANDLE DataHandle;
318 EFI_ACPI_DATA_TYPE DataType;
323 if ((AcpiSdtProtocol ==
NULL) || (AsciiObjectPath ==
NULL)) {
324 return EFI_INVALID_PARAMETER;
330 Status = AcpiSdtProtocol->FindPath (TableHandle, AsciiObjectPath, &ObjectHandle);
331 if (EFI_ERROR (Status)) {
335 Status = AcpiSdtProtocol->GetOption (ObjectHandle, 0, &DataType, (VOID *)&Buffer, &BufferSize);
336 if (EFI_ERROR (Status)) {
337 Status = EFI_NOT_FOUND;
341 ASSERT (DataType == EFI_ACPI_DATA_TYPE_OPCODE);
342 ASSERT (Buffer !=
NULL);
344 if (Buffer[0] != AML_NAME_OP) {
345 Status = EFI_NOT_FOUND;
352 Status = AcpiSdtProtocol->GetChild (ObjectHandle, &DataHandle);
355 Status = AcpiSdtProtocol->GetOption (DataHandle, 0, &DataType, (VOID *)&Buffer, &BufferSize);
356 ASSERT (DataType == EFI_ACPI_DATA_TYPE_OPCODE);
357 ASSERT (Buffer !=
NULL);
359 if ((Buffer[0] == AML_ZERO_OP) || (Buffer[0] == AML_ONE_OP)) {
360 Status = AcpiSdtProtocol->SetOption (DataHandle, 0, (VOID *)&Value,
sizeof (UINT8));
367 case AML_BYTE_PREFIX:
368 DataSize =
sizeof (UINT8);
371 case AML_WORD_PREFIX:
372 DataSize =
sizeof (UINT16);
375 case AML_DWORD_PREFIX:
376 DataSize =
sizeof (UINT32);
379 case AML_QWORD_PREFIX:
380 DataSize =
sizeof (UINT64);
385 Status = EFI_INVALID_PARAMETER;
389 Status = AcpiSdtProtocol->SetOption (DataHandle, 1, (VOID *)&Value, DataSize);
394 AcpiSdtProtocol->Close (DataHandle);
395 AcpiSdtProtocol->Close (ObjectHandle);
EFI_STATUS EFIAPI AcpiUpdateChecksum(IN OUT UINT8 *Buffer, IN UINTN Size)
EFI_STATUS EFIAPI AcpiAmlObjectUpdateInteger(IN EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, IN EFI_ACPI_HANDLE TableHandle, IN CHAR8 *AsciiObjectPath, IN UINTN Value)
EFI_STATUS EFIAPI AcpiLocateTableBySignature(IN EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, IN UINT32 TableSignature, IN OUT UINTN *Index, OUT EFI_ACPI_DESCRIPTION_HEADER **Table, OUT UINTN *TableKey)
EFI_STATUS LocateAndInstallAcpiFromFvConditional(IN CONST EFI_GUID *AcpiFile, IN EFI_LOCATE_ACPI_CHECK CheckAcpiTableFunction)
EFI_STATUS LocateAndInstallAcpiFromFv(IN CONST EFI_GUID *AcpiFile)
UINT8 EFIAPI CalculateCheckSum8(IN CONST UINT8 *Buffer, IN UINTN Length)
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
VOID EFIAPI Exit(IN EFI_STATUS Status)