Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/superio/superio.c
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | |||||
const struct sio_device nct5104_devices[] = { | const struct sio_device nct5104_devices[] = { | ||||
{ .ldn = 7, .type = SUPERIO_DEV_GPIO }, | { .ldn = 7, .type = SUPERIO_DEV_GPIO }, | ||||
{ .ldn = 8, .type = SUPERIO_DEV_WDT }, | { .ldn = 8, .type = SUPERIO_DEV_WDT }, | ||||
{ .ldn = 15, .type = SUPERIO_DEV_GPIO }, | { .ldn = 15, .type = SUPERIO_DEV_GPIO }, | ||||
{ .type = SUPERIO_DEV_NONE }, | { .type = SUPERIO_DEV_NONE }, | ||||
}; | }; | ||||
const struct sio_device fintek_devices[] = { | const struct sio_device fintek_devices[] = { | ||||
{ .ldn = 6, .type = SUPERIO_DEV_GPIO }, | |||||
{ .ldn = 7, .type = SUPERIO_DEV_WDT }, | { .ldn = 7, .type = SUPERIO_DEV_WDT }, | ||||
{ .type = SUPERIO_DEV_NONE }, | { .type = SUPERIO_DEV_NONE }, | ||||
}; | }; | ||||
static const struct { | static const struct { | ||||
superio_vendor_t vendor; | superio_vendor_t vendor; | ||||
uint16_t devid; | uint16_t devid; | ||||
uint16_t mask; | uint16_t mask; | ||||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | const struct sio_device *devices; | ||||
.devices = nvt_devices, | .devices = nvt_devices, | ||||
}, | }, | ||||
{ | { | ||||
.vendor = SUPERIO_VENDOR_NUVOTON, .devid = 0xd300, .mask = 0xff, | .vendor = SUPERIO_VENDOR_NUVOTON, .devid = 0xd300, .mask = 0xff, | ||||
.descr = "Nuvoton NCT6795", | .descr = "Nuvoton NCT6795", | ||||
.devices = nvt_devices, | .devices = nvt_devices, | ||||
}, | }, | ||||
{ | { | ||||
.vendor = SUPERIO_VENDOR_FINTEK, .devid = 0x1210, .mask = 0xff, | .vendor = SUPERIO_VENDOR_FINTEK, .devid = 0x1210, .mask = 0xff, | ||||
stephane.rochoy_stormshield.eu: BTW, I wonder if it wouldn't be more consistent with the mask to set `.devid` to 0x1200. Or… | |||||
impUnsubmitted Not Done Inline ActionsMask here makes little sense, I think. The whole point of the mask is to make it easier to support a range of parts since superio parts tended to have a crazy number of variations on a theme, all with different IDs imp: Mask here makes little sense, I think. The whole point of the mask is to make it easier to… | |||||
.descr = "Fintek F81803", | .descr = "Fintek F81803", | ||||
.devices = fintek_devices, | .devices = fintek_devices, | ||||
}, | }, | ||||
{ | |||||
.vendor = SUPERIO_VENDOR_FINTEK, .devid = 0x0704, | |||||
.descr = "Fintek F81865", | |||||
.devices = fintek_devices, | |||||
}, | |||||
{ 0, 0 } | { 0, 0 } | ||||
}; | }; | ||||
static const char * | static const char * | ||||
devtype_to_str(superio_dev_type_t type) | devtype_to_str(superio_dev_type_t type) | ||||
{ | { | ||||
switch (type) { | switch (type) { | ||||
case SUPERIO_DEV_NONE: | case SUPERIO_DEV_NONE: | ||||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | superio_detect(device_t dev, bool claim, struct siosc *sc) | ||||
sc->known_devices = superio_table[i].devices; | sc->known_devices = superio_table[i].devices; | ||||
sc->io_res = res; | sc->io_res = res; | ||||
sc->io_rid = rid; | sc->io_rid = rid; | ||||
sc->io_port = port; | sc->io_port = port; | ||||
sc->devid = devid; | sc->devid = devid; | ||||
sc->revid = revid; | sc->revid = revid; | ||||
KASSERT(sc->vendor == SUPERIO_VENDOR_ITE || | KASSERT(sc->vendor == SUPERIO_VENDOR_ITE || | ||||
sc->vendor == SUPERIO_VENDOR_NUVOTON, | sc->vendor == SUPERIO_VENDOR_NUVOTON || | ||||
("Only ITE and Nuvoton SuperIO-s are supported")); | sc->vendor == SUPERIO_VENDOR_FINTEK, | ||||
("Only ITE, Nuvoton and Fintek SuperIO-s are supported")); | |||||
sc->ldn_reg = 0x07; | sc->ldn_reg = 0x07; | ||||
sc->enable_reg = 0x30; | sc->enable_reg = 0x30; | ||||
sc->current_ldn = 0xff; /* no device should have this */ | sc->current_ldn = 0xff; /* no device should have this */ | ||||
if (superio_table[i].descr != NULL) { | if (superio_table[i].descr != NULL) { | ||||
device_set_desc(dev, superio_table[i].descr); | device_set_desc(dev, superio_table[i].descr); | ||||
} else if (sc->vendor == SUPERIO_VENDOR_ITE) { | } else if (sc->vendor == SUPERIO_VENDOR_ITE) { | ||||
char descr[64]; | char descr[64]; | ||||
▲ Show 20 Lines • Show All 470 Lines • Show Last 20 Lines |
BTW, I wonder if it wouldn't be more consistent with the mask to set .devid to 0x1200. Or, maybe, just remove the mask as this entry seems to be only about one specific device.