Path: blob/main/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmvar.h
39536 views
/*-1* Copyright (c) 2015-2016 Landon Fuller <[email protected]>2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer,9* without modification.10* 2. Redistributions in binary form must reproduce at minimum a disclaimer11* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any12* redistribution must be conditioned upon including a substantially13* similar Disclaimer requirement for further binary redistribution.14*15* NO WARRANTY16* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS17* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT18* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY19* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL20* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,21* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF22* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS23* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER24* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)25* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF26* THE POSSIBILITY OF SUCH DAMAGES.27*/2829#ifndef _BHND_NVRAM_BHND_NVRAM_BCMVAR_H_30#define _BHND_NVRAM_BHND_NVRAM_BCMVAR_H_3132#define BCM_NVRAM_ENCODE_OPT_VERSION "bcm_version"3334/**35* BCM NVRAM header value data.36*/37union bhnd_nvram_bcm_hvar_value {38uint16_t u16;39uint32_t u32;40};4142/**43* Internal representation of BCM NVRAM values that mirror (and must be44* vended as) NVRAM variables.45*/46struct bhnd_nvram_bcm_hvar {47const char *name; /**< variable name */48bhnd_nvram_type type; /**< value type */49size_t nelem; /**< value element count */50size_t len; /**< value length */51const char *envp; /**< Pointer to the NVRAM variable mirroring52this header value, or NULL. */53bool stale; /**< header value does not match54mirrored NVRAM value */5556/** variable data */57union bhnd_nvram_bcm_hvar_value value;58};5960/** BCM NVRAM header */61struct bhnd_nvram_bcmhdr {62uint32_t magic;63uint32_t size;64uint32_t cfg0; /**< crc:8, version:8, sdram_init:16 */65uint32_t cfg1; /**< sdram_config:16, sdram_refresh:16 */66uint32_t sdram_ncdl; /**< sdram_ncdl */67} __packed;6869int bhnd_nvram_bcm_getvar_direct_common(struct bhnd_nvram_io *io,70const char *name, void *outp, size_t *olen, bhnd_nvram_type otype,71bool have_header);7273#endif /* _BHND_NVRAM_BHND_NVRAM_BCMVAR_H_ */747576