MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bcm_find_core

Function bcm_find_core

freebsd/mips/broadcom/bcm_machdep.c:184–219  ·  view source on GitHub ↗

* Search the device enumeration table for a core matching @p descs, * * @param bp Platform state containing a valid EROM parser. * @param descs The core match descriptor table. * @param num_descs The number of match descriptors in @p descs. * @param[out] info If non-NULL, will be populated with the core * info. * @param[out] addr If non-NULL, will be populated with the core's *

Source from the content-addressed store, hash-verified

182 * physical register address.
183 */
184static int
185bcm_find_core(struct bcm_platform *bp, const struct bhnd_core_match *descs,
186 size_t num_descs, struct bhnd_core_info *info, uintptr_t *addr)
187{
188 bhnd_addr_t b_addr;
189 bhnd_size_t b_size;
190 int error;
191
192 /* Fetch core info */
193 for (size_t i = 0; i < num_descs; i++) {
194 error = bhnd_erom_lookup_core_addr(&bp->erom.obj, &descs[i],
195 BHND_PORT_DEVICE, 0, 0, info, &b_addr, &b_size);
196
197 /* Terminate search on first match */
198 if (error == 0)
199 break;
200
201 /* Terminate on first error (other than core not found) */
202 if (error != ENOENT)
203 return (error);
204
205 /* Continue search ... */
206 }
207
208 /* Provide the core's base address */
209 if (addr != NULL && b_addr > UINTPTR_MAX) {
210 BCM_ERR("core address %#jx overflows native address width\n",
211 (uintmax_t)b_addr);
212 return (ERANGE);
213 }
214
215 if (addr != NULL)
216 *addr = b_addr;
217
218 return (0);
219}
220
221/**
222 * Read a variable directly from NVRAM, decoding as @p type.

Callers 1

bcm_init_platform_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected