mirror of https://github.com/acidanthera/audk.git
DuetPkg: Fix build break caused by EFI_SPECIFICATION_VERSION usage
The EFI_SPECIFICATION_VERSION MACRO is no longer defined in edk2 builds, and this module does not need to support the older < UEFI 2.0 code path. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10096 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
4442c579e4
commit
c6f293af97
|
@ -138,16 +138,6 @@ Returns:
|
||||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||||
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
|
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
|
||||||
PCI_DRIVER_OVERRIDE_LIST *Node;
|
PCI_DRIVER_OVERRIDE_LIST *Node;
|
||||||
#if (EFI_SPECIFICATION_VERSION < 0x00020000)
|
|
||||||
EFI_DRIVER_OS_HANDOFF_HEADER *DriverOsHandoffHeader;
|
|
||||||
EFI_DRIVER_OS_HANDOFF_HEADER *NewDriverOsHandoffHeader;
|
|
||||||
EFI_DRIVER_OS_HANDOFF *DriverOsHandoff;
|
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
||||||
EFI_HANDLE DeviceHandle;
|
|
||||||
UINTN NumberOfEntries;
|
|
||||||
UINTN Size;
|
|
||||||
UINTN Index;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Status = gBS->HandleProtocol (DriverImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
|
Status = gBS->HandleProtocol (DriverImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
@ -182,113 +172,5 @@ Returns:
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (EFI_SPECIFICATION_VERSION < 0x00020000)
|
|
||||||
DriverOsHandoffHeader = NULL;
|
|
||||||
Status = EfiLibGetSystemConfigurationTable (&gEfiUgaIoProtocolGuid, (VOID **) &DriverOsHandoffHeader);
|
|
||||||
if (!EFI_ERROR (Status) && DriverOsHandoffHeader != NULL) {
|
|
||||||
for (Index = 0; Index < DriverOsHandoffHeader->NumberOfEntries; Index++) {
|
|
||||||
DriverOsHandoff = (EFI_DRIVER_OS_HANDOFF *)((UINTN)(DriverOsHandoffHeader) +
|
|
||||||
DriverOsHandoffHeader->HeaderSize +
|
|
||||||
Index * DriverOsHandoffHeader->SizeOfEntries);
|
|
||||||
DevicePath = DriverOsHandoff->DevicePath;
|
|
||||||
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, &DeviceHandle);
|
|
||||||
if (!EFI_ERROR (Status) && DeviceHandle != NULL && IsDevicePathEnd (DevicePath)) {
|
|
||||||
if (DeviceHandle == PciIoDevice->Handle) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NumberOfEntries = DriverOsHandoffHeader->NumberOfEntries + 1;
|
|
||||||
} else {
|
|
||||||
NumberOfEntries = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->AllocatePool (
|
|
||||||
EfiRuntimeServicesData,
|
|
||||||
sizeof (EFI_DRIVER_OS_HANDOFF_HEADER) + NumberOfEntries * sizeof (EFI_DRIVER_OS_HANDOFF),
|
|
||||||
(VOID **) &NewDriverOsHandoffHeader
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DriverOsHandoffHeader == NULL) {
|
|
||||||
NewDriverOsHandoffHeader->Version = 0;
|
|
||||||
NewDriverOsHandoffHeader->HeaderSize = sizeof (EFI_DRIVER_OS_HANDOFF_HEADER);
|
|
||||||
NewDriverOsHandoffHeader->SizeOfEntries = sizeof (EFI_DRIVER_OS_HANDOFF);
|
|
||||||
NewDriverOsHandoffHeader->NumberOfEntries = (UINT32) NumberOfEntries;
|
|
||||||
} else {
|
|
||||||
gBS->CopyMem (
|
|
||||||
NewDriverOsHandoffHeader,
|
|
||||||
DriverOsHandoffHeader,
|
|
||||||
DriverOsHandoffHeader->HeaderSize + (NumberOfEntries - 1) * DriverOsHandoffHeader->SizeOfEntries
|
|
||||||
);
|
|
||||||
NewDriverOsHandoffHeader->NumberOfEntries = (UINT32) NumberOfEntries;
|
|
||||||
}
|
|
||||||
|
|
||||||
DriverOsHandoff = (EFI_DRIVER_OS_HANDOFF *)((UINTN)NewDriverOsHandoffHeader +
|
|
||||||
NewDriverOsHandoffHeader->HeaderSize +
|
|
||||||
(NumberOfEntries - 1) * NewDriverOsHandoffHeader->SizeOfEntries);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fill in the EFI_DRIVER_OS_HANDOFF structure
|
|
||||||
//
|
|
||||||
DriverOsHandoff->Type = EfiUgaDriverFromPciRom;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Compute the size of the device path
|
|
||||||
//
|
|
||||||
Size = EfiDevicePathSize (PciIoDevice->DevicePath);
|
|
||||||
if (Size == 0) {
|
|
||||||
DriverOsHandoff->DevicePath = NULL;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Allocate space for duplicate device path
|
|
||||||
//
|
|
||||||
Status = gBS->AllocatePool (
|
|
||||||
EfiRuntimeServicesData,
|
|
||||||
Size,
|
|
||||||
(VOID **) &DriverOsHandoff->DevicePath
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
gBS->FreePool (NewDriverOsHandoffHeader);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Make copy of device path
|
|
||||||
//
|
|
||||||
CopyMem (DriverOsHandoff->DevicePath, PciIoDevice->DevicePath, Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
DriverOsHandoff->PciRomSize = (UINT64) PciIoDevice->PciIo.RomSize;
|
|
||||||
Status = gBS->AllocatePool (
|
|
||||||
EfiRuntimeServicesData,
|
|
||||||
(UINTN) DriverOsHandoff->PciRomSize,
|
|
||||||
(VOID **) &DriverOsHandoff->PciRomImage
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
gBS->FreePool (NewDriverOsHandoffHeader);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
gBS->CopyMem (
|
|
||||||
DriverOsHandoff->PciRomImage,
|
|
||||||
PciIoDevice->PciIo.RomImage,
|
|
||||||
(UINTN) DriverOsHandoff->PciRomSize
|
|
||||||
);
|
|
||||||
|
|
||||||
Status = gBS->InstallConfigurationTable (&gEfiUgaIoProtocolGuid, NewDriverOsHandoffHeader);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DriverOsHandoffHeader != NULL) {
|
|
||||||
gBS->FreePool (DriverOsHandoffHeader);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue