diff options
-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; |