diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -547,7 +547,7 @@ dev = pdev->pdrv != NULL && pdev->pdrv->isdrm ? device_get_parent(pdev->dev.bsddev) : pdev->dev.bsddev; - res = pci_reserve_map(device_get_parent(dev), dev, type, &rid, 0, ~0, + res = pci_reserve_map(device_get_parent(dev), dev, type, rid, 0, ~0, 1, 1, 0); if (res == NULL) return (NULL); diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -5505,7 +5505,7 @@ #endif /* DDB */ struct resource * -pci_reserve_map(device_t dev, device_t child, int type, int *rid, +pci_reserve_map(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int num, u_int flags) { @@ -5520,10 +5520,10 @@ res = NULL; /* If rid is managed by EA, ignore it */ - if (pci_ea_is_enabled(child, *rid)) + if (pci_ea_is_enabled(child, rid)) goto out; - pm = pci_find_bar(child, *rid); + pm = pci_find_bar(child, rid); if (pm != NULL) { /* This is a BAR that we failed to allocate earlier. */ mapsize = pm->pm_size; @@ -5537,28 +5537,28 @@ * have a atapci device in legacy mode and it fails * here, that other code is broken. */ - pci_read_bar(child, *rid, &map, &testval, NULL); + pci_read_bar(child, rid, &map, &testval, NULL); /* * Determine the size of the BAR and ignore BARs with a size * of 0. Device ROM BARs use a different mask value. */ - if (PCIR_IS_BIOS(&dinfo->cfg, *rid)) + if (PCIR_IS_BIOS(&dinfo->cfg, rid)) mapsize = pci_romsize(testval); else mapsize = pci_mapsize(testval); if (mapsize == 0) goto out; - pm = pci_add_bar(child, *rid, map, mapsize); + pm = pci_add_bar(child, rid, map, mapsize); } - if (PCI_BAR_MEM(map) || PCIR_IS_BIOS(&dinfo->cfg, *rid)) { + if (PCI_BAR_MEM(map) || PCIR_IS_BIOS(&dinfo->cfg, rid)) { if (type != SYS_RES_MEMORY) { if (bootverbose) device_printf(dev, "child %s requested type %d for rid %#x," " but the BAR says it is an memio\n", - device_get_nameunit(child), type, *rid); + device_get_nameunit(child), type, rid); goto out; } } else { @@ -5567,7 +5567,7 @@ device_printf(dev, "child %s requested type %d for rid %#x," " but the BAR says it is an ioport\n", - device_get_nameunit(child), type, *rid); + device_get_nameunit(child), type, rid); goto out; } } @@ -5589,20 +5589,20 @@ * Allocate enough resource, and then write back the * appropriate BAR for that resource. */ - resource_list_add(rl, type, *rid, start, end, count); - res = resource_list_reserve(rl, dev, child, type, *rid, start, end, + resource_list_add(rl, type, rid, start, end, count); + res = resource_list_reserve(rl, dev, child, type, rid, start, end, count, flags & ~RF_ACTIVE); if (res == NULL) { - resource_list_delete(rl, type, *rid); + resource_list_delete(rl, type, rid); device_printf(child, "%#jx bytes of rid %#x res %d failed (%#jx, %#jx).\n", - count, *rid, type, start, end); + count, rid, type, start, end); goto out; } if (bootverbose) device_printf(child, "Lazy allocation of %#jx bytes rid %#x type %d at %#jx\n", - count, *rid, type, rman_get_start(res)); + count, rid, type, rman_get_start(res)); /* Disable decoding via the CMD register before updating the BAR */ cmd = pci_read_config(child, PCIR_COMMAND, 2); @@ -5680,7 +5680,7 @@ /* Reserve resources for this BAR if needed. */ rle = resource_list_find(rl, type, rid); if (rle == NULL) { - res = pci_reserve_map(dev, child, type, &rid, start, end, + res = pci_reserve_map(dev, child, type, rid, start, end, count, num, flags); if (res == NULL) return (NULL); diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -147,7 +147,7 @@ pci_addr_t size); struct resource *pci_reserve_map(device_t dev, device_t child, int type, - int *rid, rman_res_t start, rman_res_t end, + int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int num, u_int flags); struct resource *pci_alloc_multi_resource(device_t dev, device_t child,