Skip to content

Commit

Permalink
pcireg: Fix subordinate value in generated configuration space
Browse files Browse the repository at this point in the history
  • Loading branch information
richardg867 committed Oct 23, 2024
1 parent 7b8b8c1 commit ae5a0d7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions clib/clib_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,17 @@ pci_init_dev(uint8_t bus, uint8_t dev, uint8_t func)

/* Generate additional configuration values not generated by
libpci's emulated configuration space code on Windows. */
if ((pacc->method == PCI_ACCESS_WIN32_CFGMGR32) && !pacc->backend_data) { /* backend_data is NULL if no usable raw access method is found */
if ((pacc->method == PCI_ACCESS_WIN32_CFGMGR32) && !pacc->backend_data) { /* backend_data is NULL if no usable raw access method was found */
/* Create cache and read generated values for every device. */
for (pdev = pacc->devices; pdev; pdev = pdev->next) {
pdev->cache = malloc(0x40 + sizeof(win_notice));
pci_setup_cache(pdev, pdev->cache, 0x40 + sizeof(win_notice));
pci_read_block(pdev, 0, pdev->cache, 64);
if (pdev->cache[0x0e] & 0x7f)
pdev->cache[0x19] = pdev->cache[0x1a] = -1; /* set unknown secondary/subordinate bus numbers for now */
if (pdev->cache[0x0e] & 0x7f) {
/* Set unknown secondary/subordinate bus numbers for now. */
pdev->cache[0x19] = -1;
pdev->cache[0x1a] = pdev->bus;
}
strcpy(&pdev->cache[0x40], win_notice);
}

Expand Down

0 comments on commit ae5a0d7

Please sign in to comment.