Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/asmc/asmc.c
| Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
| #include <sys/module.h> | #include <sys/module.h> | ||||
| #include <sys/mutex.h> | #include <sys/mutex.h> | ||||
| #include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
| #include <sys/systm.h> | #include <sys/systm.h> | ||||
| #include <sys/taskqueue.h> | #include <sys/taskqueue.h> | ||||
| #include <sys/rman.h> | #include <sys/rman.h> | ||||
| #include <machine/resource.h> | #include <machine/resource.h> | ||||
| #include <netinet/in.h> | |||||
| #include <contrib/dev/acpica/include/acpi.h> | #include <contrib/dev/acpica/include/acpi.h> | ||||
| #include <dev/acpica/acpivar.h> | #include <dev/acpica/acpivar.h> | ||||
| #include <dev/asmc/asmcvar.h> | #include <dev/asmc/asmcvar.h> | ||||
| /* | /* | ||||
| * Device interface. | * Device interface. | ||||
| ▲ Show 20 Lines • Show All 868 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| #endif | #endif | ||||
| static int | static int | ||||
| asmc_init(device_t dev) | asmc_init(device_t dev) | ||||
| { | { | ||||
| struct asmc_softc *sc = device_get_softc(dev); | struct asmc_softc *sc = device_get_softc(dev); | ||||
| struct sysctl_ctx_list *sysctlctx; | struct sysctl_ctx_list *sysctlctx; | ||||
| uint8_t buf[6]; | |||||
| int i, error = 1; | int i, error = 1; | ||||
| uint8_t buf[4]; | |||||
| sysctlctx = device_get_sysctl_ctx(dev); | sysctlctx = device_get_sysctl_ctx(dev); | ||||
| error = asmc_key_read(dev, ASMC_KEY_REV, buf, 6); | |||||
| if (error != 0) | |||||
| goto out_err; | |||||
| device_printf(dev, "SMC revision: %x.%x%x%x\n", buf[0], buf[1], buf[2], | |||||
| ntohs(*(uint16_t *)buf + 4)); | |||||
| if (sc->sc_model->smc_sms_x == NULL) | if (sc->sc_model->smc_sms_x == NULL) | ||||
| goto nosms; | goto nosms; | ||||
| /* | /* | ||||
| * We are ready to receive interrupts from the SMS. | * We are ready to receive interrupts from the SMS. | ||||
| */ | */ | ||||
| buf[0] = 0x01; | buf[0] = 0x01; | ||||
| ASMC_DPRINTF(("intok key\n")); | ASMC_DPRINTF(("intok key\n")); | ||||
| ▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | if (asmc_key_read(dev, ASMC_NKEYS, buf, 4) == 0) { | ||||
| sc->sc_nkeys = be32dec(buf); | sc->sc_nkeys = be32dec(buf); | ||||
| if (bootverbose) | if (bootverbose) | ||||
| device_printf(dev, "number of keys: %d\n", | device_printf(dev, "number of keys: %d\n", | ||||
| sc->sc_nkeys); | sc->sc_nkeys); | ||||
| } else { | } else { | ||||
| sc->sc_nkeys = 0; | sc->sc_nkeys = 0; | ||||
| } | } | ||||
| out_err: | |||||
| #ifdef ASMC_DEBUG | #ifdef ASMC_DEBUG | ||||
| asmc_dumpall(dev); | asmc_dumpall(dev); | ||||
| #endif | #endif | ||||
| return (error); | return (error); | ||||
| } | } | ||||
| /* | /* | ||||
| * We need to make sure that the SMC acks the byte sent. | * We need to make sure that the SMC acks the byte sent. | ||||
| * Just wait up to (amount * 10) ms. | * Just wait up to (amount * 10) ms. | ||||
| */ | */ | ||||
| static int | static int | ||||
| ▲ Show 20 Lines • Show All 752 Lines • Show Last 20 Lines | |||||