| 401 | } |
| 402 | |
| 403 | int print_ambs(struct pci_dev *dev, struct pci_access *pacc) |
| 404 | { |
| 405 | struct pci_dev *dev16; |
| 406 | int branch, channel, amb; |
| 407 | int max_branch, max_channel, max_amb; |
| 408 | volatile void *ambconfig; |
| 409 | uint64_t ambconfig_phys; |
| 410 | |
| 411 | printf("\n============= AMBs ============\n\n"); |
| 412 | |
| 413 | switch (dev->device_id) { |
| 414 | case PCI_DEVICE_ID_INTEL_I5000P: |
| 415 | case PCI_DEVICE_ID_INTEL_I5000X: |
| 416 | case PCI_DEVICE_ID_INTEL_I5000Z: |
| 417 | |
| 418 | max_branch = 2; |
| 419 | |
| 420 | if (!(dev16 = pci_get_dev(pacc, 0, 0, 0x10, 0))) { |
| 421 | perror("Error: no device 0:16.0\n"); |
| 422 | return 1; |
| 423 | } |
| 424 | |
| 425 | ambconfig_phys = ((uint64_t)pci_read_long(dev16, 0x4c) << 32) | |
| 426 | pci_read_long(dev16, 0x48); |
| 427 | |
| 428 | max_channel = pci_read_byte(dev16, 0x56)/max_branch; |
| 429 | max_amb = pci_read_byte(dev16, 0x57); |
| 430 | pci_free_dev(dev16); |
| 431 | break; |
| 432 | |
| 433 | default: |
| 434 | printf("Error: Dumping AMBs on this MCH is not (yet) supported.\n"); |
| 435 | return 1; |
| 436 | } |
| 437 | |
| 438 | if (!(ambconfig = map_physical(ambconfig_phys, AMB_CONFIG_SPACE_SIZE))) { |
| 439 | fprintf(stderr, "Error mapping AMB config space\n"); |
| 440 | return 1; |
| 441 | } |
| 442 | |
| 443 | for(branch = 0; branch < max_branch; branch++) { |
| 444 | for(channel = 0; channel < max_channel; channel++) { |
| 445 | for(amb = 0; amb < max_amb; amb++) { |
| 446 | dump_amb(ambconfig, branch, channel, amb); |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | unmap_physical((void *)ambconfig, AMB_CONFIG_SPACE_SIZE); |
| 451 | return 0; |
| 452 | } |
no test coverage detected