Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/nvram/bhnd_nvram_data_bcmvar.h
- This file was moved from sys/dev/bhnd/nvram/bhnd_sprom_parservar.h.
/*- | /*- | ||||
* Copyright (c) 2016 Landon Fuller <landon@landonf.org> | * Copyright (c) 2015-2016 Landon Fuller <landonf@FreeBSD.org> | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
* notice, this list of conditions and the following disclaimer, | * notice, this list of conditions and the following disclaimer, | ||||
* without modification. | * without modification. | ||||
Show All 9 Lines | |||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||||
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, | ||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||||
* THE POSSIBILITY OF SUCH DAMAGES. | * THE POSSIBILITY OF SUCH DAMAGES. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _BHND_NVRAM_SPROM_PARSERVAR_H_ | #ifndef _BHND_NVRAM_BHND_NVRAM_BCMVAR_H_ | ||||
#define _BHND_NVRAM_SPROM_PARSERVAR_H_ | #define _BHND_NVRAM_BHND_NVRAM_BCMVAR_H_ | ||||
#include "bhnd_sprom_parser.h" | /** | ||||
* BCM NVRAM header value data. | |||||
*/ | |||||
union bhnd_nvram_bcm_hvar_value { | |||||
uint16_t u16; | |||||
uint32_t u32; | |||||
}; | |||||
#define SPROM_SZ_R1_3 128 /**< SPROM image size (rev 1-3) */ | /** | ||||
#define SPROM_SZ_R4_8_9 440 /**< SPROM image size (rev 4, 8-9) */ | * Internal representation of BCM NVRAM values that mirror (and must be | ||||
#define SPROM_SZ_R10 460 /**< SPROM image size (rev 10) */ | * vended as) NVRAM variables. | ||||
#define SPROM_SZ_R11 468 /**< SPROM image size (rev 11) */ | */ | ||||
struct bhnd_nvram_bcm_hvar { | |||||
const char *name; /**< variable name */ | |||||
bhnd_nvram_type type; /**< value type */ | |||||
size_t nelem; /**< value element count */ | |||||
size_t len; /**< value length */ | |||||
const char *envp; /**< Pointer to the NVRAM variable mirroring | |||||
this header value, or NULL. */ | |||||
bool stale; /**< header value does not match | |||||
mirrored NVRAM value */ | |||||
/** Maximum supported SPROM image size */ | /** variable data */ | ||||
#define SPROM_SZ_MAX SPROM_SZ_R11 | union bhnd_nvram_bcm_hvar_value value; | ||||
}; | |||||
#define SPROM_SIG_NONE 0x0 | /** BCM NVRAM header */ | ||||
#define SPROM_SIG_NONE_OFF 0x0 | struct bhnd_nvram_bcmhdr { | ||||
uint32_t magic; | |||||
uint32_t size; | |||||
uint32_t cfg0; /**< crc:8, version:8, sdram_init:16 */ | |||||
uint32_t cfg1; /**< sdram_config:16, sdram_refresh:16 */ | |||||
uint32_t sdram_ncdl; /**< sdram_ncdl */ | |||||
} __packed; | |||||
/** SPROM signature (rev 4) */ | #endif /* _BHND_NVRAM_BHND_NVRAM_BCMVAR_H_ */ | ||||
#define SPROM_SIG_R4 0x5372 | |||||
#define SPROM_SIG_R4_OFF 64 /**< SPROM signature offset (rev 4) */ | |||||
/** SPROM signature (rev 8, 9) */ | |||||
#define SPROM_SIG_R8_9 SPROM_SIG_R4 | |||||
#define SPROM_SIG_R8_9_OFF 128 /**< SPROM signature offset (rev 8-9) */ | |||||
/** SPROM signature (rev 10) */ | |||||
#define SPROM_SIG_R10 SPROM_SIG_R4 | |||||
#define SPROM_SIG_R10_OFF 438 /**< SPROM signature offset (rev 10) */ | |||||
/** SPROM signature (rev 11) */ | |||||
#define SPROM_SIG_R11 0x0634 | |||||
#define SPROM_SIG_R11_OFF 128 /**< SPROM signature offset (rev 11) */ | |||||
#endif /* _BHND_NVRAM_SPROM_PARSERVAR_H_ */ |