Rev 4377 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4377 | Rev 4692 | ||
---|---|---|---|
Line 148... | Line 148... | ||
148 | byte *p; |
148 | byte *p; |
149 | int id1 = 0, id2 = 0, id3 = 0, id4 = 0; |
149 | int id1 = 0, id2 = 0, id3 = 0, id4 = 0; |
150 | int cat = -1; |
150 | int cat = -1; |
151 | int nest; |
151 | int nest; |
152 | static const char parse_error[] = "Parse error"; |
152 | static const char parse_error[] = "Parse error"; |
153 | int i; |
153 | size_t i; |
154 | 154 | ||
155 | *lino = 0; |
155 | *lino = 0; |
156 | for (i = 0; i < sizeof(pci_ids) / sizeof(char *); i++) { |
156 | for (i = 0; i < sizeof(pci_ids) / sizeof(char *); i++) { |
157 | line = (byte *) pci_ids[i]; |
157 | line = (byte *) pci_ids[i]; |
158 | (*lino)++; |
158 | (*lino)++; |
Line 328... | Line 328... | ||
328 | switch (flags) { |
328 | switch (flags) { |
329 | case PCI_LOOKUP_VENDOR: |
329 | case PCI_LOOKUP_VENDOR: |
330 | iv = va_arg(args, int); |
330 | iv = va_arg(args, int); |
331 | if (num) |
331 | if (num) |
332 | res = snprintf(buf, size, "%04x", iv); |
332 | res = snprintf(buf, size, "%04x", iv); |
333 | else if (v = id_lookup(a, ID_VENDOR, iv, 0, 0, 0)) |
333 | else if ((v = id_lookup(a, ID_VENDOR, iv, 0, 0, 0)) != 0) |
334 | return (char *) v->name; |
334 | return (char *) v->name; |
335 | else |
335 | else |
336 | res = snprintf(buf, size, "Unknown vendor %04x", iv); |
336 | res = snprintf(buf, size, "Unknown vendor %04x", iv); |
337 | break; |
337 | break; |
338 | case PCI_LOOKUP_DEVICE: |
338 | case PCI_LOOKUP_DEVICE: |
339 | iv = va_arg(args, int); |
339 | iv = va_arg(args, int); |
340 | id = va_arg(args, int); |
340 | id = va_arg(args, int); |
341 | if (num) |
341 | if (num) |
342 | res = snprintf(buf, size, "%04x", id); |
342 | res = snprintf(buf, size, "%04x", id); |
343 | else if (d = id_lookup(a, ID_DEVICE, iv, id, 0, 0)) |
343 | else if ((d = id_lookup(a, ID_DEVICE, iv, id, 0, 0)) != 0) |
344 | return (char *) d->name; |
344 | return (char *) d->name; |
345 | else if (synth) |
345 | else if (synth) |
346 | res = snprintf(buf, size, "Unknown device %04x", id); |
346 | res = snprintf(buf, size, "Unknown device %04x", id); |
347 | else |
347 | else |
348 | return NULL; |
348 | return NULL; |
Line 368... | Line 368... | ||
368 | break; |
368 | break; |
369 | case PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_VENDOR: |
369 | case PCI_LOOKUP_SUBSYSTEM | PCI_LOOKUP_VENDOR: |
370 | isv = va_arg(args, int); |
370 | isv = va_arg(args, int); |
371 | if (num) |
371 | if (num) |
372 | res = snprintf(buf, size, "%04x", isv); |
372 | res = snprintf(buf, size, "%04x", isv); |
373 | else if (v = id_lookup(a, ID_VENDOR, isv, 0, 0, 0)) |
373 | else if ((v = id_lookup(a, ID_VENDOR, isv, 0, 0, 0)) != 0) |
374 | return (char *) v->name; |
374 | return (char *) v->name; |
375 | else if (synth) |
375 | else if (synth) |
376 | res = snprintf(buf, size, "Unknown vendor %04x", isv); |
376 | res = snprintf(buf, size, "Unknown vendor %04x", isv); |
377 | else |
377 | else |
378 | return NULL; |
378 | return NULL; |
Line 382... | Line 382... | ||
382 | id = va_arg(args, int); |
382 | id = va_arg(args, int); |
383 | isv = va_arg(args, int); |
383 | isv = va_arg(args, int); |
384 | isd = va_arg(args, int); |
384 | isd = va_arg(args, int); |
385 | if (num) |
385 | if (num) |
386 | res = snprintf(buf, size, "%04x", isd); |
386 | res = snprintf(buf, size, "%04x", isd); |
387 | else if (d = id_lookup_subsys(a, iv, id, isv, isd)) |
387 | else if ((d = id_lookup_subsys(a, iv, id, isv, isd)) != 0) |
388 | return (char *) d->name; |
388 | return (char *) d->name; |
389 | else if (synth) |
389 | else if (synth) |
390 | res = snprintf(buf, size, "Unknown device %04x", isd); |
390 | res = snprintf(buf, size, "Unknown device %04x", isd); |
391 | else |
391 | else |
392 | return NULL; |
392 | return NULL; |
Line 413... | Line 413... | ||
413 | break; |
413 | break; |
414 | case PCI_LOOKUP_CLASS: |
414 | case PCI_LOOKUP_CLASS: |
415 | icls = va_arg(args, int); |
415 | icls = va_arg(args, int); |
416 | if (num) |
416 | if (num) |
417 | res = snprintf(buf, size, "%04x", icls); |
417 | res = snprintf(buf, size, "%04x", icls); |
418 | else if (cls = id_lookup(a, ID_SUBCLASS, icls >> 8, icls & 0xff, 0, 0)) |
418 | else if ((cls = id_lookup(a, ID_SUBCLASS, icls >> 8, icls & 0xff, 0, 0)) != 0) |
419 | return (char *) cls->name; |
419 | return (char *) cls->name; |
420 | else if (cls = id_lookup(a, ID_CLASS, icls, 0, 0, 0)) |
420 | else if ((cls = id_lookup(a, ID_CLASS, icls, 0, 0, 0)) != 0) |
421 | res = snprintf(buf, size, "%s [%04x]", cls->name, icls); |
421 | res = snprintf(buf, size, "%s [%04x]", cls->name, icls); |
422 | else if (synth) |
422 | else if (synth) |
423 | res = snprintf(buf, size, "Class %04x", icls); |
423 | res = snprintf(buf, size, "Class %04x", icls); |
424 | else |
424 | else |
425 | return NULL; |
425 | return NULL; |
Line 427... | Line 427... | ||
427 | case PCI_LOOKUP_PROGIF: |
427 | case PCI_LOOKUP_PROGIF: |
428 | icls = va_arg(args, int); |
428 | icls = va_arg(args, int); |
429 | ipif = va_arg(args, int); |
429 | ipif = va_arg(args, int); |
430 | if (num) |
430 | if (num) |
431 | res = snprintf(buf, size, "%02x", ipif); |
431 | res = snprintf(buf, size, "%02x", ipif); |
432 | else if (pif = id_lookup(a, ID_PROGIF, icls >> 8, icls & 0xff, ipif, 0)) |
432 | else if ((pif = id_lookup(a, ID_PROGIF, icls >> 8, icls & 0xff, ipif, 0)) != 0) |
433 | return (char *) pif->name; |
433 | return (char *) pif->name; |
434 | else if (icls == 0x0101 && !(ipif & 0x70)) { |
434 | else if (icls == 0x0101 && !(ipif & 0x70)) { |
435 | /* IDE controllers have complex prog-if semantics */ |
435 | /* IDE controllers have complex prog-if semantics */ |
436 | res = snprintf(buf, size, "%s%s%s%s%s", |
436 | res = snprintf(buf, size, "%s%s%s%s%s", |
437 | (ipif & 0x80) ? "Master " : "", |
437 | (ipif & 0x80) ? "Master " : "", |