Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Make ipmi driver available to other platforms.
details: https://anonhg.NetBSD.org/src/rev/6734f8e42331
branches: trunk
changeset: 995504:6734f8e42331
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Tue Dec 25 11:56:13 2018 +0000
description:
Make ipmi driver available to other platforms.
Add ACPI attachment.
diffstat:
sys/arch/amd64/conf/GENERIC | 10 +-
sys/arch/amd64/conf/XEN3_DOM0 | 6 +-
sys/arch/i386/conf/GENERIC | 6 +-
sys/arch/i386/conf/XEN3PAE_DOM0 | 4 +-
sys/arch/x86/conf/files.x86 | 7 +-
sys/arch/x86/include/ipmivar.h | 321 +-----
sys/arch/x86/x86/ipmi.c | 2321 ---------------------------------------
sys/arch/x86/x86/x86_ipmi.c | 205 +++
sys/arch/xen/conf/files.xen | 7 +-
sys/conf/files | 7 +-
sys/dev/acpi/files.acpi | 7 +-
sys/dev/acpi/ipmi_acpi.c | 205 +++
sys/dev/files.dev | 3 +-
sys/dev/ipmi.c | 2205 +++++++++++++++++++++++++++++++++++++
sys/dev/ipmivar.h | 300 +++++
15 files changed, 2955 insertions(+), 2659 deletions(-)
diffs (truncated from 5810 to 300 lines):
diff -r f30420c0e83d -r 6734f8e42331 sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC Tue Dec 25 09:00:26 2018 +0000
+++ b/sys/arch/amd64/conf/GENERIC Tue Dec 25 11:56:13 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.513 2018/12/14 22:00:26 jakllsch Exp $
+# $NetBSD: GENERIC,v 1.514 2018/12/25 11:56:14 mlelstv Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.513 $"
+#ident "GENERIC-$Revision: 1.514 $"
maxusers 64 # estimated number of users
@@ -288,6 +288,8 @@
#IPMI support
ipmi0 at mainbus?
+ipmi_acpi* at acpi?
+ipmi0 at ipmi_acpi?
# ACPI will be used if present. If not it will fall back to MPBIOS
acpi0 at mainbus0
@@ -365,8 +367,8 @@
# XXX 'puc's aren't really bridges, but there's no better place for them here
puc* at pci? dev ? function ? # PCI "universal" comm. cards
-#amdpcib* at pci? dev ? function ? # AMD 8111 PCI-ISA w/ HPET
-#hpet* at amdpcib?
+amdpcib* at pci? dev ? function ? # AMD 8111 PCI-ISA w/ HPET
+hpet* at amdpcib?
pwdog* at pci? dev ? function ? # QUANCOM PWDOG1
diff -r f30420c0e83d -r 6734f8e42331 sys/arch/amd64/conf/XEN3_DOM0
--- a/sys/arch/amd64/conf/XEN3_DOM0 Tue Dec 25 09:00:26 2018 +0000
+++ b/sys/arch/amd64/conf/XEN3_DOM0 Tue Dec 25 11:56:13 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.161 2018/12/22 07:45:58 cherry Exp $
+# $NetBSD: XEN3_DOM0,v 1.162 2018/12/25 11:56:14 mlelstv Exp $
include "arch/amd64/conf/std.xen"
@@ -10,7 +10,7 @@
#options UVMHIST_PRINT
#options SYSCALL_DEBUG
-#ident "XEN3_DOM0-$Revision: 1.161 $"
+#ident "XEN3_DOM0-$Revision: 1.162 $"
maxusers 32 # estimated number of users
@@ -192,6 +192,8 @@
# IPMI support
ipmi0 at mainbus?
+ipmi_acpi* at acpi?
+ipmi0 at ipmi_acpi?
hypervisor* at mainbus? # Xen hypervisor
diff -r f30420c0e83d -r 6734f8e42331 sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC Tue Dec 25 09:00:26 2018 +0000
+++ b/sys/arch/i386/conf/GENERIC Tue Dec 25 11:56:13 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1198 2018/12/14 22:00:26 jakllsch Exp $
+# $NetBSD: GENERIC,v 1.1199 2018/12/25 11:56:14 mlelstv Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.1198 $"
+#ident "GENERIC-$Revision: 1.1199 $"
maxusers 64 # estimated number of users
@@ -299,6 +299,8 @@
#IPMI support
ipmi0 at mainbus?
+ipmi_acpi* at acpi?
+ipmi0 at ipmi_acpi?
# Advanced Configuration and Power Interface
diff -r f30420c0e83d -r 6734f8e42331 sys/arch/i386/conf/XEN3PAE_DOM0
--- a/sys/arch/i386/conf/XEN3PAE_DOM0 Tue Dec 25 09:00:26 2018 +0000
+++ b/sys/arch/i386/conf/XEN3PAE_DOM0 Tue Dec 25 11:56:13 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3PAE_DOM0,v 1.10 2018/12/22 07:45:58 cherry Exp $
+# $NetBSD: XEN3PAE_DOM0,v 1.11 2018/12/25 11:56:14 mlelstv Exp $
#
# XEN3_0: Xen 3.0 domain0 kernel
@@ -194,6 +194,8 @@
# IPMI support
ipmi0 at mainbus?
+ipmi_acpi* at acpi?
+ipmi0 at ipmi_acpi?
hypervisor* at mainbus? # Xen hypervisor
diff -r f30420c0e83d -r 6734f8e42331 sys/arch/x86/conf/files.x86
--- a/sys/arch/x86/conf/files.x86 Tue Dec 25 09:00:26 2018 +0000
+++ b/sys/arch/x86/conf/files.x86 Tue Dec 25 11:56:13 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.x86,v 1.105 2018/12/20 10:33:41 cherry Exp $
+# $NetBSD: files.x86,v 1.106 2018/12/25 11:56:14 mlelstv Exp $
# options for MP configuration through the MP spec
defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI
@@ -25,7 +25,6 @@
define cpubus { [apid = -1] }
define cpufeaturebus {}
define ioapicbus { [apid = -1] }
-define ipmibus {}
# BIOS32 routines
define bios32
@@ -146,9 +145,7 @@
file arch/x86/x86/x86_stub.c
# IPMI device
-device ipmi: sysmon_envsys, sysmon_wdog
-attach ipmi at ipmibus
-file arch/x86/x86/ipmi.c ipmi needs-flag
+file arch/x86/x86/x86_ipmi.c ipmi needs-flag
file arch/x86/x86/vga_post.c vga_post
diff -r f30420c0e83d -r 6734f8e42331 sys/arch/x86/include/ipmivar.h
--- a/sys/arch/x86/include/ipmivar.h Tue Dec 25 09:00:26 2018 +0000
+++ b/sys/arch/x86/include/ipmivar.h Tue Dec 25 11:56:13 2018 +0000
@@ -1,318 +1,7 @@
-/* $NetBSD: ipmivar.h,v 1.11 2010/08/01 08:16:14 mlelstv Exp $ */
-
-/*
- * Copyright (c) 2005 Jordan Hargrave
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/mutex.h>
-#include <sys/condvar.h>
-
-#include <dev/sysmon/sysmonvar.h>
-
-#ifndef _IPMIVAR_H_
-#define _IPMIVAR_H_
-
-#define IPMI_IF_KCS 1
-#define IPMI_IF_SMIC 2
-#define IPMI_IF_BT 3
-
-#define IPMI_IF_KCS_NREGS 2
-#define IPMI_IF_SMIC_NREGS 3
-#define IPMI_IF_BT_NREGS 3
-
-struct ipmi_thread;
-struct ipmi_softc;
-
-struct ipmi_attach_args {
- bus_space_tag_t iaa_iot;
- bus_space_tag_t iaa_memt;
-
- int iaa_if_type;
- int iaa_if_rev;
- int iaa_if_iotype;
- int iaa_if_iobase;
- int iaa_if_iospacing;
- int iaa_if_irq;
- int iaa_if_irqlvl;
-};
-
-struct ipmi_if {
- const char *name;
- int nregs;
- void *(*buildmsg)(struct ipmi_softc *, int, int, int,
- const void *, int *);
- int (*sendmsg)(struct ipmi_softc *, int, const uint8_t *);
- int (*recvmsg)(struct ipmi_softc *, int, int *, uint8_t *);
- int (*reset)(struct ipmi_softc *);
- int (*probe)(struct ipmi_softc *);
-};
-
-struct ipmi_softc {
- device_t sc_dev;
-
- struct ipmi_if *sc_if; /* Interface layer */
- int sc_if_iospacing; /* Spacing of I/O ports */
- int sc_if_rev; /* IPMI Revision */
- struct ipmi_attach_args sc_ia;
-
- void *sc_ih; /* Interrupt/IO handles */
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
-
- int sc_btseq;
-
- struct lwp *sc_kthread;
-
- int sc_max_retries;
-
- kmutex_t sc_poll_mtx;
- kcondvar_t sc_poll_cv;
-
- kmutex_t sc_cmd_mtx;
- kmutex_t sc_sleep_mtx;
- kcondvar_t sc_cmd_sleep;
-
- struct ipmi_bmc_args *sc_iowait_args;
-
- struct ipmi_sensor *current_sensor;
- volatile bool sc_thread_running;
- volatile bool sc_tickle_due;
- struct sysmon_wdog sc_wdog;
- struct sysmon_envsys *sc_envsys;
- envsys_data_t *sc_sensor;
- int sc_nsensors; /* total number of sensors */
-
- char sc_buf[64];
- bool sc_buf_rsvd;
-};
-
-struct ipmi_thread {
- struct ipmi_softc *sc;
- volatile int running;
-};
-
-#define IPMI_WDOG_USE_NOLOG __BIT(7)
-#define IPMI_WDOG_USE_NOSTOP __BIT(6)
-#define IPMI_WDOG_USE_RSVD1 __BITS(5, 3)
-#define IPMI_WDOG_USE_USE_MASK __BITS(2, 0)
-#define IPMI_WDOG_USE_USE_RSVD __SHIFTIN(0, IPMI_WDOG_USE_USE_MASK);
-#define IPMI_WDOG_USE_USE_FRB2 __SHIFTIN(1, IPMI_WDOG_USE_USE_MASK);
-#define IPMI_WDOG_USE_USE_POST __SHIFTIN(2, IPMI_WDOG_USE_USE_MASK);
-#define IPMI_WDOG_USE_USE_OSLOAD __SHIFTIN(3, IPMI_WDOG_USE_USE_MASK);
-#define IPMI_WDOG_USE_USE_OS __SHIFTIN(4, IPMI_WDOG_USE_USE_MASK);
-#define IPMI_WDOG_USE_USE_OEM __SHIFTIN(5, IPMI_WDOG_USE_USE_MASK);
-
-#define IPMI_WDOG_ACT_PRE_RSVD1 __BIT(7)
-#define IPMI_WDOG_ACT_PRE_MASK __BITS(6, 4)
-#define IPMI_WDOG_ACT_PRE_DISABLED __SHIFTIN(0, IPMI_WDOG_ACT_MASK)
-#define IPMI_WDOG_ACT_PRE_SMI __SHIFTIN(1, IPMI_WDOG_ACT_MASK)
-#define IPMI_WDOG_ACT_PRE_NMI __SHIFTIN(2, IPMI_WDOG_ACT_MASK)
-#define IPMI_WDOG_ACT_PRE_INTERRUPT __SHIFTIN(3, IPMI_WDOG_ACT_MASK)
-#define IPMI_WDOG_ACT_PRE_RSVD0 __BIT(3)
-#define IPMI_WDOG_ACT_MASK __BITS(2, 0)
-#define IPMI_WDOG_ACT_DISABLED __SHIFTIN(0, IPMI_WDOG_ACT_MASK)
-#define IPMI_WDOG_ACT_RESET __SHIFTIN(1, IPMI_WDOG_ACT_MASK)
-#define IPMI_WDOG_ACT_PWROFF __SHIFTIN(2, IPMI_WDOG_ACT_MASK)
-#define IPMI_WDOG_ACT_PWRCYCLE __SHIFTIN(3, IPMI_WDOG_ACT_MASK)
-
-#define IPMI_WDOG_FLAGS_RSVD1 __BITS(7, 6)
-#define IPMI_WDOG_FLAGS_OEM __BIT(5)
-#define IPMI_WDOG_FLAGS_OS __BIT(4)
-#define IPMI_WDOG_FLAGS_OSLOAD __BIT(3)
-#define IPMI_WDOG_FLAGS_POST __BIT(2)
-#define IPMI_WDOG_FLAGS_FRB2 __BIT(1)
-#define IPMI_WDOG_FLAGS_RSVD0 __BIT(0)
-
-struct ipmi_set_watchdog {
- uint8_t wdog_use;
- uint8_t wdog_action;
- uint8_t wdog_pretimeout;
- uint8_t wdog_flags;
- uint16_t wdog_timeout;
-} __packed;
+/* $NetBSD: ipmivar.h,v 1.12 2018/12/25 11:56:13 mlelstv Exp $ */
-struct ipmi_get_watchdog {
Home |
Main Index |
Thread Index |
Old Index