/** @file\r
Rewrite the BootOrder NvVar based on QEMU's "bootorder" fw_cfg file.\r
\r
- Copyright (C) 2012, Red Hat, Inc.\r
+ Copyright (C) 2012 - 2013, Red Hat, Inc.\r
\r
This program and the accompanying materials are licensed and made available\r
under the terms and conditions of the BSD License which accompanies this\r
#include <Library/UefiRuntimeServicesTableLib.h>\r
#include <Library/BaseLib.h>\r
#include <Library/PrintLib.h>\r
-#include <Protocol/DevicePathToText.h>\r
+#include <Library/DevicePathLib.h>\r
#include <Guid/GlobalVariable.h>\r
\r
\r
TargetLun[0],\r
TargetLun[1]\r
);\r
+ } else if (NumNodes >= 3 &&\r
+ SubstringEq (OfwNode[1].DriverName, "ethernet") &&\r
+ SubstringEq (OfwNode[2].DriverName, "ethernet-phy")\r
+ ) {\r
+ //\r
+ // OpenFirmware device path (Ethernet NIC):\r
+ //\r
+ // /pci@i0cf8/ethernet@3[,2]/ethernet-phy@0\r
+ // ^ ^ ^\r
+ // | | fixed\r
+ // | PCI slot[, function] holding Ethernet card\r
+ // PCI root at system bus port, PIO\r
+ //\r
+ // UEFI device path prefix (dependent on presence of nonzero PCI function):\r
+ //\r
+ // PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400E15EEF,0x1)\r
+ // PciRoot(0x0)/Pci(0x3,0x2)/MAC(525400E15EEF,0x1)\r
+ // ^ ^\r
+ // MAC address IfType (1 == Ethernet)\r
+ //\r
+ // (Some UEFI NIC drivers don't set 0x1 for IfType.)\r
+ //\r
+ Written = UnicodeSPrintAsciiFormat (\r
+ Translated,\r
+ *TranslatedSize * sizeof (*Translated), // BufferSize in bytes\r
+ "PciRoot(0x0)/Pci(0x%x,0x%x)/MAC",\r
+ PciDevFun[0],\r
+ PciDevFun[1]\r
+ );\r
} else {\r
return RETURN_UNSUPPORTED;\r
}\r
Match (\r
IN CONST CHAR16 *Translated,\r
IN UINTN TranslatedLength,\r
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
- IN CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText\r
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
)\r
{\r
CHAR16 *Converted;\r
BOOLEAN Result;\r
\r
- Converted = DevPathToText->ConvertDevicePathToText (\r
- DevicePath,\r
- FALSE, // DisplayOnly\r
- FALSE // AllowShortcuts\r
- );\r
+ Converted = ConvertDevicePathToText (\r
+ DevicePath,\r
+ FALSE, // DisplayOnly\r
+ FALSE // AllowShortcuts\r
+ );\r
if (Converted == NULL) {\r
return FALSE;\r
}\r
)\r
{\r
RETURN_STATUS Status;\r
-\r
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;\r
-\r
FIRMWARE_CONFIG_ITEM FwCfgItem;\r
UINTN FwCfgSize;\r
CHAR8 *FwCfg;\r
UINTN TranslatedSize;\r
CHAR16 Translated[TRANSLATION_OUTPUT_SIZE];\r
\r
- Status = gBS->LocateProtocol (\r
- &gEfiDevicePathToTextProtocolGuid,\r
- NULL, // optional registration key\r
- (VOID **) &DevPathToText\r
- );\r
- if (Status != EFI_SUCCESS) {\r
- return Status;\r
- }\r
-\r
Status = QemuFwCfgFindFile ("bootorder", &FwCfgItem, &FwCfgSize);\r
if (Status != RETURN_SUCCESS) {\r
return Status;\r
Match (\r
Translated,\r
TranslatedSize, // contains length, not size, in CHAR16's here\r
- BootOption->DevicePath,\r
- DevPathToText\r
+ BootOption->DevicePath\r
)\r
) {\r
//\r