OvmfPkg: QemuBootOrder: lower the required number of OFW nodes to 2

2 nodes in an OpenFirmware device path are sufficient for the generic
check at the beginning of TranslateOfwNodes(). The driver specific
branches check for the necessary nodes individually.

The number of nodes saved for examination is unchanged.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13800 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jljusten 2012-10-08 07:33:25 +00:00
parent cdde6ddf53
commit ec01afdbbf
1 changed files with 11 additions and 8 deletions

View File

@ -31,9 +31,10 @@
/** /**
Number of nodes in OpenFirmware device paths that is required and examined. Numbers of nodes in OpenFirmware device paths that are required and examined.
**/ **/
#define FIXED_OFW_NODES 4 #define REQUIRED_OFW_NODES 2
#define EXAMINED_OFW_NODES 4
/** /**
@ -497,7 +498,7 @@ TranslateOfwNodes (
// //
// Get PCI device and optional PCI function. Assume a single PCI root. // Get PCI device and optional PCI function. Assume a single PCI root.
// //
if (NumNodes < FIXED_OFW_NODES || if (NumNodes < REQUIRED_OFW_NODES ||
!SubstringEq (OfwNode[0].DriverName, "pci") !SubstringEq (OfwNode[0].DriverName, "pci")
) { ) {
return RETURN_UNSUPPORTED; return RETURN_UNSUPPORTED;
@ -513,7 +514,8 @@ TranslateOfwNodes (
return RETURN_UNSUPPORTED; return RETURN_UNSUPPORTED;
} }
if (SubstringEq (OfwNode[1].DriverName, "ide") && if (NumNodes >= 4 &&
SubstringEq (OfwNode[1].DriverName, "ide") &&
SubstringEq (OfwNode[2].DriverName, "drive") && SubstringEq (OfwNode[2].DriverName, "drive") &&
SubstringEq (OfwNode[3].DriverName, "disk") SubstringEq (OfwNode[3].DriverName, "disk")
) { ) {
@ -562,7 +564,8 @@ TranslateOfwNodes (
Secondary ? "Secondary" : "Primary", Secondary ? "Secondary" : "Primary",
Slave ? "Slave" : "Master" Slave ? "Slave" : "Master"
); );
} else if (SubstringEq (OfwNode[1].DriverName, "isa") && } else if (NumNodes >= 4 &&
SubstringEq (OfwNode[1].DriverName, "isa") &&
SubstringEq (OfwNode[2].DriverName, "fdc") && SubstringEq (OfwNode[2].DriverName, "fdc") &&
SubstringEq (OfwNode[3].DriverName, "floppy") SubstringEq (OfwNode[3].DriverName, "floppy")
) { ) {
@ -676,7 +679,7 @@ TranslateOfwPath (
{ {
UINTN NumNodes; UINTN NumNodes;
RETURN_STATUS Status; RETURN_STATUS Status;
OFW_NODE Node[FIXED_OFW_NODES]; OFW_NODE Node[EXAMINED_OFW_NODES];
BOOLEAN IsFinal; BOOLEAN IsFinal;
OFW_NODE Skip; OFW_NODE Skip;
@ -692,7 +695,7 @@ TranslateOfwPath (
++NumNodes; ++NumNodes;
Status = ParseOfwNode ( Status = ParseOfwNode (
Ptr, Ptr,
(NumNodes < FIXED_OFW_NODES) ? &Node[NumNodes] : &Skip, (NumNodes < EXAMINED_OFW_NODES) ? &Node[NumNodes] : &Skip,
&IsFinal &IsFinal
); );
} }
@ -712,7 +715,7 @@ TranslateOfwPath (
Status = TranslateOfwNodes ( Status = TranslateOfwNodes (
Node, Node,
NumNodes < FIXED_OFW_NODES ? NumNodes : FIXED_OFW_NODES, NumNodes < EXAMINED_OFW_NODES ? NumNodes : EXAMINED_OFW_NODES,
Translated, Translated,
TranslatedSize); TranslatedSize);
switch (Status) { switch (Status) {