aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorPetr Borsodi <petr.borsodi@gmail.com>2019-01-15 13:06:19 +0000
committerMichael Brown <mcb30@ipxe.org>2019-01-15 13:08:44 +0000
commitba0d5aa993df4bad28b2a6a36c10b43c7e5c33f2 (patch)
tree8900aba5da38bfbcbd2aa1c31acb426cf580fa47 /src/util
parent133f4c47baef6002b2ccb4904a035cda2303c6e5 (diff)
downloadipxe-ba0d5aa993df4bad28b2a6a36c10b43c7e5c33f2.zip
ipxe-ba0d5aa993df4bad28b2a6a36c10b43c7e5c33f2.tar.gz
ipxe-ba0d5aa993df4bad28b2a6a36c10b43c7e5c33f2.tar.bz2
[pci] Correct invalid base-class/sub-class/prog-if order in PCIR
PCI Configuration Space contains fields prog-if at the offset 0x09, sub-class at the offset 0x0a and base-class at the offset 0x0b (it respects little endian). PCIR structure uses these fields in the same order. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/Option/ROM.pm4
-rw-r--r--src/util/efirom.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/util/Option/ROM.pm b/src/util/Option/ROM.pm
index 232cf16..48d92dd 100644
--- a/src/util/Option/ROM.pm
+++ b/src/util/Option/ROM.pm
@@ -508,9 +508,9 @@ sub new {
device_list => { offset => 0x08, length => 0x02, pack => "S" },
struct_length => { offset => 0x0a, length => 0x02, pack => "S" },
struct_revision =>{ offset => 0x0c, length => 0x01, pack => "C" },
- base_class => { offset => 0x0d, length => 0x01, pack => "C" },
+ prog_intf => { offset => 0x0d, length => 0x01, pack => "C" },
sub_class => { offset => 0x0e, length => 0x01, pack => "C" },
- prog_intf => { offset => 0x0f, length => 0x01, pack => "C" },
+ base_class => { offset => 0x0f, length => 0x01, pack => "C" },
image_length => { offset => 0x10, length => 0x02, pack => "S" },
revision => { offset => 0x12, length => 0x02, pack => "S" },
code_type => { offset => 0x14, length => 0x01, pack => "C" },
diff --git a/src/util/efirom.c b/src/util/efirom.c
index 943a669..93cd79f 100644
--- a/src/util/efirom.c
+++ b/src/util/efirom.c
@@ -149,7 +149,7 @@ static void make_efi_rom ( FILE *pe, FILE *rom, struct options *opts ) {
headers->pci.VendorId = opts->vendor;
headers->pci.DeviceId = opts->device;
headers->pci.Length = sizeof ( headers->pci );
- headers->pci.ClassCode[0] = PCI_CLASS_NETWORK;
+ headers->pci.ClassCode[2] = PCI_CLASS_NETWORK;
headers->pci.ImageLength = ( rom_size / 512 );
headers->pci.CodeType = 0x03; /* No constant in EFI headers? */
headers->pci.Indicator = 0x80; /* No constant in EFI headers? */