From 8ec7a852b0cbbd7348b05373ea0fd79d3c288c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Mon, 19 Feb 1996 00:30:40 +0000 Subject: [PATCH] Remove limit of port I/O addresses to 65K, since PCI specifies 32 bit port addresses (even though the PC architecture doesn't support them). Add code to limit the I/O map size based on the lowest set bit of the address. This cures the problem with the BT946C only having a 16 bit map register, in voiolation of the PCI specs, without giving up the general support of >65K port regions. --- sys/dev/pci/pci.c | 8 +++++--- sys/pci/pci.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 1bf861c34c3..7b1bfb219f4 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.44 1996/01/30 01:14:29 se Exp $ +** $Id: pci.c,v 1.45 1996/02/17 23:57:03 se Exp $ ** ** General subroutines for the PCI bus. ** pci_configure () @@ -576,8 +576,9 @@ pci_bus_config (void) continue; case 1: case 5: - size = -(data & PCI_MAP_IO_ADDRESS_MASK); addr = map & PCI_MAP_IO_ADDRESS_MASK; + size = -(data & PCI_MAP_IO_ADDRESS_MASK); + size &= ~(addr ^ -addr); pci_register_io (pcicb, addr, addr+size-1); pcicb->pcicb_pamount += size; @@ -975,7 +976,7 @@ int pci_map_port (pcici_t tag, u_long reg, u_short* pa) */ ioaddr = pcibus->pb_read (tag, reg) & PCI_MAP_IO_ADDRESS_MASK; - if (!ioaddr || ioaddr > 0xfffful) { + if (!ioaddr) { printf ("pci_map_port failed: not configured by bios.\n"); return (0); }; @@ -990,6 +991,7 @@ int pci_map_port (pcici_t tag, u_long reg, u_short* pa) return (0); }; iosize = -(data & PCI_MAP_IO_ADDRESS_MASK); + iosize &= ~(ioaddr ^ -ioaddr); if (ioaddr < pcicb->pcicb_iobase || ioaddr + iosize -1 > pcicb->pcicb_iolimit) { printf ("pci_map_port failed: device's iorange 0x%x-0x%x " diff --git a/sys/pci/pci.c b/sys/pci/pci.c index 1bf861c34c3..7b1bfb219f4 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.44 1996/01/30 01:14:29 se Exp $ +** $Id: pci.c,v 1.45 1996/02/17 23:57:03 se Exp $ ** ** General subroutines for the PCI bus. ** pci_configure () @@ -576,8 +576,9 @@ pci_bus_config (void) continue; case 1: case 5: - size = -(data & PCI_MAP_IO_ADDRESS_MASK); addr = map & PCI_MAP_IO_ADDRESS_MASK; + size = -(data & PCI_MAP_IO_ADDRESS_MASK); + size &= ~(addr ^ -addr); pci_register_io (pcicb, addr, addr+size-1); pcicb->pcicb_pamount += size; @@ -975,7 +976,7 @@ int pci_map_port (pcici_t tag, u_long reg, u_short* pa) */ ioaddr = pcibus->pb_read (tag, reg) & PCI_MAP_IO_ADDRESS_MASK; - if (!ioaddr || ioaddr > 0xfffful) { + if (!ioaddr) { printf ("pci_map_port failed: not configured by bios.\n"); return (0); }; @@ -990,6 +991,7 @@ int pci_map_port (pcici_t tag, u_long reg, u_short* pa) return (0); }; iosize = -(data & PCI_MAP_IO_ADDRESS_MASK); + iosize &= ~(ioaddr ^ -ioaddr); if (ioaddr < pcicb->pcicb_iobase || ioaddr + iosize -1 > pcicb->pcicb_iolimit) { printf ("pci_map_port failed: device's iorange 0x%x-0x%x "