Changeset 8071af9f in mainline for pci/libpci/generic.c
- Timestamp:
- 2006-05-14T09:33:09Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8a568e3
- Parents:
- 57ff9ab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pci/libpci/generic.c
r57ff9ab r8071af9f 4 4 * Copyright (c) 1997--2000 Martin Mares <mj@ucw.cz> 5 5 * 6 * M odified and ported to HelenOS by Jakub Jermar.6 * May 8, 2006 - Modified and ported to HelenOS by Jakub Jermar. 7 7 * 8 8 * Can be freely distributed and used under the terms of the GNU GPL. … … 107 107 if (cnt) { 108 108 for (i = 0; i < cnt; i++) { 109 u32 x = 110 pci_read_long(d, 111 PCI_BASE_ADDRESS_0 + 112 i * 4); 109 u32 x = pci_read_long(d, PCI_BASE_ADDRESS_0 + i * 4); 113 110 if (!x || x == (u32) ~ 0) 114 111 continue; 115 if ((x & PCI_BASE_ADDRESS_SPACE) == 116 PCI_BASE_ADDRESS_SPACE_IO) 112 if ((x & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) 117 113 d->base_addr[i] = x; 118 114 else { 119 if ((x & 120 PCI_BASE_ADDRESS_MEM_TYPE_MASK) 121 != 122 PCI_BASE_ADDRESS_MEM_TYPE_64) 115 if ((x & PCI_BASE_ADDRESS_MEM_TYPE_MASK) != PCI_BASE_ADDRESS_MEM_TYPE_64) 123 116 d->base_addr[i] = x; 124 117 else if (i >= cnt - 1) 125 a->warning 126 ("%04x:%02x:%02x.%d: Invalid 64-bit address seen for BAR %d.", 118 a->warning("%04x:%02x:%02x.%d: Invalid 64-bit address seen for BAR %d.", 127 119 d->domain, d->bus, 128 120 d->dev, d->func, i); 129 121 else { 130 u32 y = 131 pci_read_long(d, 132 PCI_BASE_ADDRESS_0 133 + 134 (++i) * 135 4); 122 u32 y = pci_read_long(d, PCI_BASE_ADDRESS_0 + (++i) * 4); 136 123 #ifdef PCI_HAVE_64BIT_ADDRESS 137 d->base_addr[i - 1] = 138 x | (((pciaddr_t) y) << 139 32); 124 d->base_addr[i - 1] = x | (((pciaddr_t) y) << 32); 140 125 #else 141 126 if (y) 142 a->warning 143 ("%04x:%02x:%02x.%d 64-bit device address ignored.", 127 a->warning("%04x:%02x:%02x.%d 64-bit device address ignored.", 144 128 d->domain, 145 129 d->bus, … … 147 131 d->func); 148 132 else 149 d->base_addr[i - 150 1] = 151 x; 133 d->base_addr[i - 1] = x; 152 134 #endif 153 135 } … … 216 198 int pci_generic_block_read(struct pci_dev *d, int pos, byte * buf, int len) 217 199 { 218 return pci_generic_block_op(d, pos, buf, len, 219 d->access->methods->read); 200 return pci_generic_block_op(d, pos, buf, len, d->access->methods->read); 220 201 } 221 202 222 203 int pci_generic_block_write(struct pci_dev *d, int pos, byte * buf, int len) 223 204 { 224 return pci_generic_block_op(d, pos, buf, len, 225 d->access->methods->write); 226 } 205 return pci_generic_block_op(d, pos, buf, len, d->access->methods->write); 206 }
Note:
See TracChangeset
for help on using the changeset viewer.