Changeset 8071af9f in mainline
- 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
- Location:
- pci
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
pci/libpci/access.c
r57ff9ab r8071af9f 4 4 * Copyright (c) 1997--2003 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. -
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 } -
pci/libpci/header.h
r57ff9ab r8071af9f 4 4 * Copyright (c) 1997--2005 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. -
pci/libpci/i386-ports.c
r57ff9ab r8071af9f 4 4 * Copyright (c) 1997--2004 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. -
pci/libpci/internal.h
r57ff9ab r8071af9f 4 4 * Copyright (c) 1997--2004 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. -
pci/libpci/names.c
r57ff9ab r8071af9f 4 4 * Copyright (c) 1997--2005 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. … … 176 176 if (!nest) { /* Top-level entries */ 177 177 if (p[0] == 'C' && p[1] == ' ') { /* Class block */ 178 if ((id1 = id_hex(p + 2, 2)) < 0 179 || !id_white_p(p[4])) 178 if ((id1 = id_hex(p + 2, 2)) < 0 || !id_white_p(p[4])) 180 179 return parse_error; 181 180 cat = ID_CLASS; … … 193 192 } else { /* Vendor ID */ 194 193 195 if ((id1 = id_hex(p, 4)) < 0 196 || !id_white_p(p[4])) 194 if ((id1 = id_hex(p, 4)) < 0 || !id_white_p(p[4])) 197 195 return parse_error; 198 196 cat = ID_VENDOR; … … 207 205 case ID_DEVICE: 208 206 case ID_SUBSYSTEM: 209 if ((id2 = id_hex(p, 4)) < 0 210 || !id_white_p(p[4])) 207 if ((id2 = id_hex(p, 4)) < 0 || !id_white_p(p[4])) 211 208 return parse_error; 212 209 p += 5; … … 215 212 break; 216 213 case ID_GEN_SUBSYSTEM: 217 if ((id2 = id_hex(p, 4)) < 0 218 || !id_white_p(p[4])) 214 if ((id2 = id_hex(p, 4)) < 0 || !id_white_p(p[4])) 219 215 return parse_error; 220 216 p += 5; … … 224 220 case ID_SUBCLASS: 225 221 case ID_PROGIF: 226 if ((id2 = id_hex(p, 2)) < 0 227 || !id_white_p(p[2])) 222 if ((id2 = id_hex(p, 2)) < 0 || !id_white_p(p[2])) 228 223 return parse_error; 229 224 p += 3; … … 237 232 case ID_DEVICE: 238 233 case ID_SUBSYSTEM: 239 if ((id3 = id_hex(p, 4)) < 0 240 || !id_white_p(p[4]) 241 || (id4 = id_hex(p + 5, 4)) < 0 242 || !id_white_p(p[9])) 234 if ((id3 = id_hex(p, 4)) < 0 || !id_white_p(p[4]) 235 || (id4 = id_hex(p + 5, 4)) < 0 || !id_white_p(p[9])) 243 236 return parse_error; 244 237 p += 10; … … 248 241 case ID_SUBCLASS: 249 242 case ID_PROGIF: 250 if ((id3 = id_hex(p, 2)) < 0 251 || !id_white_p(p[2])) 243 if ((id3 = id_hex(p, 2)) < 0 || !id_white_p(p[2])) 252 244 return parse_error; 253 245 p += 3; … … 342 334 return (char *) v->name; 343 335 else 344 res = 345 snprintf(buf, size, "Unknown vendor %04x", iv); 336 res = snprintf(buf, size, "Unknown vendor %04x", iv); 346 337 break; 347 338 case PCI_LOOKUP_DEVICE: … … 353 344 return (char *) d->name; 354 345 else if (synth) 355 res = 356 snprintf(buf, size, "Unknown device %04x", id); 346 res = snprintf(buf, size, "Unknown device %04x", id); 357 347 else 358 348 return NULL; … … 367 357 d = id_lookup(a, ID_DEVICE, iv, id, 0, 0); 368 358 if (v && d) 369 res = 370 snprintf(buf, size, "%s %s", v->name, 359 res = snprintf(buf, size, "%s %s", v->name, 371 360 d->name); 372 361 else if (!synth) 373 362 return NULL; 374 363 else if (!v) 375 res = 376 snprintf(buf, size, 377 "Unknown device %04x:%04x", 378 iv, id); 364 res = snprintf(buf, size, "Unknown device %04x:%04x", iv, id); 379 365 else /* !d */ 380 res = 381 snprintf(buf, size, 382 "%s Unknown device %04x", 383 v->name, id); 366 res = snprintf(buf, size, "%s Unknown device %04x", v->name, id); 384 367 } 385 368 break; … … 391 374 return (char *) v->name; 392 375 else if (synth) 393 res = 394 snprintf(buf, size, "Unknown vendor %04x", 395 isv); 376 res = snprintf(buf, size, "Unknown vendor %04x", isv); 396 377 else 397 378 return NULL; … … 407 388 return (char *) d->name; 408 389 else if (synth) 409 res = 410 snprintf(buf, size, "Unknown device %04x", 411 isd); 390 res = snprintf(buf, size, "Unknown device %04x", isd); 412 391 else 413 392 return NULL; … … 424 403 d = id_lookup_subsys(a, iv, id, isv, isd); 425 404 if (v && d) 426 res = 427 snprintf(buf, size, "%s %s", v->name, 428 d->name); 405 res = snprintf(buf, size, "%s %s", v->name, d->name); 429 406 else if (!synth) 430 407 return NULL; 431 408 else if (!v) 432 res = 433 snprintf(buf, size, 434 "Unknown device %04x:%04x", 435 isv, isd); 409 res = snprintf(buf, size, "Unknown device %04x:%04x", isv, isd); 436 410 else /* !d */ 437 res = 438 snprintf(buf, size, 439 "%s Unknown device %04x", 440 v->name, isd); 411 res = snprintf(buf, size, "%s Unknown device %04x", v->name, isd); 441 412 } 442 413 break; … … 445 416 if (num) 446 417 res = snprintf(buf, size, "%04x", icls); 447 else if (cls = 448 id_lookup(a, ID_SUBCLASS, icls >> 8, icls & 0xff, 449 0, 0)) 418 else if (cls = id_lookup(a, ID_SUBCLASS, icls >> 8, icls & 0xff, 0, 0)) 450 419 return (char *) cls->name; 451 420 else if (cls = id_lookup(a, ID_CLASS, icls, 0, 0, 0)) 452 res = 453 snprintf(buf, size, "%s [%04x]", cls->name, 454 icls); 421 res = snprintf(buf, size, "%s [%04x]", cls->name, icls); 455 422 else if (synth) 456 423 res = snprintf(buf, size, "Class %04x", icls); … … 463 430 if (num) 464 431 res = snprintf(buf, size, "%02x", ipif); 465 else if (pif = 466 id_lookup(a, ID_PROGIF, icls >> 8, icls & 0xff, 467 ipif, 0)) 432 else if (pif = id_lookup(a, ID_PROGIF, icls >> 8, icls & 0xff, ipif, 0)) 468 433 return (char *) pif->name; 469 434 else if (icls == 0x0101 && !(ipif & 0x70)) { -
pci/libpci/pci.h
r57ff9ab r8071af9f 4 4 * Copyright (c) 1997--2005 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. -
pci/libpci/sysdep.h
r57ff9ab r8071af9f 4 4 * Copyright (c) 1997--2004 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. -
pci/libpci/types.h
r57ff9ab r8071af9f 4 4 * Copyright (c) 1997--2005 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. -
pci/pci.c
r57ff9ab r8071af9f 38 38 pci_scan_bus(pacc); /* We want to get the list of devices */ 39 39 for(dev=pacc->devices; dev; dev=dev->next) { /* Iterate over all devices */ 40 pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES ); /* Fill in header info we need */40 pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_IRQ); 41 41 c = pci_read_word(dev, PCI_CLASS_DEVICE); /* Read config register directly */ 42 42 printf("%02x:%02x.%d vendor=%04x device=%04x class=%04x irq=%d base0=%lx\n",
Note:
See TracChangeset
for help on using the changeset viewer.