Lines Matching full:bcm

71 					     struct bhnd_nvram_bcm *bcm,
74 struct bhnd_nvram_bcm *bcm,
77 struct bhnd_nvram_bcm *bcm,
80 * Set of BCM NVRAM header values that are required to be mirrored in the
117 /** BCM NVRAM data class instance */
123 /** BCM header values */
129 BHND_NVRAM_DATA_CLASS_DEFN(bcm, "Broadcom", BHND_NVRAM_DATA_CAP_DEVPATHS,
171 * Common BCM/BCMRAW implementation of bhnd_nvram_getvar_direct().
411 /* Fetch BCM nvram version from options */ in bhnd_nvram_bcm_serialize()
552 * Initialize @p bcm with the provided NVRAM data mapped by @p src.
554 * @param bcm A newly allocated data instance.
557 bhnd_nvram_bcm_init(struct bhnd_nvram_bcm *bcm, struct bhnd_nvram_io *src) in bhnd_nvram_bcm_init() argument
592 bcm->data = bhnd_nvram_iobuf_empty(io_size, io_size + 1); in bhnd_nvram_bcm_init()
593 if (bcm->data == NULL) in bhnd_nvram_bcm_init()
598 error = bhnd_nvram_io_write_ptr(bcm->data, 0x0, &ptr, io_size, NULL); in bhnd_nvram_bcm_init()
619 data = bhnd_nvram_bcm_gethdrvar(bcm, _name ##_VAR); \ in bhnd_nvram_bcm_init()
633 _Static_assert(nitems(bcm->hvars) == 4, "missing initialization for" in bhnd_nvram_bcm_init()
639 bcm->count = 0; in bhnd_nvram_bcm_init()
666 for (size_t i = 0; i < nitems(bcm->hvars); i++) { in bhnd_nvram_bcm_init()
671 hvar = &bcm->hvars[i]; in bhnd_nvram_bcm_init()
717 bcm->count++; in bhnd_nvram_bcm_init()
727 if ((error = bhnd_nvram_io_setsize(bcm->data, io_size))) in bhnd_nvram_bcm_init()
732 error = bhnd_nvram_io_write(bcm->data, io_size-1, &ch, in bhnd_nvram_bcm_init()
745 for (size_t i = 0; i < nitems(bcm->hvars); i++) { in bhnd_nvram_bcm_init()
746 if (bcm->hvars[i].envp == NULL) in bhnd_nvram_bcm_init()
747 bcm->count++; in bhnd_nvram_bcm_init()
752 error = bhnd_nvram_plist_append_bytes(bcm->opts, in bhnd_nvram_bcm_init()
764 struct bhnd_nvram_bcm *bcm; in bhnd_nvram_bcm_new() local
767 bcm = (struct bhnd_nvram_bcm *)nv; in bhnd_nvram_bcm_new()
769 /* Populate default BCM mirrored header variable set */ in bhnd_nvram_bcm_new()
770 _Static_assert(sizeof(bcm->hvars) == sizeof(bhnd_nvram_bcm_hvars), in bhnd_nvram_bcm_new()
772 memcpy(bcm->hvars, bhnd_nvram_bcm_hvars, sizeof(bcm->hvars)); in bhnd_nvram_bcm_new()
776 bcm->opts = bhnd_nvram_plist_new(); in bhnd_nvram_bcm_new()
777 if (bcm->opts == NULL) in bhnd_nvram_bcm_new()
780 /* Parse the BCM input data and initialize our backing in bhnd_nvram_bcm_new()
782 if ((error = bhnd_nvram_bcm_init(bcm, io))) { in bhnd_nvram_bcm_new()
793 struct bhnd_nvram_bcm *bcm = (struct bhnd_nvram_bcm *)nv; in bhnd_nvram_bcm_free() local
795 if (bcm->data != NULL) in bhnd_nvram_bcm_free()
796 bhnd_nvram_io_free(bcm->data); in bhnd_nvram_bcm_free()
798 if (bcm->opts != NULL) in bhnd_nvram_bcm_free()
799 bhnd_nvram_plist_release(bcm->opts); in bhnd_nvram_bcm_free()
805 struct bhnd_nvram_bcm *bcm = (struct bhnd_nvram_bcm *)nv; in bhnd_nvram_bcm_count() local
806 return (bcm->count); in bhnd_nvram_bcm_count()
812 struct bhnd_nvram_bcm *bcm = (struct bhnd_nvram_bcm *)nv; in bhnd_nvram_bcm_options() local
813 return (bcm->opts); in bhnd_nvram_bcm_options()
825 struct bhnd_nvram_bcm *bcm; in bhnd_nvram_bcm_next() local
832 bcm = (struct bhnd_nvram_bcm *)nv; in bhnd_nvram_bcm_next()
835 io_size = bhnd_nvram_io_getsize(bcm->data) - io_offset; in bhnd_nvram_bcm_next()
838 error = bhnd_nvram_io_read_ptr(bcm->data, io_offset, &ptr, io_size, in bhnd_nvram_bcm_next()
849 hvar = bhnd_nvram_bcm_to_hdrvar(bcm, *cookiep); in bhnd_nvram_bcm_next()
854 idx = bhnd_nvram_bcm_hdrvar_index(bcm, hvar) + 1; in bhnd_nvram_bcm_next()
858 for (size_t i = idx; i < nitems(bcm->hvars); i++) { in bhnd_nvram_bcm_next()
859 hvar_next = &bcm->hvars[i]; in bhnd_nvram_bcm_next()
893 for (size_t i = 0; i < nitems(bcm->hvars); i++) { in bhnd_nvram_bcm_next()
894 if (bcm->hvars[i].envp != envp) in bhnd_nvram_bcm_next()
897 hvar = &bcm->hvars[i]; in bhnd_nvram_bcm_next()
915 for (size_t i = 0; i < nitems(bcm->hvars); i++) { in bhnd_nvram_bcm_next()
916 if (bcm->hvars[i].envp != NULL) in bhnd_nvram_bcm_next()
919 *cookiep = &bcm->hvars[i]; in bhnd_nvram_bcm_next()
920 return (bcm->hvars[i].name); in bhnd_nvram_bcm_next()
941 struct bhnd_nvram_bcm *bcm; in bhnd_nvram_bcm_getvar_order() local
944 bcm = (struct bhnd_nvram_bcm *)nv; in bhnd_nvram_bcm_getvar_order()
946 hvar1 = bhnd_nvram_bcm_to_hdrvar(bcm, cookiep1); in bhnd_nvram_bcm_getvar_order()
947 hvar2 = bhnd_nvram_bcm_to_hdrvar(bcm, cookiep2); in bhnd_nvram_bcm_getvar_order()
950 * in the BCM data */ in bhnd_nvram_bcm_getvar_order()
988 struct bhnd_nvram_bcm *bcm; in bhnd_nvram_bcm_getvar_ptr() local
992 bcm = (struct bhnd_nvram_bcm *)nv; in bhnd_nvram_bcm_getvar_ptr()
995 if ((hvar = bhnd_nvram_bcm_to_hdrvar(bcm, cookiep)) != NULL) { in bhnd_nvram_bcm_getvar_ptr()
1018 struct bhnd_nvram_bcm *bcm; in bhnd_nvram_bcm_getvar_name() local
1021 bcm = (struct bhnd_nvram_bcm *)nv; in bhnd_nvram_bcm_getvar_name()
1024 if ((hvar = bhnd_nvram_bcm_to_hdrvar(bcm, cookiep)) != NULL) { in bhnd_nvram_bcm_getvar_name()
1043 /* Value must be bcm-formatted string */ in bhnd_nvram_bcm_filter_setvar()
1062 * Return the internal BCM data reference for a header-defined variable
1066 bhnd_nvram_bcm_gethdrvar(struct bhnd_nvram_bcm *bcm, const char *name) in bhnd_nvram_bcm_gethdrvar() argument
1068 for (size_t i = 0; i < nitems(bcm->hvars); i++) { in bhnd_nvram_bcm_gethdrvar()
1069 if (strcmp(bcm->hvars[i].name, name) == 0) in bhnd_nvram_bcm_gethdrvar()
1070 return (&bcm->hvars[i]); in bhnd_nvram_bcm_gethdrvar()
1079 * internal BCM data reference. Otherwise, returns NULL.
1082 bhnd_nvram_bcm_to_hdrvar(struct bhnd_nvram_bcm *bcm, void *cookiep) in bhnd_nvram_bcm_to_hdrvar() argument
1090 if (nitems(bcm->hvars) == 0) in bhnd_nvram_bcm_to_hdrvar()
1093 if (cookiep < (void *)&bcm->hvars[0]) in bhnd_nvram_bcm_to_hdrvar()
1096 if (cookiep > (void *)&bcm->hvars[nitems(bcm->hvars)-1]) in bhnd_nvram_bcm_to_hdrvar()
1100 base = (uintptr_t)bcm->hvars; in bhnd_nvram_bcm_to_hdrvar()
1103 BHND_NV_ASSERT((ptr - base) % sizeof(bcm->hvars[0]) == 0, in bhnd_nvram_bcm_to_hdrvar()
1104 ("misaligned hvar pointer %p/%p", cookiep, bcm->hvars)); in bhnd_nvram_bcm_to_hdrvar()
1111 * Return the index of @p hdrvar within @p bcm's backing hvars array.
1114 bhnd_nvram_bcm_hdrvar_index(struct bhnd_nvram_bcm *bcm, in bhnd_nvram_bcm_hdrvar_index() argument
1117 BHND_NV_ASSERT(bhnd_nvram_bcm_to_hdrvar(bcm, (void *)hdrvar) != NULL, in bhnd_nvram_bcm_hdrvar_index()
1120 return (hdrvar - &bcm->hvars[0]); in bhnd_nvram_bcm_hdrvar_index()