Index: sys/dev/bhnd/bhndb/bhndb_subr.c =================================================================== --- sys/dev/bhnd/bhndb/bhndb_subr.c +++ sys/dev/bhnd/bhndb/bhndb_subr.c @@ -38,12 +38,12 @@ /** * Attach a BHND bridge device to @p parent. - * + * * @param parent A parent PCI device. * @param[out] bhndb On success, the probed and attached bhndb bridge device. * @param unit The device unit number, or -1 to select the next available unit * number. - * + * * @retval 0 success * @retval non-zero Failed to attach the bhndb device. */ @@ -88,15 +88,15 @@ /** * Helper function for implementing BUS_RESUME_CHILD() on bridged * bhnd(4) buses. - * + * * This implementation of BUS_RESUME_CHILD() uses BUS_GET_RESOURCE_LIST() * to find the child's resources and call BHNDB_SUSPEND_RESOURCE() for all * child resources, ensuring that the device's allocated bridge resources * will be available to other devices during bus resumption. - * - * Before suspending any resources, @p child is suspended by + * + * Before suspending any resources, @p child is suspended by * calling bhnd_generic_suspend_child(). - * + * * If @p child is not a direct child of @p dev, suspension is delegated to * the @p dev parent. */ @@ -130,13 +130,13 @@ /** * Helper function for implementing BUS_RESUME_CHILD() on bridged * bhnd(4) bus devices. - * + * * This implementation of BUS_RESUME_CHILD() uses BUS_GET_RESOURCE_LIST() * to find the child's resources and call BHNDB_RESUME_RESOURCE() for all * child resources, before delegating to bhnd_generic_resume_child(). - * + * * If resource resumption fails, @p child will not be resumed. - * + * * If @p child is not a direct child of @p dev, suspension is delegated to * the @p dev parent. */ @@ -146,7 +146,7 @@ struct resource_list *rl; struct resource_list_entry *rle; int error; - + if (device_get_parent(child) != dev) BUS_RESUME_CHILD(device_get_parent(dev), child); @@ -184,10 +184,10 @@ /** * Find the resource containing @p win. - * + * * @param br The bhndb resource state to search. * @param win A register window. - * + * * @retval resource the resource containing @p win. * @retval NULL if no resource containing @p win can be found. */ @@ -198,7 +198,7 @@ const struct resource_spec *rspecs; rspecs = br->cfg->resource_specs; - for (u_int i = 0; rspecs[i].type != -1; i++) { + for (u_int i = 0; rspecs[i].type != -1; i++) { if (win->res.type != rspecs[i].type) continue; @@ -219,7 +219,7 @@ /** * Allocate and initialize a new resource state structure, allocating * bus resources from @p parent_dev according to @p cfg. - * + * * @param dev The bridge device. * @param parent_dev The parent device from which resources will be allocated. * @param cfg The hardware configuration to be used. @@ -248,7 +248,7 @@ r->cfg = cfg; r->min_prio = BHNDB_PRIORITY_NONE; STAILQ_INIT(&r->bus_regions); - + /* Determine our bridge resource count from the hardware config. */ res_num = 0; for (size_t i = 0; cfg->resource_specs[i].type != -1; i++) @@ -265,7 +265,7 @@ /* Initialize and terminate the table */ for (size_t i = 0; i < res_num; i++) r->res_spec[i] = cfg->resource_specs[i]; - + r->res_spec[res_num].type = -1; /* Allocate space for our resource references */ @@ -292,7 +292,7 @@ device_printf(r->dev, "max dynamic regwin count exceeded\n"); goto failed; } - + /* Allocate the dynamic window allocation table. */ r->dw_alloc = malloc(sizeof(r->dw_alloc[0]) * r->dwa_count, M_BHND, M_NOWAIT); @@ -320,13 +320,13 @@ } else if (last_window_size == 0) { last_window_size = win->win_size; } else if (last_window_size != win->win_size) { - /* + /* * No existing hardware should trigger this. - * + * * If you run into this in the future, the dynamic * window allocator and the resource priority system * will need to be extended to support multiple register - * window allocation pools. + * window allocation pools. */ device_printf(r->dev, "devices that vend multiple " "dynamic register window sizes are not currently " @@ -339,7 +339,7 @@ dwa->parent_res = NULL; dwa->rnid = rnid; dwa->target = 0x0; - + LIST_INIT(&dwa->refs); /* Find and validate corresponding resource. */ @@ -388,7 +388,7 @@ /** * Deallocate the given bridge resource structure and any associated resources. - * + * * @param br Resource state to be deallocated. */ void @@ -416,7 +416,7 @@ free(dwr, M_BHND); } } - + /* Release bus regions */ STAILQ_FOREACH_SAFE(region, &br->bus_regions, link, r_next) { STAILQ_REMOVE(&br->bus_regions, region, bhndb_region, link); @@ -431,7 +431,7 @@ /** * Add a bus region entry to @p r for the given base @p addr and @p size. - * + * * @param br The resource state to which the bus region entry will be added. * @param addr The base address of this region. * @param size The size of this region. @@ -439,7 +439,7 @@ * made within this bus region. * @param static_regwin If available, a static register window mapping this * bus region entry. If not available, NULL. - * + * * @retval 0 success * @retval non-zero if adding the bus region fails. */ @@ -469,11 +469,11 @@ /** * Find a bus region that maps @p size bytes at @p addr. - * + * * @param br The resource state to search. * @param addr The requested starting address. * @param size The requested size. - * + * * @retval bhndb_region A region that fully contains the requested range. * @retval NULL If no mapping region can be found. */ @@ -500,7 +500,7 @@ /** * Find the entry matching @p r in @p dwa's references, if any. - * + * * @param dwa The dynamic window allocation to search * @param r The resource to search for in @p dwa. */ @@ -530,10 +530,10 @@ /** * Find the dynamic region allocated for @p r, if any. - * + * * @param br The resource state to search. * @param r The resource to search for. - * + * * @retval bhndb_dw_alloc The allocation record for @p r. * @retval NULL if no dynamic window is allocated for @p r. */ @@ -560,11 +560,11 @@ /** * Find an existing dynamic window mapping @p size bytes * at @p addr. The window may or may not be free. - * + * * @param br The resource state to search. * @param addr The requested starting address. * @param size The requested size. - * + * * @retval bhndb_dw_alloc A window allocation that fully contains the requested * range. * @retval NULL If no mapping region can be found. @@ -598,11 +598,11 @@ /** * Retain a reference to @p dwa for use by @p res. - * + * * @param br The resource state owning @p dwa. * @param dwa The allocation record to be retained. * @param res The resource that will own a reference to @p dwa. - * + * * @retval 0 success * @retval ENOMEM Failed to allocate a new reference structure. */ @@ -626,7 +626,7 @@ /* Update the free list */ br->dwa_freelist &= ~(1 << (dwa->rnid)); - + return (0); } @@ -634,7 +634,7 @@ * Release a reference to @p dwa previously retained by @p res. If the * reference count of @p dwa reaches zero, it will be added to the * free list. - * + * * @param br The resource state owning @p dwa. * @param dwa The allocation record to be released. * @param res The resource that currently owns a reference to @p dwa. @@ -660,11 +660,11 @@ /** * Attempt to set (or reset) the target address of @p dwa to map @p size bytes * at @p addr. - * + * * This will apply any necessary window alignment and verify that * the window is capable of mapping the requested range prior to modifying * therecord. - * + * * @param dev The device on which to issue the BHNDB_SET_WINDOW_ADDR() request. * @param br The resource state owning @p dwa. * @param dwa The allocation record to be configured. @@ -694,7 +694,7 @@ /* Verify that the window is large enough for the full target */ if (rw->win_size - offset < size) return (ENOMEM); - + /* Update the window target */ error = BHNDB_SET_WINDOW_ADDR(dev, dwa->win, dwa->target); if (error) { @@ -707,7 +707,7 @@ /** * Return the count of @p type register windows in @p table. - * + * * @param table The table to search. * @param type The required window type, or BHNDB_REGWIN_T_INVALID to * count all register window types. @@ -730,13 +730,13 @@ /** * Search @p table for the first window with the given @p type. - * + * * @param table The table to search. * @param type The required window type. * @param min_size The minimum window size. - * + * * @retval bhndb_regwin The first matching window. - * @retval NULL If no window of the requested type could be found. + * @retval NULL If no window of the requested type could be found. */ const struct bhndb_regwin * bhndb_regwin_find_type(const struct bhndb_regwin *table, @@ -755,7 +755,7 @@ /** * Search @p windows for the first matching core window. - * + * * @param table The table to search. * @param class The required core class. * @param unit The required core unit, or -1. @@ -764,14 +764,14 @@ * @param region The required region. * * @retval bhndb_regwin The first matching window. - * @retval NULL If no matching window was found. + * @retval NULL If no matching window was found. */ const struct bhndb_regwin * bhndb_regwin_find_core(const struct bhndb_regwin *table, bhnd_devclass_t class, int unit, bhnd_port_type port_type, u_int port, u_int region) { const struct bhndb_regwin *rw; - + for (rw = table; rw->win_type != BHNDB_REGWIN_T_INVALID; rw++) { if (rw->win_type != BHNDB_REGWIN_T_CORE) @@ -800,11 +800,11 @@ /** * Search @p windows for the best available window of at least @p min_size. - * + * * Search order: * - BHND_REGWIN_T_CORE * - BHND_REGWIN_T_DYN - * + * * @param table The table to search. * @param class The required core class. * @param unit The required core unit, or -1. @@ -814,7 +814,7 @@ * @param min_size The minimum window size. * * @retval bhndb_regwin The first matching window. - * @retval NULL If no matching window was found. + * @retval NULL If no matching window was found. */ const struct bhndb_regwin * bhndb_regwin_find_best(const struct bhndb_regwin *table, @@ -836,7 +836,7 @@ /** * Return true if @p regw defines a static port register window, and * the mapped port is actually defined on @p dev. - * + * * @param regw A register window to match against. * @param dev A bhnd(4) bus device. */ @@ -854,7 +854,7 @@ /* Device unit must match */ if (bhnd_get_core_unit(dev) != regw->win_spec.core.unit) return (false); - + /* The regwin port/region must be defined. */ if (!bhnd_is_region_valid(dev, regw->win_spec.core.port_type, regw->win_spec.core.port, regw->win_spec.core.region)) @@ -869,7 +869,7 @@ /** * Search for a core resource priority descriptor in @p table that matches * @p device. - * + * * @param table The table to search. * @param device A bhnd(4) bus device. */