diff options
author | se <se@FreeBSD.org> | 1996-11-12 23:10:24 +0000 |
---|---|---|
committer | se <se@FreeBSD.org> | 1996-11-12 23:10:24 +0000 |
commit | bb3b58af857086afe079fca68139fd585381bfff (patch) | |
tree | b3fffe0d2e086f52bf8b84c982f3b239619f1681 | |
parent | 74bda8433b8407a6199e7840fb48fde136cd1c8f (diff) | |
download | FreeBSD-src-bb3b58af857086afe079fca68139fd585381bfff.zip FreeBSD-src-bb3b58af857086afe079fca68139fd585381bfff.tar.gz |
Fix PCI to PCI bridge register bit field masks.
Thanks to "Mike Durian" <durian@plutotech.com> for the very good
problem report and his support as a beta tester of this patch.
-rw-r--r-- | sys/dev/pci/pci.c | 37 | ||||
-rw-r--r-- | sys/dev/pci/pcireg.h | 10 | ||||
-rw-r--r-- | sys/pci/pci.c | 37 | ||||
-rw-r--r-- | sys/pci/pcireg.h | 10 |
4 files changed, 22 insertions, 72 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index d1d696d..2913c5b 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.56 1996/10/14 13:04:34 se Exp $ +** $Id: pci.c,v 1.57 1996/10/22 20:20:11 se Exp $ ** ** General subroutines for the PCI bus. ** pci_configure () @@ -729,23 +729,14 @@ pci_bus_config (void) ** Bridge was configured by the bios. ** Read out the mapped io region. */ - u_int reg, data, mask; + unsigned reg; reg = pci_conf_read (tag, PCI_PCI_BRIDGE_IO_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_IO_REG, 0xFFFF); - data = pci_conf_read (tag, - PCI_PCI_BRIDGE_IO_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_IO_REG, reg & 0xffff); - - mask = (0xFF00 ^ (data & 0xFF00)) | 0xFF; - this->pcicb_iobase = PCI_PPB_IOBASE_EXTRACT (reg); this->pcicb_iolimit = - PCI_PPB_IOLIMIT_EXTRACT(reg) | mask; + PCI_PPB_IOLIMIT_EXTRACT(reg); /* ** Note the used io space. @@ -760,25 +751,17 @@ pci_bus_config (void) ** Bridge was configured by the bios. ** Read out the mapped memory regions. */ - u_int reg, data, mask; + unsigned reg; /* ** non prefetchable memory */ reg = pci_conf_read (tag, PCI_PCI_BRIDGE_MEM_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_MEM_REG, 0xFFFFFFFF); - data = pci_conf_read (tag, - PCI_PCI_BRIDGE_MEM_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_MEM_REG, reg); - - mask = 0xFFFFFFFF ^ (data & 0xFFFF0000); this->pcicb_membase = PCI_PPB_MEMBASE_EXTRACT (reg); this->pcicb_memlimit = - PCI_PPB_MEMLIMIT_EXTRACT(reg) | mask; + PCI_PPB_MEMLIMIT_EXTRACT(reg); /* ** Register used memory space. @@ -792,18 +775,10 @@ pci_bus_config (void) */ reg = pci_conf_read (tag, PCI_PCI_BRIDGE_PMEM_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_PMEM_REG, 0xFFFFFFFF); - data = pci_conf_read (tag, - PCI_PCI_BRIDGE_PMEM_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_PMEM_REG, reg); - - mask = 0xFFFFFFFF ^ (data & 0xFFFF0000); this->pcicb_p_membase= PCI_PPB_MEMBASE_EXTRACT (reg); this->pcicb_p_memlimit= - PCI_PPB_MEMLIMIT_EXTRACT(reg) | mask; + PCI_PPB_MEMLIMIT_EXTRACT(reg); /* ** Register used memory space. diff --git a/sys/dev/pci/pcireg.h b/sys/dev/pci/pcireg.h index 54b446b..437a0f3 100644 --- a/sys/dev/pci/pcireg.h +++ b/sys/dev/pci/pcireg.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcireg.h,v 1.7 1996/01/25 18:31:59 se Exp $ +** $Id: pcireg.h,v 1.8 1996/10/22 20:20:14 se Exp $ ** ** Names for PCI configuration space registers. ** @@ -174,11 +174,11 @@ #define PCI_SECONDARY_BUS_INSERT(x, y) (((x) & ~PCI_SECONDARY_BUS_MASK) | ((y) << 8)) #define PCI_SUBORDINATE_BUS_INSERT(x, y) (((x) & ~PCI_SUBORDINATE_BUS_MASK) | ((y) << 16)) -#define PCI_PPB_IOBASE_EXTRACT(x) (((x) << 8) & 0xFF00) -#define PCI_PPB_IOLIMIT_EXTRACT(x) (((x) << 0) & 0xFF00) +#define PCI_PPB_IOBASE_EXTRACT(x) (((x) << 8) & 0xF000) +#define PCI_PPB_IOLIMIT_EXTRACT(x) (((x) << 0) & 0xF000 | 0x0FFF) -#define PCI_PPB_MEMBASE_EXTRACT(x) (((x) << 16) & 0xFFFF0000) -#define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFFF0000) +#define PCI_PPB_MEMBASE_EXTRACT(x) (((x) << 16) & 0xFFF00000) +#define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFF00000 | 0x000FFFFF) /* ** Interrupt configuration register diff --git a/sys/pci/pci.c b/sys/pci/pci.c index d1d696d..2913c5b 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.56 1996/10/14 13:04:34 se Exp $ +** $Id: pci.c,v 1.57 1996/10/22 20:20:11 se Exp $ ** ** General subroutines for the PCI bus. ** pci_configure () @@ -729,23 +729,14 @@ pci_bus_config (void) ** Bridge was configured by the bios. ** Read out the mapped io region. */ - u_int reg, data, mask; + unsigned reg; reg = pci_conf_read (tag, PCI_PCI_BRIDGE_IO_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_IO_REG, 0xFFFF); - data = pci_conf_read (tag, - PCI_PCI_BRIDGE_IO_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_IO_REG, reg & 0xffff); - - mask = (0xFF00 ^ (data & 0xFF00)) | 0xFF; - this->pcicb_iobase = PCI_PPB_IOBASE_EXTRACT (reg); this->pcicb_iolimit = - PCI_PPB_IOLIMIT_EXTRACT(reg) | mask; + PCI_PPB_IOLIMIT_EXTRACT(reg); /* ** Note the used io space. @@ -760,25 +751,17 @@ pci_bus_config (void) ** Bridge was configured by the bios. ** Read out the mapped memory regions. */ - u_int reg, data, mask; + unsigned reg; /* ** non prefetchable memory */ reg = pci_conf_read (tag, PCI_PCI_BRIDGE_MEM_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_MEM_REG, 0xFFFFFFFF); - data = pci_conf_read (tag, - PCI_PCI_BRIDGE_MEM_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_MEM_REG, reg); - - mask = 0xFFFFFFFF ^ (data & 0xFFFF0000); this->pcicb_membase = PCI_PPB_MEMBASE_EXTRACT (reg); this->pcicb_memlimit = - PCI_PPB_MEMLIMIT_EXTRACT(reg) | mask; + PCI_PPB_MEMLIMIT_EXTRACT(reg); /* ** Register used memory space. @@ -792,18 +775,10 @@ pci_bus_config (void) */ reg = pci_conf_read (tag, PCI_PCI_BRIDGE_PMEM_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_PMEM_REG, 0xFFFFFFFF); - data = pci_conf_read (tag, - PCI_PCI_BRIDGE_PMEM_REG); - pci_conf_write(tag, - PCI_PCI_BRIDGE_PMEM_REG, reg); - - mask = 0xFFFFFFFF ^ (data & 0xFFFF0000); this->pcicb_p_membase= PCI_PPB_MEMBASE_EXTRACT (reg); this->pcicb_p_memlimit= - PCI_PPB_MEMLIMIT_EXTRACT(reg) | mask; + PCI_PPB_MEMLIMIT_EXTRACT(reg); /* ** Register used memory space. diff --git a/sys/pci/pcireg.h b/sys/pci/pcireg.h index 54b446b..437a0f3 100644 --- a/sys/pci/pcireg.h +++ b/sys/pci/pcireg.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcireg.h,v 1.7 1996/01/25 18:31:59 se Exp $ +** $Id: pcireg.h,v 1.8 1996/10/22 20:20:14 se Exp $ ** ** Names for PCI configuration space registers. ** @@ -174,11 +174,11 @@ #define PCI_SECONDARY_BUS_INSERT(x, y) (((x) & ~PCI_SECONDARY_BUS_MASK) | ((y) << 8)) #define PCI_SUBORDINATE_BUS_INSERT(x, y) (((x) & ~PCI_SUBORDINATE_BUS_MASK) | ((y) << 16)) -#define PCI_PPB_IOBASE_EXTRACT(x) (((x) << 8) & 0xFF00) -#define PCI_PPB_IOLIMIT_EXTRACT(x) (((x) << 0) & 0xFF00) +#define PCI_PPB_IOBASE_EXTRACT(x) (((x) << 8) & 0xF000) +#define PCI_PPB_IOLIMIT_EXTRACT(x) (((x) << 0) & 0xF000 | 0x0FFF) -#define PCI_PPB_MEMBASE_EXTRACT(x) (((x) << 16) & 0xFFFF0000) -#define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFFF0000) +#define PCI_PPB_MEMBASE_EXTRACT(x) (((x) << 16) & 0xFFF00000) +#define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFF00000 | 0x000FFFFF) /* ** Interrupt configuration register |