Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/bhnd_subr.c
Show First 20 Lines • Show All 2,098 Lines • ▼ Show 20 Lines | |||||
bhnd_bus_generic_get_chipid(device_t dev, device_t child) | bhnd_bus_generic_get_chipid(device_t dev, device_t child) | ||||
{ | { | ||||
if (device_get_parent(dev) != NULL) | if (device_get_parent(dev) != NULL) | ||||
return (BHND_BUS_GET_CHIPID(device_get_parent(dev), child)); | return (BHND_BUS_GET_CHIPID(device_get_parent(dev), child)); | ||||
panic("missing BHND_BUS_GET_CHIPID()"); | panic("missing BHND_BUS_GET_CHIPID()"); | ||||
} | } | ||||
/** | |||||
* Helper function for implementing BHND_BUS_GET_DMA_TRANSLATION(). | |||||
* | |||||
* If a parent device is available, this implementation delegates the | |||||
* request to the BHND_BUS_GET_DMA_TRANSLATION() method on the parent of @p dev. | |||||
* | |||||
* If no parent device is available, this implementation will panic. | |||||
*/ | |||||
int | |||||
bhnd_bus_generic_get_dma_translation(device_t dev, device_t child, u_int width, | |||||
uint32_t flags, bus_dma_tag_t *dmat, | |||||
struct bhnd_dma_translation *translation) | |||||
{ | |||||
if (device_get_parent(dev) != NULL) { | |||||
return (BHND_BUS_GET_DMA_TRANSLATION(device_get_parent(dev), | |||||
child, width, flags, dmat, translation)); | |||||
} | |||||
panic("missing BHND_BUS_GET_DMA_TRANSLATION()"); | |||||
} | |||||
/* nvram board_info population macros for bhnd_bus_generic_read_board_info() */ | /* nvram board_info population macros for bhnd_bus_generic_read_board_info() */ | ||||
#define BHND_GV(_dest, _name) \ | #define BHND_GV(_dest, _name) \ | ||||
bhnd_nvram_getvar_uint(child, BHND_NVAR_ ## _name, &_dest, \ | bhnd_nvram_getvar_uint(child, BHND_NVAR_ ## _name, &_dest, \ | ||||
sizeof(_dest)) | sizeof(_dest)) | ||||
#define REQ_BHND_GV(_dest, _name) do { \ | #define REQ_BHND_GV(_dest, _name) do { \ | ||||
if ((error = BHND_GV(_dest, _name))) { \ | if ((error = BHND_GV(_dest, _name))) { \ | ||||
device_printf(dev, \ | device_printf(dev, \ | ||||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | |||||
* This implementation simply returns the address of nearest bhnd(4) bus, | * This implementation simply returns the address of nearest bhnd(4) bus, | ||||
* which may be @p dev; this behavior may be incompatible with FDT/OFW targets. | * which may be @p dev; this behavior may be incompatible with FDT/OFW targets. | ||||
*/ | */ | ||||
uintptr_t | uintptr_t | ||||
bhnd_bus_generic_get_intr_domain(device_t dev, device_t child, bool self) | bhnd_bus_generic_get_intr_domain(device_t dev, device_t child, bool self) | ||||
{ | { | ||||
return ((uintptr_t)dev); | return ((uintptr_t)dev); | ||||
} | } | ||||
No newline at end of file | No newline at end of file |