diff options
author | msmith <msmith@FreeBSD.org> | 2000-05-04 17:44:55 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2000-05-04 17:44:55 +0000 |
commit | e306b417ff4bae50658cdbeeef9128c894836842 (patch) | |
tree | b490cb914c3b81ef51c7a2aae015e3e144b51b29 /sys | |
parent | 2243e4696cccf14137c11a653dd04b64e25cfef4 (diff) | |
download | FreeBSD-src-e306b417ff4bae50658cdbeeef9128c894836842.zip FreeBSD-src-e306b417ff4bae50658cdbeeef9128c894836842.tar.gz |
Don't assume that the PCI BIOS is going to clear the unused bits in %ecx
when it returns.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/pci/pci_bus.c | 6 | ||||
-rw-r--r-- | sys/amd64/pci/pci_cfgreg.c | 6 | ||||
-rw-r--r-- | sys/i386/isa/pcibus.c | 6 | ||||
-rw-r--r-- | sys/i386/pci/pci_bus.c | 6 | ||||
-rw-r--r-- | sys/i386/pci/pci_cfgreg.c | 6 | ||||
-rw-r--r-- | sys/i386/pci/pci_pir.c | 6 |
6 files changed, 30 insertions, 6 deletions
diff --git a/sys/amd64/pci/pci_bus.c b/sys/amd64/pci/pci_bus.c index a1b399b..0f49b63 100644 --- a/sys/amd64/pci/pci_bus.c +++ b/sys/amd64/pci/pci_bus.c @@ -90,16 +90,20 @@ static int pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) { struct bios_regs args; + u_int mask; switch(bytes) { case 1: args.eax = PCIBIOS_READ_CONFIG_BYTE; + mask = 0xff; break; case 2: args.eax = PCIBIOS_READ_CONFIG_WORD; + mask = 0xffff; break; case 4: args.eax = PCIBIOS_READ_CONFIG_DWORD; + mask = 0xffffffff; break; default: return(-1); @@ -108,7 +112,7 @@ pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) args.edi = reg; bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)); /* check call results? */ - return(args.ecx); + return(args.ecx & mask); } static void diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c index a1b399b..0f49b63 100644 --- a/sys/amd64/pci/pci_cfgreg.c +++ b/sys/amd64/pci/pci_cfgreg.c @@ -90,16 +90,20 @@ static int pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) { struct bios_regs args; + u_int mask; switch(bytes) { case 1: args.eax = PCIBIOS_READ_CONFIG_BYTE; + mask = 0xff; break; case 2: args.eax = PCIBIOS_READ_CONFIG_WORD; + mask = 0xffff; break; case 4: args.eax = PCIBIOS_READ_CONFIG_DWORD; + mask = 0xffffffff; break; default: return(-1); @@ -108,7 +112,7 @@ pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) args.edi = reg; bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)); /* check call results? */ - return(args.ecx); + return(args.ecx & mask); } static void diff --git a/sys/i386/isa/pcibus.c b/sys/i386/isa/pcibus.c index a1b399b..0f49b63 100644 --- a/sys/i386/isa/pcibus.c +++ b/sys/i386/isa/pcibus.c @@ -90,16 +90,20 @@ static int pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) { struct bios_regs args; + u_int mask; switch(bytes) { case 1: args.eax = PCIBIOS_READ_CONFIG_BYTE; + mask = 0xff; break; case 2: args.eax = PCIBIOS_READ_CONFIG_WORD; + mask = 0xffff; break; case 4: args.eax = PCIBIOS_READ_CONFIG_DWORD; + mask = 0xffffffff; break; default: return(-1); @@ -108,7 +112,7 @@ pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) args.edi = reg; bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)); /* check call results? */ - return(args.ecx); + return(args.ecx & mask); } static void diff --git a/sys/i386/pci/pci_bus.c b/sys/i386/pci/pci_bus.c index a1b399b..0f49b63 100644 --- a/sys/i386/pci/pci_bus.c +++ b/sys/i386/pci/pci_bus.c @@ -90,16 +90,20 @@ static int pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) { struct bios_regs args; + u_int mask; switch(bytes) { case 1: args.eax = PCIBIOS_READ_CONFIG_BYTE; + mask = 0xff; break; case 2: args.eax = PCIBIOS_READ_CONFIG_WORD; + mask = 0xffff; break; case 4: args.eax = PCIBIOS_READ_CONFIG_DWORD; + mask = 0xffffffff; break; default: return(-1); @@ -108,7 +112,7 @@ pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) args.edi = reg; bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)); /* check call results? */ - return(args.ecx); + return(args.ecx & mask); } static void diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index a1b399b..0f49b63 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -90,16 +90,20 @@ static int pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) { struct bios_regs args; + u_int mask; switch(bytes) { case 1: args.eax = PCIBIOS_READ_CONFIG_BYTE; + mask = 0xff; break; case 2: args.eax = PCIBIOS_READ_CONFIG_WORD; + mask = 0xffff; break; case 4: args.eax = PCIBIOS_READ_CONFIG_DWORD; + mask = 0xffffffff; break; default: return(-1); @@ -108,7 +112,7 @@ pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) args.edi = reg; bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)); /* check call results? */ - return(args.ecx); + return(args.ecx & mask); } static void diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c index a1b399b..0f49b63 100644 --- a/sys/i386/pci/pci_pir.c +++ b/sys/i386/pci/pci_pir.c @@ -90,16 +90,20 @@ static int pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) { struct bios_regs args; + u_int mask; switch(bytes) { case 1: args.eax = PCIBIOS_READ_CONFIG_BYTE; + mask = 0xff; break; case 2: args.eax = PCIBIOS_READ_CONFIG_WORD; + mask = 0xffff; break; case 4: args.eax = PCIBIOS_READ_CONFIG_DWORD; + mask = 0xffffffff; break; default: return(-1); @@ -108,7 +112,7 @@ pcibios_cfgread(pcicfgregs *cfg, int reg, int bytes) args.edi = reg; bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)); /* check call results? */ - return(args.ecx); + return(args.ecx & mask); } static void |