From 594b5aeb67979647c6524aa2efa4a48ed1f98963 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 16 Feb 2003 02:02:44 +0000 Subject: [PATCH] Use rman_get_device rather than rle->resl->r_dev. make pci_hdrtypedata and pci_read_extcap accessible (but maybe in the end we'll make them private again). --- sys/dev/pci/pci.c | 10 +++------- sys/dev/pci/pci_private.h | 4 +++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index ecdcba0a231..3ca38c3c7e7 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -65,9 +65,6 @@ static int pci_maptype(unsigned mapreg); static int pci_mapsize(unsigned testval); static int pci_maprange(unsigned mapreg); static void pci_fixancient(pcicfgregs *cfg); -static void pci_hdrtypedata(device_t pcib, int b, int s, int f, - pcicfgregs *cfg); -static void pci_read_extcap(device_t pcib, pcicfgregs *cfg); static int pci_porten(device_t pcib, int b, int s, int f); static int pci_memen(device_t pcib, int b, int s, int f); @@ -294,7 +291,7 @@ pci_fixancient(pcicfgregs *cfg) /* extract header type specific config data */ -static void +void pci_hdrtypedata(device_t pcib, int b, int s, int f, pcicfgregs *cfg) { #define REG(n, w) PCIB_READ_CONFIG(pcib, b, s, f, n, w) @@ -392,7 +389,7 @@ pci_read_device(device_t pcib, int b, int s, int f, size_t size) #undef REG } -static void +void pci_read_extcap(device_t pcib, pcicfgregs *cfg) { #define REG(n, w) PCIB_READ_CONFIG(pcib, cfg->bus, cfg->slot, cfg->func, n, w) @@ -451,7 +448,6 @@ pci_freecfg(struct pci_devinfo *dinfo) devlist_head = &pci_devq; - /* XXX this hasn't been tested */ STAILQ_REMOVE(devlist_head, dinfo, pci_devinfo, pci_links); free(dinfo, M_DEVBUF); @@ -1337,7 +1333,7 @@ pci_delete_resource(device_t dev, device_t child, int type, int rid) rle = resource_list_find(rl, type, rid); if (rle) { if (rle->res) { - if (rle->res->r_dev != dev || + if (rman_get_device(rle->res) != dev || rman_get_flags(rle->res) & RF_ACTIVE) { device_printf(dev, "delete_resource: " "Resource still owned by child, oops. " diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h index 1b14bc84069..3902efb45f8 100644 --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -68,5 +68,7 @@ struct pci_devinfo *pci_read_device(device_t pcib, int b, int s, int f, size_t size); void pci_print_verbose(struct pci_devinfo *dinfo); int pci_freecfg(struct pci_devinfo *dinfo); - +void pci_hdrtypedata(device_t pcib, int b, int s, int f, + pcicfgregs *cfg); +void pci_read_extcap(device_t pcib, pcicfgregs *cfg); #endif /* _PCI_PRIVATE_H_ */