Wed Dec 26 06:45:58 2018 UTC ()
Fix 32bit build.


(mlelstv)
diff -r1.1 -r1.2 src/sys/dev/ipmi.c
diff -r1.1 -r1.2 src/sys/dev/acpi/ipmi_acpi.c

cvs diff -r1.1 -r1.2 src/sys/dev/ipmi.c (expand / switch to unified diff)

--- src/sys/dev/ipmi.c 2018/12/25 11:56:13 1.1
+++ src/sys/dev/ipmi.c 2018/12/26 06:45:58 1.2
@@ -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);

cvs diff -r1.1 -r1.2 src/sys/dev/acpi/ipmi_acpi.c (expand / switch to unified diff)

--- src/sys/dev/acpi/ipmi_acpi.c 2018/12/25 11:56:14 1.1
+++ src/sys/dev/acpi/ipmi_acpi.c 2018/12/26 06:45:58 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ipmi_acpi.c,v 1.1 2018/12/25 11:56:14 mlelstv Exp $ */ 1/* $NetBSD: ipmi_acpi.c,v 1.2 2018/12/26 06:45:58 mlelstv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2018 The NetBSD Foundation, Inc. 4 * Copyright (c) 2018 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Michael van Elst 8 * by Michael van Elst
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: ipmi_acpi.c,v 1.1 2018/12/25 11:56:14 mlelstv Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: ipmi_acpi.c,v 1.2 2018/12/26 06:45:58 mlelstv Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/module.h> 37#include <sys/module.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39 39
40#include <dev/acpi/acpireg.h> 40#include <dev/acpi/acpireg.h>
41#include <dev/acpi/acpivar.h> 41#include <dev/acpi/acpivar.h>
42 42
43#include <dev/ipmivar.h> 43#include <dev/ipmivar.h>
44 44
45#define _COMPONENT ACPI_RESOURCE_COMPONENT 45#define _COMPONENT ACPI_RESOURCE_COMPONENT
46ACPI_MODULE_NAME ("ipmi_acpi") 46ACPI_MODULE_NAME ("ipmi_acpi")
@@ -82,26 +82,27 @@ ipmi_acpi_attach(device_t parent, device @@ -82,26 +82,27 @@ ipmi_acpi_attach(device_t parent, device
82{ 82{
83 ipmi_acpi_softc_t *sc = device_private(self); 83 ipmi_acpi_softc_t *sc = device_private(self);
84 struct acpi_attach_args *aa = (struct acpi_attach_args *)opaque; 84 struct acpi_attach_args *aa = (struct acpi_attach_args *)opaque;
85 ACPI_STATUS rv; 85 ACPI_STATUS rv;
86 ACPI_INTEGER itype, ivers, adr; 86 ACPI_INTEGER itype, ivers, adr;
87 struct acpi_resources res; 87 struct acpi_resources res;
88 struct acpi_io *io; 88 struct acpi_io *io;
89 struct acpi_mem *mem; 89 struct acpi_mem *mem;
90#if notyet 90#if notyet
91 struct acpi_irq *irq; 91 struct acpi_irq *irq;
92#endif 92#endif
93 struct ipmi_attach_args IA, *ia = &IA; 93 struct ipmi_attach_args IA, *ia = &IA;
94 bus_addr_t reg2; 94 bus_addr_t reg2;
 95 uint16_t i2caddr;
95 96
96 sc->sc_dev = self; 97 sc->sc_dev = self;
97 98
98 aprint_naive("\n"); 99 aprint_naive("\n");
99 100
100 rv = acpi_eval_integer(aa->aa_node->ad_handle, "_IFT", &itype); 101 rv = acpi_eval_integer(aa->aa_node->ad_handle, "_IFT", &itype);
101 if (ACPI_FAILURE(rv)) { 102 if (ACPI_FAILURE(rv)) {
102 aprint_error("no _IFT\n"); 103 aprint_error("no _IFT\n");
103 return; 104 return;
104 } 105 }
105 106
106 rv = acpi_eval_integer(aa->aa_node->ad_handle, "_SRV", &ivers); 107 rv = acpi_eval_integer(aa->aa_node->ad_handle, "_SRV", &ivers);
107 if (ACPI_FAILURE(rv)) { 108 if (ACPI_FAILURE(rv)) {
@@ -163,27 +164,34 @@ ipmi_acpi_attach(device_t parent, device @@ -163,27 +164,34 @@ ipmi_acpi_attach(device_t parent, device
163 if (reg2 > ia->iaa_if_iobase) 164 if (reg2 > ia->iaa_if_iobase)
164 ia->iaa_if_iospacing = reg2 - ia->iaa_if_iobase; 165 ia->iaa_if_iospacing = reg2 - ia->iaa_if_iobase;
165 166
166 config_found_ia(self, "ipmibus", ia, 0); 167 config_found_ia(self, "ipmibus", ia, 0);
167 168
168 break; 169 break;
169 case IPMI_IF_SSIF: 170 case IPMI_IF_SSIF:
170 rv = acpi_eval_integer(aa->aa_node->ad_handle, "_ADR", &adr); 171 rv = acpi_eval_integer(aa->aa_node->ad_handle, "_ADR", &adr);
171 if (ACPI_FAILURE(rv)) { 172 if (ACPI_FAILURE(rv)) {
172 aprint_normal("\n"); 173 aprint_normal("\n");
173 aprint_error_dev(self, "no resources\n"); 174 aprint_error_dev(self, "no resources\n");
174 return; 175 return;
175 } 176 }
176 aprint_normal(": i2c 0x%lx\n", adr); 177 if (adr > 65535) {
 178 aprint_normal("\n");
 179 aprint_error_dev(self, "i2c address out of range\n");
 180 return;
 181 }
 182 i2caddr = adr;
 183
 184 aprint_normal(": i2c 0x%x\n", i2caddr);
177 break; 185 break;
178 default: 186 default:
179 aprint_normal("\n"); 187 aprint_normal("\n");
180 aprint_error_dev(self, "unknown interface type\n"); 188 aprint_error_dev(self, "unknown interface type\n");
181 return; 189 return;
182 } 190 }
183 191
184 sc->sc_init = true; 192 sc->sc_init = true;
185 193
186 if (!pmf_device_register(self, NULL, NULL)) 194 if (!pmf_device_register(self, NULL, NULL))
187 aprint_error_dev(self, "couldn't establish power handler\n"); 195 aprint_error_dev(self, "couldn't establish power handler\n");
188} 196}
189 197