Lines Matching full:layout

60  * The SPROM data format is a fixed-layout, non-self-descriptive binary format,
112 * the @p layout's expected magic value.
114 * If @p layout does not defined a magic value, @p magic is set to 0x0
118 * @param layout The SPROM layout against which @p io should be verified.
127 const bhnd_sprom_layout *layout, uint16_t *magic) in bhnd_nvram_sprom_check_magic() argument
131 /* Skip if layout does not define a magic value */ in bhnd_nvram_sprom_check_magic()
132 if (layout->flags & SPROM_LAYOUT_MAGIC_NONE) in bhnd_nvram_sprom_check_magic()
136 error = bhnd_nvram_io_read(io, layout->magic_offset, magic, in bhnd_nvram_sprom_check_magic()
143 /* If the signature does not match, skip to next layout */ in bhnd_nvram_sprom_check_magic()
144 if (*magic != layout->magic_value) in bhnd_nvram_sprom_check_magic()
159 * @param[out] ident On success, the identified SPROM layout.
181 const bhnd_sprom_layout *layout; in bhnd_nvram_sprom_ident() local
190 layout = &bhnd_sprom_layouts[i]; in bhnd_nvram_sprom_ident()
194 if ((layout->flags & SPROM_LAYOUT_MAGIC_NONE)) in bhnd_nvram_sprom_ident()
201 * Layout instances must be ordered from smallest to largest by in bhnd_nvram_sprom_ident()
205 if (nbytes > layout->size) in bhnd_nvram_sprom_ident()
206 BHND_NV_PANIC("SPROM layout defined out-of-order"); in bhnd_nvram_sprom_ident()
208 nread = layout->size - nbytes; in bhnd_nvram_sprom_ident()
229 error = bhnd_nvram_io_read(io, layout->srev_offset, &srevcrc, in bhnd_nvram_sprom_ident()
239 if (layout->rev == 1 && srev == 0x10) in bhnd_nvram_sprom_ident()
242 /* Check revision against the layout definition */ in bhnd_nvram_sprom_ident()
243 if (srev != layout->rev) in bhnd_nvram_sprom_ident()
246 /* Check the magic value, skipping to the next layout on in bhnd_nvram_sprom_ident()
248 error = bhnd_nvram_sprom_check_magic(io, layout, &magic); in bhnd_nvram_sprom_ident()
254 magic, layout->magic_value); in bhnd_nvram_sprom_ident()
276 *ident = layout; in bhnd_nvram_sprom_ident()
292 const bhnd_sprom_layout *layout; in bhnd_nvram_sprom_probe() local
296 if ((error = bhnd_nvram_sprom_ident(io, &layout))) in bhnd_nvram_sprom_probe()
306 const bhnd_sprom_layout *layout; in bhnd_nvram_sprom_getvar_direct() local
318 /* Identify the SPROM image layout */ in bhnd_nvram_sprom_getvar_direct()
319 if ((error = bhnd_nvram_sprom_ident(io, &layout))) in bhnd_nvram_sprom_getvar_direct()
322 /* Initialize SPROM layout interpreter */ in bhnd_nvram_sprom_getvar_direct()
323 if ((error = bhnd_sprom_opcode_init(&state, layout))) { in bhnd_nvram_sprom_getvar_direct()
328 /* Find SPROM layout entry for the requested variable */ in bhnd_nvram_sprom_getvar_direct()
365 * Return the SPROM layout definition for the given @p sromrev, or NULL if
371 /* Find matching SPROM layout definition */ in bhnd_nvram_sprom_get_layout()
384 * @param state The SPROM opcode state describing the layout of @p io.
416 /* Fetch the element count from the SPROM variable layout definition */ in bhnd_nvram_sprom_write_var()
520 * Seek to the start of the variable's SPROM layout definition and in bhnd_nvram_sprom_write_var()
616 const bhnd_sprom_layout *layout; in bhnd_nvram_sprom_serialize() local
623 layout = NULL; in bhnd_nvram_sprom_serialize()
639 /* Find SPROM layout definition */ in bhnd_nvram_sprom_serialize()
640 if ((layout = bhnd_nvram_sprom_get_layout(sromrev)) == NULL) { in bhnd_nvram_sprom_serialize()
646 *olen = layout->size; in bhnd_nvram_sprom_serialize()
652 /* Initialize SPROM layout interpreter */ in bhnd_nvram_sprom_serialize()
653 if ((error = bhnd_sprom_opcode_init(&state, layout))) { in bhnd_nvram_sprom_serialize()
663 /* Fetch the corresponding SPROM layout index entry */ in bhnd_nvram_sprom_serialize()
668 "%hhu\n", name, layout->rev); in bhnd_nvram_sprom_serialize()
723 if (!(layout->flags & SPROM_LAYOUT_MAGIC_NONE)) { in bhnd_nvram_sprom_serialize()
726 magic = htole16(layout->magic_value); in bhnd_nvram_sprom_serialize()
727 error = bhnd_nvram_io_write(io, layout->magic_offset, &magic, in bhnd_nvram_sprom_serialize()
736 crc = ~bhnd_nvram_crc8(outp, layout->crc_offset, in bhnd_nvram_sprom_serialize()
740 error = bhnd_nvram_io_write(io, layout->crc_offset, &crc, sizeof(crc)); in bhnd_nvram_sprom_serialize()
769 if ((error = bhnd_nvram_sprom_ident(io, &sp->layout))) in bhnd_nvram_sprom_new()
773 sp->data = bhnd_nvram_iobuf_copy_range(io, 0, sp->layout->size); in bhnd_nvram_sprom_new()
778 if ((error = bhnd_sprom_opcode_init(&sp->state, sp->layout))) in bhnd_nvram_sprom_new()
803 return (sprom->layout->num_vars); in bhnd_nvram_sprom_count()
1049 * @param state The SPROM opcode state describing the layout of @p io.
1397 /* Variable must be defined in our SPROM layout */ in bhnd_nvram_sprom_filter_setvar()
1410 /* Value must be encodeable by our SPROM layout */ in bhnd_nvram_sprom_filter_setvar()
1436 /* Variable must be defined in our SPROM layout */ in bhnd_nvram_sprom_filter_unsetvar()
1445 * Since SPROM's layout is fixed, this requires IGNALL -- if in bhnd_nvram_sprom_filter_unsetvar()
1462 /* The layout revision is immutable and cannot be changed */ in bhnd_sprom_is_external_immutable()