-/* $OpenBSD: fdt.h,v 1.2 2016/06/09 12:32:42 kettenis Exp $ */
+/* $OpenBSD: fdt.h,v 1.3 2016/07/13 20:42:44 patrick Exp $ */
/*
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
*
int fa_nreg;
uint32_t *fa_intr;
int fa_nintr;
+ int fa_acells;
+ int fa_scells;
};
#endif /* __ARM_FDT_H__ */
-/* $OpenBSD: mainbus.c,v 1.10 2016/05/29 11:03:34 jsg Exp $ */
+/* $OpenBSD: mainbus.c,v 1.11 2016/07/13 20:42:44 patrick Exp $ */
/*
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
*
struct device sc_dev;
bus_space_tag_t sc_iot;
bus_dma_tag_t sc_dmat;
+ int sc_acells;
+ int sc_scells;
};
struct cfattach mainbus_ca = {
sc->sc_iot = &armv7_bs_tag;
#endif
sc->sc_dmat = &mainbus_dma_tag;
+ sc->sc_acells = OF_getpropint(OF_peer(0), "#address-cells", 1);
+ sc->sc_scells = OF_getpropint(OF_peer(0), "#size-cells", 1);
if ((len = OF_getprop(node, "model", buffer, sizeof(buffer))) > 0) {
printf(": %s\n", buffer);
fa.fa_node = node;
fa.fa_iot = sc->sc_iot;
fa.fa_dmat = sc->sc_dmat;
+ fa.fa_acells = sc->sc_acells;
+ fa.fa_scells = sc->sc_scells;
/* TODO: attach the device's clocks first? */
-/* $OpenBSD: simplebus.c,v 1.5 2016/06/12 13:10:06 kettenis Exp $ */
+/* $OpenBSD: simplebus.c,v 1.6 2016/07/13 20:42:44 patrick Exp $ */
/*
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
*
int sc_node;
bus_space_tag_t sc_iot;
bus_dma_tag_t sc_dmat;
+ int sc_acells;
+ int sc_scells;
};
struct cfattach simplebus_ca = {
sc->sc_node = fa->fa_node;
sc->sc_iot = fa->fa_iot;
sc->sc_dmat = fa->fa_dmat;
+ sc->sc_acells = OF_getpropint(sc->sc_node, "#address-cells",
+ fa->fa_acells);
+ sc->sc_scells = OF_getpropint(sc->sc_node, "#size-cells",
+ fa->fa_scells);
if (OF_getprop(sc->sc_node, "name", name, sizeof(name)) > 0) {
name[sizeof(name) - 1] = 0;
fa.fa_node = node;
fa.fa_iot = sc->sc_iot;
fa.fa_dmat = sc->sc_dmat;
+ fa.fa_acells = sc->sc_acells;
+ fa.fa_scells = sc->sc_scells;
len = OF_getproplen(node, "reg");
if (len > 0 && (len % sizeof(uint32_t)) == 0) {