diff options
author | adrian <adrian@FreeBSD.org> | 2012-04-15 02:38:01 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2012-04-15 02:38:01 +0000 |
commit | 179e79fd203fd1e5098387dc459f5d26f36b9f7a (patch) | |
tree | e4df8ddda0611c8cd61047979e579a3cdb660628 | |
parent | 3f3580908c1867806d913b76a03768e3d46b6a40 (diff) | |
download | FreeBSD-src-179e79fd203fd1e5098387dc459f5d26f36b9f7a.zip FreeBSD-src-179e79fd203fd1e5098387dc459f5d26f36b9f7a.tar.gz |
Fix the mask logic when reading PCI configuration space registers.
-rw-r--r-- | sys/mips/atheros/ar71xx_pci.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/mips/atheros/ar71xx_pci.c b/sys/mips/atheros/ar71xx_pci.c index 6cebbcb..e04b02f 100644 --- a/sys/mips/atheros/ar71xx_pci.c +++ b/sys/mips/atheros/ar71xx_pci.c @@ -204,8 +204,12 @@ ar71xx_pci_read_config(device_t dev, u_int bus, u_int slot, u_int func, /* register access is 32-bit aligned */ shift = (reg & 3) * 8; - if (shift) - mask = (1 << shift) - 1; + + /* Create a mask based on the width, post-shift */ + if (bytes == 2) + mask = 0xffff; + else if (bytes == 1) + mask = 0xff; else mask = 0xffffffff; |