Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/fdt/simplebus.c
Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | simplebus_get_resource_list(device_t bus __unused, device_t child) | ||||
ndi = device_get_ivars(child); | ndi = device_get_ivars(child); | ||||
if (ndi == NULL) | if (ndi == NULL) | ||||
return (NULL); | return (NULL); | ||||
return (&ndi->rl); | return (&ndi->rl); | ||||
} | } | ||||
ssize_t | ssize_t | ||||
simplebus_get_property(device_t bus, device_t child, const char *propname, | simplebus_get_property(device_t bus, device_t child, const char *propname, | ||||
void *propvalue, size_t size) | void *propvalue, size_t size, device_property_type_t type) | ||||
{ | { | ||||
phandle_t node = ofw_bus_get_node(child); | phandle_t node = ofw_bus_get_node(child); | ||||
switch (type) { | |||||
case DEVICE_PROP_ANY: | |||||
case DEVICE_PROP_BUFFER: | |||||
case DEVICE_PROP_UINT32: | |||||
case DEVICE_PROP_UINT64: | |||||
break; | |||||
default: | |||||
return (-1); | |||||
} | |||||
if (propvalue == NULL || size == 0) | if (propvalue == NULL || size == 0) | ||||
return (OF_getproplen(node, propname)); | return (OF_getproplen(node, propname)); | ||||
/* | |||||
* Integer values are stored in BE format. | |||||
* If caller declared that the underlying property type is uint32 | |||||
* we need to do the conversion to match host endianness. | |||||
* For uint64 properties do the same. In DT every 8 byte integer is | |||||
* stored using two uint32 variables in BE format. | |||||
mw: s/uint32s/uint32 variables/ | |||||
*/ | |||||
if (type == DEVICE_PROP_UINT32 || type == DEVICE_PROP_UINT64) | |||||
Not Done Inline Actionss/|/||/ mw: s/|/||/ | |||||
andrewUnsubmitted Not Done Inline ActionsIs this correct on little endian in the DEVICE_PROP_UINT64 case? Won't the two 32 bit halves be backwards? andrew: Is this correct on little endian in the `DEVICE_PROP_UINT64` case? Won't the two 32 bit halves… | |||||
kdAuthorUnsubmitted Done Inline ActionsWhoops, you're right. kd: Whoops, you're right.
I've added the conversion and tested it by reading a simple 64bit… | |||||
return (OF_getencprop(node, propname, propvalue, size)); | return (OF_getencprop(node, propname, propvalue, size)); | ||||
return (OF_getprop(node, propname, propvalue, size)); | |||||
} | } | ||||
static struct resource * | static struct resource * | ||||
simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, | simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, | ||||
rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct simplebus_softc *sc; | struct simplebus_softc *sc; | ||||
struct simplebus_devinfo *di; | struct simplebus_devinfo *di; | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |
s/uint32s/uint32 variables/