Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_bus.c
Show First 20 Lines • Show All 2,711 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
void | void | ||||
device_verbose(device_t dev) | device_verbose(device_t dev) | ||||
{ | { | ||||
dev->flags &= ~DF_QUIET; | dev->flags &= ~DF_QUIET; | ||||
} | } | ||||
ssize_t | ssize_t | ||||
device_get_property(device_t dev, const char *prop, void *val, size_t sz) | device_get_property(device_t dev, const char *prop, void *val, size_t sz, | ||||
device_property_type_t type) | |||||
{ | { | ||||
device_t bus = device_get_parent(dev); | device_t bus = device_get_parent(dev); | ||||
return (BUS_GET_PROPERTY(bus, dev, prop, val, sz)); | switch (type) { | ||||
case DEVICE_PROP_ANY: | |||||
case DEVICE_PROP_BUFFER: | |||||
break; | |||||
case DEVICE_PROP_UINT32: | |||||
if (sz % 4 != 0) | |||||
return (-1); | |||||
break; | |||||
case DEVICE_PROP_UINT64: | |||||
if (sz % 8 != 0) | |||||
return (-1); | |||||
break; | |||||
default: | |||||
return (-1); | |||||
} | } | ||||
return (BUS_GET_PROPERTY(bus, dev, prop, val, sz, type)); | |||||
} | |||||
bool | bool | ||||
device_has_property(device_t dev, const char *prop) | device_has_property(device_t dev, const char *prop) | ||||
{ | { | ||||
return (device_get_property(dev, prop, NULL, 0) >= 0); | return (device_get_property(dev, prop, NULL, 0, DEVICE_PROP_ANY) >= 0); | ||||
} | } | ||||
/** | /** | ||||
* @brief Return non-zero if the DF_QUIET_CHIDLREN flag is set on the device | * @brief Return non-zero if the DF_QUIET_CHIDLREN flag is set on the device | ||||
*/ | */ | ||||
int | int | ||||
device_has_quiet_children(device_t dev) | device_has_quiet_children(device_t dev) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,389 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* @brief Helper function for implementing BUS_GET_PROPERTY(). | * @brief Helper function for implementing BUS_GET_PROPERTY(). | ||||
* | * | ||||
* This simply calls the BUS_GET_PROPERTY of the parent of dev, | * This simply calls the BUS_GET_PROPERTY of the parent of dev, | ||||
* until a non-default implementation is found. | * until a non-default implementation is found. | ||||
*/ | */ | ||||
ssize_t | ssize_t | ||||
bus_generic_get_property(device_t dev, device_t child, const char *propname, | bus_generic_get_property(device_t dev, device_t child, const char *propname, | ||||
void *propvalue, size_t size) | void *propvalue, size_t size, device_property_type_t type) | ||||
{ | { | ||||
if (device_get_parent(dev) != NULL) | if (device_get_parent(dev) != NULL) | ||||
return (BUS_GET_PROPERTY(device_get_parent(dev), child, | return (BUS_GET_PROPERTY(device_get_parent(dev), child, | ||||
propname, propvalue, size)); | propname, propvalue, size, type)); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
/** | /** | ||||
* @brief Stub function for implementing BUS_GET_RESOURCE_LIST(). | * @brief Stub function for implementing BUS_GET_RESOURCE_LIST(). | ||||
* | * | ||||
* @returns NULL | * @returns NULL | ||||
▲ Show 20 Lines • Show All 2,144 Lines • Show Last 20 Lines |