summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2012-09-09 23:55:12 +0000
committerRobert Mustacchi <rm@joyent.com>2012-09-09 23:55:53 +0000
commit4effda7fc5d948821a09a60e6385149d48c7e9dd (patch)
tree2e34ffb2030c98f8dc50c6cf242e97cc47a4b0d3 /usr/src
parentef3bbd25c8ae82171a168482dbc926338fdddd5f (diff)
downloadillumos-joyent-4effda7fc5d948821a09a60e6385149d48c7e9dd.tar.gz
OS-1530 ipmi should use /dev/ipmi0 for compatability
OS-1531 allow get_smbios_info to fail OS-1532 remove bmc_intf.h
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/devfsadm/i386/misc_link_i386.c6
-rw-r--r--usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c2
-rw-r--r--usr/src/cmd/fm/modules/common/sp-monitor/sp_monitor.c4
-rw-r--r--usr/src/lib/libipmi/common/ipmi_bmc.c8
-rw-r--r--usr/src/lib/libipmi/common/libipmi.c3
-rw-r--r--usr/src/lib/libipmi/common/libipmi.h21
-rw-r--r--usr/src/man/man7d/ipmi.7d2
-rw-r--r--usr/src/pkg/manifests/system-header.mf1
-rw-r--r--usr/src/uts/common/sys/Makefile1
-rw-r--r--usr/src/uts/common/sys/bmc_intf.h203
-rw-r--r--usr/src/uts/intel/io/ipmi/ipmi_main.c22
11 files changed, 37 insertions, 236 deletions
diff --git a/usr/src/cmd/devfsadm/i386/misc_link_i386.c b/usr/src/cmd/devfsadm/i386/misc_link_i386.c
index 9b1dc469f0..5d2e18ad8a 100644
--- a/usr/src/cmd/devfsadm/i386/misc_link_i386.c
+++ b/usr/src/cmd/devfsadm/i386/misc_link_i386.c
@@ -353,7 +353,11 @@ kdmouse(di_minor_t minor, di_node_t node)
static int
ipmi(di_minor_t minor, di_node_t node)
{
- (void) devfsadm_mklink("ipmi", node, minor, 0);
+ /*
+ * Follow convention from other systems, and include an instance#,
+ * even though there will only be one.
+ */
+ (void) devfsadm_mklink("ipmi0", node, minor, 0);
return (DEVFSADM_CONTINUE);
}
diff --git a/usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c b/usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c
index 6748f1c5f7..b618de53e0 100644
--- a/usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c
+++ b/usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c
@@ -188,7 +188,7 @@ send_fma_cap_to_ilom(fmd_hdl_t *hdl, uint32_t fma_cap)
if ((ipmi_hdl = ipmi_open(&error, &msg, IPMI_TRANSPORT_BMC, NULL))
== NULL) {
/*
- * If /dev/ipmi doesn't exist on the system, then return
+ * If /dev/ipmi0 doesn't exist on the system, then return
* without doing anything.
*/
if (error != EIPMI_BMC_OPEN_FAILED)
diff --git a/usr/src/cmd/fm/modules/common/sp-monitor/sp_monitor.c b/usr/src/cmd/fm/modules/common/sp-monitor/sp_monitor.c
index a2b20577f8..431c0f10ce 100644
--- a/usr/src/cmd/fm/modules/common/sp-monitor/sp_monitor.c
+++ b/usr/src/cmd/fm/modules/common/sp-monitor/sp_monitor.c
@@ -29,7 +29,7 @@
* /dev/ipmi IPMI monitor
*
* The purpose of this module is to monitor the connection between the system
- * and the service processor attached via /dev/ipmi. The module assumes the SP
+ * and the service processor attached via /dev/ipmi0. The module assumes the SP
* supports the Sun OEM uptime IPMI command. If the BMC connection does not
* exist, or the uptime function is not implemented, then the module unloads
* without doing anything.
@@ -149,7 +149,7 @@ _fmd_init(fmd_hdl_t *hdl)
if ((smp->sm_hdl = ipmi_open(&error, &msg, IPMI_TRANSPORT_BMC, NULL))
== NULL) {
/*
- * If /dev/ipmi doesn't exist on the system, then unload the
+ * If /dev/ipmi0 doesn't exist on the system, then unload the
* module without doing anything.
*/
if (error != EIPMI_BMC_OPEN_FAILED)
diff --git a/usr/src/lib/libipmi/common/ipmi_bmc.c b/usr/src/lib/libipmi/common/ipmi_bmc.c
index 48e15a489f..b6c4076a56 100644
--- a/usr/src/lib/libipmi/common/ipmi_bmc.c
+++ b/usr/src/lib/libipmi/common/ipmi_bmc.c
@@ -39,18 +39,18 @@
#include "ipmi_impl.h"
/*
- * IPMI transport for the local BMC at /dev/ipmi.
+ * IPMI transport for the local BMC at /dev/ipmi0.
*/
typedef struct ipmi_bmc {
ipmi_handle_t *ib_ihp; /* ipmi handle */
- int ib_fd; /* /dev/ipmi filedescriptor */
+ int ib_fd; /* /dev/ipmi0 filedescriptor */
uint32_t ib_msgseq; /* message sequence number */
uint8_t *ib_msg; /* message buffer */
size_t ib_msglen; /* size of message buffer */
} ipmi_bmc_t;
-#define BMC_DEV "/dev/ipmi"
+#define BMC_DEV "/dev/ipmi0"
static void
ipmi_bmc_close(void *data)
@@ -74,7 +74,7 @@ ipmi_bmc_open(ipmi_handle_t *ihp, nvlist_t *params)
return (NULL);
ibp->ib_ihp = ihp;
- /* open /dev/ipmi */
+ /* open /dev/ipmi0 */
if ((ibp->ib_fd = open(BMC_DEV, O_RDWR)) < 0) {
ipmi_free(ihp, ibp);
(void) ipmi_set_error(ihp, EIPMI_BMC_OPEN_FAILED, "%s",
diff --git a/usr/src/lib/libipmi/common/libipmi.c b/usr/src/lib/libipmi/common/libipmi.c
index d678dc8257..63e985755c 100644
--- a/usr/src/lib/libipmi/common/libipmi.c
+++ b/usr/src/lib/libipmi/common/libipmi.c
@@ -26,8 +26,6 @@
#include <libipmi.h>
#include <string.h>
-#include <sys/bmc_intf.h>
-
#include "ipmi_impl.h"
ipmi_handle_t *
@@ -119,7 +117,6 @@ static struct ipmi_err_conv {
{ 0xD5, EIPMI_UNAVAILABLE },
{ 0xD6, EIPMI_UNAVAILABLE },
{ 0xFF, EIPMI_UNSPECIFIED },
- { BMC_IPMI_OEM_FAILURE_SENDBMC, EIPMI_SEND_FAILED },
};
#define IPMI_ERROR_COUNT \
diff --git a/usr/src/lib/libipmi/common/libipmi.h b/usr/src/lib/libipmi/common/libipmi.h
index 0f20363c07..af8a1f6351 100644
--- a/usr/src/lib/libipmi/common/libipmi.h
+++ b/usr/src/lib/libipmi/common/libipmi.h
@@ -26,7 +26,6 @@
#ifndef _LIBIPMI_H
#define _LIBIPMI_H
-#include <sys/bmc_intf.h>
#include <sys/byteorder.h>
#include <sys/nvpair.h>
#include <sys/sysmacros.h>
@@ -34,7 +33,7 @@
/*
* Private interfaces for communicating with attached services over IPMI. This
* library is designed for system software communicating with Illumos-supported
- * service processors over /dev/ipmi. It is not a generic IPMI library.
+ * service processors over /dev/ipmi0. It is not a generic IPMI library.
*
* Documentation references refer to "Intelligent Platform Management Interface
* Specification Second Generation v2.0", document revision 1.0 with Februrary
@@ -53,10 +52,12 @@ typedef struct ipmi_handle ipmi_handle_t;
/*
* Basic netfn definitions. See section 5.1.
*/
-#define IPMI_NETFN_CHASSIS BMC_NETFN_CHASSIS
-#define IPMI_NETFN_APP BMC_NETFN_APP
-#define IPMI_NETFN_STORAGE BMC_NETFN_STORAGE
-#define IPMI_NETFN_SE BMC_NETFN_SE
+#define IPMI_NETFN_CHASSIS 0x0
+#define IPMI_NETFN_BRIDGE 0x2
+#define IPMI_NETFN_SE 0x4
+#define IPMI_NETFN_APP 0x6
+#define IPMI_NETFN_FIRMWARE 0x8
+#define IPMI_NETFN_STORAGE 0xa
#define IPMI_NETFN_TRANSPORT 0x0C
#define IPMI_NETFN_OEM 0x2e
@@ -67,10 +68,10 @@ typedef struct ipmi_handle ipmi_handle_t;
typedef enum {
EIPMI_NOMEM = EIPMI_BASE, /* memory allocation failure */
- EIPMI_BMC_OPEN_FAILED, /* failed to open /dev/ipmi */
- EIPMI_BMC_PUTMSG, /* failed to send message to /dev/ipmi */
- EIPMI_BMC_GETMSG, /* failed to read response from /dev/ipmi */
- EIPMI_BMC_RESPONSE, /* response from /dev/ipmi failed */
+ EIPMI_BMC_OPEN_FAILED, /* failed to open /dev/ipmi0 */
+ EIPMI_BMC_PUTMSG, /* failed to send message to /dev/ipmi0 */
+ EIPMI_BMC_GETMSG, /* failed to read response from /dev/ipmi0 */
+ EIPMI_BMC_RESPONSE, /* response from /dev/ipmi0 failed */
EIPMI_INVALID_COMMAND, /* invalid command */
EIPMI_COMMAND_TIMEOUT, /* command timeout */
EIPMI_DATA_LENGTH_EXCEEDED, /* maximum data length exceeded */
diff --git a/usr/src/man/man7d/ipmi.7d b/usr/src/man/man7d/ipmi.7d
index 710b8f968c..1ce5594d23 100644
--- a/usr/src/man/man7d/ipmi.7d
+++ b/usr/src/man/man7d/ipmi.7d
@@ -9,7 +9,7 @@ ipmi \- OpenIPMI compatible IPMI interface driver
.SH SYNOPSIS
.LP
.nf
-\fB/dev/ipmi\fR
+\fB/dev/ipmi0\fR
.fi
.SH DESCRIPTION
diff --git a/usr/src/pkg/manifests/system-header.mf b/usr/src/pkg/manifests/system-header.mf
index baffee6182..3fb3c1351c 100644
--- a/usr/src/pkg/manifests/system-header.mf
+++ b/usr/src/pkg/manifests/system-header.mf
@@ -813,7 +813,6 @@ file path=usr/include/sys/bitmap.h
file path=usr/include/sys/bitset.h
file path=usr/include/sys/bl.h
file path=usr/include/sys/blkdev.h
-file path=usr/include/sys/bmc_intf.h
file path=usr/include/sys/bofi.h
file path=usr/include/sys/bofi_impl.h
file path=usr/include/sys/bootconf.h
diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile
index 14cc0785f0..50846d0cb3 100644
--- a/usr/src/uts/common/sys/Makefile
+++ b/usr/src/uts/common/sys/Makefile
@@ -87,7 +87,6 @@ CHKHDRS= \
bitset.h \
bl.h \
blkdev.h \
- bmc_intf.h \
bofi.h \
bofi_impl.h \
bpp_io.h \
diff --git a/usr/src/uts/common/sys/bmc_intf.h b/usr/src/uts/common/sys/bmc_intf.h
deleted file mode 100644
index 83211e0174..0000000000
--- a/usr/src/uts/common/sys/bmc_intf.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _BMC_INTF_H
-#define _BMC_INTF_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BMC_SUCCESS 0x0
-#define BMC_FAILURE 0x1
-
-#define BMC_NETFN_CHASSIS 0x0
-#define BMC_NETFN_BRIDGE 0x2
-#define BMC_NETFN_SE 0x4
-#define BMC_NETFN_APP 0x6
-#define BMC_NETFN_FIRMWARE 0x8
-#define BMC_NETFN_STORAGE 0xa
-#define BMC_NETFN_TRANSPORT 0xc
-
-#define SEND_MAX_PAYLOAD_SIZE 34 /* MAX payload */
-#define RECV_MAX_PAYLOAD_SIZE 33 /* MAX payload */
-#define BMC_MIN_RESPONSE_SIZE 3
-#define BMC_MIN_REQUEST_SIZE 2
-#define BMC_MAX_RESPONSE_SIZE (BMC_MIN_RESPONSE_SIZE + RECV_MAX_PAYLOAD_SIZE)
-#define BMC_MAX_REQUEST_SIZE (BMC_MIN_REQUEST_SIZE + BMC_MAX_RESPONSE_SIZE)
-
-#define BUF_SIZE 256
-#define MAX_BUF_SIZE 256
-
-/*
- * Useful macros
- */
-#define FORM_NETFNLUN(net, lun) ((((net) << 2) | ((lun) & 0x3)))
-#define GET_NETFN(netfn) (((netfn) >> 2) & 0x3f)
-#define GET_LUN(netfn) (netfn & 0x3)
-#define RESP_NETFN(nflun) ((nflun) | 1)
-#define ISREQUEST(nl) (((nl) & 1) == 0) /* test for request */
-#define ISRESPONSE(nl) (((nl) & 1) == 1) /* test for response */
-
-
-/* for checking BMC specific stuff */
-#define BMC_GET_DEVICE_ID 0x1 /* GET DEVICE ID COMMAND */
-#define BMC_IPMI_15_VER 0x51 /* IPMI 1.5 definion */
-
-/* BMC Completion Code and OEM Completion Code */
-#define BMC_IPMI_UNSPECIFIC_ERROR 0xFF /* Unspecific Error */
-#define BMC_IPMI_INVALID_COMMAND 0xC1 /* Invalid Command */
-#define BMC_IPMI_COMMAND_TIMEOUT 0xC3 /* Command Timeout */
-#define BMC_IPMI_DATA_LENGTH_EXCEED 0xC8 /* DataLength exceeded limit */
-#define BMC_IPMI_OEM_FAILURE_SENDBMC 0x7E /* Cannot send BMC req */
-
-
-#define IOCTL_IPMI_KCS_ACTION 0x01
-#define IOCTL_IPMI_INTERFACE_METHOD 0x02
-
-/* Interface methods returned from IOCTL_IPMI_INTERFACE_METHOD ioctl: */
-
-#define BMC_IOCTL_METHOD 0 /* Not returned from ioctl, */
- /* but can be used by */
- /* applications that want to */
- /* compare against an */
- /* alternative method. */
-#define BMC_PUTMSG_METHOD 1
-
-/*
- * bmc_req_t is the data structure to send
- * request packet from applications to the driver
- * module.
- *
- * the request pkt is mainly for KCS-interface-BMC
- * messages. Since the system interface is session-less
- * connections, the packet won't have any session
- * information.
- *
- * the data payload will be 2 bytes less than max
- * BMC supported packet size.
- * the address of the responder is always BMC and so
- * rsSa field is not required.
- */
-typedef struct bmc_req {
- uint8_t fn; /* netFn for command */
- uint8_t lun; /* logical unit on responder */
- uint8_t cmd; /* command */
- uint8_t datalength; /* length of following data */
- uint8_t data[SEND_MAX_PAYLOAD_SIZE]; /* request data */
-} bmc_req_t;
-
-/*
- * bmc_rsp_t is the data structure to send
- * respond packet from applications to the driver
- * module.
- *
- * the respond pkt is mainly for KCS-interface-BMC
- * messages. Since the system interface is session-less
- * connections, the packet won't have any session
- * information.
- *
- * the data payload will be 2 bytes less than max
- * BMC supported packet size.
- */
-typedef struct bmc_rsp {
- uint8_t fn; /* netFn for command */
- uint8_t lun; /* logical unit on responder */
- uint8_t cmd; /* command */
- uint8_t ccode; /* completion code */
- uint8_t datalength; /* Length */
- uint8_t data[RECV_MAX_PAYLOAD_SIZE]; /* response */
-} bmc_rsp_t;
-
-/*
- * the data structure for synchronous operation via ioctl (DEPRECATED)
- */
-typedef struct bmc_reqrsp {
- bmc_req_t req; /* request half */
- bmc_rsp_t rsp; /* response half */
-} bmc_reqrsp_t;
-
-
-/*
- * The new way of communicating with the bmc driver is to use putmsg() to
- * send a message of a particular type. Replies from the driver also have this
- * form, and will require the user to process the type field before examining
- * the rest of the reply.
- *
- * The only change that must be observed when using the request and response
- * structures defined above is as follows:
- * when sending messages to the bmc driver, the data portion is now variable
- * (the caller must allocate enough space to store the all structure members,
- * plus enough space to cover the amount of data in the request), e.g.:
- *
- * bmc_msg_t *msg = malloc(offsetof(bmc_msg_t, msg) + sizeof(bmc_req_t) + 10);
- *
- * The amount allocated for the message is (# of bytes before the msg field) +
- * the size of a bmc_req_t (which includes SEND_MAX_PAYLOAD_SIZE
- * bytes in the data field), plus an additional 10 bytes for the data
- * field (so the data field would occupy (SEND_MAX_PAYLOAD_SIZE + 10)
- * bytes). The datalength member must reflect the amount of data in the
- * request's data field (as was required when using the ioctl interface).
- */
-typedef struct bmc_msg {
- uint8_t m_type; /* Message type (see below) */
- uint32_t m_id; /* Message ID */
- uint8_t reserved[32];
- uint8_t msg[1]; /* Variable length message data */
-} bmc_msg_t;
-
-
-/*
- * An error response passed back from the bmc driver will have its m_id
- * field set to BMC_UNKNOWN_MSG_ID if a message is sent to it that is not
- * at least as large as a bmc_msg_t.
- */
-#define BMC_UNKNOWN_MSG_ID ~((uint32_t)0)
-
-
-/*
- * Possible values for the m_type field in bmc_msg_t:
- */
-#define BMC_MSG_REQUEST 1 /* BMC request (as above, sent to the */
- /* driver by the user), bmc_msg.msg */
- /* begins with the bmc_req_t */
- /* structure. */
-#define BMC_MSG_RESPONSE 2 /* BMC response (sent by the driver) */
- /* bmc_msg.msg begins with the */
- /* bmc_rsp_t structure. */
-#define BMC_MSG_ERROR 3 /* Error while processing a user msg */
- /* msg[0] is the error code */
- /* (interpret as an errno value) */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BMC_INTF_H */
diff --git a/usr/src/uts/intel/io/ipmi/ipmi_main.c b/usr/src/uts/intel/io/ipmi/ipmi_main.c
index e55237bf0f..465cb338a6 100644
--- a/usr/src/uts/intel/io/ipmi/ipmi_main.c
+++ b/usr/src/uts/intel/io/ipmi/ipmi_main.c
@@ -71,13 +71,13 @@ static id_space_t *minor_ids;
/*
* Use the SMBIOS info to determine if the system has an IPMI.
*/
-static void
-get_smbios_ipmi_info()
+static int
+get_smbios_ipmi_info(void)
{
smbios_ipmi_t ipmi;
if (ksmbios == NULL || smbios_info_ipmi(ksmbios, &ipmi) == SMB_ERR)
- return;
+ return (DDI_FAILURE);
cmn_err(CE_CONT, "!SMBIOS type 0x%x, addr 0x%llx", ipmi.smbip_type,
(long long unsigned int)(ipmi.smbip_addr));
@@ -89,7 +89,7 @@ get_smbios_ipmi_info()
*/
if (ipmi.smbip_addr == NULL) {
cmn_err(CE_WARN, "!SMBIOS: Invalid base address");
- return;
+ return (DDI_FAILURE);
}
sc->ipmi_io_type = ipmi.smbip_type;
@@ -111,14 +111,17 @@ get_smbios_ipmi_info()
}
break;
default:
- return;
+ return (DDI_FAILURE);
}
- if (ipmi.smbip_intr > 15)
+ if (ipmi.smbip_intr > 15) {
cmn_err(CE_WARN, "!SMBIOS: Non-ISA IRQ %d for IPMI",
ipmi.smbip_intr);
- else
- sc->ipmi_io_irq = ipmi.smbip_intr;
+ return (DDI_FAILURE);
+ }
+
+ sc->ipmi_io_irq = ipmi.smbip_intr;
+ return (DDI_SUCCESS);
}
static ipmi_device_t *
@@ -483,7 +486,8 @@ ipmi_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
- get_smbios_ipmi_info();
+ if (get_smbios_ipmi_info() == DDI_FAILURE)
+ return (DDI_FAILURE);
/*
* Support for the other types (SMIC, SSIF) should be added here.