Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/bhnd_subr.c
Context not available. | |||||
/** | /** | ||||
* Return the name of a port type. | * Return the name of a port type. | ||||
* | |||||
* @param port_type The port type to look up. | |||||
*/ | */ | ||||
const char * | const char * | ||||
bhnd_port_type_name(bhnd_port_type port_type) | bhnd_port_type_name(bhnd_port_type port_type) | ||||
Context not available. | |||||
/** | /** | ||||
* Return the name of an NVRAM source. | * Return the name of an NVRAM source. | ||||
* | |||||
* @param nvram_src The NVRAM source type to look up. | |||||
*/ | */ | ||||
const char * | const char * | ||||
bhnd_nvram_src_name(bhnd_nvram_src nvram_src) | bhnd_nvram_src_name(bhnd_nvram_src nvram_src) | ||||
Context not available. | |||||
/** | /** | ||||
* Return a human-readable name for a BHND core. | * Return a human-readable name for a BHND core. | ||||
* | * | ||||
* @param vendor The core designer's JEDEC-106 Manufacturer ID | * @param vendor The core designer's JEDEC-106 Manufacturer ID. | ||||
* @param device The core identifier. | * @param device The core identifier. | ||||
*/ | */ | ||||
const char * | const char * | ||||
Context not available. | |||||
/** | /** | ||||
* Return the device class for a BHND core. | * Return the device class for a BHND core. | ||||
* | * | ||||
* @param vendor The core designer's JEDEC-106 Manufacturer ID | * @param vendor The core designer's JEDEC-106 Manufacturer ID. | ||||
* @param device The core identifier. | * @param device The core identifier. | ||||
*/ | */ | ||||
bhnd_devclass_t | bhnd_devclass_t | ||||
Context not available. | |||||
* @param size Capacity of @p buffer, in bytes. | * @param size Capacity of @p buffer, in bytes. | ||||
* @param chip_id Chip ID to be formatted. | * @param chip_id Chip ID to be formatted. | ||||
* | * | ||||
* @return Returns the required number of bytes on success, or a negative | * @return The required number of bytes on success, or a negative integer on | ||||
* integer on failure. No more than @p size-1 characters be written, with | * failure. No more than @p size-1 characters be written, with the @p size'th | ||||
* the @p size'th set to '\0'. | * set to '\0'. | ||||
* | * | ||||
* @sa BHND_CHIPID_MAX_NAMELEN | * @sa BHND_CHIPID_MAX_NAMELEN | ||||
*/ | */ | ||||
Context not available. | |||||
} | } | ||||
/** | /** | ||||
* Initialize a core info record with data from from a bhnd-attached @p dev. | * Return a core info record populated from a bhnd-attached @p dev. | ||||
* | * | ||||
* @param dev A bhnd device. | * @param dev A bhnd device. | ||||
* @param core The record to be initialized. | * | ||||
* @return A core info record for @p dev. | |||||
*/ | */ | ||||
struct bhnd_core_info | struct bhnd_core_info | ||||
bhnd_get_core_info(device_t dev) { | bhnd_get_core_info(device_t dev) { | ||||
Context not available. | |||||
* @param devlist An array of bhnd devices. | * @param devlist An array of bhnd devices. | ||||
* @param devcount The number of devices in @p devs. | * @param devcount The number of devices in @p devs. | ||||
* @param order The sort order to be used. | * @param order The sort order to be used. | ||||
* | |||||
* @retval 0 success | |||||
* @retval EINVAL if the sort order is unknown. | |||||
*/ | */ | ||||
int | int | ||||
bhnd_sort_devices(device_t *devlist, size_t devcount, bhnd_device_order order) | bhnd_sort_devices(device_t *devlist, size_t devcount, bhnd_device_order order) | ||||
Context not available. | |||||
* should be attached. | * should be attached. | ||||
* | * | ||||
* @retval device_t if a matching parent device is found. | * @retval device_t if a matching parent device is found. | ||||
* @retval NULL @p dev is not attached via a bhndb bus | * @retval NULL if @p dev is not attached via a bhndb bus. | ||||
* @retval NULL no parent device is attached via @p bus_class. | * @retval NULL if no parent device is attached via @p bus_class. | ||||
*/ | */ | ||||
device_t | device_t | ||||
bhnd_find_bridge_root(device_t dev, devclass_t bus_class) | bhnd_find_bridge_root(device_t dev, devclass_t bus_class) | ||||
Context not available. | |||||
* | * | ||||
* @param cores The table to search. | * @param cores The table to search. | ||||
* @param num_cores The length of @p cores. | * @param num_cores The length of @p cores. | ||||
* @param desc A match descriptor. | * @param class The device class to match on. | ||||
* | * | ||||
* @retval bhnd_core_info if a matching core is found. | * @retval non-NULL if a matching core is found. | ||||
* @retval NULL if no matching core is found. | * @retval NULL if no matching core is found. | ||||
*/ | */ | ||||
const struct bhnd_core_info * | const struct bhnd_core_info * | ||||
Context not available. | |||||
* Create an equality match descriptor for @p core. | * Create an equality match descriptor for @p core. | ||||
* | * | ||||
* @param core The core info to be matched on. | * @param core The core info to be matched on. | ||||
* @param desc On return, will be populated with a match descriptor for @p core. | * | ||||
* @return an equality match descriptor for @p core. | |||||
*/ | */ | ||||
struct bhnd_core_match | struct bhnd_core_match | ||||
bhnd_core_get_match_desc(const struct bhnd_core_info *core) | bhnd_core_get_match_desc(const struct bhnd_core_info *core) | ||||
Context not available. | |||||
/** | /** | ||||
* Return true if the @p lhs is equal to @p rhs | * Return true if the @p lhs is equal to @p rhs. | ||||
* | * | ||||
* @param lhs The first bhnd core descriptor to compare. | * @param lhs The first bhnd core descriptor to compare. | ||||
* @param rhs The second bhnd core descriptor to compare. | * @param rhs The second bhnd core descriptor to compare. | ||||
Context not available. | |||||
* @param core A bhnd core descriptor. | * @param core A bhnd core descriptor. | ||||
* @param desc A match descriptor to compare against @p core. | * @param desc A match descriptor to compare against @p core. | ||||
* | * | ||||
* @retval true if @p core matches @p match | * @retval true if @p core matches @p match. | ||||
* @retval false if @p core does not match @p match. | * @retval false if @p core does not match @p match. | ||||
*/ | */ | ||||
bool | bool | ||||
Context not available. | |||||
* @param chip A bhnd chip identifier. | * @param chip A bhnd chip identifier. | ||||
* @param desc A match descriptor to compare against @p chip. | * @param desc A match descriptor to compare against @p chip. | ||||
* | * | ||||
* @retval true if @p chip matches @p match | * @retval true if @p chip matches @p match. | ||||
* @retval false if @p chip does not match @p match. | * @retval false if @p chip does not match @p match. | ||||
*/ | */ | ||||
bool | bool | ||||
Context not available. | |||||
* @param board The bhnd board info. | * @param board The bhnd board info. | ||||
* @param desc A match descriptor to compare against @p board. | * @param desc A match descriptor to compare against @p board. | ||||
* | * | ||||
* @retval true if @p chip matches @p match | * @retval true if @p chip matches @p match. | ||||
* @retval false if @p chip does not match @p match. | * @retval false if @p chip does not match @p match. | ||||
*/ | */ | ||||
bool | bool | ||||
Context not available. | |||||
* @param hwrev A bhnd hardware revision. | * @param hwrev A bhnd hardware revision. | ||||
* @param desc A match descriptor to compare against @p core. | * @param desc A match descriptor to compare against @p core. | ||||
* | * | ||||
* @retval true if @p hwrev matches @p match | * @retval true if @p hwrev matches @p match. | ||||
* @retval false if @p hwrev does not match @p match. | * @retval false if @p hwrev does not match @p match. | ||||
*/ | */ | ||||
bool | bool | ||||
Context not available. | |||||
* @param dev A bhnd device. | * @param dev A bhnd device. | ||||
* @param desc A match descriptor to compare against @p dev. | * @param desc A match descriptor to compare against @p dev. | ||||
* | * | ||||
* @retval true if @p dev matches @p match | * @retval true if @p dev matches @p match. | ||||
* @retval false if @p dev does not match @p match. | * @retval false if @p dev does not match @p match. | ||||
*/ | */ | ||||
bool | bool | ||||
Context not available. | |||||
* @param table The device table to search. | * @param table The device table to search. | ||||
* @param entry_size The @p table entry size, in bytes. | * @param entry_size The @p table entry size, in bytes. | ||||
* | * | ||||
* @retval bhnd_device the first matching device, if any. | * @retval non-NULL the first matching device, if any. | ||||
* @retval NULL if no matching device is found in @p table. | * @retval NULL if no matching device is found in @p table. | ||||
*/ | */ | ||||
const struct bhnd_device * | const struct bhnd_device * | ||||
Context not available. | |||||
* | * | ||||
* @param dev A bhnd device to match against @p table. | * @param dev A bhnd device to match against @p table. | ||||
* @param table The device table to search. | * @param table The device table to search. | ||||
* @param entry_size The @p table entry size, in bytes. | |||||
* | * | ||||
* @return returns all matching quirk flags. | * @return all matching quirk flags. | ||||
*/ | */ | ||||
uint32_t | uint32_t | ||||
bhnd_device_quirks(device_t dev, const struct bhnd_device *table, | bhnd_device_quirks(device_t dev, const struct bhnd_device *table, | ||||
Context not available. | |||||
* @param dev The device owning @p rs. | * @param dev The device owning @p rs. | ||||
* @param rs A resource spec that encompasses the ChipCommon register block. | * @param rs A resource spec that encompasses the ChipCommon register block. | ||||
* @param chipc_offset The offset of the ChipCommon registers within @p rs. | * @param chipc_offset The offset of the ChipCommon registers within @p rs. | ||||
* @param[out] result the chip identification data. | * @param[out] result The chip identification data. | ||||
* | * | ||||
* @retval 0 success | * @retval 0 success | ||||
* @retval non-zero if the ChipCommon identification data could not be read. | * @retval non-zero if the ChipCommon identification data could not be read. | ||||
Context not available. | |||||
* registrations for @p provider. | * registrations for @p provider. | ||||
* | * | ||||
* @retval 0 success | * @retval 0 success | ||||
* @retval EBUSY if active references to @p provider exist; @see | * @retval EBUSY if active references to @p provider exist; see | ||||
* bhnd_service_registry_retain() and | * bhnd_service_registry_retain() and | ||||
* bhnd_service_registry_release(). | * bhnd_service_registry_release(). | ||||
*/ | */ | ||||
Context not available. | |||||
* bhnd_service_registry_retain(). | * bhnd_service_registry_retain(). | ||||
* | * | ||||
* If this is the last reference to an inherited service provider registration | * If this is the last reference to an inherited service provider registration | ||||
* (@see BHND_SPF_INHERITED), the registration will also be removed, and | * (see BHND_SPF_INHERITED), the registration will also be removed, and | ||||
* true will be returned. | * true will be returned. | ||||
* | * | ||||
* @param bsr The service registry from which @p provider | * @param bsr The service registry from which @p provider | ||||
Context not available. | |||||
* provider. | * provider. | ||||
* @retval false The service provider was not inherited, or active | * @retval false The service provider was not inherited, or active | ||||
* references to the provider remain. | * references to the provider remain. | ||||
* | |||||
* @see BHND_SPF_INHERITED | |||||
*/ | */ | ||||
bool | bool | ||||
bhnd_service_registry_release(struct bhnd_service_registry *bsr, | bhnd_service_registry_release(struct bhnd_service_registry *bsr, | ||||
Context not available. | |||||
* populate @p dev's device description. | * populate @p dev's device description. | ||||
* | * | ||||
* @param dev A bhnd-bus attached device. | * @param dev A bhnd-bus attached device. | ||||
* @param dev_name The core's name (e.g. "SDIO Device Core") | * @param dev_name The core's name (e.g. "SDIO Device Core"). | ||||
*/ | */ | ||||
void | void | ||||
bhnd_set_custom_core_desc(device_t dev, const char *dev_name) | bhnd_set_custom_core_desc(device_t dev, const char *dev_name) | ||||
Context not available. | |||||
* description. | * description. | ||||
* | * | ||||
* @param dev A bhnd-bus attached device. | * @param dev A bhnd-bus attached device. | ||||
* @param chip_id The chip identification. | |||||
*/ | */ | ||||
void | void | ||||
bhnd_set_default_bus_desc(device_t dev, const struct bhnd_chipid *chip_id) | bhnd_set_default_bus_desc(device_t dev, const struct bhnd_chipid *chip_id) | ||||
Context not available. |