From b3daa02e72e719c029f97fbc1359a082d6918219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Mon, 26 May 1997 21:52:41 +0000 Subject: [PATCH] Yet another fix for configuration mechanism 1 register accesses: Adjust the data port address by adding the two low order bits of the register number. The address port takes only a word address (i.e. ignores the two low order bits written to it). --- sys/amd64/pci/pci_bus.c | 9 +++++---- sys/amd64/pci/pci_cfgreg.c | 9 +++++---- sys/i386/isa/pcibus.c | 9 +++++---- sys/i386/pci/pci_bus.c | 9 +++++---- sys/i386/pci/pci_cfgreg.c | 9 +++++---- sys/i386/pci/pci_pir.c | 9 +++++---- 6 files changed, 30 insertions(+), 24 deletions(-) diff --git a/sys/amd64/pci/pci_bus.c b/sys/amd64/pci/pci_bus.c index 7085c1edbc7..b801abd16c9 100644 --- a/sys/amd64/pci/pci_bus.c +++ b/sys/amd64/pci/pci_bus.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.37 1997/05/26 21:11:05 se Exp $ + * $Id: pcibus.c,v 1.38 1997/05/26 21:25:24 se Exp $ * */ @@ -59,9 +59,10 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes) && (reg & (bytes -1)) == 0) { switch (cfgmech) { case 1: - outl(CONF1_ADDR_PORT, (1 << 31) | - (bus << 16) | (slot << 11) | (func << 8) | reg); - dataport = CONF1_DATA_PORT; + outl(CONF1_ADDR_PORT, (1 << 31) + | (bus << 16) | (slot << 11) + | (func << 8) | (reg & ~0x03)); + dataport = CONF1_DATA_PORT + (reg & 0x03); break; case 2: outb(CONF2_ENABLE_PORT, 0xf0 | (func << 1)); diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c index 7085c1edbc7..b801abd16c9 100644 --- a/sys/amd64/pci/pci_cfgreg.c +++ b/sys/amd64/pci/pci_cfgreg.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.37 1997/05/26 21:11:05 se Exp $ + * $Id: pcibus.c,v 1.38 1997/05/26 21:25:24 se Exp $ * */ @@ -59,9 +59,10 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes) && (reg & (bytes -1)) == 0) { switch (cfgmech) { case 1: - outl(CONF1_ADDR_PORT, (1 << 31) | - (bus << 16) | (slot << 11) | (func << 8) | reg); - dataport = CONF1_DATA_PORT; + outl(CONF1_ADDR_PORT, (1 << 31) + | (bus << 16) | (slot << 11) + | (func << 8) | (reg & ~0x03)); + dataport = CONF1_DATA_PORT + (reg & 0x03); break; case 2: outb(CONF2_ENABLE_PORT, 0xf0 | (func << 1)); diff --git a/sys/i386/isa/pcibus.c b/sys/i386/isa/pcibus.c index 7085c1edbc7..b801abd16c9 100644 --- a/sys/i386/isa/pcibus.c +++ b/sys/i386/isa/pcibus.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.37 1997/05/26 21:11:05 se Exp $ + * $Id: pcibus.c,v 1.38 1997/05/26 21:25:24 se Exp $ * */ @@ -59,9 +59,10 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes) && (reg & (bytes -1)) == 0) { switch (cfgmech) { case 1: - outl(CONF1_ADDR_PORT, (1 << 31) | - (bus << 16) | (slot << 11) | (func << 8) | reg); - dataport = CONF1_DATA_PORT; + outl(CONF1_ADDR_PORT, (1 << 31) + | (bus << 16) | (slot << 11) + | (func << 8) | (reg & ~0x03)); + dataport = CONF1_DATA_PORT + (reg & 0x03); break; case 2: outb(CONF2_ENABLE_PORT, 0xf0 | (func << 1)); diff --git a/sys/i386/pci/pci_bus.c b/sys/i386/pci/pci_bus.c index 7085c1edbc7..b801abd16c9 100644 --- a/sys/i386/pci/pci_bus.c +++ b/sys/i386/pci/pci_bus.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.37 1997/05/26 21:11:05 se Exp $ + * $Id: pcibus.c,v 1.38 1997/05/26 21:25:24 se Exp $ * */ @@ -59,9 +59,10 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes) && (reg & (bytes -1)) == 0) { switch (cfgmech) { case 1: - outl(CONF1_ADDR_PORT, (1 << 31) | - (bus << 16) | (slot << 11) | (func << 8) | reg); - dataport = CONF1_DATA_PORT; + outl(CONF1_ADDR_PORT, (1 << 31) + | (bus << 16) | (slot << 11) + | (func << 8) | (reg & ~0x03)); + dataport = CONF1_DATA_PORT + (reg & 0x03); break; case 2: outb(CONF2_ENABLE_PORT, 0xf0 | (func << 1)); diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index 7085c1edbc7..b801abd16c9 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.37 1997/05/26 21:11:05 se Exp $ + * $Id: pcibus.c,v 1.38 1997/05/26 21:25:24 se Exp $ * */ @@ -59,9 +59,10 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes) && (reg & (bytes -1)) == 0) { switch (cfgmech) { case 1: - outl(CONF1_ADDR_PORT, (1 << 31) | - (bus << 16) | (slot << 11) | (func << 8) | reg); - dataport = CONF1_DATA_PORT; + outl(CONF1_ADDR_PORT, (1 << 31) + | (bus << 16) | (slot << 11) + | (func << 8) | (reg & ~0x03)); + dataport = CONF1_DATA_PORT + (reg & 0x03); break; case 2: outb(CONF2_ENABLE_PORT, 0xf0 | (func << 1)); diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c index 7085c1edbc7..b801abd16c9 100644 --- a/sys/i386/pci/pci_pir.c +++ b/sys/i386/pci/pci_pir.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.37 1997/05/26 21:11:05 se Exp $ + * $Id: pcibus.c,v 1.38 1997/05/26 21:25:24 se Exp $ * */ @@ -59,9 +59,10 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes) && (reg & (bytes -1)) == 0) { switch (cfgmech) { case 1: - outl(CONF1_ADDR_PORT, (1 << 31) | - (bus << 16) | (slot << 11) | (func << 8) | reg); - dataport = CONF1_DATA_PORT; + outl(CONF1_ADDR_PORT, (1 << 31) + | (bus << 16) | (slot << 11) + | (func << 8) | (reg & ~0x03)); + dataport = CONF1_DATA_PORT + (reg & 0x03); break; case 2: outb(CONF2_ENABLE_PORT, 0xf0 | (func << 1));