aboutsummaryrefslogtreecommitdiff
path: root/core/ipmi.c
AgeCommit message (Collapse)AuthorFilesLines
2016-03-07ipmi: Log exact NetFn value in OPAL logsVipin K Parashar1-1/+1
As per IPMI message format NetFn value in present in first 6 bits while last 2 bits contain LUN value. This needs to be taken care while printing NetFn value in OPAL logs which is useful while debugging fails. [root@fir01 /]# ipmitool raw 0x0a 0x48 47 b1 d0 56 [root@fir01 /]# >From OPAL Logs --------------- [133969609199,7] BT: seq 0x3d netfn 0x0a cmd 0x48: Message sent to host [133975465455,7] BT: seq 0x3d netfn 0x0a cmd 0x48: IPMI MSG done >From BMC Logs -------------- IPMIMain: [693 WARNING][corecmdselect.c:913] Request: Channel:f; Netfn:a; Cmd:48; IPMIMain: [693 INFO][corecmdselect.c:924] Response: Channel:f; Netfn:a; Cmd:48; Data:0 47 b1 d0 56 Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com> Reviewed-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-07-03core/ipmi: Provide the dequeue message interfaceNeelesh Gupta1-0/+13
Add a wrapper for the client to be able to invoke the backend dequeue message function. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Cc: Alistair Popple <alistair@popple.id.au> Acked-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-04-18ipmi: Check for ipmi backend presence before useAlistair Popple1-0/+38
Not all ipmi related functions check for a valid backend before attempting to use it. Under normal circumstances this should not happen as the platform should always register an ipmi backend. However a system should be able to boot without a functional ipmi backend, which is sometimes the case during system bringup. This patch adds presence checks for an ipmi backend before attempting to use it, thus allowing a system with a non-functional backend to boot without ipmi. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-04-01Remove redundant includes of opal-api.hMichael Ellerman1-1/+0
Now that opal.h includes opal-api.h, there are a bunch of files that include both but don't need to. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-04hw/ipmi: Set boot count sensorJoel Stanley1-2/+7
The boot count sensor is a discrete sensor that is set once the system is up and running. On successful boot, the BMC expects the sensor to be set to 2. Signed-off-by: Joel Stanley <joel@jms.id.au>
2015-02-19ipmi: Fix locking for synchronous message sendingAlistair Popple1-5/+3
Skiboot now doesn't run the running pollers while holding a lock to avoid dead-locks. The current implementation of ipmi_queue_msg_sync() does exactly that while it waits for the pollers to be called. This patch fixes the problem by releasing the lock prior to calling the pollers. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi/wdt: Add ipmi watchdog timer supportAlistair Popple1-0/+6
Add support for an ipmi watchdog timer. During skiboot initialisation this patch will cause the system to be reset if opal_run_pollers() isn't called for more than 60 seconds. Once the payload is started the watchdog timer will be reset and a pre-timeout interrupt set. The payload should then receive the interrupt and call into skiboot which will disable the watchdog timer. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: Implement Read Event and SEL parsingJoel Stanley1-1/+2
The read event mechanism is used when the BMC has an asynchronous message for the host. It sets a flag that we read with Get Message Flags, and then we read the message using Read Event. This event message contains a SEL message. There are two OEM SEL messages we expect from the AMI BMC: - graceful power operations. This is when the BMC wants the host to power down or reboot. - PNOR Locking. When the BMC wants to access the PNOR, it requests that the host not touch it. This patch implements the parsing. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: handle SMS_ATN eventsJeremy Kerr1-0/+40
When the bt interface sets the SMS_ATN flag, we perform a Get Message Flags to determine what messages are available. The only message type currently processed is the Event Message Buffer, which provides SEL messages for indicating OEM specific events such as graceful system shutdown and PNOR access requested. These events will be handled by the IPMI layer in skiboot. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: Add support for synchronous message sendingAlistair Popple1-0/+23
This patch adds support for sending ipmi messages synchronously. This is necessary to allow messages to be sent during skiboot initialisation as interrupt servicing/polling is controlled by the host operating system which is not yet running. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: Add a function to (re)initialise a message without allocationAlistair Popple1-10/+18
Currently the only functions we have for initialising ipmi messages with the correct values also allocate memory for the message. In some cases we want to reuse previously allocated messages to avoid continually freeing/allocating memory. This patch introduces a function which (re)initialises a previously allocated message and converts existing instances of this behaviour over to the new function. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-06Move skiboot internal things from opal.h to opal-api.hStewart Smith1-0/+3
This is probably not the best collection of things in the world, but it means that opal.h is much closer to being directly usable by an OS. This triggers a bunch of #include fixes throughout the tree. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-02ipmi/bt: Enable adding messages to the start of the queueAlistair Popple1-0/+5
By default new ipmi messages are added to the end of the transmission queue. However sometimes it is necessary to add messages to the start of the queue. This patch adds a new ipmi function that adds messages to the start of the transmission queue. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-11-12bt/ipmi: Quieten logging outputAlistair Popple1-1/+1
Some tools (eg. ipmitool) that use the Linux ipmi stack send potentially invalid commands to probe functionality. Currently skiboot prints an error to the console whenever this happens resulting in excessive noise when using the Linux ipmi stack. This patch just removes and/or lowers the logging level of these errors. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-30ipmi: Add an opal interface to the ipmi stackAlistair Popple1-3/+5
This patch adds two opal calls (opal_ipmi_send and opal_ipmi_recv) to allow an operating system to send and receive arbitrary ipmi messages to the BMC. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-15skiboot: Add default error handler for ipmi messagesAlistair Popple1-2/+5
Most messages won't require their own error handler. This patch adds a default handler to ensure we don't leak messages. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-10-01ipmi/bt: Improve message validation and allow out-of-order command responsesAlistair Popple1-6/+13
This patch adds validation of the ipmi cmd and netfn numbers returned by the bmc. It also ensures the sequence number is correct by searching the outstanding message queue for the corresponding sequence number. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-01ipmi: Add ipmi_present APIJoel Stanley1-0/+5
Similar to the use of fsp_present, this is so code can safely call functions which may not work on the platform they are running on, or as protection against calling before the device is initialised. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-01core/ipmi: Remove time includesJoel Stanley1-2/+0
We moved the rtc code out to its own ipmi driver, so we don't need these headers anymore. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-01bt/ipmi: Convert to using asynchronous messagingAlistair Popple1-1/+1
Previously we were doing synchronous messaging and cranking the bt state machine from within OPAL. This was not ideal as it could potentially take control away from the OS for long periods of time if the BMC is busy. This patch solves the problem using the opal_poll api to do asynchronous messaging. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-01ipmi: Refactored ipmi layer to use generic backendAlistair Popple1-118/+46
The initial implementation of the ipmi stack was still tightly coupled with the backend (in this case bt). This patch refactors the ipmi code to use a generic backend device. The core ipmi messaging functionality and the implementation of specific commands has also been split into different files. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-01bt/ipmi: Fixup allocation of bt/ipmi messagesAlistair Popple1-21/+15
The original implementation of the bt and ipmi layers required the bt, ipmi and message data to be allocated separately. This is sub-optimal as it could cause excessive memory fragmentation. This patch fixes the problem by adding a function to the bt layer to allocate space for both the required data and bt/ipmi message. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-09-01ipmi: Improve RTC supportBenjamin Herrenschmidt1-3/+14
Create a device-node which will be used by Linux for matching and use a saner default time if IPMI doesn't work. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-08-15ipmi: Add an IPMI command to get and set the RTCAlistair Popple1-0/+98
Add IPMI GET_SEL_TIME and SET_SEL_TIME commands to the IPMI stack. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-08-15ipmi: Correct chassis control messageJoel Stanley1-5/+12
I misread the spec when implementing the chassis control message. This fixes the message, as well as correcting the naming of the IPMI fields to better reflect what they represent. Signed-off-by: Joel Stanley <joel@jms.id.au> Acked-by: Jeremy Kerr <jeremy.kerr@au.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-08-13plat/palmetto: Add shutdown and rebootJoel Stanley1-0/+26
Rebooting and power down for the Palmetto is done by the BMC, which we speak to over the BT interface using IPMI. Implement the IPMI chassis commands which are used for power control, and hook them up to the palmetto platform callbacks for shutdown and reboot. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-08-13ipmi: Add a base IPMI stack with a BT driverAlistair Popple1-0/+36
This patch adds a basic IPMI layer to the sapphire core and support for a BT IPMI interface as found on the Aspeed BMC of the Palmetto platform [ Changed the compatible property -- BenH ] Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>