Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/nvram/bhnd_nvramvar.h
- This file was copied from sys/dev/bhnd/nvram/bhnd_spromreg.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 13 Lines | |||||
* 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_SPROMREG_H_ | #ifndef _BHND_NVRAM_BHND_NVRAMVAR_H_ | ||||
#define _BHND_NVRAM_SPROMREG_H_ | #define _BHND_NVRAM_BHND_NVRAMVAR_H_ | ||||
#define SPROM_SZ_R1_3 128 /**< SPROM image size (rev 1-3) */ | #include <sys/param.h> | ||||
#define SPROM_SZ_R4_8_9 440 /**< SPROM image size (rev 4, 8-9) */ | #include <sys/bus.h> | ||||
#define SPROM_SZ_R10 460 /**< SPROM image size (rev 10) */ | |||||
#define SPROM_SZ_R11 468 /**< SPROM image size (rev 11) */ | |||||
/** Maximum supported SPROM image size */ | #include "bhnd_nvram_parser.h" | ||||
#define SPROM_SZ_MAX SPROM_SZ_R11 | |||||
#define SPROM_SIG_NONE 0x0 | DECLARE_CLASS(bhnd_nvram_driver); | ||||
#define SPROM_SIG_NONE_OFF 0x0 | |||||
/** SPROM signature (rev 4) */ | int bhnd_nvram_probe(device_t dev); | ||||
#define SPROM_SIG_R4 0x5372 | int bhnd_nvram_attach(device_t dev, void *data, size_t size, | ||||
#define SPROM_SIG_R4_OFF 64 /**< SPROM signature offset (rev 4) */ | bhnd_nvram_format fmt); | ||||
int bhnd_nvram_resume(device_t dev); | |||||
int bhnd_nvram_suspend(device_t dev); | |||||
int bhnd_nvram_detach(device_t dev); | |||||
/** SPROM signature (rev 8, 9) */ | /** | ||||
#define SPROM_SIG_R8_9 SPROM_SIG_R4 | * bhnd_nvram driver instance state. Must be first member of all subclass | ||||
#define SPROM_SIG_R8_9_OFF 128 /**< SPROM signature offset (rev 8-9) */ | * softc structures. | ||||
*/ | |||||
struct bhnd_nvram_softc { | |||||
device_t dev; | |||||
struct mtx mtx; /**< nvram mutex */ | |||||
struct bhnd_nvram nvram; /**< nvram shadow */ | |||||
}; | |||||
/** 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 BHND_NVRAM_LOCK_INIT(sc) \ | ||||
#define SPROM_SIG_R11 0x0634 | mtx_init(&(sc)->mtx, device_get_nameunit((sc)->dev), \ | ||||
#define SPROM_SIG_R11_OFF 128 /**< SPROM signature offset (rev 11) */ | "bhnd_nvram lock", MTX_DEF) | ||||
#define BHND_NVRAM_LOCK(sc) mtx_lock(&(sc)->mtx) | |||||
#define BHND_NVRAM_UNLOCK(sc) mtx_unlock(&(sc)->mtx) | |||||
#define BHND_NVRAM_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->mtx, what) | |||||
#define BHND_NVRAM_LOCK_DESTROY(sc) mtx_destroy(&(sc)->mtx) | |||||
#endif /* _BHND_NVRAM_BHND_NVRAMVAR_H_ */ | |||||
#endif /* _BHND_NVRAM_SPROMREG_H_ */ |