PERFORCE change 230880 for review
John Baldwin
jhb at FreeBSD.org
Tue Jul 9 03:12:19 UTC 2013
http://p4web.freebsd.org/@@230880?ac=10
Change 230880 by jhb at jhb_pipkin on 2013/07/09 03:11:51
Compile, but doesn't really work yet.
Affected files ...
.. //depot/projects/pci/sys/amd64/include/resource.h#5 edit
.. //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c#33 edit
.. //depot/projects/pci/sys/dev/pci/pci_private.h#16 edit
.. //depot/projects/pci/sys/dev/pci/pci_subr.c#7 edit
.. //depot/projects/pci/sys/dev/pci/pcib_private.h#23 edit
.. //depot/projects/pci/sys/i386/include/resource.h#3 edit
.. //depot/projects/pci/sys/x86/x86/nexus.c#12 edit
Differences ...
==== //depot/projects/pci/sys/amd64/include/resource.h#5 (text+ko) ====
@@ -41,7 +41,7 @@
#define SYS_RES_MEMORY 3 /* i/o memory */
#define SYS_RES_IOPORT 4 /* i/o ports */
#ifdef NEW_PCIB
-//#define PCI_RES_BUS 5 /* PCI bus numbers */
+#define PCI_RES_BUS 5 /* PCI bus numbers */
#endif
#endif /* !_MACHINE_RESOURCE_H_ */
==== //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c#33 (text+ko) ====
@@ -44,6 +44,7 @@
#include <dev/acpica/acpivar.h>
#include <machine/pci_cfgreg.h>
+#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcib_private.h>
#include "pcib_if.h"
@@ -271,7 +272,21 @@
}
#endif
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
static int
+first_decoded_bus(struct acpi_hpcib_softc *sc, u_long *startp)
+{
+ struct resource_list_entry *rle;
+
+ rle = resource_list_find(&sc->ap_host_res.hr_rl, PCI_RES_BUS, 0);
+ if (rle == NULL)
+ return (ENXIO);
+ *startp = rle->start;
+ return (0);
+}
+#endif
+
+static int
acpi_pcib_acpi_attach(device_t dev)
{
struct acpi_hpcib_softc *sc;
@@ -280,7 +295,7 @@
u_int slot, func, busok;
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
struct resource *bus_res;
- u_long start, end;
+ u_long start;
int rid;
#endif
uint8_t busno;
@@ -405,8 +420,7 @@
* If we have a region of bus numbers, use the first
* number for our bus.
*/
- if (rman_first_free_region(&sc->ap_host_res.hr_bus_rman, &start,
- &end) == 0)
+ if (first_decoded_bus(sc, &start) == 0)
sc->ap_bus = start;
else {
rid = 0;
@@ -422,8 +436,7 @@
}
} else {
#ifdef INVARIANTS
- if (rman_first_free_region(&sc->ap_host_res.hr_bus_rman, &start,
- &end) == 0)
+ if (first_decoded_bus(sc, &start) == 0)
KASSERT(start == sc->ap_bus, ("bus number mismatch"));
#endif
}
==== //depot/projects/pci/sys/dev/pci/pci_private.h#16 (text+ko) ====
@@ -132,13 +132,4 @@
*/
void pci_cfg_save(device_t, struct pci_devinfo *, int);
-#ifdef PCI_RES_BUS
-struct resource *pci_domain_alloc_bus(int domain, device_t dev, int *rid,
- u_long start, u_long end, u_long count, u_int flags);
-int pci_domain_adjust_bus(int domain, device_t dev,
- struct resource *r, u_long start, u_long end);
-int pci_domain_release_bus(int domain, device_t dev, int rid,
- struct resource *r);
-#endif
-
#endif /* _PCI_PRIVATE_H_ */
==== //depot/projects/pci/sys/dev/pci/pci_subr.c#7 (text+ko) ====
@@ -35,11 +35,13 @@
#include <sys/param.h>
#include <sys/bus.h>
+#include <sys/malloc.h>
#include <sys/rman.h>
#include <sys/systm.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
+#include <dev/pci/pci_private.h>
#include <dev/pci/pcib_private.h>
/*
@@ -183,7 +185,11 @@
struct resource_list_entry *rle;
int rid;
+#ifdef PCI_RES_BUS
+ if (bootverbose || type == PCI_RES_BUS)
+#else
if (bootverbose)
+#endif
device_printf(hr->hr_pcib, "decoding %d %srange %#lx-%#lx\n",
type, flags & RF_PREFETCHABLE ? "prefetchable ": "", start,
end);
@@ -237,7 +243,11 @@
r = bus_generic_alloc_resource(hr->hr_pcib, dev, type, rid,
new_start, new_end, count, flags);
if (r != NULL) {
+#ifdef PCI_RES_BUS
+ if (bootverbose || type == PCI_RES_BUS)
+#else
if (bootverbose)
+#endif
device_printf(hr->hr_pcib,
"allocated type %d (%#lx-%#lx) for rid %x of %s\n",
type, rman_get_start(r), rman_get_end(r),
==== //depot/projects/pci/sys/dev/pci/pcib_private.h#23 (text+ko) ====
@@ -118,6 +118,14 @@
int host_pcib_get_busno(pci_read_config_fn read_config, int bus,
int slot, int func, uint8_t *busnum);
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+struct resource *pci_domain_alloc_bus(int domain, device_t dev, int *rid,
+ u_long start, u_long end, u_long count, u_int flags);
+int pci_domain_adjust_bus(int domain, device_t dev,
+ struct resource *r, u_long start, u_long end);
+int pci_domain_release_bus(int domain, device_t dev, int rid,
+ struct resource *r);
+#endif
int pcib_attach(device_t dev);
void pcib_attach_common(device_t dev);
#ifdef NEW_PCIB
==== //depot/projects/pci/sys/i386/include/resource.h#3 (text+ko) ====
@@ -40,5 +40,8 @@
#define SYS_RES_DRQ 2 /* isa dma lines */
#define SYS_RES_MEMORY 3 /* i/o memory */
#define SYS_RES_IOPORT 4 /* i/o ports */
+#ifdef NEW_PCIB
+#define PCI_RES_BUS 5 /* PCI bus numbers */
+#endif
#endif /* !_MACHINE_RESOURCE_H_ */
==== //depot/projects/pci/sys/x86/x86/nexus.c#12 (text+ko) ====
@@ -521,7 +521,7 @@
{
#ifdef PCI_RES_BUS
- if (type == PCI_RES_BUS) {
+ if (type == PCI_RES_BUS)
return (pci_domain_release_bus(pcib_get_domain(child), child,
rid, r));
#endif
More information about the p4-projects
mailing list