Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/bhnd/nvram/bhnd_sprom.c
Show First 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | bhnd_sprom_detach(device_t dev) | ||||
return (0); | return (0); | ||||
} | } | ||||
/** | /** | ||||
* Default bhnd sprom driver implementation of BHND_NVRAM_GETVAR(). | * Default bhnd sprom driver implementation of BHND_NVRAM_GETVAR(). | ||||
*/ | */ | ||||
static int | static int | ||||
bhnd_sprom_getvar_meth(device_t dev, const char *name, void *buf, size_t *len) | bhnd_sprom_getvar_method(device_t dev, const char *name, void *buf, size_t *len, | ||||
bhnd_nvram_type type) | |||||
{ | { | ||||
struct bhnd_sprom_softc *sc; | struct bhnd_sprom_softc *sc; | ||||
int error; | int error; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
SPROM_LOCK(sc); | SPROM_LOCK(sc); | ||||
error = bhnd_sprom_getvar(&sc->shadow, name, buf, len); | error = bhnd_sprom_getvar(&sc->shadow, name, buf, len, type); | ||||
SPROM_UNLOCK(sc); | SPROM_UNLOCK(sc); | ||||
return (error); | return (error); | ||||
} | } | ||||
/** | /** | ||||
* Default bhnd sprom driver implementation of BHND_NVRAM_SETVAR(). | * Default bhnd sprom driver implementation of BHND_NVRAM_SETVAR(). | ||||
*/ | */ | ||||
static int | static int | ||||
bhnd_sprom_setvar_meth(device_t dev, const char *name, const void *buf, | bhnd_sprom_setvar_method(device_t dev, const char *name, const void *buf, | ||||
size_t len) | size_t len, bhnd_nvram_type type) | ||||
{ | { | ||||
struct bhnd_sprom_softc *sc; | struct bhnd_sprom_softc *sc; | ||||
int error; | int error; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
SPROM_LOCK(sc); | SPROM_LOCK(sc); | ||||
error = bhnd_sprom_setvar(&sc->shadow, name, buf, len); | error = bhnd_sprom_setvar(&sc->shadow, name, buf, len, type); | ||||
SPROM_UNLOCK(sc); | SPROM_UNLOCK(sc); | ||||
return (error); | return (error); | ||||
} | } | ||||
static device_method_t bhnd_sprom_methods[] = { | static device_method_t bhnd_sprom_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, bhnd_sprom_probe), | DEVMETHOD(device_probe, bhnd_sprom_probe), | ||||
DEVMETHOD(device_attach, bhnd_sprom_attach_meth), | DEVMETHOD(device_attach, bhnd_sprom_attach_meth), | ||||
DEVMETHOD(device_resume, bhnd_sprom_resume), | DEVMETHOD(device_resume, bhnd_sprom_resume), | ||||
DEVMETHOD(device_suspend, bhnd_sprom_suspend), | DEVMETHOD(device_suspend, bhnd_sprom_suspend), | ||||
DEVMETHOD(device_detach, bhnd_sprom_detach), | DEVMETHOD(device_detach, bhnd_sprom_detach), | ||||
/* NVRAM interface */ | /* NVRAM interface */ | ||||
DEVMETHOD(bhnd_nvram_getvar, bhnd_sprom_getvar_meth), | DEVMETHOD(bhnd_nvram_getvar, bhnd_sprom_getvar_method), | ||||
DEVMETHOD(bhnd_nvram_setvar, bhnd_sprom_setvar_meth), | DEVMETHOD(bhnd_nvram_setvar, bhnd_sprom_setvar_method), | ||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
DEFINE_CLASS_0(bhnd_nvram, bhnd_sprom_driver, bhnd_sprom_methods, sizeof(struct bhnd_sprom_softc)); | DEFINE_CLASS_0(bhnd_nvram, bhnd_sprom_driver, bhnd_sprom_methods, sizeof(struct bhnd_sprom_softc)); | ||||
MODULE_VERSION(bhnd_sprom, 1); | MODULE_VERSION(bhnd_sprom, 1); |