mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-09 18:10:32 +00:00
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.
This commit is contained in:
parent
77dfeccef6
commit
c88529d0e9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19695
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue