mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
superio: Add superio_ldn_read and superio_ldn_write
Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/719
This commit is contained in:
parent
93f899bed5
commit
26a0a4035e
2 changed files with 29 additions and 13 deletions
|
|
@ -564,7 +564,7 @@ superio_detect(device_t dev, bool claim, struct siosc *sc)
|
|||
sc->vendor == SUPERIO_VENDOR_FINTEK,
|
||||
("Only ITE, Nuvoton and Fintek SuperIO-s are supported"));
|
||||
sc->ldn_reg = 0x07;
|
||||
sc->enable_reg = 0x30;
|
||||
sc->enable_reg = 0x30; /* FIXME enable_reg not used by nctgpio(4). */
|
||||
sc->current_ldn = 0xff; /* no device should have this */
|
||||
|
||||
if (superio_table[i].descr != NULL) {
|
||||
|
|
@ -878,29 +878,43 @@ superio_revid(device_t dev)
|
|||
}
|
||||
|
||||
uint8_t
|
||||
superio_read(device_t dev, uint8_t reg)
|
||||
superio_ldn_read(device_t dev, uint8_t ldn, uint8_t reg)
|
||||
{
|
||||
device_t sio_dev = device_get_parent(dev);
|
||||
struct siosc *sc = device_get_softc(sio_dev);
|
||||
struct superio_devinfo *dinfo = device_get_ivars(dev);
|
||||
uint8_t v;
|
||||
device_t sio_dev = device_get_parent(dev);
|
||||
struct siosc *sc = device_get_softc(sio_dev);
|
||||
uint8_t v;
|
||||
|
||||
sio_conf_enter(sc);
|
||||
v = sio_ldn_read(sc, dinfo->ldn, reg);
|
||||
v = sio_ldn_read(sc, ldn, reg);
|
||||
sio_conf_exit(sc);
|
||||
return (v);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
superio_read(device_t dev, uint8_t reg)
|
||||
{
|
||||
struct superio_devinfo *dinfo = device_get_ivars(dev);
|
||||
|
||||
return (superio_ldn_read(dev, dinfo->ldn, reg));
|
||||
}
|
||||
|
||||
void
|
||||
superio_ldn_write(device_t dev, uint8_t ldn, uint8_t reg, uint8_t val)
|
||||
{
|
||||
device_t sio_dev = device_get_parent(dev);
|
||||
struct siosc *sc = device_get_softc(sio_dev);
|
||||
|
||||
sio_conf_enter(sc);
|
||||
sio_ldn_write(sc, ldn, reg, val);
|
||||
sio_conf_exit(sc);
|
||||
}
|
||||
|
||||
void
|
||||
superio_write(device_t dev, uint8_t reg, uint8_t val)
|
||||
{
|
||||
device_t sio_dev = device_get_parent(dev);
|
||||
struct siosc *sc = device_get_softc(sio_dev);
|
||||
struct superio_devinfo *dinfo = device_get_ivars(dev);
|
||||
|
||||
sio_conf_enter(sc);
|
||||
sio_ldn_write(sc, dinfo->ldn, reg, val);
|
||||
sio_conf_exit(sc);
|
||||
return (superio_ldn_write(dev, dinfo->ldn, reg, val));
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -915,7 +929,7 @@ superio_dev_enabled(device_t dev, uint8_t mask)
|
|||
if (sc->vendor == SUPERIO_VENDOR_ITE && dinfo->ldn == 7)
|
||||
return (true);
|
||||
|
||||
v = superio_read(dev, sc->enable_reg);
|
||||
v = superio_read(dev, sc->enable_reg); /* FIXME enable_reg not used by nctgpio(4). */
|
||||
return ((v & mask) != 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ superio_vendor_t superio_vendor(device_t dev);
|
|||
uint16_t superio_devid(device_t dev);
|
||||
uint8_t superio_revid(device_t dev);
|
||||
uint8_t superio_read(device_t dev, uint8_t reg);
|
||||
uint8_t superio_ldn_read(device_t dev, uint8_t ldn, uint8_t reg);
|
||||
void superio_write(device_t dev, uint8_t reg, uint8_t val);
|
||||
void superio_ldn_write(device_t dev, uint8_t ldn, uint8_t reg, uint8_t val);
|
||||
bool superio_dev_enabled(device_t dev, uint8_t mask);
|
||||
void superio_dev_enable(device_t dev, uint8_t mask);
|
||||
void superio_dev_disable(device_t dev, uint8_t mask);
|
||||
|
|
|
|||
Loading…
Reference in a new issue