From e0c8c9460c51199bf09838f2d5b8defa0e9fc80f Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Sun, 27 Mar 2005 10:35:07 +0000 Subject: [PATCH] Argh. PCI resource list became an STAILQ instead of an SLIST. Try to deal with this while maintaining backards source compatibility with stable. --- sys/compat/ndis/kern_ndis.c | 15 ++++++++++++++- sys/dev/if_ndis/if_ndis_pci.c | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c index d2ce35b13f5f..7e5341219b64 100644 --- a/sys/compat/ndis/kern_ndis.c +++ b/sys/compat/ndis/kern_ndis.c @@ -902,15 +902,22 @@ ndis_convert_res(arg) ndis_miniport_block *block; device_t dev; struct resource_list *brl; + struct resource_list_entry *brle; +#if __FreeBSD_version < 600022 struct resource_list brl_rev; - struct resource_list_entry *brle, *n; + struct resource_list_entry *n; +#endif int error = 0; sc = arg; block = sc->ndis_block; dev = sc->ndis_dev; +#if __FreeBSD_version < 600022 SLIST_INIT(&brl_rev); +#else + STAILQ_INIT(&brl_rev); +#endif rl = malloc(sizeof(ndis_resource_list) + (sizeof(cm_partial_resource_desc) * (sc->ndis_rescnt - 1)), @@ -928,6 +935,7 @@ ndis_convert_res(arg) if (brl != NULL) { +#if __FreeBSD_version < 600022 /* * We have a small problem. Some PCI devices have * multiple I/O ranges. Windows orders them starting @@ -954,6 +962,9 @@ ndis_convert_res(arg) } SLIST_FOREACH(brle, &brl_rev, link) { +#else + STAILQ_FOREACH(brle, &brl, link) { +#endif switch (brle->type) { case SYS_RES_IOPORT: prd->cprd_type = CmResourceTypePort; @@ -994,11 +1005,13 @@ ndis_convert_res(arg) bad: +#if __FreeBSD_version < 600022 while (!SLIST_EMPTY(&brl_rev)) { n = SLIST_FIRST(&brl_rev); SLIST_REMOVE_HEAD(&brl_rev, link); free (n, M_TEMP); } +#endif return(error); } diff --git a/sys/dev/if_ndis/if_ndis_pci.c b/sys/dev/if_ndis/if_ndis_pci.c index 6222efe895d2..08109e65f07a 100644 --- a/sys/dev/if_ndis/if_ndis_pci.c +++ b/sys/dev/if_ndis/if_ndis_pci.c @@ -196,7 +196,11 @@ ndis_attach_pci(dev) rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev); if (rl != NULL) { +#if __FreeBSD_version < 600022 + SLIST_FOREACH(rle, rl, link) { +#else STAILQ_FOREACH(rle, rl, link) { +#endif switch (rle->type) { case SYS_RES_IOPORT: sc->ndis_io_rid = rle->rid;