summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-05-14 01:53:20 +0000
committerian <ian@FreeBSD.org>2014-05-14 01:53:20 +0000
commit14106897a198286392ed1343f8984675609d1e2a (patch)
treeea48f091a3b1b41f214ed5ffa8cf5ba4241728f1 /sys
parentae2bbb5100a71ca9712eebe64ce4a80b680f030b (diff)
downloadFreeBSD-src-14106897a198286392ed1343f8984675609d1e2a.zip
FreeBSD-src-14106897a198286392ed1343f8984675609d1e2a.tar.gz
MFC r257702, r257745, r257746, r257747, r257751, r257791, r257793,
r257794, r257795, r257992 Teach nexus(4) about Open Firmware (e.g. FDT) on ARM and MIPS, retiring fdtbus in most cases. Make OF_nextprop() work correctly for FDT by using the libfdt fdt_next_property_offset() API. Do not panic if pmap_mincore() is called. An addendum: it is possible, though of questionable utility, for a node to have no properties at all. Add definition for the Atheros 8021 gigabit PHY. Consolidate Apple firmware hacks and improve them by switching on the presence of mac-io devices in the tree, which uniquely identifies Apple hardware. Allow OF_decode_addr() to also be able to map resources on big-endian devices. Make tsec work with the device tree present on the RB800. Be more flexible about which compatible strings to accept. This brings up the PCI Express bus on the RB800 using the firmware device tree. Rename the "bare" platform "mpc85xx", which is what it actually is, and add actual platform probing based on PVR.
Diffstat (limited to 'sys')
-rw-r--r--sys/arm/arm/nexus.c91
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_fb.c2
-rw-r--r--sys/arm/freescale/imx/tzic.c4
-rw-r--r--sys/arm/mv/mv_localbus.c2
-rw-r--r--sys/arm/mv/mv_pci.c2
-rw-r--r--sys/conf/files2
-rw-r--r--sys/dev/fdt/simplebus.c2
-rw-r--r--sys/dev/mii/atphy.c1
-rw-r--r--sys/dev/mii/miidevs1
-rw-r--r--sys/dev/ofw/ofw_fdt.c95
-rw-r--r--sys/mips/mips/nexus.c246
-rw-r--r--sys/powerpc/booke/pmap.c2
-rw-r--r--sys/powerpc/mpc85xx/lbc.c2
-rw-r--r--sys/powerpc/mpc85xx/pci_mpc85xx.c2
14 files changed, 233 insertions, 221 deletions
diff --git a/sys/arm/arm/nexus.c b/sys/arm/arm/nexus.c
index 9b5047e..a5f9022 100644
--- a/sys/arm/arm/nexus.c
+++ b/sys/arm/arm/nexus.c
@@ -60,6 +60,12 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/intr.h>
+#include "opt_platform.h"
+
+#ifdef FDT
+#include <dev/ofw/ofw_nexus.h>
+#include <machine/fdt.h>
+#else
static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device");
struct nexus_device {
@@ -76,13 +82,18 @@ static int nexus_print_child(device_t, device_t);
static device_t nexus_add_child(device_t, u_int, const char *, int);
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
u_long, u_long, u_long, u_int);
+#endif
static int nexus_activate_resource(device_t, device_t, int, int,
struct resource *);
+static int nexus_deactivate_resource(device_t, device_t, int, int,
+ struct resource *);
+
static int nexus_setup_intr(device_t dev, device_t child, struct resource *res,
int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep);
static int nexus_teardown_intr(device_t, device_t, struct resource *, void *);
static device_method_t nexus_methods[] = {
+#ifndef FDT
/* Device interface */
DEVMETHOD(device_probe, nexus_probe),
DEVMETHOD(device_attach, nexus_attach),
@@ -90,19 +101,28 @@ static device_method_t nexus_methods[] = {
DEVMETHOD(bus_print_child, nexus_print_child),
DEVMETHOD(bus_add_child, nexus_add_child),
DEVMETHOD(bus_alloc_resource, nexus_alloc_resource),
+#endif
DEVMETHOD(bus_activate_resource, nexus_activate_resource),
+ DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
{ 0, 0 }
};
+static devclass_t nexus_devclass;
+#ifndef FDT
static driver_t nexus_driver = {
"nexus",
nexus_methods,
1 /* no softc */
};
-static devclass_t nexus_devclass;
+#else
+DEFINE_CLASS_1(nexus, nexus_driver, nexus_methods,
+ sizeof(struct ofw_nexus_softc), ofw_nexus_driver);
+#endif
+DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
+#ifndef FDT
static int
nexus_probe(device_t dev)
{
@@ -113,30 +133,6 @@ nexus_probe(device_t dev)
}
static int
-nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
- driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
-{
- int irq;
-
- if ((rman_get_flags(res) & RF_SHAREABLE) == 0)
- flags |= INTR_EXCL;
-
- for (irq = rman_get_start(res); irq <= rman_get_end(res); irq++) {
- arm_setup_irqhandler(device_get_nameunit(child),
- filt, intr, arg, irq, flags, cookiep);
- arm_unmask_irq(irq);
- }
- return (0);
-}
-
-static int
-nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
-{
-
- return (arm_remove_irqhandler(rman_get_start(r), ih));
-}
-
-static int
nexus_attach(device_t dev)
{
@@ -156,7 +152,6 @@ nexus_attach(device_t dev)
return (0);
}
-
static int
nexus_print_child(device_t bus, device_t child)
{
@@ -193,7 +188,6 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit)
* child of one of our descendants, not a direct child of nexus0.
* (Exceptions include footbridge.)
*/
-#define ARM_BUS_SPACE_MEM 1
static struct resource *
nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
u_long start, u_long end, u_long count, u_int flags)
@@ -204,6 +198,7 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
switch (type) {
case SYS_RES_MEMORY:
+ case SYS_RES_IOPORT:
rm = &mem_rman;
break;
@@ -216,7 +211,6 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
return (0);
rman_set_rid(rv, *rid);
- rman_set_bustag(rv, (void*)ARM_BUS_SPACE_MEM);
rman_set_bushandle(rv, rman_get_start(rv));
if (needactivate) {
@@ -228,6 +222,31 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
return (rv);
}
+#endif
+
+static int
+nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
+ driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
+{
+ int irq;
+
+ if ((rman_get_flags(res) & RF_SHAREABLE) == 0)
+ flags |= INTR_EXCL;
+
+ for (irq = rman_get_start(res); irq <= rman_get_end(res); irq++) {
+ arm_setup_irqhandler(device_get_nameunit(child),
+ filt, intr, arg, irq, flags, cookiep);
+ arm_unmask_irq(irq);
+ }
+ return (0);
+}
+
+static int
+nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
+{
+
+ return (arm_remove_irqhandler(rman_get_start(r), ih));
+}
static int
@@ -237,7 +256,7 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid,
/*
* If this is a memory resource, map it into the kernel.
*/
- if (rman_get_bustag(r) == (void*)ARM_BUS_SPACE_MEM) {
+ if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
caddr_t vaddr = 0;
u_int32_t paddr;
u_int32_t psize;
@@ -248,9 +267,21 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid,
poffs = paddr - trunc_page(paddr);
vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs;
rman_set_virtual(r, vaddr);
+#ifdef FDT
+ rman_set_bustag(r, fdtbus_bs_tag);
+#else
+ rman_set_bustag(r, (void *)1);
+#endif
rman_set_bushandle(r, (bus_space_handle_t) vaddr);
}
return (rman_activate_resource(r));
}
-DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
+static int
+nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
+ struct resource *res)
+{
+
+ return (rman_deactivate_resource(res));
+}
+
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_fb.c b/sys/arm/broadcom/bcm2835/bcm2835_fb.c
index 2e7bc80..5dd5f99 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_fb.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_fb.c
@@ -361,7 +361,7 @@ static driver_t bcm_fb_driver = {
sizeof(struct bcmsc_softc),
};
-DRIVER_MODULE(bcm2835fb, fdtbus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
+DRIVER_MODULE(bcm2835fb, nexus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
/*
* Video driver routines and glue.
diff --git a/sys/arm/freescale/imx/tzic.c b/sys/arm/freescale/imx/tzic.c
index d8a579f..b1a3b07 100644
--- a/sys/arm/freescale/imx/tzic.c
+++ b/sys/arm/freescale/imx/tzic.c
@@ -142,9 +142,9 @@ static devclass_t tzic_devclass;
/*
* Memory space of controller located outside of device range, so let him to
- * attach not only to simplebus, but fdtbus also.
+ * attach not only to simplebus, but nexus also.
*/
-EARLY_DRIVER_MODULE(tzic, fdtbus, tzic_driver, tzic_devclass, 0, 0,
+EARLY_DRIVER_MODULE(tzic, nexus, tzic_driver, tzic_devclass, 0, 0,
BUS_PASS_INTERRUPT);
EARLY_DRIVER_MODULE(tzic, simplebus, tzic_driver, tzic_devclass, 0, 0,
BUS_PASS_INTERRUPT);
diff --git a/sys/arm/mv/mv_localbus.c b/sys/arm/mv/mv_localbus.c
index 363a2b7..0a03688 100644
--- a/sys/arm/mv/mv_localbus.c
+++ b/sys/arm/mv/mv_localbus.c
@@ -156,7 +156,7 @@ static struct localbus_bank localbus_banks[MV_LOCALBUS_MAX_BANKS];
devclass_t localbus_devclass;
-DRIVER_MODULE(localbus, fdtbus, localbus_driver, localbus_devclass, 0, 0);
+DRIVER_MODULE(localbus, nexus, localbus_driver, localbus_devclass, 0, 0);
static int
fdt_localbus_reg_decode(phandle_t node, struct localbus_softc *sc,
diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c
index 3c63eb2..f708b90 100644
--- a/sys/arm/mv/mv_pci.c
+++ b/sys/arm/mv/mv_pci.c
@@ -230,7 +230,7 @@ static driver_t mv_pcib_driver = {
devclass_t pcib_devclass;
-DRIVER_MODULE(pcib, fdtbus, mv_pcib_driver, pcib_devclass, 0, 0);
+DRIVER_MODULE(pcib, nexus, mv_pcib_driver, pcib_devclass, 0, 0);
static struct mtx pcicfg_mtx;
diff --git a/sys/conf/files b/sys/conf/files
index 65937d4..cac3b54 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1409,7 +1409,7 @@ dev/fdt/fdt_pci.c optional fdt pci
dev/fdt/fdt_slicer.c optional fdt cfi | fdt nand
dev/fdt/fdt_static_dtb.S optional fdt fdt_dtb_static \
dependency "$S/boot/fdt/dts/${FDT_DTS_FILE}"
-dev/fdt/fdtbus.c optional fdt
+dev/fdt/fdtbus.c optional fdtbus
dev/fdt/simplebus.c optional fdt
dev/fe/if_fe.c optional fe
dev/fe/if_fe_pccard.c optional fe pccard
diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c
index c63cd86..92439cd 100644
--- a/sys/dev/fdt/simplebus.c
+++ b/sys/dev/fdt/simplebus.c
@@ -138,7 +138,7 @@ static driver_t simplebus_driver = {
devclass_t simplebus_devclass;
-DRIVER_MODULE(simplebus, fdtbus, simplebus_driver, simplebus_devclass, 0, 0);
+DRIVER_MODULE(simplebus, nexus, simplebus_driver, simplebus_devclass, 0, 0);
DRIVER_MODULE(simplebus, simplebus, simplebus_driver, simplebus_devclass, 0,
0);
diff --git a/sys/dev/mii/atphy.c b/sys/dev/mii/atphy.c
index cca8813..e480e86 100644
--- a/sys/dev/mii/atphy.c
+++ b/sys/dev/mii/atphy.c
@@ -80,6 +80,7 @@ static int atphy_setmedia(struct mii_softc *, int);
static const struct mii_phydesc atphys[] = {
MII_PHY_DESC(xxATHEROS, F1),
MII_PHY_DESC(xxATHEROS, F1_7),
+ MII_PHY_DESC(xxATHEROS, AR8021),
MII_PHY_DESC(xxATHEROS, F2),
MII_PHY_END
};
diff --git a/sys/dev/mii/miidevs b/sys/dev/mii/miidevs
index 60a883a..d7671b2 100644
--- a/sys/dev/mii/miidevs
+++ b/sys/dev/mii/miidevs
@@ -136,6 +136,7 @@ model yyAMD 79c901home 0x0039 Am79C901 HomePNA 1.0 interface
/* Atheros Communications/Attansic PHYs */
model xxATHEROS F1 0x0001 Atheros F1 10/100/1000 PHY
model xxATHEROS F2 0x0002 Atheros F2 10/100 PHY
+model xxATHEROS AR8021 0x0004 Atheros AR8021 10/100/1000 PHY
model xxATHEROS F1_7 0x0007 Atheros F1 10/100/1000 PHY
/* Asix semiconductor PHYs */
diff --git a/sys/dev/ofw/ofw_fdt.c b/sys/dev/ofw/ofw_fdt.c
index a4aca3c..b53bdab 100644
--- a/sys/dev/ofw/ofw_fdt.c
+++ b/sys/dev/ofw/ofw_fdt.c
@@ -137,26 +137,6 @@ fdt_phandle_offset(phandle_t p)
return (pint - dtoff);
}
-static int
-fdt_pointer_offset(const void *ptr)
-{
- uintptr_t dt_struct, p;
- int offset;
-
- p = (uintptr_t)ptr;
- dt_struct = (uintptr_t)fdtp + fdt_off_dt_struct(fdtp);
-
- if ((p < dt_struct) ||
- p > (dt_struct + fdt_size_dt_struct(fdtp)))
- return (-1);
-
- offset = p - dt_struct;
- if (offset < 0)
- return (-1);
-
- return (offset);
-}
-
/* Return the next sibling of this node or 0. */
static phandle_t
ofw_fdt_peer(ofw_t ofw, phandle_t node)
@@ -285,41 +265,6 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t package, const char *propname, void *buf,
return (len);
}
-static int
-fdt_nextprop(int offset, char *buf, size_t size)
-{
- const struct fdt_property *prop;
- const char *name;
- uint32_t tag;
- int nextoffset, depth;
-
- depth = 0;
- tag = fdt_next_tag(fdtp, offset, &nextoffset);
-
- /* Find the next prop */
- do {
- offset = nextoffset;
- tag = fdt_next_tag(fdtp, offset, &nextoffset);
-
- if (tag == FDT_BEGIN_NODE)
- depth++;
- else if (tag == FDT_END_NODE)
- depth--;
- else if ((tag == FDT_PROP) && (depth == 0)) {
- prop =
- (const struct fdt_property *)fdt_offset_ptr(fdtp,
- offset, sizeof(*prop));
- name = fdt_string(fdtp,
- fdt32_to_cpu(prop->nameoff));
- strncpy(buf, name, size);
- return (strlen(name));
- } else
- depth = -1;
- } while (depth >= 0);
-
- return (0);
-}
-
/*
* Get the next property of a package. Return the actual len of retrieved
* prop name.
@@ -329,26 +274,42 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t package, const char *previous, char *buf,
size_t size)
{
const struct fdt_property *prop;
- int offset, rv;
+ const char *name;
+ int offset;
offset = fdt_phandle_offset(package);
if (offset < 0)
return (-1);
- if (previous == NULL)
- /* Find the first prop in the node */
- return (fdt_nextprop(offset, buf, size));
+ /* Find the first prop in the node */
+ offset = fdt_first_property_offset(fdtp, offset);
+ if (offset < 0)
+ return (0); /* No properties */
+
+ if (previous != NULL) {
+ while (offset >= 0) {
+ prop = fdt_get_property_by_offset(fdtp, offset, NULL);
+ if (prop == NULL)
+ return (-1); /* Internal error */
+
+ offset = fdt_next_property_offset(fdtp, offset);
+ if (offset < 0)
+ return (0); /* No more properties */
+
+ /* Check if the last one was the one we wanted */
+ name = fdt_string(fdtp, fdt32_to_cpu(prop->nameoff));
+ if (strcmp(name, previous) == 0)
+ break;
+ }
+ }
- /*
- * Advance to the previous prop
- */
- prop = fdt_get_property(fdtp, offset, previous, NULL);
+ prop = fdt_get_property_by_offset(fdtp, offset, &offset);
if (prop == NULL)
- return (-1);
+ return (-1); /* Internal error */
- offset = fdt_pointer_offset(prop);
- rv = fdt_nextprop(offset, buf, size);
- return (rv);
+ strncpy(buf, fdt_string(fdtp, fdt32_to_cpu(prop->nameoff)), size);
+
+ return (strlen(buf));
}
/* Set the value of a property of a package. */
diff --git a/sys/mips/mips/nexus.c b/sys/mips/mips/nexus.c
index 47b8c19..ecf315d 100644
--- a/sys/mips/mips/nexus.c
+++ b/sys/mips/mips/nexus.c
@@ -58,6 +58,12 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/vmparam.h>
+#include "opt_platform.h"
+
+#ifdef FDT
+#include <dev/ofw/ofw_nexus.h>
+#endif
+
#undef NEXUS_DEBUG
#ifdef NEXUS_DEBUG
#define dprintf printf
@@ -65,6 +71,9 @@ __FBSDID("$FreeBSD$");
#define dprintf(x, arg...)
#endif /* NEXUS_DEBUG */
+#define NUM_MIPS_IRQS 6
+
+#ifndef FDT
static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device");
struct nexus_device {
@@ -72,7 +81,6 @@ struct nexus_device {
};
#define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev))
-#define NUM_MIPS_IRQS 6
static struct rman irq_rman;
static struct rman mem_rman;
@@ -80,18 +88,13 @@ static struct rman mem_rman;
static struct resource *
nexus_alloc_resource(device_t, device_t, int, int *, u_long,
u_long, u_long, u_int);
-static int nexus_activate_resource(device_t, device_t, int, int,
- struct resource *);
static device_t nexus_add_child(device_t, u_int, const char *, int);
static int nexus_attach(device_t);
-static int nexus_deactivate_resource(device_t, device_t, int, int,
- struct resource *);
static void nexus_delete_resource(device_t, device_t, int, int);
static struct resource_list *
nexus_get_reslist(device_t, device_t);
static int nexus_get_resource(device_t, device_t, int, int, u_long *,
u_long *);
-static void nexus_hinted_child(device_t, const char *, int);
static int nexus_print_child(device_t, device_t);
static int nexus_print_all_resources(device_t dev);
static int nexus_probe(device_t);
@@ -99,6 +102,12 @@ static int nexus_release_resource(device_t, device_t, int, int,
struct resource *);
static int nexus_set_resource(device_t, device_t, int, int, u_long,
u_long);
+#endif
+static int nexus_activate_resource(device_t, device_t, int, int,
+ struct resource *);
+static int nexus_deactivate_resource(device_t, device_t, int, int,
+ struct resource *);
+static void nexus_hinted_child(device_t, const char *, int);
static int nexus_setup_intr(device_t dev, device_t child,
struct resource *res, int flags, driver_filter_t *filt,
driver_intr_t *intr, void *arg, void **cookiep);
@@ -106,35 +115,43 @@ static int nexus_teardown_intr(device_t, device_t, struct resource *,
void *);
static device_method_t nexus_methods[] = {
+#ifndef FDT
/* Device interface */
DEVMETHOD(device_probe, nexus_probe),
DEVMETHOD(device_attach, nexus_attach),
/* Bus interface */
DEVMETHOD(bus_add_child, nexus_add_child),
- DEVMETHOD(bus_activate_resource,nexus_activate_resource),
DEVMETHOD(bus_alloc_resource, nexus_alloc_resource),
- DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
DEVMETHOD(bus_delete_resource, nexus_delete_resource),
DEVMETHOD(bus_get_resource, nexus_get_resource),
DEVMETHOD(bus_get_resource_list, nexus_get_reslist),
- DEVMETHOD(bus_hinted_child, nexus_hinted_child),
DEVMETHOD(bus_print_child, nexus_print_child),
DEVMETHOD(bus_release_resource, nexus_release_resource),
DEVMETHOD(bus_set_resource, nexus_set_resource),
+#endif
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
+ DEVMETHOD(bus_activate_resource,nexus_activate_resource),
+ DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
+ DEVMETHOD(bus_hinted_child, nexus_hinted_child),
{ 0, 0 }
};
+#ifndef FDT
static driver_t nexus_driver = {
"nexus",
nexus_methods,
1 /* no softc */
};
+#else
+DEFINE_CLASS_1(nexus, nexus_driver, nexus_methods,
+ sizeof(struct ofw_nexus_softc), ofw_nexus_driver);
+#endif
static devclass_t nexus_devclass;
+#ifndef FDT
static int
nexus_probe(device_t dev)
{
@@ -163,34 +180,6 @@ nexus_probe(device_t dev)
}
static int
-nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
- driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
-{
- register_t s;
- int irq;
-
- s = intr_disable();
- irq = rman_get_start(res);
- if (irq >= NUM_MIPS_IRQS) {
- intr_restore(s);
- return (0);
- }
-
- cpu_establish_hardintr(device_get_nameunit(child), filt, intr, arg,
- irq, flags, cookiep);
- intr_restore(s);
- return (0);
-}
-
-static int
-nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
-{
-
- printf("Unimplemented %s at %s:%d\n", __func__, __FILE__, __LINE__);
- return (0);
-}
-
-static int
nexus_attach(device_t dev)
{
@@ -231,59 +220,6 @@ nexus_print_all_resources(device_t dev)
return (retval);
}
-static void
-nexus_hinted_child(device_t bus, const char *dname, int dunit)
-{
- device_t child;
- long maddr;
- int msize;
- int order;
- int result;
- int irq;
- int mem_hints_count;
-
- if ((resource_int_value(dname, dunit, "order", &order)) != 0)
- order = 1000;
- child = BUS_ADD_CHILD(bus, order, dname, dunit);
- if (child == NULL)
- return;
-
- /*
- * Set hard-wired resources for hinted child using
- * specific RIDs.
- */
- mem_hints_count = 0;
- if (resource_long_value(dname, dunit, "maddr", &maddr) == 0)
- mem_hints_count++;
- if (resource_int_value(dname, dunit, "msize", &msize) == 0)
- mem_hints_count++;
-
- /* check if all info for mem resource has been provided */
- if ((mem_hints_count > 0) && (mem_hints_count < 2)) {
- printf("Either maddr or msize hint is missing for %s%d\n",
- dname, dunit);
- }
- else if (mem_hints_count) {
- dprintf("%s: discovered hinted child %s at maddr %p(%d)\n",
- __func__, device_get_nameunit(child),
- (void *)(intptr_t)maddr, msize);
-
- result = bus_set_resource(child, SYS_RES_MEMORY, 0, maddr,
- msize);
- if (result != 0) {
- device_printf(bus,
- "warning: bus_set_resource() failed\n");
- }
- }
-
- if (resource_int_value(dname, dunit, "irq", &irq) == 0) {
- result = bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
- if (result != 0)
- device_printf(bus,
- "warning: bus_set_resource() failed\n");
- }
-}
-
static device_t
nexus_add_child(device_t bus, u_int order, const char *name, int unit)
{
@@ -381,30 +317,6 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
return (rv);
}
-static int
-nexus_activate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *r)
-{
- void *vaddr;
- vm_paddr_t paddr;
- vm_size_t psize;
-
- /*
- * If this is a memory resource, use pmap_mapdev to map it.
- */
- if (type == SYS_RES_MEMORY) {
- paddr = rman_get_start(r);
- psize = rman_get_size(r);
- vaddr = pmap_mapdev(paddr, psize);
-
- rman_set_virtual(r, vaddr);
- rman_set_bustag(r, mips_bus_space_generic);
- rman_set_bushandle(r, (bus_space_handle_t)(uintptr_t)vaddr);
- }
-
- return (rman_activate_resource(r));
-}
-
static struct resource_list *
nexus_get_reslist(device_t dev, device_t child)
{
@@ -475,6 +387,31 @@ nexus_release_resource(device_t bus, device_t child, int type, int rid,
return (rman_release_resource(r));
}
+#endif
+
+static int
+nexus_activate_resource(device_t bus, device_t child, int type, int rid,
+ struct resource *r)
+{
+ void *vaddr;
+ vm_paddr_t paddr;
+ vm_size_t psize;
+
+ /*
+ * If this is a memory resource, use pmap_mapdev to map it.
+ */
+ if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
+ paddr = rman_get_start(r);
+ psize = rman_get_size(r);
+ vaddr = pmap_mapdev(paddr, psize);
+
+ rman_set_virtual(r, vaddr);
+ rman_set_bustag(r, mips_bus_space_generic);
+ rman_set_bushandle(r, (bus_space_handle_t)(uintptr_t)vaddr);
+ }
+
+ return (rman_activate_resource(r));
+}
static int
nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
@@ -490,4 +427,85 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
return (rman_deactivate_resource(r));
}
+static int
+nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
+ driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
+{
+ register_t s;
+ int irq;
+
+ s = intr_disable();
+ irq = rman_get_start(res);
+ if (irq >= NUM_MIPS_IRQS) {
+ intr_restore(s);
+ return (0);
+ }
+
+ cpu_establish_hardintr(device_get_nameunit(child), filt, intr, arg,
+ irq, flags, cookiep);
+ intr_restore(s);
+ return (0);
+}
+
+static int
+nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
+{
+
+ printf("Unimplemented %s at %s:%d\n", __func__, __FILE__, __LINE__);
+ return (0);
+}
+
+static void
+nexus_hinted_child(device_t bus, const char *dname, int dunit)
+{
+ device_t child;
+ long maddr;
+ int msize;
+ int order;
+ int result;
+ int irq;
+ int mem_hints_count;
+
+ if ((resource_int_value(dname, dunit, "order", &order)) != 0)
+ order = 1000;
+ child = BUS_ADD_CHILD(bus, order, dname, dunit);
+ if (child == NULL)
+ return;
+
+ /*
+ * Set hard-wired resources for hinted child using
+ * specific RIDs.
+ */
+ mem_hints_count = 0;
+ if (resource_long_value(dname, dunit, "maddr", &maddr) == 0)
+ mem_hints_count++;
+ if (resource_int_value(dname, dunit, "msize", &msize) == 0)
+ mem_hints_count++;
+
+ /* check if all info for mem resource has been provided */
+ if ((mem_hints_count > 0) && (mem_hints_count < 2)) {
+ printf("Either maddr or msize hint is missing for %s%d\n",
+ dname, dunit);
+ }
+ else if (mem_hints_count) {
+ dprintf("%s: discovered hinted child %s at maddr %p(%d)\n",
+ __func__, device_get_nameunit(child),
+ (void *)(intptr_t)maddr, msize);
+
+ result = bus_set_resource(child, SYS_RES_MEMORY, 0, maddr,
+ msize);
+ if (result != 0) {
+ device_printf(bus,
+ "warning: bus_set_resource() failed\n");
+ }
+ }
+
+ if (resource_int_value(dname, dunit, "irq", &irq) == 0) {
+ result = bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
+ if (result != 0)
+ device_printf(bus,
+ "warning: bus_set_resource() failed\n");
+ }
+}
+
DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c
index 6ccdc74..6d943c9 100644
--- a/sys/powerpc/booke/pmap.c
+++ b/sys/powerpc/booke/pmap.c
@@ -2759,7 +2759,7 @@ mmu_booke_mincore(mmu_t mmu, pmap_t pmap, vm_offset_t addr,
vm_paddr_t *locked_pa)
{
- TODO;
+ /* XXX: this should be implemented at some point */
return (0);
}
diff --git a/sys/powerpc/mpc85xx/lbc.c b/sys/powerpc/mpc85xx/lbc.c
index cbcd9fc..5c27ca4 100644
--- a/sys/powerpc/mpc85xx/lbc.c
+++ b/sys/powerpc/mpc85xx/lbc.c
@@ -113,7 +113,7 @@ static driver_t lbc_driver = {
devclass_t lbc_devclass;
-DRIVER_MODULE(lbc, fdtbus, lbc_driver, lbc_devclass, 0, 0);
+DRIVER_MODULE(lbc, nexus, lbc_driver, lbc_devclass, 0, 0);
/*
* Calculate address mask used by OR(n) registers. Use memory region size to
diff --git a/sys/powerpc/mpc85xx/pci_mpc85xx.c b/sys/powerpc/mpc85xx/pci_mpc85xx.c
index f5d51e0..5d7f542 100644
--- a/sys/powerpc/mpc85xx/pci_mpc85xx.c
+++ b/sys/powerpc/mpc85xx/pci_mpc85xx.c
@@ -170,7 +170,7 @@ static devclass_t fsl_pcib_devclass;
DEFINE_CLASS_1(pcib, fsl_pcib_driver, fsl_pcib_methods,
sizeof(struct fsl_pcib_softc), ofw_pci_driver);
-DRIVER_MODULE(pcib, fdtbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0);
+DRIVER_MODULE(pcib, nexus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0);
static int
fsl_pcib_probe(device_t dev)
OpenPOWER on IntegriCloud