122b33ca4SAndrew Turner /*-
222b33ca4SAndrew Turner * Copyright (c) 2008 Benno Rice
322b33ca4SAndrew Turner * All rights reserved.
422b33ca4SAndrew Turner * Copyright (c) 2020 Andrew Turner
522b33ca4SAndrew Turner *
622b33ca4SAndrew Turner * Redistribution and use in source and binary forms, with or without
722b33ca4SAndrew Turner * modification, are permitted provided that the following conditions
822b33ca4SAndrew Turner * are met:
922b33ca4SAndrew Turner * 1. Redistributions of source code must retain the above copyright
1022b33ca4SAndrew Turner * notice, this list of conditions and the following disclaimer.
1122b33ca4SAndrew Turner * 2. Redistributions in binary form must reproduce the above copyright
1222b33ca4SAndrew Turner * notice, this list of conditions and the following disclaimer in the
1322b33ca4SAndrew Turner * documentation and/or other materials provided with the distribution.
1422b33ca4SAndrew Turner *
1522b33ca4SAndrew Turner * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1622b33ca4SAndrew Turner * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1722b33ca4SAndrew Turner * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1822b33ca4SAndrew Turner * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1922b33ca4SAndrew Turner * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2022b33ca4SAndrew Turner * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2122b33ca4SAndrew Turner * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2222b33ca4SAndrew Turner * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2322b33ca4SAndrew Turner * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2422b33ca4SAndrew Turner * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2522b33ca4SAndrew Turner *
2622b33ca4SAndrew Turner */
2722b33ca4SAndrew Turner
2822b33ca4SAndrew Turner #include <sys/param.h>
2922b33ca4SAndrew Turner #include <sys/bus.h>
3022b33ca4SAndrew Turner #include <sys/kernel.h>
3122b33ca4SAndrew Turner #include <sys/module.h>
3222b33ca4SAndrew Turner #include <sys/socket.h>
3322b33ca4SAndrew Turner #include <sys/systm.h>
3422b33ca4SAndrew Turner #include <sys/taskqueue.h>
3522b33ca4SAndrew Turner
3622b33ca4SAndrew Turner #include <net/if.h>
3722b33ca4SAndrew Turner
3822b33ca4SAndrew Turner #include <dev/smc/if_smcvar.h>
3922b33ca4SAndrew Turner
4022b33ca4SAndrew Turner #include <contrib/dev/acpica/include/acpi.h>
4122b33ca4SAndrew Turner #include <dev/acpica/acpivar.h>
4222b33ca4SAndrew Turner
4322b33ca4SAndrew Turner static int smc_acpi_probe(device_t);
4422b33ca4SAndrew Turner
4522b33ca4SAndrew Turner static int
smc_acpi_probe(device_t dev)4622b33ca4SAndrew Turner smc_acpi_probe(device_t dev)
4722b33ca4SAndrew Turner {
4822b33ca4SAndrew Turner struct smc_softc *sc;
4922b33ca4SAndrew Turner ACPI_HANDLE h;
5022b33ca4SAndrew Turner
5122b33ca4SAndrew Turner if ((h = acpi_get_handle(dev)) == NULL)
5222b33ca4SAndrew Turner return (ENXIO);
5322b33ca4SAndrew Turner
5422b33ca4SAndrew Turner if (!acpi_MatchHid(h, "LNRO0003"))
5522b33ca4SAndrew Turner return (ENXIO);
5622b33ca4SAndrew Turner
5722b33ca4SAndrew Turner sc = device_get_softc(dev);
5822b33ca4SAndrew Turner sc->smc_usemem = 1;
5922b33ca4SAndrew Turner
6022b33ca4SAndrew Turner return (smc_probe(dev));
6122b33ca4SAndrew Turner }
6222b33ca4SAndrew Turner
6322b33ca4SAndrew Turner static device_method_t smc_acpi_methods[] = {
6422b33ca4SAndrew Turner /* Device interface */
6522b33ca4SAndrew Turner DEVMETHOD(device_probe, smc_acpi_probe),
6622b33ca4SAndrew Turner { 0, 0 }
6722b33ca4SAndrew Turner };
6822b33ca4SAndrew Turner
6922b33ca4SAndrew Turner DEFINE_CLASS_1(smc, smc_acpi_driver, smc_acpi_methods,
7022b33ca4SAndrew Turner sizeof(struct smc_softc), smc_driver);
7122b33ca4SAndrew Turner
72*e88935abSJohn Baldwin DRIVER_MODULE(smc, acpi, smc_acpi_driver, 0, 0);
7322b33ca4SAndrew Turner MODULE_DEPEND(smc, acpi, 1, 1, 1);
7422b33ca4SAndrew Turner MODULE_DEPEND(smc, ether, 1, 1, 1);
7522b33ca4SAndrew Turner MODULE_DEPEND(smc, miibus, 1, 1, 1);
76