| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ipmi.c,v 1.1 2018/12/25 11:56:13 mlelstv Exp $ */ | | 1 | /* $NetBSD: ipmi.c,v 1.2 2018/12/26 06:45:58 mlelstv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2006 Manuel Bouyer. | | 4 | * Copyright (c) 2006 Manuel Bouyer. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -42,27 +42,27 @@ | | | @@ -42,27 +42,27 @@ |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR | | 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR |
45 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 45 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | | 51 | * SUCH DAMAGE. |
52 | */ | | 52 | */ |
53 | | | 53 | |
54 | #include <sys/cdefs.h> | | 54 | #include <sys/cdefs.h> |
55 | __KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.1 2018/12/25 11:56:13 mlelstv Exp $"); | | 55 | __KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.2 2018/12/26 06:45:58 mlelstv Exp $"); |
56 | | | 56 | |
57 | #include <sys/types.h> | | 57 | #include <sys/types.h> |
58 | #include <sys/param.h> | | 58 | #include <sys/param.h> |
59 | #include <sys/systm.h> | | 59 | #include <sys/systm.h> |
60 | #include <sys/kernel.h> | | 60 | #include <sys/kernel.h> |
61 | #include <sys/device.h> | | 61 | #include <sys/device.h> |
62 | #include <sys/extent.h> | | 62 | #include <sys/extent.h> |
63 | #include <sys/callout.h> | | 63 | #include <sys/callout.h> |
64 | #include <sys/envsys.h> | | 64 | #include <sys/envsys.h> |
65 | #include <sys/malloc.h> | | 65 | #include <sys/malloc.h> |
66 | #include <sys/kthread.h> | | 66 | #include <sys/kthread.h> |
67 | #include <sys/bus.h> | | 67 | #include <sys/bus.h> |
68 | #include <sys/intr.h> | | 68 | #include <sys/intr.h> |
| @@ -1841,27 +1841,27 @@ ipmi_map_regs(struct ipmi_softc *sc, str | | | @@ -1841,27 +1841,27 @@ ipmi_map_regs(struct ipmi_softc *sc, str |
1841 | if (ia->iaa_if_iotype == 'i') | | 1841 | if (ia->iaa_if_iotype == 'i') |
1842 | sc->sc_iot = ia->iaa_iot; | | 1842 | sc->sc_iot = ia->iaa_iot; |
1843 | else | | 1843 | else |
1844 | sc->sc_iot = ia->iaa_memt; | | 1844 | sc->sc_iot = ia->iaa_memt; |
1845 | | | 1845 | |
1846 | sc->sc_if_rev = ia->iaa_if_rev; | | 1846 | sc->sc_if_rev = ia->iaa_if_rev; |
1847 | sc->sc_if_iospacing = ia->iaa_if_iospacing; | | 1847 | sc->sc_if_iospacing = ia->iaa_if_iospacing; |
1848 | if ((error = bus_space_map(sc->sc_iot, ia->iaa_if_iobase, | | 1848 | if ((error = bus_space_map(sc->sc_iot, ia->iaa_if_iobase, |
1849 | sc->sc_if->nregs * sc->sc_if_iospacing, 0, &sc->sc_ioh)) != 0) { | | 1849 | sc->sc_if->nregs * sc->sc_if_iospacing, 0, &sc->sc_ioh)) != 0) { |
1850 | const char *xname = sc->sc_dev ? device_xname(sc->sc_dev) : | | 1850 | const char *xname = sc->sc_dev ? device_xname(sc->sc_dev) : |
1851 | "ipmi0"; | | 1851 | "ipmi0"; |
1852 | aprint_error("%s: %s:bus_space_map(..., %" PRIx64 ", %x" | | 1852 | aprint_error("%s: %s:bus_space_map(..., %" PRIx64 ", %x" |
1853 | ", 0, %p) type %c failed %d\n", | | 1853 | ", 0, %p) type %c failed %d\n", |
1854 | xname, __func__, ia->iaa_if_iobase, | | 1854 | xname, __func__, (uint64_t)ia->iaa_if_iobase, |
1855 | sc->sc_if->nregs * sc->sc_if_iospacing, &sc->sc_ioh, | | 1855 | sc->sc_if->nregs * sc->sc_if_iospacing, &sc->sc_ioh, |
1856 | ia->iaa_if_iotype, error); | | 1856 | ia->iaa_if_iotype, error); |
1857 | return -1; | | 1857 | return -1; |
1858 | } | | 1858 | } |
1859 | #if 0 | | 1859 | #if 0 |
1860 | if (iaa->if_if_irq != -1) | | 1860 | if (iaa->if_if_irq != -1) |
1861 | sc->ih = isa_intr_establish(-1, iaa->if_if_irq, | | 1861 | sc->ih = isa_intr_establish(-1, iaa->if_if_irq, |
1862 | iaa->if_irqlvl, IPL_BIO, ipmi_intr, sc, | | 1862 | iaa->if_irqlvl, IPL_BIO, ipmi_intr, sc, |
1863 | device_xname(sc->sc_dev); | | 1863 | device_xname(sc->sc_dev); |
1864 | #endif | | 1864 | #endif |
1865 | return 0; | | 1865 | return 0; |
1866 | } | | 1866 | } |
1867 | | | 1867 | |
| @@ -1990,27 +1990,28 @@ ipmi_thread(void *cookie) | | | @@ -1990,27 +1990,28 @@ ipmi_thread(void *cookie) |
1990 | | | 1990 | |
1991 | if (sysmon_envsys_register(sc->sc_envsys)) { | | 1991 | if (sysmon_envsys_register(sc->sc_envsys)) { |
1992 | aprint_error_dev(self, "unable to register with sysmon\n"); | | 1992 | aprint_error_dev(self, "unable to register with sysmon\n"); |
1993 | sysmon_envsys_destroy(sc->sc_envsys); | | 1993 | sysmon_envsys_destroy(sc->sc_envsys); |
1994 | } | | 1994 | } |
1995 | | | 1995 | |
1996 | /* initialize sensor list for thread */ | | 1996 | /* initialize sensor list for thread */ |
1997 | if (!SLIST_EMPTY(&ipmi_sensor_list)) | | 1997 | if (!SLIST_EMPTY(&ipmi_sensor_list)) |
1998 | sc->current_sensor = SLIST_FIRST(&ipmi_sensor_list); | | 1998 | sc->current_sensor = SLIST_FIRST(&ipmi_sensor_list); |
1999 | | | 1999 | |
2000 | aprint_verbose_dev(self, "version %d.%d interface %s %sbase " | | 2000 | aprint_verbose_dev(self, "version %d.%d interface %s %sbase " |
2001 | "0x%" PRIx64 "/%#x spacing %d\n", | | 2001 | "0x%" PRIx64 "/%#x spacing %d\n", |
2002 | ia->iaa_if_rev >> 4, ia->iaa_if_rev & 0xF, sc->sc_if->name, | | 2002 | ia->iaa_if_rev >> 4, ia->iaa_if_rev & 0xF, sc->sc_if->name, |
2003 | ia->iaa_if_iotype == 'i' ? "io" : "mem", ia->iaa_if_iobase, | | 2003 | ia->iaa_if_iotype == 'i' ? "io" : "mem", |
| | | 2004 | (uint64_t)ia->iaa_if_iobase, |
2004 | ia->iaa_if_iospacing * sc->sc_if->nregs, ia->iaa_if_iospacing); | | 2005 | ia->iaa_if_iospacing * sc->sc_if->nregs, ia->iaa_if_iospacing); |
2005 | if (ia->iaa_if_irq != -1) | | 2006 | if (ia->iaa_if_irq != -1) |
2006 | aprint_verbose_dev(self, " irq %d\n", ia->iaa_if_irq); | | 2007 | aprint_verbose_dev(self, " irq %d\n", ia->iaa_if_irq); |
2007 | | | 2008 | |
2008 | /* setup flag to exclude iic */ | | 2009 | /* setup flag to exclude iic */ |
2009 | ipmi_enabled = 1; | | 2010 | ipmi_enabled = 1; |
2010 | | | 2011 | |
2011 | /* Setup Watchdog timer */ | | 2012 | /* Setup Watchdog timer */ |
2012 | sc->sc_wdog.smw_name = device_xname(sc->sc_dev); | | 2013 | sc->sc_wdog.smw_name = device_xname(sc->sc_dev); |
2013 | sc->sc_wdog.smw_cookie = sc; | | 2014 | sc->sc_wdog.smw_cookie = sc; |
2014 | sc->sc_wdog.smw_setmode = ipmi_watchdog_setmode; | | 2015 | sc->sc_wdog.smw_setmode = ipmi_watchdog_setmode; |
2015 | sc->sc_wdog.smw_tickle = ipmi_watchdog_tickle; | | 2016 | sc->sc_wdog.smw_tickle = ipmi_watchdog_tickle; |
2016 | sysmon_wdog_register(&sc->sc_wdog); | | 2017 | sysmon_wdog_register(&sc->sc_wdog); |