Compare commits

...

154 Commits

Author SHA1 Message Date
342f44b9f3 Update ChangeLog for 1.8.15 rleease 2014-11-24 06:40:17 -07:00
e1c7b532bd Release Version 1.8.15 2014-11-24 06:30:52 -07:00
3314024867 Remove debian from extra distribution rule for make dist 2014-10-23 14:27:06 -06:00
15499d014f Update ChangeLog for 1.8.15RC1 2014-10-23 14:02:38 -06:00
21fbd0e967 ID#340 - ipmitool sol session improperly closes on packet retry
Commit for Pat Donlin
2014-10-17 20:14:12 +02:00
deb9a4ed5d ID#277 - support for hostnames longer than 64 chars
ID#313 ipmitool doesn't support hostname long than 64 symbols
ID#277 Minor issue with ipmi_intf_session_set_hostname()

Commit adds support pretty much for FQDN not just up to the length of one label.
This is achieved by change in in struct ipmi_session; and strdup() of user
input. Of course, we have to free() this once we're done.
2014-10-17 19:33:37 +02:00
58837647c2 lib/ipmi_kontronoem.c - clean up formatting, code
Commit cleans up formatting in 'lib/ipmi_kontronoem.c'. Also, it adds some error
messages and fixes return codes.
2014-09-21 09:36:14 +02:00
5c85c7bc61 ID: 247 - 'sensor thresh' help output is wrong
Fix invalid help output by copy-pasting part of 'sensor thresh help'.
2014-09-20 18:21:23 +02:00
aa8bac2da2 Rename printf_sensor_get_usage() -> print_sensor_get_usage() 2014-09-20 18:07:23 +02:00
2b15969dcb Put 'sensor thresh help' into function
Move help text for 'sensor thresh help' into its own function.
2014-09-20 18:05:04 +02:00
7560d4f2f4 ID: 324 - conflicting declaration write_fru_area()
Commit fixes conflicting declarations of write_fru_area().

Author: Jörg Frings-Fürst
2014-09-20 15:43:30 +02:00
859e8a4576 ID: 337 - Add support for 13G Dell PowerEdge
Description: Add support for Dell 13G server.
 Add support for upcoming Dell PowerEdge 13G server
 and replace multiple if statments.
 Based on patch from  SriniG <srinivas_g_gowda@dell.com>

Author: Jörg Frings-Fürst <debian@jff-webhosting.net>
Origin: based on patch from SriniG <srinivas_g_gowda@dell.com>
Bug: http://sourceforge.net/p/ipmitool/patches/102/
Bug-debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=756555
Forwarded: http://sourceforge.net/p/ipmitool/patches/102/
Reviewed-by: 2014-08-07 SriniG <srinivas_g_gowda@dell.com>
2014-09-20 15:30:55 +02:00
f49c9eec53 print message header and data in verbose print
Change-Id: I613e35e180c815279d2a50f44956a5ed5bf5461b
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvaragan@ericsson.com>
2014-09-03 10:01:07 +02:00
a6f34c9029 fix incorrect data validation
Change-Id: I6c277b4716445e8ae9a6851cca48e1ad95df49b4
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvaragan@ericsson.com>
2014-09-03 09:53:56 +02:00
bee3fda656 update result ptr before return
Change-Id: If976f5c769d8ba83eefa1693e6969ef17f357ba8
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvaragan@ericsson.com>
2014-09-03 09:44:57 +02:00
737b801768 delete duplicate macros
Change-Id: Ie219c955c4644b8ab9822fd1e5523d70038b5261
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvaragan@ericsson.com>
2014-09-03 09:42:11 +02:00
96b19bb62d ID: 325 DDR4 DIMM Decoding Logic
Bug 325 was associated with identification of DDR4 SDRAM, but correct decoding
logic was necessary to actually support DDR4 decode.    This commit adds the
necessary logic to decode and display DDR4 DIMMS.
2014-08-13 07:12:42 -06:00
9372d2e34e ID: 328 HPM.2 fixes
Fix commited for Dmitry Bazhenov
2014-08-11 11:21:23 -06:00
9babab10f3 ID: 329 hpm.1 upgrade fixes
Fix commited for Dmitry Bazhenov
2014-08-11 11:17:41 -06:00
58d510f90f ID : 103 picmg discover messages should be DEBUG, not INFO
Changed picmg discover messages to LOG_DEBUG
2014-08-11 10:49:10 -06:00
ea49700ec1 ID: 331 Passwords provided in file (-f option) truncated on space
Code changed to remove truncation on space since space is valid in a password
2014-08-11 10:38:09 -06:00
732be1b968 ID: 325 - Can not identify DDR4 SDRAM 2014-08-11 08:34:58 -06:00
d79b0e05af ID: 318 - ipmi_tsol.c: fix buffer overflow
Commit fixes buffer over-flow in ipmi_tsol caused by mis-calculation in buffer
size, resp. using wrong variables completely.
2014-05-29 20:19:37 +02:00
3b15a7c0e2 ID: 306 - "fru print" command prints the FRU #0 twice
This patch make the command to spit FRU info #0 only once.

Commit for Dmitry Bazhenov
2014-05-25 08:52:07 +02:00
3f508629a5 ID: 305 - HPM.1 deferred activation support fixup
Currently, the HPM.1 agent in the IPMItool does not differ between Rollback
support and Deferred Activation Support. The patch fixes up this bug.

Commit for Dmitry Bazhenov
2014-05-25 08:48:50 +02:00
3473670051 lib/ipmi_tsol.c - remove dead code 2014-05-24 10:05:30 +02:00
aefd287222 lib/ipmi_tsol.c - make code formatting saner 2014-05-24 10:05:05 +02:00
6d25903a0b ID: 317 - ipmi_fwum.c: fix typo 2014-05-24 09:18:32 +02:00
26da519310 ID: 315 - buildsystem: configure.in is deprecated
As per https://lists.gnu.org/archive/html/automake/2013-05/msg00049.html,
renamed to configure.ac
2014-05-24 09:16:52 +02:00
edfee17f21 ID: 316 - Directory debian is outdated
Debian upstream will take care of packaging.
2014-05-24 09:14:47 +02:00
b37b914973 ID: 103 - 'lib/ipmi_ekanalyzer.c' needs a re-work
Most of the code is reformatted. I've removed some if blocks which didn't make
sense along the way. However, huge pile of work remains.
2014-05-19 05:35:16 +02:00
4e4a92100c ID: 103 - 'lib/ipmi_ekanalyzer.c' needs a re-work
Remove trailing empty lines.
2014-05-18 06:32:44 +02:00
8f7837364b ID: 46 - SEL OEM record corner case
According to 31.6.1 SEL Record Type Ranges, IPMIv2.0 specification, timestamped
OEM SEL records are in interval of <C0h,DFh> and not <C0h,DFh).
2014-05-17 11:39:42 +02:00
be7917f9f5 Changes Integrated since 1.8.14RC2 2014-05-05 07:26:36 -06:00
a7d3bda08d ID: 311 man page update for new sunoem commands 2014-05-05 06:58:08 -06:00
d531785a23 ID: 280 - man page cleanup 2014-04-29 09:38:11 -06:00
eeeb973e39 Make comment about 'source offset' explicit 2014-04-26 14:43:30 +02:00
166ae1da23 ID: 308 - "fru edit" no longer works for non-zero fields
1. Warnings about "FRU Area Length" based on uninitialized (malloc'd) memory
contents (due to fru->max_read_size not being initialized, left at 0) and
fru_data not being zeroed after malloc() in ipmi_fru_set_field_string().

2. "fru edit" commands for any field index other than 0 would fail (with "Field
not found !" error) due to a couple offset and length calculation errors (for
all the supported "area" types) in ipmi_fru_set_field_string().

3. "fru edit" commands would corrupt the FRU Inventory Area due to incorrect
"source offset" value being specified in write_fru_area() call in
impi_fru_set_field_string().

Commit for Rob Swindell
2014-04-25 20:48:40 +02:00
4f0967779e ID: 310 - lanplus retry regression
The lanplus driver for has a bug in ipmi_lanplus_open_session(). There is
an extra and undesired check for a null response (timeout). As a result, it
returns 1 to the caller. The result of this is an occasional assertion. Commit
mends this.

Commit for Pat Donlin
2014-04-25 20:40:36 +02:00
9d88837ef3 Add ticket IDs, if we have one 2014-04-18 06:39:09 +02:00
824c0ed4a0 Add hpm2.h to list of distributed include files 2014-04-17 14:01:22 -06:00
7ea04d8f77 Update ChangeLog for 1.8.14RC2 changes 2014-04-17 13:28:54 -06:00
8d5e8fcf7a Incorrect byteswap in SOL maximum payload code
max_inbound_payload_size, max_outbound_payload_size and port are
assembled byte by byte using shifts. This works correctly in both
little and big endian and doing a subsequent byte swap is wrong.

To highlight this issue I dumped the values on a big endian machine:

max_inbound_payload_size 51200
max_outbound_payload_size 51200
port 28418

And after this fix:

max_inbound_payload_size 200
max_outbound_payload_size 200
port 623

Signed-off-by: Zdenek Styblik <stybla@turnovfree.net>
2014-04-12 15:13:25 +02:00
2c7526be6b Fix build error in HPM.2 code
lib/hpm2.c uses BSWAP_16 without including ipmitool/bswap.h.

Signed-off-by: Zdenek Styblik <stybla@turnovfree.net>
2014-04-12 15:08:39 +02:00
a88db0d181 ID: 300 - new sunoem functionality
Main changes include:

 * direct connection to ILOM command line interface
 * ability to add/delete ssh keys fot ILOM users
 * ability to set ILOM properties
 * ability to retrieve various logs from SP
 * removal of obsolete/non-functioning code and other misc changes

Commit for Martin Hovorka of Oracle
2014-04-09 21:24:05 +02:00
42aba7eb4f ID: 144 - Fix 'dcmi power set_limit action <value>'
From the ticket:
(v1.8.12) "dcmi power set_limit action <value>" (where <value> is either
"sel_logging" or "power_off") does not actually send the "Set Power Limit"
command (so no change to the power limit policy is made).

This was caused by all atoi(), strtol(), strtoul() calls being replaced. This
patch should fix it.

Commit for Holger Liebig
2014-04-08 15:24:55 +02:00
23e9340b49 ID:302 - HPM.2 long message support
This patch adds basic long message support for PICMG-based systems according to
the HPM.2 specification.
It also introduces APIs for setting inbound and outbound messages sizes per
selected interface.
This APIs are used in LAN and LAN+ interfaces to set autonomously detected
inbound and outbound message sizes.
The newly introduced APIs also replace the existing message size detection code
in several ipmitool commands in order to leverage the advantages of long message
support (HPM.1 upgrade, SDR acquring, FRU inventory read and write).
The Kontron-specific long message support is moved under a OEM option.

Commit for Dmitry Bazhenov
2014-04-08 15:18:50 +02:00
707d77ffbc Add new SEL entries for ipmi 2.0 rev 1.1
Signed-off-by: Jordan Hargrave <jordan_hargrave@dell.com>
Signed-off-by: Zdenek Styblik <stybla@turnovfree.net>
2014-04-05 11:38:08 +02:00
7584b96c1d Update ipmtool version to 1.8.14-cvs 2014-03-28 07:35:25 -06:00
cc85ce1333 Update For 1.8.14 Release 2014-03-28 07:24:06 -06:00
2c7a5f91ef ID: 299 - openipmi plugin writes zero to wrong byte
The intent is to zero the byte that no longer contains valid data (because the
data was shifted one byte to the left). However, the wrong byte is being zeroed.
One way this shows up is when displaying the descriptions with hpm compprop.
2014-03-27 20:29:44 +01:00
9e3dba7e97 ID: 301 - Add OS/Hypervisor installation status events
Add OS/Hypervisor installation status event types to SEL as noted in table-24 in
section 42.2.

Commit-for: Charles Rose
2014-03-27 19:57:30 +01:00
176774cf9f ID: 298 - fix LANplus retry
``I had submitted a patch back on Nov 19, 2013 regarding a fix to lanplus retry.
This had resolved a problem whereby a retry of a payload type of
IPMI_PAYLOAD_TYPE_IPMI first removed the request from the queue before going
back for a retry of the message. I have been able to determine why this fix
works correctly. More importantly I have been able to resolve other retry
problems in lanplus where assertion panics were hitting on certain retry
operations. A new, replacement patch for resolving both of these types of retry
bugs follows.

The first bug,where the ipmi_lanplus_send_payload() is sending a payload type of
IPMI_PAYLOAD_TYPE_IPMI is retryable, however I found in testing that it did not
remove the previous request entry from the list of requests chain. If the
original message had timed out, a second message sent, the second reply would
not match up to the right entry on the list as the req command and sequence
numbers are the same. By first removing the first request from the chain this
resolves it. The consequence of not removing the stale entry was random errors.

The second bug is when waiting for a message response times out during the
ipmi_lanplus_send_payload types IPMI_PAYLOAD_TYPE(s) RCMP_OPEN_REQUEST, RAKP1,
RAKP_3. In various testing where the message timed out on either of these three
payload types, ipmitool would assertion panic upon retry as the session_state
was wrong. The timeout could be due to the message never getting to the BMC, the
BMC never acting/responding to the message, or the reply message packet dropped
(it is UDP after all). If the BMC had acted on the message but the reply was not
received, the BMC state would had advanced, and a retry of any of these three
commands would error. It is not knowable at retry time if the BMC had acted on
the message or not. The solution is upon message timeout failure, retry all
three commands in the sequence. This has shown to be reliable and does not
result in assertions or any unexpected BMC behaviors. Should the original
message response eventually arrive very late, it is just discarded.

The testing for these problems was elusive until we found a moderately slow BMC
and had separate sessions direct a fusillade of nmap operations on the BMC, then
run simple ipmitool commands. This caused sufficient loading of the network and
BMC to cause lengthy delays and outright packet drops. The general approach on
the second fix is to return a timeout error code back through ipmi_lanplus_open
where the sequence can be retried.''

Patch-by: Pat Donlin
2014-03-23 08:15:51 +01:00
cab450a052 ID: 295 - inform user if SOL session disconnected
Currently if we are connected to ipmitool sol session and if service processor
goes down due to reset/reload, then user has no way to know that sol session has
been disconnected. Commit aims to fix such case.

Patch-by: Mamatha Inamdar
2014-03-23 07:58:11 +01:00
250eb15f92 ID: 297 - don't print-out SEL entry if ID not present
Don't print-out SEL log entry if SEL Record ID isn't present.

Patch-by: Mamatha Inamdar
2014-03-23 07:51:05 +01:00
02e4a0361c ID:296 - Fix PSD size decoding
Commit replaces size decoding code with code ported from "decode-dimms" Perl
script found in i2c-tools 3.0.3. Former code has reported incorrect size of DDR2
modules.

Patch-by: Alexander Amelkin
2014-03-23 07:37:58 +01:00
ca5cc560f6 Add options to chassis bootparam set bootflag 2014-03-11 10:26:43 -06:00
b4a9d2f9a2 ID: 293 - Use of uninitialized variable in ipmi_main()
The variable addr is used uninitialized on line 918 of ipmi_main(). Commit
ensures it is initialized to 0 before being used.

Reported-by: NUXI
2014-02-27 08:56:28 +01:00
8d44c55feb Properly handle plugin non-zero target adddress with -t specification Bug 292 2014-02-10 06:05:49 -07:00
c18ec02f33 Move all files one level up in the file hierarcy, to avoid the useless ipmitool directory. 2014-02-05 17:30:32 +01:00
b0aad15d67 Add myself to AUTHORS to test git commit emails. 2014-01-31 11:58:47 +01:00
adbf585bd4 Add link to commit archive to test git commit emails. 2014-01-31 11:51:59 +01:00
9393bf0133 Typo, missing semicolon. 2014-01-31 06:13:58 +00:00
2c2844ac03 Use TIOCFLUSH if TCFLSH is missing to get the serial plugin building on Hurd. 2014-01-30 18:55:46 +00:00
c186e2a681 Disable imb and open plugins by default on Hurd. The platform lack the required kernel support. 2014-01-30 18:33:47 +00:00
e02ed2ca2c Change serial plugin to only try to disable the IUCLC serial line flag on platforms supporting it. Fixes build problem on Hurd and FreeBSD. 2014-01-30 18:17:45 +00:00
a06f8a26d4 Add missing break; in switch block (Coverity CID 1149010). 2014-01-15 08:58:04 +00:00
a324db391c Add missing format string placeholder (Coverity CID 1149038). 2014-01-15 08:55:38 +00:00
b086e876d7 Add missing format string placeholder (Coverity CID 1149037). 2014-01-15 08:54:00 +00:00
555a08ece0 Add missing format string placeholder (Coverity CID 1149036). 2014-01-15 08:52:23 +00:00
696ccb0787 Set pointer to NULL just after free() two other places too. 2014-01-11 07:58:50 +00:00
86cb5ee175 Make sure to set free()ed pointer to NULL immediately, as specified by
<URL: http://sourceforge.net/p/ipmitool/wiki/coding_standards/ >.
2014-01-11 07:43:12 +00:00
99fff91f9d Make sure blockId buffer is never overflown (Coverity CID 1149058). 2014-01-11 07:22:46 +00:00
df3e3c7969 Fix incorrect printf() arguments (Coverity CID 1149035). 2014-01-11 07:11:41 +00:00
135977a497 Make sure to release malloc()-ed data when fread() fail to read board
type data (Coverity CID 1149052).
2014-01-11 06:50:57 +00:00
4e220bebb0 Check return value from open() in ipmi_start_daemon() (Coverity CID CID 1148983). 2014-01-11 06:45:44 +00:00
4698e667f5 Make sure input_file is not used if it is NULL (Coverity CID 1149055). 2014-01-11 06:29:01 +00:00
ff1dbe3d5b ID: 278 - Error in sol looptest
Commit fixes use of uninitialized variable in SOL "looptest".
2013-12-17 05:17:55 +00:00
d42890ef17 ID: 290 - ipmi_sol.c needs a clean-up
ipmi_sol_payload_access() - change formatting and simplify.
2013-12-17 05:05:43 +00:00
2d7fe32687 ID: 85 - Supermicro memory ecc error display
Commit adds memory ECC error display for Supermicro boards and adds a
Supermicro oem sensor type for SEL.
2013-12-17 04:56:18 +00:00
3a852a8849 ID: 85 - Supermicro memory ECC error display
Commit adds ipmi_get_oem_id() function.
2013-12-17 04:53:20 +00:00
c9e047c334 ID: 290 - ipmi_sol.c needs a clean-up
Clean up code formatting in ipmi_sol_main().
2013-12-08 20:45:17 +00:00
6cf6b4b845 ID: 286 - Open session retries hit assert in ipmi_lanplus_send_payload
If we have to retry an open session request, we hit an assert
that assumes we can only be in LANPLUS_STATE_PRESESSION state.

Add LANPLUS_STATE_OPEN_SESSION_SENT so we don't abort if
we retry.

Commit for Anton Blanchard
2013-12-08 19:12:21 +00:00
36c11f6033 ID: 285 - Fix SEGV in ipmi_lanplus_open_session
If ipmi_lanplus_send_payload fails we get a NULL pointer
returned. Error out straight away instead of continuing on
and getting a SEGV when we dereference rsp.

Commit for Anton Blanchard
2013-12-08 19:06:13 +00:00
5dc9585e77 ID: 284 - Fix SEGV in ipmi_main
Check the return code of ipmi_main_intf->open(), and take the
error path if it fails. Right now we continue on blindly which
results in a SEGV.

Commit for Anton Blanchard
2013-12-08 18:59:28 +00:00
0b97d32c25 ID: 283 - ipmi_intf_socket_connect fails with IPv4 hosts
A recent IPv6 patch broke IPv4 connections. Fix the incorrect
conditional to get it going again.

Commit for Anton Blanchard
2013-12-08 18:54:18 +00:00
5949b19d44 Fix code formatting, at least a bit. 2013-12-08 18:46:53 +00:00
0cd8f46c42 Reverting commit ``Add support for enabling/disabling PEF policy entries'' as
there is no ticket/ticket number missing and no code review.
2013-11-26 04:25:46 +00:00
2ff745286b Add support for enabling/disabling PEF policy entries 2013-11-25 21:38:04 +00:00
f6cabfb089 PA: 83 - Revised IPv6 patch
Author: Holger Liebig
Deduplicated socket connection shared among lan and lanplus.
Allows IPv6 address and tries to pick correct scope ID.
2013-11-14 12:56:49 +00:00
d3ca7cb090 FR: 24 - Exchange OS Name Hostname BMC URL during startup
Correct sysconfig defaults in comment. Systemd dependencies.
2013-11-05 13:01:36 +00:00
6871fe1c8e FR: 24 - Exchange OS Name Hostname BMC URL during startup
Add service, systemd unit, sysconfig in contrib
2013-11-05 12:27:00 +00:00
b9a0c5a091 ID: 46 - ipmi_fwum needs some re-work
Commit changes to 'include/ipmitool/ipmi_fwum.h'.
2013-10-28 05:21:46 +00:00
1cc4ba699d ID: 46 - ipmi_fwum needs some re-work
Move 'struct' and 'enum' into header file
2013-10-26 19:31:44 +00:00
b779439ad0 ID: 46 - ipmi_fwum needs some re-work
Replace tKFWUM_Status with int

Commit replaces tKFWUM_Status with int. tKFWUM_Status is all nice and neat, but
if int can do, why would you use something that makes your lines unnecessarily
longer?
2013-10-26 19:30:15 +00:00
63ef18e6e0 ID: 46 - ipmi_fwum needs some re-work
Remove keyword 'static'

Commit removes ``static'' as I see no point, no point at all to have it here.
2013-10-26 19:29:49 +00:00
935b215514 ID: 46 - ipmi_fwum needs some re-work
Rename saveFirmwareInfo -> save_fw_nfo
2013-10-26 19:29:29 +00:00
cd524c2d25 ID: 46 - ipmi_fwum needs some re-work
File name is no longer ``uchar *'' - remove casts

File name is no longer ``unsigned char *'', therefore remove pointless casts to
``char *''.
2013-10-26 19:29:05 +00:00
e24c7f75f2 ID: 46 - ipmi_fwum needs some re-work
Remove duplicate Kontron IANA number

Commit removes/replaces duplicate Kontron IANA number which can be found in
'include/ipmitool/ipmi.h' as well. Therefore there is no need to have it here.
2013-10-26 19:28:40 +00:00
da4b779adf ID: 46 - ipmi_fwum needs some re-work
Group together and order[a-z] function prototypes
2013-10-26 19:27:43 +00:00
aca8d6ad7b ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - download/upgrade fw

Commit removes KfwumMain() and creates ipmi_fwum_fwupgrade() instead.
2013-10-26 19:27:15 +00:00
5416af78a5 ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - start fw upgrade

Commit moves start-fw-upgrade out of KfwumMain(). It also changes return type of
KfwumStartFirmwareUpgrade().
2013-10-26 19:26:38 +00:00
770e61663f ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - tracelog

Commit moves tracelog out of KfwumMain() and changes return type of
KfwumGetTraceLog().
2013-10-26 19:26:16 +00:00
22f294fc27 ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - status

Commit moves status out of KfwumMain().
2013-10-26 19:25:16 +00:00
a675601da4 ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - info

Commit moves 'info' out of KfwumMain().
2013-10-26 19:24:02 +00:00
645120f545 ID: 46 - ipmi_fwum needs some re-work
Dismantle KfwumMain() - rollback

Commit moves 'rollback' out of KfwumMain() and changes return value of
KfwumManualRollback().
2013-10-26 19:23:37 +00:00
2df9ca914f ID: 46 - ipmi_fwum needs some re-work
KfwumMain() - return value void -> int

KfwumMain() returns int instead of void now in order to report success or
failure of given task.
2013-10-26 19:23:16 +00:00
a5d55b5d51 ID: 46 - ipmi_fwum needs some re-work
Move #define into header file
2013-10-26 19:20:50 +00:00
f2ba7fcd60 ID: 46 - ipmi_fwum needs some re-work
Rename VERSION_MAJ and VERSION_MIN

Commit renames VERSION_MAJ to VER_MAJOR and VERSION_MIN to VER_MINOR.
2013-10-26 19:18:34 +00:00
24923222f6 ID: 46 - ipmi_fwum needs some re-work
Finish off formatting, remove useless comments

Commit finishes off formatting changes and removes useless, out-of-date,
comments.
2013-10-26 19:18:01 +00:00
5bf68a4769 ID: 46 - ipmi_fwum needs some re-work
KfwumGetInfoFromFirmware() - code formatting, simplify
2013-10-26 19:16:36 +00:00
4e2ac7d097 ID: 46 - ipmi_fwum needs some re-work
KfwumOutputInfo() -> printf_kfwum_info() + code formatting
2013-10-26 19:15:15 +00:00
d5d86d4dcb ID: 46 - ipmi_fwum needs some re-work
KfwumGetTraceLog() - code formatting, simplification
2013-10-26 19:14:43 +00:00
0a4a5cafbc ID: 46 - ipmi_fwum needs some re-work
KfwumStartFirmwareUpgrade() - code formatting
2013-10-26 19:13:43 +00:00
043c42160e ID: 46 - ipmi_fwum needs some re-work
KfwumGetStatus() - formatting, simplify, documentation
2013-10-26 19:12:44 +00:00
49879b387c ID: 46 - ipmi_fwum needs some re-work
KfwumShowProgress() - code formatting, fix

Commit fixes code formatting in KfwumShowProgress() and replaces ``unsigned
char'', which didn't make any sense, with a ``signed char'', resp. ``char''.
2013-10-26 19:11:33 +00:00
38121041c1 ID: 46 - ipmi_fwum needs some re-work
KfwumUploadFirmware() - code formatting
2013-10-26 19:10:16 +00:00
d8f27165d1 ID: 46 - ipmi_fwum needs some re-work
KfwumFinishFirmareImage() - code formatting
2013-10-26 19:09:15 +00:00
5a1e81a948 ID: 46 - ipmi_fwum needs some re-work
KfwumSaveFirmwareImage() - formatting, clean-up

Commit cleans up formatting, code and, hopefully, simplifies
KfwumSaveFirmwareImage().
2013-10-26 19:08:12 +00:00
f12b976ebc ID: 46 - ipmi_fwum needs some re-work
KfwumStartFirmwareImage() - code formatting, simplify
2013-10-26 19:07:04 +00:00
0dddcfe450 ID: 46 - ipmi_fwum needs some re-work
KfwumManualRollback() - code formatting, simplify
2013-10-26 19:06:28 +00:00
700658e91e ID: 46 - ipmi_fwum needs some re-work
KfwumGetDeviceInfo() - simplify, code formatting
2013-10-26 19:04:42 +00:00
3df72b68bc ID: 46 - ipmi_fwum needs some re-work
KfwumGetInfo() - simplify logic, code formatting
2013-10-26 19:03:54 +00:00
068bcb02e4 ID: 46 - ipmi_fwum needs some re-work
Rename KfwumValidFirmwareForBoard(), document

Commit renames KfwumValidFirmwareForBoard() to ipmi_kfwum_checkfwcompat() and
adds a bit of documentation about this function.
Code formatting of this function changed as well.
2013-10-26 18:38:24 +00:00
52634a708f ID: 46 - ipmi_fwum needs some re-work
KfwumGetFileSize() - small re-work
2013-10-26 18:37:45 +00:00
2b08fd405e ID: 46 - ipmi_fwum needs some re-work
KfwumMain() - change code formatting

Commit changes code formatting of KfwumMain() into readable form and to make
sense out of it.
2013-10-26 18:37:00 +00:00
fb3c6f292e ID: 46 - ipmi_fwum needs some re-work
Rename KfwumOutputHelp() to printf_kfwum_help()
2013-10-26 18:35:44 +00:00
d02492f1c7 ID: 46 - ipmi_fwum needs some re-work
Remove trailing tabs and white spaces.
2013-10-26 17:12:29 +00:00
9517cb332b ID: 46 - ipmi_fwum needs some re-work
ipmi_fwum_main() re-work.
2013-10-26 17:10:14 +00:00
ae96dd3229 ID: 50 - ipmi_hpmfwupg needs a clean up
I really don't believe you meant 'static' + function(), seriously.
2013-10-26 14:40:05 +00:00
968f5d6552 ID: 50 - ipmi_hpmfwupg needs a clean up
Rather major re-work of internal logic in HpmfwupgPreparationStage().
2013-10-26 14:18:48 +00:00
f4730e1f67 ID: 50 - ipmi_hpmfwupg needs a clean up
ComponentId has its own declaration now.
2013-10-26 07:08:13 +00:00
b782311e10 ID: 50 - ipmi_hpmfwupg needs a clean up
* print error if not enough parameters given, return code 1
* recognize 'help' as a valid parameter
* print error if a invalid parameter is given, return code 1
2013-10-26 06:55:18 +00:00
45d0a4255a ID: #279 ipmitool sdr list broken
Restoration of the interface target address and channel after a bridged
request was incorrectly tied to a non-zero saved target address.  This does
not work for the Openipmi interface because the default interface target address
for the Openipmi interface is zero by default.
2013-10-23 20:32:40 +00:00
ac9513025c ID: 50 - ipmi_hpmfwupg needs a clean up
Remove "changelog". That's why we have tickets, SCM, ChangeLog etc.
2013-10-11 04:45:55 +00:00
60a3e63429 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgQuerySelftestResult() - kill one level of indentation.
2013-10-11 04:14:59 +00:00
f19ed0a90b ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgUpgradeStage() - kill one level of indentation by changing one if().
2013-10-10 12:26:46 +00:00
7a0b451fd7 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgValidateImageIntegrity() - re-write a bit to make it more compact.
2013-10-10 12:17:22 +00:00
a8119d13a8 ID: 50 - ipmi_hpmfwupg needs a clean up
Add missing ``rsp == NULL'' comp.
2013-10-10 12:06:00 +00:00
f56cea1253 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgQueryRollbackStatus() - kill one level of indentation.
2013-10-10 12:04:52 +00:00
7b5683d85d ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgManualFirmwareRollback() - kill one level of indentation.
2013-10-10 11:56:04 +00:00
80c03570ac ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgActivateFirmware(), HpmfwupgGetUpgradeStatus() - kill one level of
indentation.
2013-10-10 11:49:53 +00:00
6de0796079 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgUploadFirmwareBlock() - kill a bit of indent by re-writing one if().
2013-10-10 11:42:32 +00:00
18aadc30d0 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgInitiateUpgradeAction() - kill unnecessary indent.
2013-10-10 11:33:27 +00:00
08f50ad301 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgAbortUpgrade() - simplify function.
2013-10-10 11:29:40 +00:00
b803224398 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgGetComponentProperties() - kill indent by rewriting two if() conditions.
2013-10-10 11:23:35 +00:00
5d3c64f028 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgGetTargetUpgCapabilities() - remove unnecessary if() and kill indent.
2013-10-10 11:13:44 +00:00
942dcb71d8 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgGetDeviceId() - simplify function.
2013-10-10 10:37:46 +00:00
29af592773 ID: 50 - ipmi_hpmfwupg needs a clean up
HpmfwupgGetBuffersFromFile() - simplify function in order to kill unnecessary
indent. Also, notify user about malloc failure and exit early.
2013-10-10 10:17:33 +00:00
ada4b48baf ID: 50 - ipmi_hpmfwupg needs a clean up
Move struct and #define into header file where they belong.
2013-10-10 09:48:58 +00:00
47831b3c15 ID: 50 - ipmi_hpmfwupg needs a clean up
Commit changes code formatting only. No functionality changes have been made.
2013-10-10 09:14:50 +00:00
efdeb12724 ID: 44 - dummy interface support - fake-ipmistack project
Commit adds support for a 'dummy' interface in order to communicate with
fake-ipmistack.
2013-10-04 05:03:33 +00:00
c7412e5815 ID: 48 - Remove hard-coded FRU inventory access length restriction
The patch removes hard-coded 16-byte length restriction onf FRU inventory
transactions. Instead, it adds an optional command-line argument for devices
which need such restriction.
For other devices, 32 bytes cap length is used.
Also, the patch contains several code optimizations as well as several bug-fixes
in API implementations where absolute FRU device offsets were used instead on
relative.

Commit for Dmitry Bazhenov
2013-10-04 04:57:20 +00:00
041d8e4bf8 ID: 276 - HPM.1 upgrade combined patch
This patch does the following:
- Fixes percentage visualization for short upgrade images
- Resolves ambiguity for action record checksum calculation
- Skips the activation stage when all components are skipped
- Partially fixes formatting
- Adds several code optimizations

Commit for Dmitry Bazhenov
2013-10-04 03:49:58 +00:00
180 changed files with 13308 additions and 11052 deletions

View File

@ -2,3 +2,4 @@ Duncan Laurie <duncan@iceblink.org>
Fredrik Öhrn <ohrn@chl.chalmers.se>
Jon Cassorla <jon.cassorla@newisys.com>
Jeremy Ellington <jeremy@jeremye.net>
Petter Reinholdtsen <pere@hungry.com>

View File

@ -1,3 +1,67 @@
version 1.8.15 2014-11-24
* ID: 340 - ipmitool sol session improperly closes on packet retry
* ID: 277 - support for hostnames longer than 64 chars
* ID: 313 - ipmitool doesn't support hostname long than 64 symbols
* ID: 277 - Minor issue with ipmi_intf_session_set_hostname()
* ID: 247 - 'sensor thresh' help output is wrong
* ID: 324 - conflicting declaration write_fru_area()
* ID: 337 - Add support for 13G Dell PowerEdge
* ID: 325 - DDR4 DIMM Decoding Logic
* ID: 328 - HPM.2 fixes
* ID: 329 - hpm.1 upgrade fixes
* ID: 103 - picmg discover messages should be DEBUG, not INFO
* ID: 331 - Passwords provided in file (-f option) truncated on space
* ID: 318 - ipmi_tsol.c: fix buffer overflow
* ID: 306 - "fru print" command prints the FRU #0 twice
* ID: 305 - HPM.1 deferred activation support fixup
* ID: 317 - ipmi_fwum.c: fix typo
* ID: 315 - buildsystem: configure.in is deprecated
* ID: 316 - Directory debian is outdated
* ID: 103 - 'lib/ipmi_ekanalyzer.c' needs a re-work
* ID: 46 - SEL OEM record corner case
version 1.8.14 2014-05-05
* ID: 299 - openipmi plugin writes zero to wrong byte
* ID: 301 - Add OS/Hypervisor installation status events
* ID: 298 - fix LANplus retry
* ID: 295 - inform user if SOL session disconnected
* ID: 297 - don't print-out SEL entry if ID not present
* ID: 296 - Fix PSD size decoding
* ID: 293 - Use of uninitialized variable in ipmi_main()
* ID: 278 - Error in sol looptest
* ID: 290 - ipmi_sol.c needs a clean-up
* ID: 85 - Supermicro memory ECC error display
* ID: 290 - ipmi_sol.c needs a clean-up
* ID: 286 - Open session retries hit assert in ipmi_lanplus_send_payload
* ID: 285 - Fix SEGV in ipmi_lanplus_open_session
* ID: 284 - Fix SEGV in ipmi_main
* ID: 283 - ipmi_intf_socket_connect fails with IPv4 hosts
* ID: 46 - ipmi_fwum needs some re-work
* ID: 50 - ipmi_hpmfwupg needs a clean up
* ID: 279 - ipmitool sdr list broken
* ID: 44 - dummy interface support - fake-ipmistack project
* ID: 48 - Remove hard-coded FRU inventory access length restriction
* ID: 276 - HPM.1 upgrade combined patch
* ID: 90 - Add options to chassis bootparam set bootflag
* ID: 292 -Properly handle plugin non-zero target adddress with -t
* Numerous Fixes based on running Coverity
* Use TIOCFLUSH if TCFLSH is missing to get the serial plugin building on
Hurd.
* Disable imb and open plugins by default on Hurd. The platform lack
the required kernel support.
* Change serial plugin to only try to disable the IUCLC serial line flag on
platforms supporting it. Fixes build problem on Hurd and FreeBSD.
* PA: 83 - Revised IPv6 patch
* FR: 24 - Exchange OS Name Hostname BMC URL during startup
* ID: 304 - Incorect byteswap in SOL maximum payload
* ID: 303 - Fix build error in HPM.2 code
* ID: 300 - new sunoem functionality
* ID: 144 - Fix 'dcmi power set_limit action <value>'
* ID: 302 - HPM.2 long message support
* ID: 309 - Add new SEL entries for ipmi 2.0 rev 1.1
* ID: 280 - man page cleanup
* ID: 311 - man page update for new sunoem commands
version 1.8.13 2013-09-09
* ID: 3611905 - Direct Serial Basic/Terminal Mode Interface drivers
* ID: 3577766 - configure's knobs and switches don't work

View File

@ -31,9 +31,7 @@
DOCDIR = $(datadir)/doc/$(PACKAGE)
DOCLIST = $(top_srcdir)/README $(top_srcdir)/COPYING $(top_srcdir)/AUTHORS $(top_srcdir)/ChangeLog
EXTRA_DIST = $(DOCLIST) \
debian/changelog debian/control debian/copyright \
debian/dirs debian/docs debian/rules
EXTRA_DIST = $(DOCLIST)
AUTOMAKE_OPTIONS = dist-bzip2

View File

@ -410,3 +410,5 @@ http://www.intel.com/design/servers/ipmi/spec.htm
OpenIPMI project: Linux IPMI kernel driver and userland library
http://openipmi.sourceforge.net
IPMItool commit archive
https://lists.sourceforge.net/lists/listinfo/ipmitool-cvs

View File

@ -3,7 +3,7 @@ dnl autoconf for ipmitool
dnl
AC_INIT([src/ipmitool.c])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([ipmitool], [1.8.13-cvs])
AM_INIT_AUTOMAKE([ipmitool], [1.8.15-cvs])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([src/ipmitool.c])
AC_PREREQ(2.50)
@ -29,7 +29,7 @@ AC_C_BIGENDIAN
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STRTOD
AC_CHECK_FUNCS([alarm gethostbyname socket select])
AC_CHECK_FUNCS([alarm gethostbyname getaddrinfo getifaddrs socket select])
AC_CHECK_FUNCS([memmove memset strchr strdup strerror])
AC_CHECK_FUNCS([getpassphrase])
@ -39,6 +39,8 @@ AM_PROG_LIBTOOL
LIBTOOL="$LIBTOOL --silent"
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([getaddrinfo], [nsl])
AC_SEARCH_LIBS([getifaddrs], [nsl])
AC_SEARCH_LIBS([socket], [socket], [],
[AC_CHECK_LIB([nsl], [socket],
[LIBS="$LIBS -lsocket -lnsl"], [], [-lsocket])])
@ -60,6 +62,7 @@ xenable_intf_imb=yes
xenable_intf_open=yes
xenable_intf_lipmi=yes
#xenable_intf_serial=yes
xenable_intf_dummy=no
xenable_all_options=yes
xenable_ipmishell=yes
@ -106,6 +109,11 @@ solaris*)
xenable_intf_bmc=no
xenable_intf_open=no
;;
gnu*)
# disable the linux and solaris-specific interfaces on Hurd
xenable_intf_imb=no
xenable_intf_open=no
;;
esac
AC_SUBST(ARCH, $host_cpu)
@ -503,6 +511,18 @@ if test "x$xenable_intf_bmc" = "xyes"; then
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB bmc/libintf_bmc.la"
fi
dnl enable Dummy interface for testing
AC_ARG_ENABLE([intf-dummy],
[AC_HELP_STRING([--enable-intf-dummy],
[enable Dummy(test) interface [default=no]])],
[xenable_intf_dummy=$enableval], [xenable_intf_dummy=no])
if test "x$xenable_intf_dummy" = "xyes"; then
AC_DEFINE(IPMI_INTF_DUMMY, [1], [Define to 1 to enable Dummy interface.])
AC_SUBST(INTF_DUMMY, [dummy])
AC_SUBST(INTF_DUMMY_LIB, [libintf_dummy.la])
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB dummy/libintf_dummy.la"
fi
AC_SUBST(IPMITOOL_INTF_LIB)
if test "x$xenable_ipmishell" = "xyes"; then
@ -602,7 +622,8 @@ AC_CONFIG_FILES([Makefile
src/plugins/imb/Makefile
src/plugins/bmc/Makefile
src/plugins/lipmi/Makefile
src/plugins/serial/Makefile])
src/plugins/serial/Makefile
src/plugins/dummy/Makefile])
AC_OUTPUT
@ -618,6 +639,7 @@ AC_MSG_RESULT([ imb : $xenable_intf_imb])
AC_MSG_RESULT([ bmc : $xenable_intf_bmc])
AC_MSG_RESULT([ lipmi : $xenable_intf_lipmi])
AC_MSG_RESULT([ serial : $xenable_intf_serial])
AC_MSG_RESULT([ dummy : $xenable_intf_dummy])
AC_MSG_RESULT([])
AC_MSG_RESULT([Extra tools])
AC_MSG_RESULT([ ipmievd : yes])

View File

@ -34,6 +34,8 @@ dist_pkgdata_DATA = oem_ibm_sel_map
EXTRA_DIST = README \
bmclanconf ipmi.init.basic ipmi.init.redhat \
exchange-bmc-os-info.init.redhat exchange-bmc-os-info.service.redhat \
exchange-bmc-os-info.sysconf \
ipmievd.init.redhat ipmievd.init.suse ipmievd.init.debian \
collect_data.sh create_rrds.sh create_webpage_compact.sh create_webpage.sh \
bmc-snmp-proxy bmc-snmp-proxy.service bmc-snmp-proxy.sysconf

View File

@ -0,0 +1,326 @@
#!/bin/sh
#############################################################################
#
# exchange-bmc-os-info: Set OS and BMC (Baseboard Management Controller)
# parameters during system startup.
#
# version: 0.72
#
# Authors: Charles Rose <charles_rose@dell.com>
# Jordan Hargrave <jordan_hargrave@dell.com>
#
# Description: Script to set OS information in the BMC; fetch BMC IP/URL
# and set in the OS for use by other scripts/user.
#
# BMC IP and URL are made available in /var/run/bmc-info
#
# Example to launch BMC web-interface:
# # . /var/run/bmc-info
# # xdg-open $BMC_URL
#
# See here for details:
# https://fedoraproject.org/wiki/Features/AgentFreeManagement
#
# OEM Specific: OEM specific ipmi commands go in:
# 'oem_set_os_version' and 'oem_get_bmc_url'
#############################################################################
#
# chkconfig: 345 99 00
# description: Set OS name, hostname in BMC; make BMC IP/URL available in OS
# processname: exchange-bmc-os-info
# config: /etc/sysconfig/exchange-bmc-os-info
#
### BEGIN INIT INFO
# Provides: exchange-bmc-os-info
# Required-Start: ipmi
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
#############################################################################
# GLOBALS
#############################################################################
CONFIGFILE=/etc/sysconfig/exchange-bmc-os-info
IPMI_TOOL=/usr/bin/ipmitool
BMC_INFO=/var/run/bmc-info
# BMC Manufacturer ID used in 'oem_set_os_version' and 'oem_get_bmc_url'
DELL="674"
#OTHER_OEM="123"
# Defaults for ${CONFIGFILE}
SET_OS_INFO="yes"
RESET_OS_INFO="no"
SET_BMC_INFO="yes"
# getsysinfo and setsysinfo commands
IPMI_SET_SYSINFO="${IPMI_TOOL} mc setsysinfo"
IPMI_GET_SYSINFO="${IPMI_TOOL} mc getsysinfo"
#############################################################################
SCRIPT_NAME=$(basename $0)
# source config
[ -r ${CONFIGFILE} ] && . ${CONFIGFILE}
RETVAL=0
if [ -f /bin/gettext.sh ]; then
GETTEXT=1
. /bin/gettext.sh
OUTPUT="eval_gettext"
else
GETTEXT=0
OUTPUT="echo"
fi
#############################################################################
# Get Vendor ID of BMC for use in 'oem_set_os_version' and 'oem_get_bmc_url'
#
get_bmc_vendor_id()
{
BMC_VENDOR=$(${IPMI_TOOL} mc info 2>/dev/null | \
sed -n "s#^Manufacturer ID.*: ##p")
[ -z "${BMC_VENDOR}" ] && RETVAL=4
}
check_ipmitool()
{
if [ -x ${IPMI_TOOL} ]; then
# v1.8.12 plus patches are required for set/getsysinfo support
# http://sourceforge.net/mailarchive/message.php?msg_id=29647222
[ ! ${IPMI_GET_SYSINFO} >/dev/null 2>&1 ] && \
RETVAL=3
else
RETVAL=2
fi
}
bmc_exists()
{
check_ipmitool
[ $RETVAL -eq 0 ] && get_bmc_vendor_id
return $RETVAL
}
#############################################################################
get_os_info()
{
OS_HOSTNAME=$(hostname)
KERNEL_VERSION=$(uname -r -m)
if [ -e /etc/lsb-release ] ; then
. /etc/lsb-release
NAME=${DISTRIB_ID}
VERSION="${DISTRIB_RELEASE} ${DISTRIB_CODENAME}"
fi
# we prefer systemd's /etc/os-release over other sources
[ -e /etc/os-release ] && . /etc/os-release
OS_NAME=${NAME}
OS_VERSION="${VERSION} kernel ${KERNEL_VERSION}"
}
oem_set_os_version()
{
# OS Version setting is not standard yet
# we need per vendor oem commands
case "${BMC_VENDOR}" in
$DELL) ${IPMI_SET_SYSINFO} delloem_os_version \
"${OS_VERSION}" > /dev/null 2>&1
return $?
;;
# Add OEM specific commands.
# Example:
# $OTHER_OEM) ${IPMI_SET_SYSINFO} otheroem_os_version \
# "${OS_VERSION}" > /dev/null 2>&1
# return $?
# ;;
*) return 0
;;
esac
}
set_os_info()
{
# Set and reset OS info in the BMC
if [ "$1" = "reset" ]; then
OS_NAME=""
OS_HOSTNAME=""
OS_VERSION=""
fi
${IPMI_SET_SYSINFO} os_name "${OS_NAME}" >/dev/null 2>&1 \
|| RETVAL=6
${IPMI_SET_SYSINFO} primary_os_name "${OS_NAME}" >/dev/null 2>&1 \
|| RETVAL=6
${IPMI_SET_SYSINFO} system_name "${OS_HOSTNAME}" >/dev/null 2>&1 \
|| RETVAL=6
oem_set_os_version || RETVAL=6
}
#############################################################################
valid_url()
{
url="(https?|http)://[a-z0-9-]+(\.[a-z0-9-]+)+([/?].*)?"
printf -- "%s" "${TMP_URL}"| grep -Eq "^${url}"
return $?
}
oem_get_bmc_url()
{
# BMC URL is not standard yet
# we need per vendor oem commands
case "$BMC_VENDOR" in
$DELL) TMP_URL=$(${IPMI_GET_SYSINFO} delloem_url 2> /dev/null)
;;
# Add OEM specific commands
# Example:
# $OTHER_OEM)
# TMP_URL=$(${IPMI_GET_SYSINFO} otheroem_url 2> /dev/null)
# ;;
*) TMP_URL="" ;;
esac
valid_url && BMC_URL=${TMP_URL} || BMC_URL=""
}
valid_ip()
{
#Thanks to mkyong.com
octet="([01]?[[:digit:]][[:digit:]]?|2[0-4][[:digit:]]|25[0-5])"
printf -- "%s" "${TMP_IPv4}"| grep -Eq "^${octet}\\.${octet}\\.${octet}\\.${octet}$"
return $?
}
get_bmc_ip()
{
#Thanks to http://ingvar.blog.redpill-linpro.com
for CHANNEL in `seq 1 14`
do
[ $(${IPMI_TOOL} lan print ${CHANNEL} 2>/dev/null \
| grep -q "^Set") ] || break
done
# Get BMC_IPv4 and BMC_URL from BMC
TMP_IPv4=$(${IPMI_TOOL} lan print ${CHANNEL} 2>/dev/null \
| sed -n "s#^IP Address .*: ##p")
valid_ip && BMC_IPv4=${TMP_IPv4} || BMC_IPv4=""
}
get_bmc_info()
{
get_bmc_ip
if [ -z "${BMC_IPv4}" ] || [ "${BMC_IPv4}" = "0.0.0.0" ]; then
BMC_IPv4=""
RETVAL=5
else
# URL makes sense only if there is an IP
oem_get_bmc_url
fi
}
set_bmc_info()
{
if [ ! $(touch "${BMC_INFO}" && chmod 600 "${BMC_INFO}") ]; then
printf "BMC_IPv4=%s\n" "${BMC_IPv4}" > "${BMC_INFO}"
[ -n "${BMC_URL}" ] && \
printf "BMC_URL=%s\n" "${BMC_URL}" >> "${BMC_INFO}"
else
RETVAL=5
fi
}
unset_bmc_info()
{
[ -f ${BMC_INFO} ] && rm -f ${BMC_INFO} > /dev/null 2>&1
}
#############################################################################
start()
{
if bmc_exists; then
[ "${SET_OS_INFO}" = "yes" ] && \
get_os_info && set_os_info
if [ "${SET_BMC_INFO}" = "yes" ]; then
get_bmc_info
if [ ${RETVAL} -eq 0 ]; then
set_bmc_info
fi
fi
fi
}
#############################################################################
stop()
{
if bmc_exists; then
# reset OS info while system reboots
# aids with debugging OS boot-up issues
if [ "${RESET_OS_INFO}" = "yes" ]; then
set_os_info reset
fi
unset_bmc_info
fi
}
#############################################################################
restart()
{
stop
[ $RETVAL -eq 0 ] && start
}
#############################################################################
status()
{
[ -r ${BMC_INFO} ] && \
grep -q "BMC_IPv4" "${BMC_INFO}" >/dev/null 1>&2 && \
BMC_STATUS="ok" || BMC_STATUS="inactive"
${OUTPUT} "${SCRIPT_NAME}: ${BMC_STATUS}" 1>&2
[ ${GETTEXT} -eq 1 ] && echo
}
#############################################################################
usage()
{
${OUTPUT} "Usage: ${SCRIPT_NAME} {start|stop|restart|status}" 1>&2
[ ${GETTEXT} -eq 1 ] && echo
RETVAL=1
}
#############################################################################
# MAIN
#############################################################################
case "$1" in
start) start ;;
stop) stop ;;
restart) restart ;;
status) status ;;
*) usage ;;
esac
case "$RETVAL" in
0|1) ;;
2) ${OUTPUT} "${SCRIPT_NAME}: ipmitool(1) not found." 1>&2 ;;
3) ${OUTPUT} "${SCRIPT_NAME}: this version of ipmitool does not support getsysinfo." 1>&2 ;;
4) ${OUTPUT} "${SCRIPT_NAME}: failed to communicate with BMC." 1>&2 ;;
5) ${OUTPUT} "${SCRIPT_NAME}: failed to set OS information in BMC." 1>&2 ;;
6) ${OUTPUT} "${SCRIPT_NAME}: failed to get BMC information." 1>&2 ;;
*) ${OUTPUT} "${SCRIPT_NAME}: unexpected error." 1>&2 ;;
esac
if [ ${RETVAL} -gt 1 ]; then
${OUTPUT} " Return code: ${RETVAL}" 1>&2
[ ${GETTEXT} -eq 1 ] && echo
fi
exit ${RETVAL}
#############################################################################
# end of file
#############################################################################

View File

@ -0,0 +1,13 @@
[Unit]
Description=Exchange Information between BMC and OS
After=ipmi.service network.target
Requires=ipmi.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/libexec/exchange-bmc-os-info start
ExecStop=/usr/libexec/exchange-bmc-os-info stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,26 @@
# exchange-bmc-os-info
#
# Config file to control Exchange of information between
# the OS and Service Processor/Baseboard Management Controller (BMC)
#
# See here for details
# https://fedoraproject.org/wiki/Features/AgentFreeManagement
### Set OS Info in BMC/Service Processor ###
# Name: SET_OS_INFO
# Description: Set OS Name, Version and Hostname in the Service Processor (BMC)
# Default: yes
SET_OS_INFO="yes"
### Reset OS Info in BMC/Service Processor ###
# Name: RESET_OS_INFO
# Description: Reset OS Name, Version and Hostname in the Service Processor (BMC).
# Useful when the OS Name/Hostname should be empty on reboot
# Default: no
RESET_OS_INFO="no"
### Set BMC/Service Processor Info in OS ###
# Name; SET_BMC_INFO
# Description: Set IP Address and URL of Service Processor/BMC in /run/bmc-info
# Default: yes
SET_BMC_INFO="yes"

View File

@ -154,9 +154,6 @@ Set the local IPMB address. The local address defaults to 0x20
or is auto discovered on PICMG platforms when -m is not specified.
There should be no need to change the local address for normal operation.
.TP
\fB\-M\fR <\fIaddress\fP>
Set transit local address for bridge request. (dual bridge)
.TP
\fB\-N\fR <\fIsec\fP>
Specify nr. of seconds between retransmissions of lan/lanplus messages.
Defaults are 2 seconds for lan and 1 second for lanplus interfaces.
@ -2309,14 +2306,16 @@ Get boot parameter. Currently supported values for <\fBparam #\fR> are:
.br
.TP
\fIset\fP <\fBoption\fR> [\fBvalue ...\fR]
\fIset\fP <\fBdevice\fR> [<\fIoptions\fP=\fBhelp,...\fR>]
.br
Set boot parameter.
Set boot device parameter used for next boot. Various options may be used
to change when the the next boot device is cleared.
Run \fI"options=help"\fP for a list of available bootparam set device options.
.RS
.TP
Currently supported values for \fB<option>\fR are:
Currently supported bootparam \fBdevice\fR settings are:
.TP
\fIforce_pxe\fP
.br
@ -2348,6 +2347,37 @@ Force boot from CD/DVD
Force boot into BIOS setup
.RE
.RS
.TP
Currently supported bootparam \fBoptions\fR settings are associated with BMC Boot Valid Bit Clearing and are as follows: Any option can be prefixed with "no-" to invert the sense of the operation.
.TP
\fIPEF\fP
.br
Clear valid bit on reset/power cycle caused by PEF
.TP
\fItimeout\fP
.br
Automatically clear boot flag valid bit if Chassis Control command is
not received within 60 seconds.
.TP
\fIwatchdog\fP
.br
Clear valid bit on reset/power cycle caused by watchdog timeout
.TP
\fIreset\fP
.br
Clear valid bit on push button reset / soft-reset
.TP
\fIpower\fP
.br
Clear valid bit on power up via power push button or wake event
.RE
.RE
.RE
@ -2946,6 +2976,15 @@ I2C Master Write\-Read IPMI command.
\fIsunoem\fP
.RS
.TP
\fIcli\fP [<\fBcommand string\fR> ...]
.br
Execute the service processor command line interface commands.
Without any command string, an interactive session is started
in the service processor command line environ ment. If a
command string is specified, the command string is executed
on the service processor and the connection is closed.
.TP
\fIled\fP
.RS
@ -2991,10 +3030,28 @@ LED Type is optional:
.RE
.TP
\fIfan\fP \fIspeed\fP <0-100>
\fInacname\fP <\fBipmi name\fR>
.br
Set system fan speed (PWM duty cycle).
.RS
Return the full NAC name of a target identified by ipmi name.
.TP
\fIping\fP <\fBcount\fR> [<\fBq\fR>]
.br
Send and receive count packets. Each packet is 64 bytes.
q - Quiet. Displays output only at the start and end of the process.
.TP
\fIgetval\fP <\fBproperty name\fR>
.br
Returns value of specified ILOM property.
.TP
\fIsetval\fP <\fBproperty name\fR> <\fBproperty value\fR> [<\fBtimeout\fR>]
.br
Sets value of ILOM property. If timeout is not specified, the
default value is 5 seconds. NOTE: setval must be executed locally on host!
.TP
\fIsshkey\fP
.RS
@ -3010,9 +3067,65 @@ with the 'user list' command.
This command will delete the SSH key for a specified userid.
.RE
.TP
\fIversion\fP
.br
Display the version of ILOM firmware.
.TP
\fIgetfile\fP <\fBfile identifier\fR> <\fBdestination file name\fR>
.br
This command will return various files from service processor and store them
in specified destination file. Note that some files may not be present or
be supported by your SP.
.br
.RS
File identifiers:
.RS
.br
\fISSH_PUBKEYS\fP
.br
\fIDIAG_PASSED\fP
.br
\fIDIAG_FAILED\fP
.br
\fIDIAG_END_TIME\fP
.br
\fIDIAG_INVENTORY\fP
.br
\fIDIAG_TEST_LOG\fP
.br
\fIDIAG_START_TIME\fP
.br
\fIDIAG_UEFI_LOG\fP
.br
\fIDIAG_TEST_LOG\fP
.br
\fIDIAG_LAST_LOG\fP
.br
\fIDIAG_LAST_CMD\fP
.RE
.RE
.TP
\fIgetbehavior\fP <\fBfeature identifier\fR>
.br
This command will test if various ILOM features are enabled.
.br
.RS
Feature identifiers:
.RS
.br
\fISUPPORTS_SIGNED_PACKAGES\fP
.br
\fIREQUIRES_SIGNED_PACKAGES\fP
.RE
.RE
.RE
.TP
\fItsol\fP
.RS

View File

@ -30,7 +30,7 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = log.h bswap.h helper.h ipmi.h ipmi_cc.h ipmi_intf.h \
noinst_HEADERS = log.h bswap.h hpm2.h helper.h ipmi.h ipmi_cc.h ipmi_intf.h \
ipmi_chassis.h ipmi_entity.h ipmi_fru.h ipmi_hpmfwupg.h ipmi_lanp.h \
ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_mc.h ipmi_raw.h \
ipmi_channel.h ipmi_sensor.h ipmi_event.h ipmi_session.h \

View File

@ -99,6 +99,7 @@ void printbuf(const uint8_t * buf, int len, const char * desc);
uint8_t ipmi_csum(uint8_t * d, int s);
FILE * ipmi_open_file(const char * file, int rw);
void ipmi_start_daemon(struct ipmi_intf *intf);
uint16_t ipmi_get_oem_id(struct ipmi_intf *intf);
#define ipmi_open_file_read(file) ipmi_open_file(file, 0)
#define ipmi_open_file_write(file) ipmi_open_file(file, 1)

91
include/ipmitool/hpm2.h Normal file
View File

@ -0,0 +1,91 @@
/*
* Copyright (c) 2012 Pigeon Point Systems. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution 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.
*
* Neither the name of Pigeon Point Systems nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* PIGEON POINT SYSTEMS ("PPS") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* PPS OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF PPS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdint.h>
#include <ipmitool/ipmi_intf.h>
/* Global HPM.2 defines */
#define HPM2_REVISION 0x01
#define HPM3_REVISION 0x01
#define HPM2_LAN_PARAMS_REV 0x01
#define HPM2_SOL_PARAMS_REV 0x01
#define HPM3_LAN_PARAMS_REV 0x01
/* IPMI defines parameter revision as
* MSN = present revision,
* LSN = oldest revision parameter is
* backward compatible with. */
#define LAN_PARAM_REV(x, y) ((x) << 4 | (y) & 0xF)
/* HPM.2 capabilities */
#define HPM2_CAPS_SOL_EXTENSION 0x01
#define HPM2_CAPS_PACKET_TRACE 0x02
#define HPM2_CAPS_EXT_MANAGEMENT 0x04
#define HPM2_CAPS_VERSION_SENSOR 0x08
#define HPM2_CAPS_DYNAMIC_SESSIONS 0x10
#if HAVE_PRAGMA_PACK
# pragma pack(push, 1)
#endif
/* HPM.2 LAN attach capabilities */
struct hpm2_lan_attach_capabilities {
uint8_t hpm2_revision_id;
uint16_t lan_channel_mask;
uint8_t hpm2_caps;
uint8_t hpm2_lan_params_start;
uint8_t hpm2_lan_params_rev;
uint8_t hpm2_sol_params_start;
uint8_t hpm2_sol_params_rev;
} ATTRIBUTE_PACKING;
/* HPM.2 LAN channel capabilities */
struct hpm2_lan_channel_capabilities {
uint8_t capabilities;
uint8_t attach_type;
uint8_t bandwidth_class;
uint16_t max_inbound_pld_size;
uint16_t max_outbound_pld_size;
} ATTRIBUTE_PACKING;
#if HAVE_PRAGMA_PACK
# pragma pack(pop)
#endif
/* HPM.2 command assignments */
#define HPM2_GET_LAN_ATTACH_CAPABILITIES 0x3E
extern int hpm2_get_capabilities(struct ipmi_intf * intf,
struct hpm2_lan_attach_capabilities * caps);
extern int hpm2_get_lan_channel_capabilities(struct ipmi_intf * intf,
uint8_t hpm2_lan_params_start,
struct hpm2_lan_channel_capabilities * caps);
extern int hpm2_detect_max_payload_size(struct ipmi_intf * intf);

View File

@ -281,7 +281,8 @@ typedef enum IPMI_OEM {
IPMI_OEM_KONTRON = 15000,
IPMI_OEM_PPS = 16394,
IPMI_OEM_AMI = 20974,
IPMI_OEM_NOKIA_SIEMENS_NETWORKS = 28458
IPMI_OEM_NOKIA_SIEMENS_NETWORKS = 28458,
IPMI_OEM_SUPERMICRO_47488 = 47488
} IPMI_OEM;
extern const struct valstr completion_code_vals[];

View File

@ -72,6 +72,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define IDRAC_11G 1
#define IDRAC_12G 2
#define IDRAC_13G 3
// Return Error code for license
#define LICENSE_NOT_SUPPORTED 0x6F
#define VFL_NOT_LICENSED 0x33
@ -184,6 +185,9 @@ typedef struct _lcd_mode
#define IMC_IDRAC_12G_MONOLITHIC (uint8_t) (0x10)
#define IMC_IDRAC_12G_MODULAR (uint8_t) (0x11)
#define IMC_IDRAC_13G_MONOLITHIC (uint8_t) (0x20)
#define IMC_IDRAC_13G_MODULAR (uint8_t) (0x21)
#define IMC_IDRAC_13G_DCS (uint8_t) (0x22)
typedef struct

View File

@ -63,6 +63,8 @@ enum {
struct fru_info {
uint16_t size;
uint8_t access:1;
uint8_t max_read_size;
uint8_t max_write_size;
};
#ifdef HAVE_PRAGMA_PACK
@ -70,6 +72,7 @@ struct fru_info {
#endif
struct fru_header {
uint8_t version;
union {
struct {
uint8_t internal;
uint8_t chassis;
@ -77,6 +80,8 @@ struct fru_header {
uint8_t product;
uint8_t multi;
} offset;
uint8_t offsets[5];
};
uint8_t pad;
uint8_t checksum;
}ATTRIBUTE_PACKING;
@ -598,6 +603,20 @@ static const char * chassis_type_desc[] __attribute__((unused)) = {
"AdvancedTCA", "Blade", "Blade Enclosure"
};
typedef struct ipmi_fru_bloc {
struct ipmi_fru_bloc * next;
uint16_t start;
uint16_t size;
uint8_t blocId[32];
} t_ipmi_fru_bloc;
static const char *section_id[4] = {
"Internal Use Section",
"Chassis Section",
"Board Section",
"Product Section"
};
int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv);
int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru);

View File

@ -0,0 +1,243 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution 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.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_KFWUM_H
# define IPMI_KFWUM_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
/* KFWUM Version */
# define VER_MAJOR 1
# define VER_MINOR 3
/* Minimum size (IPMB/IOL/old protocol) */
# define KFWUM_SMALL_BUFFER 32
/* Maximum size on KCS interface */
# define KFWUM_BIG_BUFFER 32
# define MAX_BUFFER_SIZE 1024*16
/* 3 address + 1 size + 1 checksum + 1 command */
# define KFWUM_OLD_CMD_OVERHEAD 6
/* 1 sequence + 1 size + 1 checksum + 1 command */
# define KFWUM_NEW_CMD_OVERHEAD 4
# define KFWUM_PAGE_SIZE 256
# define FWUM_SAVE_FIRMWARE_NO_RESPONSE_LIMIT 6
# define FWUM_MAX_UPLOAD_RETRY 6
# define TRACE_LOG_CHUNK_COUNT 7
# define TRACE_LOG_CHUNK_SIZE 7
# define TRACE_LOG_ATT_COUNT 3
# define IN_FIRMWARE_INFO_OFFSET_LOCATION 0x5a0
# define IN_FIRMWARE_INFO_SIZE 20
# define IN_FIRMWARE_INFO_OFFSET_FILE_SIZE 0
# define IN_FIRMWARE_INFO_OFFSET_CHECKSUM 4
# define IN_FIRMWARE_INFO_OFFSET_BOARD_ID 6
# define IN_FIRMWARE_INFO_OFFSET_DEVICE_ID 8
# define IN_FIRMWARE_INFO_OFFSET_TABLE_VERSION 9
# define IN_FIRMWARE_INFO_OFFSET_IMPLEMENT_REV 10
# define IN_FIRMWARE_INFO_OFFSET_VER_MAJOROR 11
# define IN_FIRMWARE_INFO_OFFSET_VER_MINORSUB 12
# define IN_FIRMWARE_INFO_OFFSET_SDR_REV 13
# define IN_FIRMWARE_INFO_OFFSET_IANA0 14
# define IN_FIRMWARE_INFO_OFFSET_IANA1 15
# define IN_FIRMWARE_INFO_OFFSET_IANA2 16
# define KWUM_GET_BYTE_AT_OFFSET(pBuffer,os) pBuffer[os]
int ipmi_fwum_main(struct ipmi_intf *, int, char **);
typedef enum eKFWUM_BoardList
{
KFWUM_BOARD_KONTRON_UNKNOWN = 0,
KFWUM_BOARD_KONTRON_5002 = 5002,
} tKFWUM_BoardList;
typedef struct sKFWUM_BoardInfo
{
tKFWUM_BoardList boardId;
IPMI_OEM iana;
} tKFWUM_BoardInfo;
typedef enum eKFWUM_DownloadType
{
KFWUM_DOWNLOAD_TYPE_ADDRESS = 0,
KFWUM_DOWNLOAD_TYPE_SEQUENCE,
} tKFWUM_DownloadType;
typedef enum eKFWUM_DownloadBuffferType
{
KFWUM_SMALL_BUFFER_TYPE = 0,
KFUMW_BIG_BUFFER_TYPE
} tKFWUM_DownloadBuffferType;
typedef struct sKFWUM_InFirmwareInfo
{
unsigned long fileSize;
unsigned short checksum;
unsigned short sumToRemoveFromChecksum;
/* Since the checksum is added in the bin
* after the checksum is calculated, we
* need to remove the each byte value. This
* byte will contain the addition of both bytes
*/
tKFWUM_BoardList boardId;
unsigned char deviceId;
unsigned char tableVers;
unsigned char implRev;
unsigned char versMajor;
unsigned char versMinor;
unsigned char versSubMinor;
unsigned char sdrRev;
IPMI_OEM iana;
} tKFWUM_InFirmwareInfo;
typedef struct sKFWUM_SaveFirmwareInfo
{
tKFWUM_DownloadType downloadType;
unsigned char bufferSize;
unsigned char overheadSize;
} tKFWUM_SaveFirmwareInfo;
/* COMMANDS */
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumGetInfoResp {
unsigned char protocolRevision;
unsigned char controllerDeviceId;
struct {
unsigned char mode:1;
unsigned char seqAdd:1;
unsigned char res : 6;
} byte;
unsigned char firmRev1;
unsigned char firmRev2;
unsigned char numBank;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumGetStatusResp {
unsigned char bankState;
unsigned char firmLengthLSB;
unsigned char firmLengthMid;
unsigned char firmLengthMSB;
unsigned char firmRev1;
unsigned char firmRev2;
unsigned char firmRev3;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumManualRollbackReq {
unsigned char type;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumStartFirmwareDownloadReq {
unsigned char lengthLSB;
unsigned char lengthMid;
unsigned char lengthMSB;
unsigned char paddingLSB;
unsigned char paddingMSB;
unsigned char useSequence;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumStartFirmwareDownloadResp {
unsigned char bank;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumSaveFirmwareAddressReq
{
unsigned char addressLSB;
unsigned char addressMid;
unsigned char addressMSB;
unsigned char numBytes;
unsigned char txBuf[KFWUM_SMALL_BUFFER-KFWUM_OLD_CMD_OVERHEAD];
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumSaveFirmwareSequenceReq
{
unsigned char sequenceNumber;
unsigned char txBuf[KFWUM_BIG_BUFFER];
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
# ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
# endif
struct KfwumFinishFirmwareDownloadReq {
unsigned char versionMaj;
unsigned char versionMinSub;
unsigned char versionSdr;
unsigned char reserved;
} ATTRIBUTE_PACKING;
# ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
# endif
#endif /* IPMI_KFWUM_H */

View File

@ -0,0 +1,809 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution 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.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_HPMFWUPG_H
#define IPMI_HPMFWUPG_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **);
/* Agent version */
#define HPMFWUPG_VERSION_MAJOR 1
#define HPMFWUPG_VERSION_MINOR 0
#define HPMFWUPG_VERSION_SUBMINOR 9
/* HPM.1 FIRMWARE UPGRADE COMMANDS (part of PICMG) */
#define HPMFWUPG_GET_TARGET_UPG_CAPABILITIES 0x2E
#define HPMFWUPG_GET_COMPONENT_PROPERTIES 0x2F
#define HPMFWUPG_ABORT_UPGRADE 0x30
#define HPMFWUPG_INITIATE_UPGRADE_ACTION 0x31
#define HPMFWUPG_UPLOAD_FIRMWARE_BLOCK 0x32
#define HPMFWUPG_FINISH_FIRMWARE_UPLOAD 0x33
#define HPMFWUPG_GET_UPGRADE_STATUS 0x34
#define HPMFWUPG_ACTIVATE_FIRMWARE 0x35
#define HPMFWUPG_QUERY_SELFTEST_RESULT 0x36
#define HPMFWUPG_QUERY_ROLLBACK_STATUS 0x37
#define HPMFWUPG_MANUAL_FIRMWARE_ROLLBACK 0x38
/* HPM.1 SPECIFIC COMPLETION CODES */
#define HPMFWUPG_ROLLBACK_COMPLETED 0x00
#define HPMFWUPG_COMMAND_IN_PROGRESS 0x80
#define HPMFWUPG_NOT_SUPPORTED 0x81
#define HPMFWUPG_SIZE_MISMATCH 0x81
#define HPMFWUPG_ROLLBACK_FAILURE 0x81
#define HPMFWUPG_INV_COMP_MASK 0x81
#define HPMFWUPG__ABORT_FAILURE 0x81
#define HPMFWUPG_INV_COMP_ID 0x82
#define HPMFWUPG_INT_CHECKSUM_ERROR 0x82
#define HPMFWUPG_INV_UPLOAD_MODE 0x82
#define HPMFWUPG_ROLLBACK_OVERRIDE 0x82
#define HPMFWUPG_INV_COMP_PROP 0x83
#define HPMFWUPG_FW_MISMATCH 0x83
#define HPMFWUPG_ROLLBACK_DENIED 0x83
/*
* This error code is used as a temporary PATCH to
* the latest Open ipmi driver. This PATCH
* will be removed once a new Open IPMI driver is released.
* (Buggy version = 39)
*/
#define ENABLE_OPENIPMI_V39_PATCH
#ifdef ENABLE_OPENIPMI_V39_PATCH
# define RETRY_COUNT_MAX 3
static int errorCount;
# define HPMFWUPG_IS_RETRYABLE(error) \
((((error==0x83)||(error==0x82)||(error==0x80)) && (errorCount++<RETRY_COUNT_MAX))?TRUE:FALSE)
#else
# define HPMFWUPG_IS_RETRYABLE(error) FALSE
#endif
/* HPM FIRMWARE UPGRADE GENERAL DEFINITIONS */
#define HPMFWUPG_PICMG_IDENTIFIER 0
#define HPMFWUPG_VERSION_SIZE 6
#define HPMFWUPG_DESC_STRING_LENGTH 12
#define HPMFWUPG_DEFAULT_INACCESS_TIMEOUT 60 /* sec */
#define HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT 60 /* sec */
#define HPMFWUPG_MD5_SIGNATURE_LENGTH 16
/* Component IDs */
typedef enum eHpmfwupgComponentId {
HPMFWUPG_COMPONENT_ID_0 = 0,
HPMFWUPG_COMPONENT_ID_1,
HPMFWUPG_COMPONENT_ID_2,
HPMFWUPG_COMPONENT_ID_3,
HPMFWUPG_COMPONENT_ID_4,
HPMFWUPG_COMPONENT_ID_5,
HPMFWUPG_COMPONENT_ID_6,
HPMFWUPG_COMPONENT_ID_7,
HPMFWUPG_COMPONENT_ID_MAX
} tHpmfwupgComponentId;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgComponentBitMask {
union {
unsigned char byte;
struct {
#ifdef WORDS_BIGENDIAN
unsigned char component7 : 1;
unsigned char component6 : 1;
unsigned char component5 : 1;
unsigned char component4 : 1;
unsigned char component3 : 1;
unsigned char component2 : 1;
unsigned char component1 : 1;
unsigned char component0 : 1;
#else
unsigned char component0 : 1;
unsigned char component1 : 1;
unsigned char component2 : 1;
unsigned char component3 : 1;
unsigned char component4 : 1;
unsigned char component5 : 1;
unsigned char component6 : 1;
unsigned char component7 : 1;
#endif
} ATTRIBUTE_PACKING bitField;
} ATTRIBUTE_PACKING ComponentBits;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
static const int HPMFWUPG_SUCCESS = 0;
static const int HPMFWUPG_ERROR = -1;
/* Upload firmware specific error codes */
static const int HPMFWUPG_UPLOAD_BLOCK_LENGTH = 1;
static const int HPMFWUPG_UPLOAD_RETRY = 2;
/* TARGET UPGRADE CAPABILITIES DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetTargetUpgCapabilitiesReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetTargetUpgCapabilitiesResp {
unsigned char picmgId;
unsigned char hpmVersion;
union {
unsigned char byte;
struct {
#if WORDS_BIGENDIAN
unsigned char fwUpgUndesirable : 1;
unsigned char autRollbackOverride : 1;
unsigned char ipmcDegradedDurinUpg: 1;
unsigned char deferActivation : 1;
unsigned char servAffectDuringUpg : 1;
unsigned char manualRollback : 1;
unsigned char autRollback : 1;
unsigned char ipmcSelftestCap : 1;
#else
unsigned char ipmcSelftestCap : 1;
unsigned char autRollback : 1;
unsigned char manualRollback : 1;
unsigned char servAffectDuringUpg : 1;
unsigned char deferActivation : 1;
unsigned char ipmcDegradedDurinUpg: 1;
unsigned char autRollbackOverride : 1;
unsigned char fwUpgUndesirable : 1;
#endif
} ATTRIBUTE_PACKING bitField;
} ATTRIBUTE_PACKING GlobalCapabilities;
unsigned char upgradeTimeout;
unsigned char selftestTimeout;
unsigned char rollbackTimeout;
unsigned char inaccessTimeout;
struct HpmfwupgComponentBitMask componentsPresent;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetTargetUpgCapabilitiesCtx {
struct HpmfwupgGetTargetUpgCapabilitiesReq req;
struct HpmfwupgGetTargetUpgCapabilitiesResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* COMPONENT PROPERTIES DEFINITIONS */
typedef enum eHpmfwupgCompPropertiesSelect {
HPMFWUPG_COMP_GEN_PROPERTIES = 0,
HPMFWUPG_COMP_CURRENT_VERSION,
HPMFWUPG_COMP_DESCRIPTION_STRING,
HPMFWUPG_COMP_ROLLBACK_FIRMWARE_VERSION,
HPMFWUPG_COMP_DEFERRED_FIRMWARE_VERSION,
HPMFWUPG_COMP_RESERVED,
HPMFWUPG_COMP_OEM_PROPERTIES = 192
} tHpmfwupgCompPropertiesSelect;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetComponentPropertiesReq {
unsigned char picmgId;
unsigned char componentId;
unsigned char selector;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetGeneralPropResp {
unsigned char picmgId;
union {
unsigned char byte;
struct {
#if WORDS_BIGENDIAN
unsigned char reserved : 2;
unsigned char payloadColdReset : 1;
unsigned char deferredActivation : 1;
unsigned char comparisonSupport : 1;
unsigned char preparationSupport : 1;
unsigned char rollbackBackup : 2;
#else
unsigned char rollbackBackup : 2;
unsigned char preparationSupport : 1;
unsigned char comparisonSupport : 1;
unsigned char deferredActivation : 1;
unsigned char payloadColdReset : 1;
unsigned char reserved : 2;
#endif
} ATTRIBUTE_PACKING bitfield;
} ATTRIBUTE_PACKING GeneralCompProperties;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetCurrentVersionResp {
unsigned char picmgId;
unsigned char currentVersion[HPMFWUPG_VERSION_SIZE];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetDescStringResp {
unsigned char picmgId;
char descString[HPMFWUPG_DESC_STRING_LENGTH];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetRollbackFwVersionResp {
unsigned char picmgId;
unsigned char rollbackFwVersion[HPMFWUPG_VERSION_SIZE];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetDeferredFwVersionResp {
unsigned char picmgId;
unsigned char deferredFwVersion[HPMFWUPG_VERSION_SIZE];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* GetComponentProperties - OEM properties (192) */
#define HPMFWUPG_OEM_LENGTH 4
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetOemProperties {
unsigned char picmgId;
unsigned char oemRspData[HPMFWUPG_OEM_LENGTH];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetComponentPropertiesResp {
union {
struct HpmfwupgGetGeneralPropResp generalPropResp;
struct HpmfwupgGetCurrentVersionResp currentVersionResp;
struct HpmfwupgGetDescStringResp descStringResp;
struct HpmfwupgGetRollbackFwVersionResp rollbackFwVersionResp;
struct HpmfwupgGetDeferredFwVersionResp deferredFwVersionResp;
struct HpmfwupgGetOemProperties oemProperties;
} ATTRIBUTE_PACKING Response;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetComponentPropertiesCtx {
struct HpmfwupgGetComponentPropertiesReq req;
struct HpmfwupgGetComponentPropertiesResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* ABORT UPGRADE DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgAbortUpgradeReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgAbortUpgradeResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgAbortUpgradeCtx {
struct HpmfwupgAbortUpgradeReq req;
struct HpmfwupgAbortUpgradeResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* UPGRADE ACTIONS DEFINITIONS */
typedef enum eHpmfwupgUpgradeAction {
HPMFWUPG_UPGRADE_ACTION_BACKUP = 0,
HPMFWUPG_UPGRADE_ACTION_PREPARE,
HPMFWUPG_UPGRADE_ACTION_UPGRADE,
HPMFWUPG_UPGRADE_ACTION_COMPARE,
HPMFWUPG_UPGRADE_ACTION_INVALID = 0xff
} tHpmfwupgUpgradeAction;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgInitiateUpgradeActionReq {
unsigned char picmgId;
struct HpmfwupgComponentBitMask componentsMask;
unsigned char upgradeAction;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgInitiateUpgradeActionResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgInitiateUpgradeActionCtx {
struct HpmfwupgInitiateUpgradeActionReq req;
struct HpmfwupgInitiateUpgradeActionResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* UPLOAD FIRMWARE BLOCK DEFINITIONS */
#define HPMFWUPG_SEND_DATA_COUNT_KCS 30
#define HPMFWUPG_SEND_DATA_COUNT_LAN 25
#define HPMFWUPG_SEND_DATA_COUNT_IPMB 26
#define HPMFWUPG_SEND_DATA_COUNT_IPMBL 26
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgUploadFirmwareBlockReq {
unsigned char picmgId;
unsigned char blockNumber;
unsigned char data[0];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgUploadFirmwareBlockResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgUploadFirmwareBlockCtx {
struct HpmfwupgUploadFirmwareBlockReq * req;
struct HpmfwupgUploadFirmwareBlockResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* FINISH FIRMWARE UPLOAD DEFINITIONS */
#define HPMFWUPG_IMAGE_SIZE_BYTE_COUNT 4
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgFinishFirmwareUploadReq {
unsigned char picmgId;
unsigned char componentId;
unsigned char imageLength[HPMFWUPG_IMAGE_SIZE_BYTE_COUNT];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgFinishFirmwareUploadResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgFinishFirmwareUploadCtx {
struct HpmfwupgFinishFirmwareUploadReq req;
struct HpmfwupgFinishFirmwareUploadResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* ACTIVATE FW DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgActivateFirmwareReq {
unsigned char picmgId;
unsigned char rollback_override;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgActivateFirmwareResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgActivateFirmwareCtx {
struct HpmfwupgActivateFirmwareReq req;
struct HpmfwupgActivateFirmwareResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* GET UPGRADE STATUS DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetUpgradeStatusReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetUpgradeStatusResp {
unsigned char picmgId;
unsigned char cmdInProcess;
unsigned char lastCmdCompCode;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgGetUpgradeStatusCtx {
struct HpmfwupgGetUpgradeStatusReq req;
struct HpmfwupgGetUpgradeStatusResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* MANUAL FW ROLLBACK DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgManualFirmwareRollbackReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgManualFirmwareRollbackResp {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
struct HpmfwupgManualFirmwareRollbackCtx {
struct HpmfwupgManualFirmwareRollbackReq req;
struct HpmfwupgManualFirmwareRollbackResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* QUERY ROLLBACK STATUS DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQueryRollbackStatusReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQueryRollbackStatusResp {
unsigned char picmgId;
struct HpmfwupgComponentBitMask rollbackComp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQueryRollbackStatusCtx {
struct HpmfwupgQueryRollbackStatusReq req;
struct HpmfwupgQueryRollbackStatusResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* QUERY SELF TEST RESULT DEFINITIONS */
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQuerySelftestResultReq {
unsigned char picmgId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQuerySelftestResultResp {
unsigned char picmgId;
unsigned char result1;
unsigned char result2;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgQuerySelftestResultCtx {
struct HpmfwupgQuerySelftestResultReq req;
struct HpmfwupgQuerySelftestResultResp resp;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
/* HPM.1 IMAGE DEFINITIONS */
#define HPMFWUPG_HEADER_SIGNATURE_LENGTH 8
#define HPMFWUPG_MANUFATURER_ID_LENGTH 3
#define HPMFWUPG_PRODUCT_ID_LENGTH 2
#define HPMFWUPG_TIME_LENGTH 4
#define HPMFWUPG_TIMEOUT_LENGTH 1
#define HPMFWUPG_COMP_REVISION_LENGTH 2
#define HPMFWUPG_FIRM_REVISION_LENGTH 6
#define HPMFWUPG_IMAGE_HEADER_VERSION 0
#define HPMFWUPG_IMAGE_SIGNATURE "PICMGFWU"
#ifdef HAVE_PRAGMA_PACK
#pragma pack(1)
#endif
struct HpmfwupgImageHeader {
char signature[HPMFWUPG_HEADER_SIGNATURE_LENGTH];
unsigned char formatVersion;
unsigned char deviceId;
unsigned char manId[HPMFWUPG_MANUFATURER_ID_LENGTH];
unsigned char prodId[HPMFWUPG_PRODUCT_ID_LENGTH];
unsigned char time[HPMFWUPG_TIME_LENGTH];
union {
struct {
#if WORDS_BIGENDIAN
unsigned char imageSelfTest : 1;
unsigned char autRollback : 1;
unsigned char manRollback : 1;
unsigned char servAffected : 1;
unsigned char reserved : 4;
#else
unsigned char reserved : 4;
unsigned char servAffected : 1;
unsigned char manRollback : 1;
unsigned char autRollback : 1;
unsigned char imageSelfTest : 1;
#endif
} ATTRIBUTE_PACKING bitField;
unsigned char byte;
}ATTRIBUTE_PACKING imageCapabilities;
struct HpmfwupgComponentBitMask components;
unsigned char selfTestTimeout;
unsigned char rollbackTimeout;
unsigned char inaccessTimeout;
unsigned char compRevision[HPMFWUPG_COMP_REVISION_LENGTH];
unsigned char firmRevision[HPMFWUPG_FIRM_REVISION_LENGTH];
unsigned short oemDataLength;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#define HPMFWUPG_DESCRIPTION_LENGTH 21
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgActionRecord {
unsigned char actionType;
struct HpmfwupgComponentBitMask components;
unsigned char checksum;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#define HPMFWUPG_FIRMWARE_SIZE_LENGTH 4
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgFirmwareImage {
unsigned char version[HPMFWUPG_FIRM_REVISION_LENGTH];
char desc[HPMFWUPG_DESCRIPTION_LENGTH];
unsigned char length[HPMFWUPG_FIRMWARE_SIZE_LENGTH];
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
#ifdef HAVE_PRAGMA_PACK
# pragma pack(1)
#endif
struct HpmfwupgUpgradeCtx {
struct HpmfwupgComponentBitMask compUpdateMask;
unsigned int imageSize;
unsigned char* pImageData;
unsigned char componentId;
struct HpmfwupgGetTargetUpgCapabilitiesResp targetCap;
struct HpmfwupgGetGeneralPropResp genCompProp[HPMFWUPG_COMPONENT_ID_MAX];
struct ipm_devid_rsp devId;
} ATTRIBUTE_PACKING;
#ifdef HAVE_PRAGMA_PACK
# pragma pack(0)
#endif
typedef enum eHpmfwupgActionType {
HPMFWUPG_ACTION_BACKUP_COMPONENTS = 0,
HPMFWUPG_ACTION_PREPARE_COMPONENTS,
HPMFWUPG_ACTION_UPLOAD_FIRMWARE,
HPMFWUPG_ACTION_RESERVED = 0xFF
} tHpmfwupgActionType;
/* FUNCTIONS PROTOTYPES */
#define HPMFWUPG_MAJORMINOR_VERSION_SIZE 2
/* Options added for user to check the version and to view both the FILE and
* TARGET Version
*/
#define VIEW_MODE 0x01
#define DEBUG_MODE 0x02
#define FORCE_MODE 0x04
#define COMPARE_MODE 0x08
typedef struct _VERSIONINFO {
unsigned char componentId;
unsigned char targetMajor;
unsigned char targetMinor;
unsigned char targetAux[4];
unsigned char rollbackMajor;
unsigned char rollbackMinor;
unsigned char rollbackAux[4];
unsigned char deferredMajor;
unsigned char deferredMinor;
unsigned char deferredAux[4];
unsigned char imageMajor;
unsigned char imageMinor;
unsigned char imageAux[4];
unsigned char coldResetRequired;
unsigned char rollbackSupported;
unsigned char deferredActivationSupported;
char descString[HPMFWUPG_DESC_STRING_LENGTH + 1];
}VERSIONINFO, *PVERSIONINFO;
VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX];
#define TARGET_VER (0x01)
#define ROLLBACK_VER (0x02)
#define IMAGE_VER (0x04)
#endif /* IPMI_KFWUM_H */

View File

@ -63,7 +63,7 @@ enum LANPLUS_SESSION_STATE {
#define IPMI_KG_BUFFER_SIZE 21 /* key plus null byte */
struct ipmi_session {
uint8_t hostname[64];
char *hostname; /* Numeric IP adress or DNS name - see RFC 1034/RFC 1035 */
uint8_t username[17];
uint8_t authcode[IPMI_AUTHCODE_BUFFER_SIZE + 1];
uint8_t challenge[16];
@ -89,8 +89,9 @@ struct ipmi_session {
uint32_t out_seq;
uint32_t timeout;
struct sockaddr_in addr;
struct sockaddr_storage addr;
socklen_t addrlen;
int ai_family; /* Protocol family for socket. */
/*
* This struct holds state data specific to IPMI v2 / RMCP+ sessions
@ -179,7 +180,8 @@ struct ipmi_intf {
uint8_t target_channel;
uint32_t transit_addr;
uint8_t transit_channel;
uint8_t channel_buf_size;
uint16_t max_request_data_size;
uint16_t max_response_data_size;
uint8_t devnum;
@ -192,6 +194,8 @@ struct ipmi_intf {
struct ipmi_rs *(*send_sol)(struct ipmi_intf * intf, struct ipmi_v2_payload * payload);
int (*keepalive)(struct ipmi_intf * intf);
int (*set_my_addr)(struct ipmi_intf * intf, uint8_t addr);
void (*set_max_request_data_size)(struct ipmi_intf * intf, uint16_t size);
void (*set_max_response_data_size)(struct ipmi_intf * intf, uint16_t size);
};
struct ipmi_intf * ipmi_intf_load(char * name);
@ -209,6 +213,10 @@ void ipmi_intf_session_set_port(struct ipmi_intf * intf, int port);
void ipmi_intf_session_set_authtype(struct ipmi_intf * intf, uint8_t authtype);
void ipmi_intf_session_set_timeout(struct ipmi_intf * intf, uint32_t timeout);
void ipmi_intf_session_set_retry(struct ipmi_intf * intf, int retry);
void ipmi_intf_session_cleanup(struct ipmi_intf *intf);
void ipmi_cleanup(struct ipmi_intf * intf);
#if defined(IPMI_INTF_LAN) || defined (IPMI_INTF_LANPLUS)
int ipmi_intf_socket_connect(struct ipmi_intf * intf);
#endif
#endif /* IPMI_INTF_H */

View File

@ -102,8 +102,6 @@ enum {
#define GET_SENSOR_EVENT_STATUS 0x2b
#define GET_SENSOR_READING 0x2d
#define GET_SENSOR_TYPE 0x2f
#define GET_SENSOR_READING 0x2d
#define GET_SENSOR_TYPE 0x2f
#ifdef HAVE_PRAGMA_PACK
#pragma pack(1)

View File

@ -107,6 +107,7 @@ struct standard_spec_sel_rec{
#define SENSOR_TYPE_OEM_NFATAL_ERROR 0xC2
#define SENSOR_TYPE_OEM_FATAL_ERROR 0xC3
#define SENSOR_TYPE_TXT_CMD_ERROR 0x20
#define SENSOR_TYPE_SUPERMICRO_OEM 0xD0
/* End of Macro for DELL Specific */
#define SEL_OEM_TS_DATA_LEN 6
#define SEL_OEM_NOTS_DATA_LEN 13
@ -326,6 +327,8 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x07, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Disabled" },
{ 0x07, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Terminator presence detected" },
{ 0x07, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Throttled" },
{ 0x07, 0x0b, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Uncorrectable machine check exception" },
{ 0x07, 0x0c, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Correctable machine check error" },
{ 0x08, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Presence detected" },
{ 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Failure detected" },
@ -336,7 +339,10 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x08, 0x06, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Vendor Mismatch" },
{ 0x08, 0x06, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Revision Mismatch" },
{ 0x08, 0x06, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Processor Missing" },
{ 0x08, 0x06, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Power Supply Rating Mismatch" },
{ 0x08, 0x06, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Voltage Rating Mismatch" },
{ 0x08, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error" },
{ 0x08, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Power Supply Inactive" },
{ 0x09, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power off/down" },
{ 0x09, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power cycle" },
@ -360,6 +366,7 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x0c, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Configuration Error" },
{ 0x0c, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Spare" },
{ 0x0c, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Throttled" },
{ 0x0c, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Critical Overtemperature" },
{ 0x0d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Present" },
{ 0x0d, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Fault" },
@ -479,6 +486,7 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x13, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Uncorrectable error" },
{ 0x13, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Fatal NMI" },
{ 0x13, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Fatal Error" },
{ 0x13, 0x0b, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Degraded" },
{ 0x14, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Power Button pressed" },
{ 0x14, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Sleep Button pressed" },
@ -491,6 +499,7 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x17, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Add-in Card", NULL },
{ 0x18, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chassis", NULL },
{ 0x19, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", NULL },
{ 0x19, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", "Thermal Trip" },
{ 0x1a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Other FRU", NULL },
{ 0x1b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", "Connected" },
@ -520,6 +529,10 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x1f, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "CD-ROM boot completed" },
{ 0x1f, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "ROM boot completed" },
{ 0x1f, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "boot completed - device not specified" },
{ 0x1f, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation started" },
{ 0x1f, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation completed" },
{ 0x1f, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation aborted" },
{ 0x1f, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation failed" },
{ 0x20, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Error during system startup" },
{ 0x20, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Run-time critical stop" },
@ -676,6 +689,56 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
{ 0x00, 0x00, 0x00, 0x00, NULL, NULL },
};
static uint16_t supermicro_x9dal[] = {
0x0635
};
static uint16_t supermicro_x9db[] = {
0x0733, 0x0722, 0x0703, 0x0721, 0x0716, 0x0637
};
static uint16_t supermicro_x9sb[] = {
0x0651
};
static uint16_t supermicro_x9[] = {
0x0635, 0x0733, 0x0722, 0x0703, 0x0721, 0x0716, 0x0637, 0x0651
};
static uint16_t supermicro_b8[] = {
0x000A, 0x061c, 0x0620, 0x0101, 0x061f, 0x0612, 0x061e
};
static uint16_t supermicro_h8[] = {
0xa111, 0x0408, 0x0811, 0x1411, 0x0911, 0x1211, 0x1011, 0xcd11, 0x1111, 0xbe11, 0xce11, 0xbd11,
0xbc11, 0xa911, 0xaa11, 0xbd11, 0xcb11, 0xad11, 0xa811, 0xac11, 0xaf11, 0xa511, 0xa011, 0x1611,
0x2511, 0xbf11, 0x1511, 0x2211, 0x2411, 0x1911, 0xab11, 0xd011, 0xae11, 0xca11, 0x0409, 0xa211,
0xa311, 0x1311, 0xba11, 0xa711, 0xd111, 0x1711, 0xcf11, 0x2011, 0x1811
};
static uint16_t supermicro_p8[] = {
0x6480, 0x7380, 0x6280, 0x7480, 0x5980
};
static uint16_t supermicro_x8[] = {
0xa880, 0x0403, 0x0100, 0x0601, 0x0001, 0x0404, 0x0606, 0x0608, 0x0632, 0x0400, 0x0401, 0x0006,
0x040a, 0xf280, 0x060f, 0x0609, 0x0008, 0x0613, 0x061b, 0x0007, 0x0600, 0x060c, 0x060d, 0x0614,
0x060c, 0x0003, 0x040b, 0x0621, 0x0610, 0x0638, 0xf380, 0x060b, 0x040d, 0x0605, 0x062d, 0x060e,
0x061a, 0xf580, 0x062e, 0x0009
};
static uint16_t supermicro_X8[] = {
0x000A, 0x061c, 0x0620, 0x0101, 0x061f, 0x0612, 0x061e, 0xa111, 0x0408, 0x0811, 0x1411, 0x0911,
0x1211, 0x1011, 0xcd11, 0x1111, 0xbe11, 0xce11, 0xbd11, 0xbc11, 0xa911, 0xaa11, 0xbd11, 0xcb11,
0xad11, 0xa811, 0xac11, 0xaf11, 0xa511, 0xa011, 0x1611, 0x2511, 0xbf11, 0x1511, 0x2211, 0x2411,
0x1911, 0xab11, 0xd011, 0xae11, 0xca11, 0x0409, 0xa211, 0xa311, 0x1311, 0xba11, 0xa711, 0xd111,
0x1711, 0xcf11, 0x2011, 0x1811, 0x6480, 0x7380, 0x6280, 0x7480, 0x5980, 0xa880, 0x0403, 0x0100,
0x0601, 0x0001, 0x0404, 0x0606, 0x0608, 0x0632, 0x0400, 0x0401, 0x0006, 0x040a, 0xf280, 0x060f,
0x0609, 0x0008, 0x0613, 0x061b, 0x0007, 0x0600, 0x060c, 0x060d, 0x0614, 0x060c, 0x0003, 0x040b,
0x0621, 0x0610, 0x0638, 0xf380, 0x060b, 0x040d, 0x0605, 0x062d, 0x060e, 0x061a, 0xf580, 0x062e,
0x0009
};
int ipmi_sel_main(struct ipmi_intf *, int, char **);
void ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt);
void ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -44,14 +44,30 @@
#define IPMI_SUNOEM_SET_SSH_KEY 0x01
#define IPMI_SUNOEM_DEL_SSH_KEY 0x02
#define IPMI_SUNOEM_GET_HEALTH_STATUS 0x10
#define IPMI_SUNOEM_CLI 0x19
#define IPMI_SUNOEM_SET_FAN_SPEED 0x20
#define IPMI_SUNOEM_LED_GET 0x21
#define IPMI_SUNOEM_LED_SET 0x22
#define IPMI_SUNOEM_ECHO 0x23
#define IPMI_SUNOEM_VERSION 0x24
#define IPMI_SUNOEM_NACNAME 0x29
#define IPMI_SUNOEM_GETVAL 0x2A
#define IPMI_SUNOEM_SETVAL 0x2C
#define IPMI_SUNOEM_SENSOR_SET 0x3A
#define IPMI_SUNOEM_SET_FAN_MODE 0x41
#define IPMI_SUNOEM_CORE_TUNNEL 0x44
/*
* Error codes of sunoem functions
*/
typedef enum {
SUNOEM_EC_SUCCESS = 0,
SUNOEM_EC_INVALID_ARG = 1,
SUNOEM_EC_BMC_NOT_RESPONDING = 2,
SUNOEM_EC_BMC_CCODE_NONZERO = 3
} sunoem_ec_t;
int ipmi_sunoem_main(struct ipmi_intf *, int, char **);
struct ipmi_rs * sunoem_led_get(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev, int ledtype);
struct ipmi_rs * sunoem_led_set(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev, int ledtype, int ledmode);
#endif /*IPMI_SUNOEM_H*/

View File

@ -1,5 +0,0 @@
For more information about setting up your Debian system with IPMI
please see the excellent howto by Tim Small:
http://buttersideup.com/docs/howto/IPMI_on_Debian.html

View File

@ -1,324 +0,0 @@
version (1.8.11) unstable; urgency=low
* Fix new GCC compilation issues in regards to Packing
* Fix Tracker bug #1642710 - ipmi_kcs_drv being loaded/unloaded
for 2.4 kernel instead of ipmi_si_drv driver module
* New -y option added to allow specification of kg keys with
non-printable characters
* New -K option added to allow kgkey settings via environmental
variable IPMI_KGKEY
* Generic device support added for EEPROM with SDR Type 10h (gendev)
* Fix to lan-bridging for a double-bridging crash and to fix
an issue with bridging multiple concurrent requests and
erroneous handling of raw Send Message
* Lanplus fix for commands like 'sensor list' without the -t option
causing wrong double bridged requests of a sensor is located
on another satellite controller
* Fix lan and lanplus request list entry removal bugs
* Fix non-working issue when trying to send a bridge message with
Cipher 3
* Change bridge message handling to reuse command ipmi_lan_poll_recv
* Added PICMG 2.0 and 2.3 support
* Fix PICMG (ATCA) extension verification and reversal of BCD encoded
values for "major" and "minor" fields
* Add IANA support for Pigeon Point
* Add OEM SW/FW Record identification
* Fix to include I2C and LUN addresses so sensors are correctly managed
* Patch ID 1990560 to get readings from non-linear analog sensors
* Add support for SOL payload status command
* SOL set parameter range checking added
* Fixed SOL activate options usage
* Fixed crashes when parsing 'sol payload' and 'tsol' cmds (#216967)
* Added retries to SOL keepalive
* Fixed wrong mask values for Front Panel disable/enable status
* Add support to access fru internal use area
* Add support for new PICMG 3.0 R3.0 (March 24, 2008) to allow
blocks of data within the FRU storage area to be write
protected.
* Fix node reporting in GUID; Tracker bug #2339675
* Fix watchdog use/action print strings
* Fix endian bug in SDR add from file; Tracker bug #2075258
* Fix crash when dumping SDRs in a file and there's an error
getting an SDR; improve algorithm for optimal packet size
* Fix occasional SDR dump segfault; #1793076
* Allow ipmitool sel delete to accept hex list entry numbers
* Fix SEL total space reporting.
* Fix for garbage sensor threshold values reported when none
returned. Tracker Bug #863748
* ipmievd change to Monitor %used in SEL buffer and log warnings when
the buffer is 80% and 100% full
-- Petter Reinholdtsen <pere@debian.org> Wed, 25 Feb 2009 09:44:31 +0200
ipmitool (1.8.10) unstable; urgency=low
* New upstream version.
* Patch to allow Debian package builds from cvs.
-- Petter Reinholdtsen <pere@debian.org> Fri, 8 Aug 2008 09:44:31 +0200
ipmitool (1.8.7-2) unstable; urgency=low
* Fix typo in init.d/ipmievd. (Closes: #361309)
-- Petter Reinholdtsen <pere@debian.org> Sat, 8 Apr 2006 06:44:31 +0200
ipmitool (1.8.7-1) unstable; urgency=low
* New upstream version.
- Dropped nuclear clause from the copyright. Updated debian/copyright
to reflect this.
- ipmievd now store pid in /var/run/ipmievd.pid. Adjust init.d
script to use it.
* Rename /etc/default/ipmievd variable IPMIEVD_OPTS is renamed to
IPMIEVD_OPTIONS to stay compatible with upstream and other
distributions. Add backwards compatibility code with a warning to
the users of the old variable.
-- Petter Reinholdtsen <pere@debian.org> Sun, 26 Mar 2006 21:11:08 +0200
ipmitool (1.8.6-2) unstable; urgency=low
* Add ia64 as an supported arch. (Closes: #355930)
-- Petter Reinholdtsen <pere@debian.org> Fri, 10 Mar 2006 23:34:50 +0100
ipmitool (1.8.6-1) unstable; urgency=low
* New upstream version.
- Avoid crashing when setting lan IP address. (Closes: #351205)
* Avoid changing history by reverding upstream change
to email addresses in debian/changelog.
* Correct typo in control file: Suggest -> Suggests. Thanks
to Philipp Matthias Hahn for the report.
* Add init.d/ipmievd script. Based on script from Elmar Hoffmann,
slightly modified to use lsb-base functions. Added dependency on
lsb-base. (Closes: #345994)
-- Petter Reinholdtsen <pere@debian.org> Sun, 26 Feb 2006 10:31:14 +0100
ipmitool (1.8.2-2) unstable; urgency=low
* Add build-dependency on 'libreadline5-dev | libreadline-dev' to make
sure all archs get readline support. (Closes: #326341)
* Add build-dependency on libssl-dev to enable SSL support on
all archs.
* Updated Standards-Version to 3.6.2.1. (No updates required)
-- Petter Reinholdtsen <pere@debian.org> Sat, 3 Sep 2005 19:18:51 +0200
ipmitool (1.8.2-1) unstable; urgency=low
* New upstream release.
- Fix FRU reading for large (>255 bytes) areas.
- Overhaul to ipmievd to support SEL polling in addition to OpenIPMI.
- Fix LAN parameter segfault when no Ciphers supported by
BMC. (Closes: #306806)
- Fix IPMIv2 support on Intel v2 BMCs (use -o intelplus).
- Separate option parsing code from main ipmitool source file.
- Add raw I2C support with IPMI Master Read-Write command.
- Add support for new 'sdr elist' extended output format.
- Add support for listing sensors by type with 'sdr type' command.
- Add support for new 'sel elist' extended output format that
cross-references events with sensors.
- Add support for sending dynamically generated platform events
based on existing sensor information.
- New '-S' argument to read local SDR cache created with 'sdr dump'.
- Updated manpage for ipmitool and ipmievd. (Closes: #306894)
* Correct the upstream URL in debian/changelog to the current one.
* Suggest package openipmi. (Closes: #305629)
* Add debian/watch file to detect new source versions.
-- Petter Reinholdtsen <pere@debian.org> Sun, 5 Jun 2005 10:29:18 +0200
ipmitool (1.8.1-1) unstable; urgency=low
* New upstream release.
* Install ipmievd into /usr/sbin/.
-- Petter Reinholdtsen <pere@debian.org> Thu, 7 Apr 2005 01:18:44 +0200
ipmitool (1.8.0-1) unstable; urgency=low
* Initial upload into Debian, based on the upstream build
rules. (Closes: #299924)
* Convert debian/changelog to UTF-8.
* Change section from 'contrib' to 'utils'.
* Build-depend on debhelper (>> 4.0.0) to match the rules file.
* Set Standards-version to 3.6.1.
* Make sure binary dependency is properly generated.
* Add long description, copied from the project README.
* Drop useless provides 'ipmitool', as the package is called 'ipmitool'.
* Don't install the COPYING file, as the license text already is
included in debian/copyright.
* Remove unused parts of the rules file.
* Correct clean target in rules file, to use 'distclean' and remove
configure-stamp not bogus config-stamp.
-- Petter Reinholdtsen <pere@debian.org> Sun, 3 Apr 2005 20:52:02 +0200
ipmitool (1.8.0) unstable; urgency=low
* Fix IPMIv2.0 issues
* Fix chassis boot parameter support
* Add support for linear sensors
-- Duncan Laurie <duncan@iceblink.org> Wed, Mar 16 2005 17:08:12 -0700
ipmitool (1.7.1) unstable; urgency=low
* Update bmc plugin to work with new Solaris bmc driver (new ioctl
for interface detection and new STREAMS message-based interface).
-- Seth Goldberg <sethmeisterg@hotmail.com> Mon, Mar 7 2005 18:03:00 -0800
ipmitool (1.7.0) unstable; urgency=low
* Propogate errors correctly so exit status will be useful
* More consistent display of errors including completion code text
* Errors and debug is send to stderr now
* New "sel get" command that will print details about SEL entry
and corresponding SDR records as well as FRUs via entity association
* Improved event generator, now supports reading events from text file
* New "-o oemtype" option for specifying OEM boards
exsting types are "supermicro" and "intelwv2"
* New PEF subsystem
* New "bmc" plugin for Solaris 10 x86
* Many bugfixes and contributed patches
-- Duncan Laurie <duncan@iceblink.org> Fri, Jan 7 2005 19:58:22 -0700
ipmitool (1.6.2) unstable; urgency=low
* Support for Supermicro BMC OEM authentication method
-- Duncan Laurie <duncan@iceblink.org> Mon, 16 Nov 2004 08:20:01 -0700
ipmitool (1.6.1) unstable; urgency=low
* Fix minor problem with LAN parameter setting
-- Duncan Laurie <duncan@iceblink.org> Wed, 29 Sep 2004 11:19:17 -0700
ipmitool (1.6.0) unstable; urgency=low
* Add a README
* Add support for IPMIv2 and Serial-over-LAN from Newisys
* Add Solaris x86 lipmi interface
* Add support for building Solaris packages
* Add support for building RPMs as non-root user
* Fix segfault when doing "sel list" (from Matthew Braithwaite)
* Fix "chassis identify" on some BMCs (from ebrower@sourceforge)
* Add "bmc info" and related output (from ebrower@sourceforge)
* new "shell" and "exec" commands
* lots of other contributed patches
-- Duncan Laurie <duncan@iceblink.org> Thu, 9 Sep 2004 21:39:37 -0700
ipmitool (1.5.9) unstable; urgency=low
* Add ability to get a particular sensor by name
* Add ability to set a particular sensor threshold
* Add support for displaying V2 channel authentication levels
* Add README for rrdtool scripts in contrib directory
* Improve lan interface retry handling
* Support prompting for password or reading from environment
* Move chaninfo command into channel subcommand
* Fix reservation ID handling when two sessions open to BMC
* Fix reading of large FRU data
* Add configure option for changing binary to ipmiadm for Solaris
* Fix compile problem on Solaris 8
-- Duncan Laurie <duncan@iceblink.org> Sat, 27 Mar 2004 00:11:37 -0700
ipmitool (1.5.8) unstable; urgency=low
* Enable static compilation of interfaces
* Fix types to be 64-bit safe
* Fix compilation problems on Solaris
* Fix multiple big-endian problems for Solaris/SPARC
* Fix channel access to save settings to NVRAM
* Set channel privilege limit to ADMIN during "access on"
* Enable gratuitous ARP in bmcautoconf.sh
* Add support for Linux kernel panic messages in SEL output
* Add support for type 3 SDR records
-- Duncan Laurie <duncan@iceblink.org> Tue, 27 Jan 2004 16:23:25 -0700
ipmitool (1.5.7) unstable; urgency=low
* add IPMIv1.5 eratta fixes
* additions to FRU printing and FRU multirecords
* better handling of SDR printing
* contrib scripts for creating rrdtool graphs
-- Duncan Laurie <duncan@iceblink.org> Mon, 5 Jan 2004 17:29:50 -0700
ipmitool (1.5.6) unstable; urgency=low
* Fix SEL event decoding for generic events
* Handle empty SEL gracefully when doing "sel list"
* Fix sdr handling of sensors that do not return a reading
* Fix for CSV display of sensor readings/units from Fredrik Öhrn
-- Duncan Laurie <duncan@iceblink.org> Thu, 4 Dec 2003 14:47:19 -0700
ipmitool (1.5.5) unstable; urgency=low
* Add -U option for setting LAN username
* Fix -v usage for plugin interfaces
-- Duncan Laurie <duncan@iceblink.org> Tue, 25 Nov 2003 15:10:48 -0700
ipmitool (1.5.4) unstable; urgency=low
* Put interface plugin API into library
* Fix ipmievd
-- Duncan Laurie <duncan@iceblink.org> Fri, 14 Nov 2003 15:16:34 -0700
ipmitool (1.5.3) unstable; urgency=low
* Add -g option to work with grizzly bmc
-- Duncan Laurie <duncan@iceblink.org> Mon, 3 Nov 2003 18:04:07 -0700
ipmitool (1.5.2) unstable; urgency=low
* add support for setting gratuitous arp interval
-- Duncan Laurie <duncan@iceblink.org> Fri, 24 Oct 2003 11:00:00 -0700
ipmitool (1.5.1) unstable; urgency=low
* better SEL support
* fix display bug in SDR list
-- Duncan Laurie <duncan@iceblink.org> Wed, 8 Oct 2003 17:28:51 -0700
ipmitool (1.5.0) unstable; urgency=low
* more robust UDP packet handling
* add Intel IMB driver support
* use autoconf/automake/libtool
-- Duncan Laurie <duncan@iceblink.org> Fri, 5 Sep 2003 11:57:32 -0700
ipmitool (1.2-1) unstable; urgency=low
* New command line option parsing
* More chassis commands supported
-- Duncan Laurie <duncan@iceblink.org> Wed, 2 Apr 2003 17:44:17 -0700
ipmitool (1.1-1) unstable; urgency=low
* Minor fixes.
-- Duncan Laurie <duncan@iceblink.org> Tue, 1 Apr 2003 14:31:10 -0700
ipmitool (1.0-1) unstable; urgency=low
* Initial Release.
-- Duncan Laurie <duncan@iceblink.org> Sun, 30 Mar 2003 21:30:46 -0700

View File

@ -1,28 +0,0 @@
Source: ipmitool
Section: utils
Priority: optional
Maintainer: Petter Reinholdtsen <pere@debian.org>
Uploaders: Duncan Laurie <duncan@iceblink.org>
Build-Depends: debhelper (>> 4.0.0), libreadline5-dev | libreadline-dev, libssl-dev, autoconf, automake1.9 | automake, autotools-dev, libtool
Standards-Version: 3.6.2.1
Package: ipmitool
Architecture: i386 amd64 ia64
Depends: ${shlibs:Depends}, lsb-base
Suggests: openipmi
Description: utility for IPMI control with kernel driver or LAN interface
A utility for managing and configuring devices that support the
Intelligent Platform Management Interface. IPMI is an open standard
for monitoring, logging, recovery, inventory, and control of hardware
that is implemented independent of the main CPU, BIOS, and OS. The
service processor (or Baseboard Management Controller, BMC) is the
brain behind platform management and its primary purpose is to handle
the autonomous sensor monitoring and event logging features.
.
The ipmitool program provides a simple command-line interface to this
BMC. It features the ability to read the sensor data repository
(SDR) and print sensor values, display the contents of the System
Event Log (SEL), print Field Replaceable Unit (FRU) inventory
information, read and set LAN configuration parameters, and perform
remote chassis power control.

View File

@ -1,36 +0,0 @@
This package was debianized by Duncan Laurie before
2003-11-18 17:55:21 +0100.
It was downloaded from <URL:http://ipmitool.sourceforge.net/>
Upstream Author: Duncan Laurie <duncan@iceblink.org>
Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistribution of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistribution 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.
Neither the name of Sun Microsystems, Inc. or the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
This software is provided "AS IS," without a warranty of any kind.
ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

View File

@ -1,4 +0,0 @@
usr/bin
usr/sbin
usr/share/ipmitool
usr/share/doc/ipmitool

View File

@ -1,2 +0,0 @@
README
AUTHORS

View File

@ -1,99 +0,0 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: ipmievd
# Required-Start: $local_fs $remote_fs $syslog
# Required-Stop: $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: IPMI event daemon
# Description: ipmievd is a daemon which will listen for events
# from the BMC that are being sent to the SEL and
# also log those messages to syslog.
### END INIT INFO
#
# Author: Elmar Hoffmann <elho@elho.net>
# Licence: This script is public domain using the same
# licence as ipmitool itself.
# Modified by: Petter Reinholdtsen
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="IPMI event daemon"
NAME=ipmievd
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
. /etc/default/rcS
# Options used by ipmievd.
#
# "open" uses the asynchronous event notification from the OpenIPMI
# kernel driver, "sel" uses active polling of the contents of the SEL
# for new events.
#
# Need to force 'daemon' mode, to make sure messages are sent to
# syslog and the program forks into the background.
#
# Se ipmievd(8) for more info.
IPMIEVD_OPTIONS="open daemon"
# Read config file if it is present.
[ -f /etc/default/$NAME ] && . /etc/default/$NAME
# Backwards compatibility with version 1.8.6-2 and 1.8.6-1. The
# variable was renamed to be compatible with upstream, SuSe and RedHat.
if [ -n "$IPMIEVD_OPTS" ]; then
echo "warning: /etc/default/$NAME variable IPMIEVD_OPTS should be renamed to IPMIEVD_OPTIONS"
IPMIEVD_OPTIONS="$IPMIEVD_OPTS"
fi
#
# Function that starts the daemon/service.
#
d_start() {
start-stop-daemon --start --quiet --exec $DAEMON -- $IPMIEVD_OPTIONS
}
#
# Function that stops the daemon/service.
#
d_stop() {
start-stop-daemon --stop --quiet --name $NAME --exec $DAEMON
}
CODE=0
case "$1" in
start)
[ "$VERBOSE" != no ] && log_begin_msg "Starting $DESC" "$NAME"
d_start || CODE=$?
[ "$VERBOSE" != no ] && log_end_msg $CODE
exit $CODE
;;
stop)
log_begin_msg "Stopping $DESC" "$NAME"
d_stop || CODE=$?
log_end_msg $CODE
exit $CODE
;;
restart|force-reload)
log_begin_msg "Restarting $DESC" "$NAME"
d_stop || true
sleep 1
d_start || CODE=$?
log_end_msg $CODE
exit $CODE
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@ -1,118 +0,0 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
export DH_COMPAT=4
export DH_OPTIONS
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
configure: configure-stamp
configure-stamp:
dh_testdir
./bootstrap
./configure --prefix=/usr \
--with-kerneldir \
--mandir=/usr/share/man
touch configure-stamp
#Architecture
build: build-arch build-indep
build-arch: build-arch-stamp
build-arch-stamp: configure-stamp
# Add here commands to compile the arch part of the package.
$(MAKE)
build-indep: build-indep-stamp
build-indep-stamp: configure-stamp
# Add here commands to compile the indep part of the package.
#$(MAKE) doc
clean:
dh_testdir
dh_testroot
rm -f build-arch-stamp build-indep-stamp configure-stamp
# Add here commands to clean up after the build process.
-$(MAKE) distclean
dh_clean
install: install-arch #install-indep
install-indep:
dh_testdir
dh_testroot
dh_clean -k -i
dh_installdirs -i
# Add here commands to install the indep part of the package into
# debian/<package>-doc.
#INSTALLDOC#
# $(MAKE) install-doc DESTDIR=$(CURDIR)/debian/tmp/ipmitool-doc
# dh_movefiles -i
install-arch:
dh_testdir
dh_testroot
dh_clean -k -a
dh_installdirs -a
# Add here commands to install the arch part of the package into
# debian/tmp.
$(MAKE) install DESTDIR=$(CURDIR)/debian/ipmitool
# No need to have two copies of the license text in the package.
$(RM) $(CURDIR)/debian/ipmitool/usr/share/doc/ipmitool/COPYING
# Move upstream changelog to correct filename.
mv $(CURDIR)/debian/ipmitool/usr/share/doc/ipmitool/ChangeLog \
$(CURDIR)/debian/ipmitool/usr/share/doc/ipmitool/changelog
# Compress to avoid lintian warning. Not sure why dh_compress
# isn't fixing this.
gzip -9 $(CURDIR)/debian/ipmitool/usr/share/doc/ipmitool/changelog
# dh_movefiles -a
# Must not depend on anything. This is to be called by
# binary-arch/binary-multi
# in another 'make' thread.
binary-common:
dh_testdir
dh_testroot
dh_installdocs
dh_installchangelogs
dh_installinit --name ipmievd
dh_link
dh_strip
dh_compress
dh_fixperms
dh_makeshlibs
dh_shlibdeps
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
# Build architecture independant packages using the common target.
binary-indep: build-indep install-indep
$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
# Build architecture dependant packages using the common target.
binary-arch: build-arch install-arch
$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
binary: binary-arch #binary-indep
.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure

View File

@ -1,6 +0,0 @@
# Rename this file to "watch" and then you can run the "uscan" command
# to check for upstream updates and more.
# Site Directory Pattern Version Script
version=2
http://heanet.dl.sourceforge.net/sourceforge/ipmitool/ipmitool-(.*).tar.bz2
# debian uupdate

View File

@ -1,42 +0,0 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution 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.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_KFWUM_H
#define IPMI_KFWUM_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_fwum_main(struct ipmi_intf *, int, char **);
#endif /* IPMI_KFWUM_H */

View File

@ -1,41 +0,0 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution 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.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef IPMI_HPMFWUPG_H
#define IPMI_HPMFWUPG_H
#include <inttypes.h>
#include <ipmitool/ipmi.h>
int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **);
#endif /* IPMI_KFWUM_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,806 +0,0 @@
/*
* Copyright (c) 2004 Kontron Canada, Inc. All Rights Reserved.
*
* Base on code from
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution 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.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
/*
* Tue Mar 7 14:36:12 2006
* <stephane.filion@ca.kontron.com>
*
* This code implements an Kontron OEM proprietary commands.
*/
#include <string.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_fru.h>
extern int verbose;
extern int read_fru_area(struct ipmi_intf * intf, struct fru_info *fru,
uint8_t id, uint32_t offset, uint32_t length,
uint8_t *frubuf);
extern int write_fru_area(struct ipmi_intf * intf, struct fru_info *fru,
unsigned char id, unsigned int soffset,
unsigned int doffset, unsigned int length,
unsigned char *pFrubuf);
extern char * get_fru_area_str(uint8_t * data, uint32_t * offset);
static void ipmi_kontron_help(void);
static int ipmi_kontron_set_serial_number(struct ipmi_intf * intf);
static int ipmi_kontron_set_mfg_date (struct ipmi_intf * intf);
static void ipmi_kontron_nextboot_help(void);
static int ipmi_kontron_nextboot_set(struct ipmi_intf * intf,
int argc, char **argv);
static int ipmi_kontronoem_send_set_large_buffer(struct ipmi_intf * intf,
unsigned char channel,
unsigned char size);
int
ipmi_kontronoem_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = 0;
if (argc == 0)
ipmi_kontron_help();
else if (strncmp(argv[0], "help", 4) == 0)
ipmi_kontron_help();
else if (!strncmp(argv[0], "setsn", 5))
{
if(argc >= 1)
{
if(ipmi_kontron_set_serial_number(intf) > 0)
{
printf("FRU serial number setted successfully\n");
}
else
{
printf("FRU serial number set failed\n");
}
}
else
{
printf("fru setsn\n");
}
}
else if (!strncmp(argv[0], "setmfgdate", 5))
{
if(argc >= 1)
{
if(ipmi_kontron_set_mfg_date(intf) > 0)
{
printf("FRU manufacturing date setted successfully\n");
}
else
{
printf("FRU manufacturing date set failed\n");
}
}
else
{
printf("fru setmfgdate\n");
}
}
else if (!strncmp(argv[0], "nextboot", sizeof("nextboot")-1))
{
if (argc > 1)
{
if ((rc = ipmi_kontron_nextboot_set(intf, argc-1, argv+1)) == 0)
{
printf("Nextboot set successfully\n");
}
else
{
printf("Nextboot set failed\n");
}
}
else
{
ipmi_kontron_nextboot_help();
}
}
else
{
printf("Invalid Kontron command: %s", argv[0]);
ipmi_kontron_help();
rc = -1;
}
return rc;
}
static void ipmi_kontron_help(void)
{
printf("Kontron Commands: setsn setmfgdate nextboot\n");
}
int ipmi_kontronoem_set_large_buffer(struct ipmi_intf * intf, unsigned char size)
{
uint8_t error_occurs = 0;
uint32_t prev_target_addr = intf->target_addr ;
if ( intf->target_addr > 0 && (intf->target_addr != intf->my_addr) )
{
intf->target_addr = intf->my_addr;
printf("Set local big buffer\n");
if(ipmi_kontronoem_send_set_large_buffer( intf, 0x0e, size ) == 0)
{
printf("Set local big buffer:success\n");
}
else
{
error_occurs = 1;
}
if (error_occurs == 0)
{
if(ipmi_kontronoem_send_set_large_buffer( intf, 0x00, size ) == 0)
{
printf("IPMB was set\n");
}
else
{
/* Revert back the previous set large buffer */
error_occurs = 1;
ipmi_kontronoem_send_set_large_buffer( intf, 0x0e, 0 );
}
}
/* Restore target address */
intf->target_addr = prev_target_addr;
}
if (error_occurs == 0)
{
if(ipmi_kontronoem_send_set_large_buffer( intf, 0x0e, size ) == 0)
{
//printf("Set remote big buffer\n");
}
else
{
if ( intf->target_addr > 0 && (intf->target_addr != intf->my_addr) )
{
/* Error occurs revert back the previous set large buffer*/
intf->target_addr = intf->my_addr;
//ipmi_kontronoem_send_set_large_buffer( intf, 0x00, 0 );
ipmi_kontronoem_send_set_large_buffer( intf, 0x0e, 0 );
intf->target_addr = prev_target_addr;
}
}
}
return error_occurs;
}
int ipmi_kontronoem_send_set_large_buffer(struct ipmi_intf * intf, unsigned char channel,unsigned char size)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
uint8_t msg_data[2];
int i;
memset(msg_data, 0, sizeof(msg_data));
msg_data[0] = channel/*0x0e*/; // Currently running interface
msg_data[1] = size;
memset(&req, 0, sizeof(req));
req.msg.netfn = 0x3E; /* OEM NetFn */
req.msg.cmd = 0x82; /* Set Channel Buffer Length - OEM */
req.msg.data = msg_data;
req.msg.data_len = 2;
req.msg.lun = 0x00;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf("Cannot send large buffer command\n");
return(-1);
}
if (rsp->ccode > 0)
{
printf("Invalid length for the selected interface (%s) %d\n",
val2str(rsp->ccode, completion_code_vals), rsp->ccode);
return(-1);
}
return 0;
}
/* ipmi_fru_set_serial_number - Set the Serial Number in FRU
*
* @intf: ipmi interface
* @id: fru id
*
* returns -1 on error
* returns 1 if successful
*/
static int
ipmi_kontron_set_serial_number(struct ipmi_intf * intf)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
struct fru_info fru;
struct fru_header header;
uint8_t msg_data[4];
char *sn;
uint8_t sn_size, checksum;
uint8_t *fru_data;
char *fru_area;
uint32_t fru_data_offset, fru_data_offset_tmp, board_sec_len, prod_sec_len, i;
sn = NULL;
fru_data = NULL;
memset(msg_data, 0, 4);
msg_data[0] = 0xb4;
msg_data[1] = 0x90;
msg_data[2] = 0x91;
msg_data[3] = 0x8b;
memset(&req, 0, sizeof(req));
req.msg.netfn = 0x3E;
req.msg.cmd = 0x0C;
req.msg.data = msg_data;
req.msg.data_len = 4;
/* Set Lun, necessary for this oem command */
req.msg.lun = 0x03;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf(" Device not present (No Response)\n");
return -11;
}
if (rsp->ccode > 0)
{
printf(" This option is not implemented for this board\n");
return -1;
}
sn_size = rsp->data_len;
sn = malloc(sn_size + 1);
if(sn == NULL)
{
printf("Out of memory!");
return -1;
}
memset(sn, 0, sn_size + 1);
memcpy(sn, rsp->data, sn_size);
if(verbose >= 1)
{
printf("Original serial number is : [%s]\n", sn);
}
memset(msg_data, 0, 4);
msg_data[0] = 0;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_INFO;
req.msg.data = msg_data;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
free(sn);
sn = NULL;
return -1;
}
if (rsp->ccode > 0) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
free(sn);
sn = NULL;
return(-1);
}
fru.size = (rsp->data[1] << 8) | rsp->data[0];
fru.access = rsp->data[2] & 0x1;
if (fru.size < 1) {
printf(" Invalid FRU size %d", fru.size);
free(sn);
sn = NULL;
return -1;
}
/*
* retrieve the FRU header
*/
msg_data[0] = 0;
msg_data[1] = 0;
msg_data[2] = 0;
msg_data[3] = 8;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_DATA;
req.msg.data = msg_data;
req.msg.data_len = 4;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf(" Device not present (No Response)\n");
free(sn);
sn = NULL;
return(-1);
}
if (rsp->ccode > 0)
{
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
free(sn);
sn = NULL;
return(-1);
}
if (verbose > 1)
printbuf(rsp->data, rsp->data_len, "FRU DATA");
memcpy(&header, rsp->data + 1, 8);
if (header.version != 1)
{
printf(" Unknown FRU header version 0x%02x",
header.version);
free(sn);
sn = NULL;
return(-1);
}
/* Set the Board Section */
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
fru_data = malloc( fru.size);
if(fru_data == NULL)
{
printf("Out of memory!");
free(sn);
sn = NULL;
return(-1);
}
memset(fru_data, 0, fru.size);
if(read_fru_area(intf ,&fru ,0 ,(header.offset.board * 8) ,board_sec_len , fru_data) < 0)
{
free(sn);
sn = NULL;
free(fru_data);
fru_data = NULL;
return(-1);
}
/*Position at Board Manufacturer*/
fru_data_offset = (header.offset.board * 8) + 6;
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Board Product Name*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
fru_data_offset_tmp = fru_data_offset;
/*Position at Serial Number*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
fru_data_offset ++;
if(strlen(fru_area) != sn_size)
{
printf("The length of the serial number in the FRU Board Area is wrong.\n");
free(sn);
sn = NULL;
free(fru_data);
fru_data = NULL;
return(-1);
}
/* Copy the new serial number in the board section saved in memory*/
memcpy(fru_data + fru_data_offset, sn, sn_size);
checksum = 0;
/* Calculate Header Checksum */
for( i = (header.offset.board * 8); i < (((header.offset.board * 8)+board_sec_len) - 2) ; i ++ )
{
checksum += fru_data[i];
}
checksum = (~checksum) + 1;
fru_data[(header.offset.board * 8)+board_sec_len - 1] = checksum;
/* Write the new FRU Board section */
if(write_fru_area(intf, &fru, 0, (header.offset.board * 8), (header.offset.board * 8), board_sec_len, fru_data) < 0)
{
free(sn);
sn = NULL;
free(fru_data);
fru_data = NULL;
return(-1);
}
/* Set the Product Section */
prod_sec_len = (header.offset.multi * 8) - (header.offset.product * 8);
if(read_fru_area(intf ,&fru ,0 ,(header.offset.product * 8) ,prod_sec_len , fru_data) < 0)
{
free(sn);
sn = NULL;
free(fru_data);
fru_data = NULL;
return(-1);
}
/*Position at Product Manufacturer*/
fru_data_offset = (header.offset.product * 8) + 3;
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Product Name*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Product Part*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
/*Position at Product Version*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
fru_data_offset_tmp = fru_data_offset;
/*Position at Serial Number*/
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
fru_data_offset ++;
if(strlen(fru_area) != sn_size)
{
free(sn);
sn = NULL;
free(fru_data);
fru_data = NULL;
printf("The length of the serial number in the FRU Product Area is wrong.\n");
return(-1);
}
/* Copy the new serial number in the product section saved in memory*/
memcpy(fru_data + fru_data_offset, sn, sn_size);
checksum = 0;
/* Calculate Header Checksum */
for( i = (header.offset.product * 8); i < (((header.offset.product * 8)+prod_sec_len) - 2) ; i ++ )
{
checksum += fru_data[i];
}
checksum = (~checksum) + 1;
fru_data[(header.offset.product * 8)+prod_sec_len - 1] = checksum;
/* Write the new FRU Board section */
if(write_fru_area(intf, &fru, 0, (header.offset.product * 8), (header.offset.product * 8), prod_sec_len, fru_data) < 0)
{
free(sn);
sn = NULL;
free(fru_data);
fru_data = NULL;
return -1;
}
free(sn);
sn = NULL;
free(fru_data);
fru_data = NULL;
return(1);
}
/* ipmi_fru_set_mfg_date - Set the Manufacturing Date in FRU
*
* @intf: ipmi interface
* @id: fru id
*
* returns -1 on error
* returns 1 if successful
*/
static int
ipmi_kontron_set_mfg_date (struct ipmi_intf * intf)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
struct fru_info fru;
struct fru_header header;
uint8_t msg_data[4];
uint8_t mfg_date[3];
uint32_t board_sec_len, i;
uint8_t *fru_data, checksum;
memset(msg_data, 0, 4);
msg_data[0] = 0xb4;
msg_data[1] = 0x90;
msg_data[2] = 0x91;
msg_data[3] = 0x8b;
memset(&req, 0, sizeof(req));
req.msg.netfn = 0x3E;
req.msg.cmd = 0x0E;
req.msg.data = msg_data;
req.msg.data_len = 4;
/* Set Lun temporary, necessary for this oem command */
req.msg.lun = 0x03;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf("Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0)
{
printf("This option is not implemented for this board\n");
return(-1);
}
if(rsp->data_len != 3)
{
printf("Invalid response for the Manufacturing date\n");
return(-1);
}
memset(mfg_date, 0, 3);
memcpy(mfg_date, rsp->data, 3);
memset(msg_data, 0, 4);
msg_data[0] = 0;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_INFO;
req.msg.data = msg_data;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return(-1);
}
fru.size = (rsp->data[1] << 8) | rsp->data[0];
fru.access = rsp->data[2] & 0x1;
if (fru.size < 1) {
printf(" Invalid FRU size %d", fru.size);
return(-1);
}
/*
* retrieve the FRU header
*/
msg_data[0] = 0;
msg_data[1] = 0;
msg_data[2] = 0;
msg_data[3] = 8;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_DATA;
req.msg.data = msg_data;
req.msg.data_len = 4;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf(" Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0)
{
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return(-1);
}
if (verbose > 1)
printbuf(rsp->data, rsp->data_len, "FRU DATA");
memcpy(&header, rsp->data + 1, 8);
if (header.version != 1)
{
printf(" Unknown FRU header version 0x%02x",
header.version);
return(-1);
}
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
fru_data = malloc( fru.size);
if(fru_data == NULL)
{
printf("Out of memory!");
return(-1);
}
memset(fru_data, 0, fru.size);
if(read_fru_area(intf ,&fru ,0 ,(header.offset.board * 8) ,board_sec_len , fru_data) < 0)
{
free(fru_data);
fru_data = NULL;
return(-1);
}
/* Copy the new manufacturing date in the board section saved in memory*/
memcpy(fru_data + (header.offset.board * 8) + 3, mfg_date, 3);
checksum = 0;
/* Calculate Header Checksum */
for( i = (header.offset.board * 8); i < (((header.offset.board * 8)+board_sec_len) - 2) ; i ++ )
{
checksum += fru_data[i];
}
checksum = (~checksum) + 1;
fru_data[(header.offset.board * 8)+board_sec_len - 1] = checksum;
/* Write the new FRU Board section */
if(write_fru_area(intf, &fru, 0, (header.offset.board * 8), (header.offset.board * 8), board_sec_len, fru_data) < 0)
{
free(fru_data);
fru_data = NULL;
return(-1);
}
free(fru_data);
fru_data = NULL;
return(1);
}
static char *bootdev[] = {"BIOS", "FDD", "HDD", "CDROM", "network", 0};
static void
ipmi_kontron_nextboot_help(void)
{
int i;
printf("nextboot <device>\n"
"Supported devices:\n");
for (i = 0; bootdev[i] != 0; i++) {
printf("- %s\n", bootdev[i]);
}
}
/* ipmi_kontron_next_boot_set - Select the next boot order on CP6012
*
* @intf: ipmi interface
* @id: fru id
*
* returns -1 on error
* returns 1 if successful
*/
static int
ipmi_kontron_nextboot_set(struct ipmi_intf * intf, int argc, char **argv)
{
struct ipmi_rs *rsp;
struct ipmi_rq req;
uint8_t msg_data[8];
int i;
memset(msg_data, 0, sizeof(msg_data));
msg_data[0] = 0xb4;
msg_data[1] = 0x90;
msg_data[2] = 0x91;
msg_data[3] = 0x8b;
msg_data[4] = 0x9d;
msg_data[5] = 0xFF;
msg_data[6] = 0xFF; /* any */
for (i = 0; bootdev[i] != 0; i++) {
if (strcmp(argv[0], bootdev[i]) == 0) {
msg_data[5] = i;
break;
}
}
/* Invalid device selected? */
if (msg_data[5] == 0xFF) {
printf("Unknown boot device: %s\n", argv[0]);
return -1;
}
memset(&req, 0, sizeof(req));
req.msg.netfn = 0x3E;
req.msg.cmd = 0x02;
req.msg.data = msg_data;
req.msg.data_len = 7;
/* Set Lun temporary, necessary for this oem command */
req.msg.lun = 0x03;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL)
{
printf("Device not present (No Response)\n");
return(-1);
}
if (rsp->ccode > 0) {
printf("Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return(-1);
}
return 0;
}

View File

@ -1,859 +0,0 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution 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.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <ctype.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/helper.h>
#include <ipmitool/log.h>
#include <ipmitool/ipmi_sel.h>
#include <ipmitool/ipmi_sdr.h>
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/ipmi_channel.h>
#include <ipmitool/ipmi_sunoem.h>
#include <ipmitool/ipmi_raw.h>
static const struct valstr sunoem_led_type_vals[] = {
{ 0, "OK2RM" },
{ 1, "SERVICE" },
{ 2, "ACT" },
{ 3, "LOCATE" },
{ 0xFF, NULL },
};
static const struct valstr sunoem_led_mode_vals[] = {
{ 0, "OFF" },
{ 1, "ON" },
{ 2, "STANDBY" },
{ 3, "SLOW" },
{ 4, "FAST" },
{ 0xFF, NULL },
};
static const struct valstr sunoem_led_mode_optvals[] = {
{ 0, "STEADY_OFF" },
{ 1, "STEADY_ON" },
{ 2, "STANDBY_BLINK" },
{ 3, "SLOW_BLINK" },
{ 4, "FAST_BLINK" },
{ 0xFF, NULL },
};
int is_sbcmd = 0;
static void
ipmi_sunoem_usage(void)
{
lprintf(LOG_NOTICE, "usage: sunoem <command> [option...]");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " fan speed <0-100>");
lprintf(LOG_NOTICE, " Set system fan speed (PWM duty cycle)");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sshkey set <userid> <id_rsa.pub>");
lprintf(LOG_NOTICE, " Set ssh key for a userid into authorized_keys,");
lprintf(LOG_NOTICE, " view users with 'user list' command.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sshkey del <userid>");
lprintf(LOG_NOTICE, " Delete ssh key for userid from authorized_keys,");
lprintf(LOG_NOTICE, " view users with 'user list' command.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " led get <sensorid> [ledtype]");
lprintf(LOG_NOTICE,
" Read status of LED found in Generic Device Locator.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " led set <sensorid> <ledmode> [ledtype]");
lprintf(LOG_NOTICE,
" Set mode of LED found in Generic Device Locator.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sbled get <sensorid> [ledtype]");
lprintf(LOG_NOTICE,
" Read status of LED found in Generic Device Locator");
lprintf(LOG_NOTICE, " for Sun Blade Modular Systems.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " sbled set <sensorid> <ledmode> [ledtype]");
lprintf(LOG_NOTICE, " Set mode of LED found in Generic Device Locator");
lprintf(LOG_NOTICE, " for Sun Blade Modular Systems.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE,
" Use 'sdr list generic' command to get list of Generic");
lprintf(LOG_NOTICE, " Devices that are controllable LEDs.");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " Required SIS LED Mode:");
lprintf(LOG_NOTICE, " OFF Off");
lprintf(LOG_NOTICE, " ON Steady On");
lprintf(LOG_NOTICE, " STANDBY 100ms on 2900ms off blink rate");
lprintf(LOG_NOTICE, " SLOW 1HZ blink rate");
lprintf(LOG_NOTICE, " FAST 4HZ blink rate");
lprintf(LOG_NOTICE, "");
lprintf(LOG_NOTICE, " Optional SIS LED Type:");
lprintf(LOG_NOTICE, " OK2RM OK to Remove");
lprintf(LOG_NOTICE, " SERVICE Service Required");
lprintf(LOG_NOTICE, " ACT Activity");
lprintf(LOG_NOTICE, " LOCATE Locate");
lprintf(LOG_NOTICE, "");
}
/*
* IPMI Request Data: 1 byte
*
* [byte 0] FanSpeed Fan speed as percentage
*/
static int
ipmi_sunoem_fan_speed(struct ipmi_intf * intf, uint8_t speed)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
/*
* sunoem fan speed <percent>
*/
if (speed > 100) {
lprintf(LOG_NOTICE, "Invalid fan speed: %d", speed);
return -1;
}
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_SET_FAN_SPEED;
req.msg.data = &speed;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Set Fan Speed command failed");
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Sun OEM Set Fan Speed command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Set Fan speed to %d%%\n", speed);
return 0;
}
static void
__sdr_list_empty(struct sdr_record_list * head)
{
struct sdr_record_list * e, * f;
for (e = head; e != NULL; e = f) {
f = e->next;
free(e);
e = NULL;
}
head = NULL;
}
static void
led_print(const char * name, uint8_t state)
{
if (csv_output)
printf("%s,%s\n", name, val2str(state, sunoem_led_mode_vals));
else
printf("%-16s | %s\n", name, val2str(state, sunoem_led_mode_vals));
}
struct ipmi_rs *
sunoem_led_get(struct ipmi_intf * intf,
struct sdr_record_generic_locator * dev,
int ledtype)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t rqdata[7];
int rqdata_len = 5;
if (dev == NULL)
return NULL;
rqdata[0] = dev->dev_slave_addr;
if (ledtype == 0xFF)
rqdata[1] = dev->oem;
else
rqdata[1] = ledtype;
rqdata[2] = dev->dev_access_addr;
rqdata[3] = dev->oem;
if (is_sbcmd) {
rqdata[4] = dev->entity.id;
rqdata[5] = dev->entity.instance;
rqdata[6] = 0;
rqdata_len = 7;
}
else {
rqdata[4] = 0;
}
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_LED_GET;
req.msg.lun = dev->lun;
req.msg.data = rqdata;
req.msg.data_len = rqdata_len;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Get LED command failed");
return NULL;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Sun OEM Get LED command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return NULL;
}
return rsp;
}
struct ipmi_rs *
sunoem_led_set(struct ipmi_intf * intf,
struct sdr_record_generic_locator * dev,
int ledtype, int ledmode)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t rqdata[9];
int rqdata_len = 7;
if (dev == NULL)
return NULL;
rqdata[0] = dev->dev_slave_addr;
if (ledtype == 0xFF)
rqdata[1] = dev->oem;
else
rqdata[1] = ledtype;
rqdata[2] = dev->dev_access_addr;
rqdata[3] = dev->oem;
rqdata[4] = ledmode;
if (is_sbcmd) {
rqdata[5] = dev->entity.id;
rqdata[6] = dev->entity.instance;
rqdata[7] = 0;
rqdata[8] = 0;
rqdata_len = 9;
}
else {
rqdata[5] = 0;
rqdata[6] = 0;
}
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_LED_SET;
req.msg.lun = dev->lun;
req.msg.data = rqdata;
req.msg.data_len = rqdata_len;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed");
return NULL;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return NULL;
}
return rsp;
}
static void
sunoem_led_get_byentity(struct ipmi_intf * intf, uint8_t entity_id,
uint8_t entity_inst, int ledtype)
{
struct ipmi_rs * rsp;
struct sdr_record_list *elist, *e;
struct entity_id entity;
if (entity_id == 0)
return;
/* lookup sdrs with this entity */
memset(&entity, 0, sizeof(struct entity_id));
entity.id = entity_id;
entity.instance = entity_inst;
elist = ipmi_sdr_find_sdr_byentity(intf, &entity);
/* for each generic sensor set its led state */
for (e = elist; e != NULL; e = e->next) {
if (e->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
rsp = sunoem_led_get(intf, e->record.genloc, ledtype);
if (rsp && rsp->data_len == 1) {
led_print((const char *)e->record.genloc->id_string, rsp->data[0]);
}
}
__sdr_list_empty(elist);
}
static void
sunoem_led_set_byentity(struct ipmi_intf * intf, uint8_t entity_id,
uint8_t entity_inst, int ledtype, int ledmode)
{
struct ipmi_rs * rsp;
struct sdr_record_list *elist, *e;
struct entity_id entity;
if (entity_id == 0)
return;
/* lookup sdrs with this entity */
memset(&entity, 0, sizeof(struct entity_id));
entity.id = entity_id;
entity.instance = entity_inst;
elist = ipmi_sdr_find_sdr_byentity(intf, &entity);
/* for each generic sensor set its led state */
for (e = elist; e != NULL; e = e->next) {
if (e->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
rsp = sunoem_led_set(intf, e->record.genloc, ledtype, ledmode);
if (rsp && rsp->data_len == 0) {
led_print((const char *)e->record.genloc->id_string, ledmode);
}
}
__sdr_list_empty(elist);
}
/*
* IPMI Request Data: 5 bytes
*
* [byte 0] devAddr Value from the "Device Slave Address" field in
* LED's Generic Device Locator record in the SDR
* [byte 1] led LED Type: OK2RM, ACT, LOCATE, SERVICE
* [byte 2] ctrlrAddr Controller address; value from the "Device
* Access Address" field, 0x20 if the LED is local
* [byte 3] hwInfo The OEM field from the SDR record
* [byte 4] force 1 = directly access the device
* 0 = go thru its controller
* Ignored if LED is local
*
* The format below is for Sun Blade Modular systems only
* [byte 4] entityID The entityID field from the SDR record
* [byte 5] entityIns The entityIns field from the SDR record
* [byte 6] force 1 = directly access the device
* 0 = go thru its controller
* Ignored if LED is local
*/
static int
ipmi_sunoem_led_get(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct sdr_record_list *sdr;
struct sdr_record_list *alist, *a;
struct sdr_record_entity_assoc *assoc;
int ledtype = 0xFF;
int i;
/*
* sunoem led/sbled get <id> [type]
*/
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
ipmi_sunoem_usage();
return 0;
}
if (argc > 1) {
ledtype = str2val(argv[1], sunoem_led_type_vals);
if (ledtype == 0xFF)
lprintf(LOG_ERR, "Unknow ledtype, will use data from the SDR oem field");
}
if (strncasecmp(argv[0], "all", 3) == 0) {
/* do all generic sensors */
alist = ipmi_sdr_find_sdr_bytype(intf,
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
if (a->record.genloc->entity.logical)
continue;
rsp = sunoem_led_get(intf, a->record.genloc, ledtype);
if (rsp && rsp->data_len == 1) {
led_print((const char *)a->record.genloc->id_string, rsp->data[0]);
}
}
__sdr_list_empty(alist);
return 0;
}
/* look up generic device locator record in SDR */
sdr = ipmi_sdr_find_sdr_byid(intf, argv[0]);
if (sdr == NULL) {
lprintf(LOG_ERR, "No Sensor Data Record found for %s", argv[0]);
return -1;
}
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR) {
lprintf(LOG_ERR, "Invalid SDR type %d", sdr->type);
return -1;
}
if (!sdr->record.genloc->entity.logical) {
/*
* handle physical entity
*/
rsp = sunoem_led_get(intf, sdr->record.genloc, ledtype);
if (rsp && rsp->data_len == 1) {
led_print((const char *)sdr->record.genloc->id_string, rsp->data[0]);
}
return 0;
}
/*
* handle logical entity for LED grouping
*/
lprintf(LOG_INFO, "LED %s is logical device", argv[0]);
/* get entity assoc records */
alist = ipmi_sdr_find_sdr_bytype(intf, SDR_RECORD_TYPE_ENTITY_ASSOC);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_ENTITY_ASSOC)
continue;
assoc = a->record.entassoc;
if (assoc == NULL)
continue;
/* check that the entity id/instance matches our generic record */
if (assoc->entity.id != sdr->record.genloc->entity.id ||
assoc->entity.instance != sdr->record.genloc->entity.instance)
continue;
if (assoc->flags.isrange) {
/*
* handle ranged entity associations
*
* the test for non-zero entity id is handled in
* sunoem_led_get_byentity()
*/
/* first range set - id 1 and 2 must be equal */
if (assoc->entity_id_1 == assoc->entity_id_2)
for (i = assoc->entity_inst_1; i <= assoc->entity_inst_2; i++)
sunoem_led_get_byentity(intf, assoc->entity_id_1, i, ledtype);
/* second range set - id 3 and 4 must be equal */
if (assoc->entity_id_3 == assoc->entity_id_4)
for (i = assoc->entity_inst_3; i <= assoc->entity_inst_4; i++)
sunoem_led_get_byentity(intf, assoc->entity_id_3, i, ledtype);
}
else {
/*
* handle entity list
*/
sunoem_led_get_byentity(intf, assoc->entity_id_1,
assoc->entity_inst_1, ledtype);
sunoem_led_get_byentity(intf, assoc->entity_id_2,
assoc->entity_inst_2, ledtype);
sunoem_led_get_byentity(intf, assoc->entity_id_3,
assoc->entity_inst_3, ledtype);
sunoem_led_get_byentity(intf, assoc->entity_id_4,
assoc->entity_inst_4, ledtype);
}
}
__sdr_list_empty(alist);
return 0;
}
/*
* IPMI Request Data: 7 bytes
*
* [byte 0] devAddr Value from the "Device Slave Address" field in
* LED's Generic Device Locator record in the SDR
* [byte 1] led LED Type: OK2RM, ACT, LOCATE, SERVICE
* [byte 2] ctrlrAddr Controller address; value from the "Device
* Access Address" field, 0x20 if the LED is local
* [byte 3] hwInfo The OEM field from the SDR record
* [byte 4] mode LED Mode: OFF, ON, STANDBY, SLOW, FAST
* [byte 5] force TRUE - directly access the device
* FALSE - go thru its controller
* Ignored if LED is local
* [byte 6] role Used by BMC for authorization purposes
*
* The format below is for Sun Blade Modular systems only
* [byte 5] entityID The entityID field from the SDR record
* [byte 6] entityIns The entityIns field from the SDR record
* [byte 7] force TRUE - directly access the device
* FALSE - go thru its controller
* Ignored if LED is local
* [byte 8] role Used by BMC for authorization purposes
*
*
* IPMI Response Data: 1 byte
*
* [byte 0] mode LED Mode: OFF, ON, STANDBY, SLOW, FAST
*/
static int
ipmi_sunoem_led_set(struct ipmi_intf * intf, int argc, char ** argv)
{
struct ipmi_rs * rsp;
struct sdr_record_list *sdr;
struct sdr_record_list *alist, *a;
struct sdr_record_entity_assoc *assoc;
int ledmode;
int ledtype = 0xFF;
int i;
/*
* sunoem led/sbled set <id> <mode> [type]
*/
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
ipmi_sunoem_usage();
return 0;
}
ledmode = str2val(argv[1], sunoem_led_mode_vals);
if (ledmode == 0xFF) {
ledmode = str2val(argv[1], sunoem_led_mode_optvals);
if (ledmode == 0xFF) {
lprintf(LOG_NOTICE, "Invalid LED Mode: %s", argv[1]);
return -1;
}
}
if (argc > 3) {
ledtype = str2val(argv[2], sunoem_led_type_vals);
if (ledtype == 0xFF)
lprintf(LOG_ERR, "Unknow ledtype, will use data from the SDR oem field");
}
if (strncasecmp(argv[0], "all", 3) == 0) {
/* do all generic sensors */
alist = ipmi_sdr_find_sdr_bytype(intf,
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
continue;
if (a->record.genloc->entity.logical)
continue;
rsp = sunoem_led_set(intf, a->record.genloc, ledtype, ledmode);
if (rsp && rsp->ccode == 0) {
led_print((const char *)a->record.genloc->id_string, ledmode);
}
}
__sdr_list_empty(alist);
return 0;
}
/* look up generic device locator records in SDR */
sdr = ipmi_sdr_find_sdr_byid(intf, argv[0]);
if (sdr == NULL) {
lprintf(LOG_ERR, "No Sensor Data Record found for %s",
argv[0]);
return -1;
}
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR) {
lprintf(LOG_ERR, "Invalid SDR type %d", sdr->type);
return -1;
}
if (!sdr->record.genloc->entity.logical) {
/*
* handle physical entity
*/
rsp = sunoem_led_set(intf, sdr->record.genloc, ledtype, ledmode);
if (rsp && rsp->ccode == 0) {
led_print(argv[0], ledmode);
}
return 0;
}
/*
* handle logical entity for LED grouping
*/
lprintf(LOG_INFO, "LED %s is logical device", argv[0]);
/* get entity assoc records */
alist = ipmi_sdr_find_sdr_bytype(intf, SDR_RECORD_TYPE_ENTITY_ASSOC);
for (a = alist; a != NULL; a = a->next) {
if (a->type != SDR_RECORD_TYPE_ENTITY_ASSOC)
continue;
assoc = a->record.entassoc;
if (assoc == NULL)
continue;
/* check that the entity id/instance matches our generic record */
if (assoc->entity.id != sdr->record.genloc->entity.id ||
assoc->entity.instance != sdr->record.genloc->entity.instance)
continue;
if (assoc->flags.isrange) {
/*
* handle ranged entity associations
*
* the test for non-zero entity id is handled in
* sunoem_led_get_byentity()
*/
/* first range set - id 1 and 2 must be equal */
if (assoc->entity_id_1 == assoc->entity_id_2)
for (i = assoc->entity_inst_1; i <= assoc->entity_inst_2; i++)
sunoem_led_set_byentity(intf, assoc->entity_id_1, i, ledtype,
ledmode);
/* second range set - id 3 and 4 must be equal */
if (assoc->entity_id_3 == assoc->entity_id_4)
for (i = assoc->entity_inst_3; i <= assoc->entity_inst_4; i++)
sunoem_led_set_byentity(intf, assoc->entity_id_3, i, ledtype,
ledmode);
}
else {
/*
* handle entity list
*/
sunoem_led_set_byentity(intf, assoc->entity_id_1,
assoc->entity_inst_1, ledtype, ledmode);
sunoem_led_set_byentity(intf, assoc->entity_id_2,
assoc->entity_inst_2, ledtype, ledmode);
sunoem_led_set_byentity(intf, assoc->entity_id_3,
assoc->entity_inst_3, ledtype, ledmode);
sunoem_led_set_byentity(intf, assoc->entity_id_4,
assoc->entity_inst_4, ledtype, ledmode);
}
}
__sdr_list_empty(alist);
return 0;
}
static int
ipmi_sunoem_sshkey_del(struct ipmi_intf * intf, uint8_t uid)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_DEL_SSH_KEY;
req.msg.data = &uid;
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d", uid);
return -1;
}
else if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d: %s", uid,
val2str(rsp->ccode, completion_code_vals));
return -1;
}
printf("Deleted SSH key for user id %d\n", uid);
return 0;
}
#define SSHKEY_BLOCK_SIZE 64
static int
ipmi_sunoem_sshkey_set(struct ipmi_intf * intf, uint8_t uid, char * ifile)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
FILE * fp;
int count;
uint16_t i_size, r, size;
uint8_t wbuf[SSHKEY_BLOCK_SIZE + 3];
if (ifile == NULL) {
lprintf(LOG_ERR, "Invalid or misisng input filename");
return -1;
}
fp = ipmi_open_file_read(ifile);
if (fp == NULL) {
lprintf(LOG_ERR, "Unable to open file %s for reading", ifile);
return -1;
}
printf("Setting SSH key for user id %d...", uid);
memset(&req, 0, sizeof(struct ipmi_rq));
req.msg.netfn = IPMI_NETFN_SUNOEM;
req.msg.cmd = IPMI_SUNOEM_SET_SSH_KEY;
req.msg.data = wbuf;
fseek(fp, 0, SEEK_END);
size = ftell(fp);
fseek(fp, 0, SEEK_SET);
for (r = 0; r < size; r += i_size) {
i_size = size - r;
if (i_size > SSHKEY_BLOCK_SIZE)
i_size = SSHKEY_BLOCK_SIZE;
memset(wbuf, 0, SSHKEY_BLOCK_SIZE);
if (-1 == fseek(fp, r, SEEK_SET)) {
lprintf(LOG_ERR, "Seek error %s. %s", ifile, strerror(errno));
return -1;
}
count = fread(wbuf+3, 1, i_size, fp);
if (count != i_size) {
lprintf(LOG_ERR, "Unable to read %d bytes from file %s", i_size, ifile);
fclose(fp);
return -1;
}
printf(".");
fflush(stdout);
wbuf[0] = uid;
if ((r + SSHKEY_BLOCK_SIZE) >= size)
wbuf[1] = 0xff;
else
wbuf[1] = (uint8_t)(r / SSHKEY_BLOCK_SIZE);
wbuf[2] = i_size;
req.msg.data_len = i_size + 3;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to set ssh key for UID %d", uid);
break;
}
}
printf("done\n");
fclose(fp);
return 0;
}
int
ipmi_sunoem_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int rc = (-1);
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
ipmi_sunoem_usage();
return 0;
}
if (strncmp(argv[0], "fan", 3) == 0) {
if (argc == 3 && strncmp(argv[1], "speed", 5) == 0) {
uint8_t pct = 0;
if (str2uchar(argv[2], &pct) != 0 || pct > 100) {
lprintf(LOG_ERR, "Fan speed is limited to range <0..100>.");
return (-1);
}
rc = ipmi_sunoem_fan_speed(intf, pct);
}
else {
ipmi_sunoem_usage();
return (-1);
}
}
else if ((strncmp(argv[0], "led", 3) == 0)
|| (strncmp(argv[0], "sbled", 5) == 0)) {
if (argc < 2) {
ipmi_sunoem_usage();
return (-1);
}
if (strncmp(argv[0], "sbled", 5) == 0) {
is_sbcmd = 1;
}
if (strncmp(argv[1], "get", 3) == 0) {
if (argc < 3) {
char * arg[] = { "all" };
rc = ipmi_sunoem_led_get(intf, 1, arg);
}
else {
rc = ipmi_sunoem_led_get(intf, argc-2, &(argv[2]));
}
}
else if (strncmp(argv[1], "set", 3) == 0) {
if (argc < 4) {
ipmi_sunoem_usage();
return (-1);
}
rc = ipmi_sunoem_led_set(intf, argc-2, &(argv[2]));
}
else {
ipmi_sunoem_usage();
return (-1);
}
}
else if (strncmp(argv[0], "sshkey", 6) == 0) {
uint8_t uid = 0;
if (argc < 3) {
ipmi_sunoem_usage();
return (-1);
}
if (str2uchar(argv[2], &uid) != 0 || uid < 1 || uid > 63) {
lprintf(LOG_ERR, "User ID is limited to range <1..63>.");
return (-1);
}
if (strncmp(argv[1], "del", 3) == 0) {
rc = ipmi_sunoem_sshkey_del(intf, uid);
}
else if (argc == 4 && strncmp(argv[1], "set", 3) == 0) {
rc = ipmi_sunoem_sshkey_set(intf, uid, argv[3]);
}
else {
ipmi_sunoem_usage();
return (-1);
}
}
else {
ipmi_sunoem_usage();
return (-1);
}
return rc;
}

View File

@ -1,317 +0,0 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution 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.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi.h>
#include <ipmitool/ipmi_sdr.h>
#include <ipmitool/log.h>
#ifdef IPMI_INTF_OPEN
extern struct ipmi_intf ipmi_open_intf;
#endif
#ifdef IPMI_INTF_IMB
extern struct ipmi_intf ipmi_imb_intf;
#endif
#ifdef IPMI_INTF_LIPMI
extern struct ipmi_intf ipmi_lipmi_intf;
#endif
#ifdef IPMI_INTF_BMC
extern struct ipmi_intf ipmi_bmc_intf;
#endif
#ifdef IPMI_INTF_LAN
extern struct ipmi_intf ipmi_lan_intf;
#endif
#ifdef IPMI_INTF_LANPLUS
extern struct ipmi_intf ipmi_lanplus_intf;
#endif
#ifdef IPMI_INTF_FREE
extern struct ipmi_intf ipmi_free_intf;
#endif
#ifdef IPMI_INTF_SERIAL
extern struct ipmi_intf ipmi_serial_term_intf;
extern struct ipmi_intf ipmi_serial_bm_intf;
#endif
struct ipmi_intf * ipmi_intf_table[] = {
#ifdef IPMI_INTF_OPEN
&ipmi_open_intf,
#endif
#ifdef IPMI_INTF_IMB
&ipmi_imb_intf,
#endif
#ifdef IPMI_INTF_LIPMI
&ipmi_lipmi_intf,
#endif
#ifdef IPMI_INTF_BMC
&ipmi_bmc_intf,
#endif
#ifdef IPMI_INTF_LAN
&ipmi_lan_intf,
#endif
#ifdef IPMI_INTF_LANPLUS
&ipmi_lanplus_intf,
#endif
#ifdef IPMI_INTF_FREE
&ipmi_free_intf,
#endif
#ifdef IPMI_INTF_SERIAL
&ipmi_serial_term_intf,
&ipmi_serial_bm_intf,
#endif
NULL
};
/* ipmi_intf_print - Print list of interfaces
*
* no meaningful return code
*/
void ipmi_intf_print(struct ipmi_intf_support * intflist)
{
struct ipmi_intf ** intf;
struct ipmi_intf_support * sup;
int def = 1;
int found;
lprintf(LOG_NOTICE, "Interfaces:");
for (intf = ipmi_intf_table; intf && *intf; intf++) {
if (intflist != NULL) {
found = 0;
for (sup=intflist; sup->name != NULL; sup++) {
if (strncmp(sup->name, (*intf)->name, strlen(sup->name)) == 0 &&
strncmp(sup->name, (*intf)->name, strlen((*intf)->name)) == 0 &&
sup->supported == 1)
found = 1;
}
if (found == 0)
continue;
}
lprintf(LOG_NOTICE, "\t%-12s %s %s",
(*intf)->name, (*intf)->desc,
def ? "[default]" : "");
def = 0;
}
lprintf(LOG_NOTICE, "");
}
/* ipmi_intf_load - Load an interface from the interface table above
* If no interface name is given return first entry
*
* @name: interface name to try and load
*
* returns pointer to inteface structure if found
* returns NULL on error
*/
struct ipmi_intf * ipmi_intf_load(char * name)
{
struct ipmi_intf ** intf;
struct ipmi_intf * i;
if (name == NULL) {
i = ipmi_intf_table[0];
if (i->setup != NULL && (i->setup(i) < 0)) {
lprintf(LOG_ERR, "Unable to setup "
"interface %s", name);
return NULL;
}
return i;
}
for (intf = ipmi_intf_table;
((intf != NULL) && (*intf != NULL));
intf++) {
i = *intf;
if (strncmp(name, i->name, strlen(name)) == 0) {
if (i->setup != NULL && (i->setup(i) < 0)) {
lprintf(LOG_ERR, "Unable to setup "
"interface %s", name);
return NULL;
}
return i;
}
}
return NULL;
}
void
ipmi_intf_session_set_hostname(struct ipmi_intf * intf, char * hostname)
{
if (intf->session == NULL)
return;
memset(intf->session->hostname, 0, 16);
if (hostname != NULL) {
memcpy(intf->session->hostname, hostname,
__min(strlen(hostname), 64));
}
}
void
ipmi_intf_session_set_username(struct ipmi_intf * intf, char * username)
{
if (intf->session == NULL)
return;
memset(intf->session->username, 0, 17);
if (username == NULL)
return;
memcpy(intf->session->username, username, __min(strlen(username), 16));
}
void
ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password)
{
if (intf->session == NULL)
return;
memset(intf->session->authcode, 0, IPMI_AUTHCODE_BUFFER_SIZE);
if (password == NULL) {
intf->session->password = 0;
return;
}
intf->session->password = 1;
memcpy(intf->session->authcode, password,
__min(strlen(password), IPMI_AUTHCODE_BUFFER_SIZE));
}
void
ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, uint8_t level)
{
if (intf->session == NULL)
return;
intf->session->privlvl = level;
}
void
ipmi_intf_session_set_lookupbit(struct ipmi_intf * intf, uint8_t lookupbit)
{
if (intf->session == NULL)
return;
intf->session->v2_data.lookupbit = lookupbit;
}
void
ipmi_intf_session_set_cipher_suite_id(struct ipmi_intf * intf, uint8_t cipher_suite_id)
{
if (intf->session == NULL)
return;
intf->session->cipher_suite_id = cipher_suite_id;
}
void
ipmi_intf_session_set_sol_escape_char(struct ipmi_intf * intf, char sol_escape_char)
{
if (intf->session == NULL)
return;
intf->session->sol_escape_char = sol_escape_char;
}
void
ipmi_intf_session_set_kgkey(struct ipmi_intf * intf, char * kgkey)
{
if (intf->session == NULL)
return;
memset(intf->session->v2_data.kg, 0, IPMI_KG_BUFFER_SIZE);
if (kgkey == NULL)
return;
memcpy(intf->session->v2_data.kg, kgkey,
__min(strlen(kgkey), IPMI_KG_BUFFER_SIZE));
}
void
ipmi_intf_session_set_port(struct ipmi_intf * intf, int port)
{
if (intf->session == NULL)
return;
intf->session->port = port;
}
void
ipmi_intf_session_set_authtype(struct ipmi_intf * intf, uint8_t authtype)
{
if (intf->session == NULL)
return;
/* clear password field if authtype NONE specified */
if (authtype == IPMI_SESSION_AUTHTYPE_NONE) {
memset(intf->session->authcode, 0, IPMI_AUTHCODE_BUFFER_SIZE);
intf->session->password = 0;
}
intf->session->authtype_set = authtype;
}
void
ipmi_intf_session_set_timeout(struct ipmi_intf * intf, uint32_t timeout)
{
if (intf->session == NULL)
return;
intf->session->timeout = timeout;
}
void
ipmi_intf_session_set_retry(struct ipmi_intf * intf, int retry)
{
if (intf->session == NULL)
return;
intf->session->retry = retry;
}
void
ipmi_cleanup(struct ipmi_intf * intf)
{
ipmi_sdr_list_empty(intf);
}

View File

@ -39,7 +39,7 @@ libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_pef.c \
ipmi_oem.c ipmi_isol.c ipmi_sunoem.c ipmi_fwum.c ipmi_picmg.c \
ipmi_main.c ipmi_tsol.c ipmi_firewall.c ipmi_kontronoem.c \
ipmi_hpmfwupg.c ipmi_sdradd.c ipmi_ekanalyzer.c ipmi_gendev.c \
ipmi_ime.c ipmi_delloem.c ipmi_dcmi.c \
ipmi_ime.c ipmi_delloem.c ipmi_dcmi.c hpm2.c \
../src/plugins/lan/md5.c ../src/plugins/lan/md5.h
libipmitool_la_LDFLAGS = -export-dynamic

View File

@ -63,6 +63,7 @@ const struct valstr spd_memtype_vals[] = {
{ 0x09, "DDR2 SDRAM FB-DIMM" },
{ 0x0A, "DDR2 SDRAM FB-DIMM Probe" },
{ 0x0B, "DDR3 SDRAM" },
{ 0x0C, "DDR4 SDRAM" },
{ 0x00, NULL },
};
@ -87,6 +88,8 @@ const struct valstr ddr3_banks_vals[] =
{ 0x00, NULL },
};
#define ddr4_ecc_vals ddr3_ecc_vals
const struct valstr ddr3_ecc_vals[] =
{
{ 0, "0 bits" },
@ -94,6 +97,62 @@ const struct valstr ddr3_ecc_vals[] =
{ 0x00, NULL },
};
const struct valstr ddr4_density_vals[] =
{
{ 0, "256 Mb" },
{ 1, "512 Mb" },
{ 2, "1 Gb" },
{ 3, "2 Gb" },
{ 4, "4 Gb" },
{ 5, "8 Gb" },
{ 6, "16 Gb" },
{ 7, "32 Gb" },
{ 0x00, NULL },
};
const struct valstr ddr4_banks_vals[] =
{
{ 0, "2 (4 Banks)" },
{ 1, "3 (8 Banks)" },
{ 0x00, NULL },
};
const struct valstr ddr4_bank_groups[] =
{
{ 0, "0 (no Bank Groups)" },
{ 1, "1 (2 Bank Groups)" },
{ 2, "2 (4 Bank Groups)" },
{ 0x00, NULL },
};
const struct valstr ddr4_package_type[] =
{
{ 0, "Monolithic DRAM Device" },
{ 1, "Non-Monolithic Device" },
{ 0x00, NULL },
};
const struct valstr ddr4_technology_type[] =
{
{ 0, "Extended module type, see byte 15" },
{ 1, "RDIMM" },
{ 2, "UDIMM" },
{ 3, "SO-DIMM" },
{ 4, "LRDIMM" },
{ 5, "Mini-RDIMM" },
{ 6, "Mini-UDIMM" },
{ 7, "7 - Reserved" },
{ 8, "72b-SO-RDIMM" },
{ 9, "72b-SO-UDIMM" },
{ 10, "10 - Reserved" },
{ 11, "11 - Reserved" },
{ 12, "16b-SO-DIMM" },
{ 13, "32b-SO-DIMM" },
{ 14, "14 - Reserved" },
{ 15, "No base memory present" },
{ 0x00, NULL },
};
const struct valstr spd_config_vals[] = {
{ 0x00, "None" },
{ 0x01, "Parity" },
@ -719,7 +778,8 @@ const struct valstr jedec_id5_vals[] = {
int
ipmi_spd_print(uint8_t *spd_data, int len)
{
int size;
int k = 0;
int ii = 0;
if (len < 92)
return -1; /* we need first 91 bytes to do our thing */
@ -799,11 +859,104 @@ ipmi_spd_print(uint8_t *spd_data, int len)
printf( "%c", *pchPN++ );
}
printf("\n");
} else if (spd_data[2] == 0x0C) /* DDR4 SDRAM */
{
int i;
int sdram_cap = 0;
int pri_bus_width = 0;
int sdram_width = 0;
int mem_size = 0;
int lrank_dimm;
if (len < 148)
return -1; /* we need first 91 bytes to do our thing */
/* "Logical rank" referes to the individually addressable die
* in a 3DS stack and has no meaning for monolithic or
* multi-load stacked SDRAMs; however, for the purposes of
* calculating the capacity of the module, one should treat
* monolithic and multi-load stack SDRAMs as having one logical
* rank per package rank.
*/
lrank_dimm = (spd_data[12]>>3&0x3) + 1; /* Number of Package Ranks per DIMM */
if ((spd_data[6] & 0x3) == 0x10) { /* 3DS package Type */
lrank_dimm *= ((spd_data[6]>>4)&0x3) + 1; /* Die Count */
}
sdram_cap = ldexp(256,(spd_data[4]&15));
pri_bus_width = ldexp(8,(spd_data[13]&7));
sdram_width = ldexp(4,(spd_data[12]&7));
mem_size = (sdram_cap/8) * (pri_bus_width/sdram_width) * lrank_dimm;
printf(" SDRAM Package Type : %s\n", val2str((spd_data[6]>>7), ddr4_package_type));
printf(" Technology : %s\n", val2str((spd_data[3]&15), ddr4_technology_type));
printf(" SDRAM Die Count : %d\n", ((spd_data[6]>>4) & 3)+1);
printf(" SDRAM Capacity : %d Mb\n", sdram_cap );
printf(" Memory Bank Group : %s\n", val2str((spd_data[4]>>6 & 0x3), ddr4_bank_groups));
printf(" Memory Banks : %s\n", val2str((spd_data[4]>>4 & 0x3), ddr4_banks_vals));
printf(" Primary Bus Width : %d bits\n", pri_bus_width );
printf(" SDRAM Device Width : %d bits\n", sdram_width );
printf(" Logical Rank per DIMM : %d\n", lrank_dimm );
printf(" Memory size : %d MB\n", mem_size );
printf(" Memory Density : %s\n", val2str(spd_data[4]&15, ddr4_density_vals));
printf(" 1.2 V Nominal Op : %s\n", (((spd_data[11]&3) != 3) ? "No":"Yes" ) );
printf(" TBD1 V Nominal Op : %s\n", (((spd_data[11]>>2&3) != 3) ? "No":"Yes" ) );
printf(" TBD2 V Nominal Op : %s\n", (((spd_data[11]>>4&3) != 3) ? "No":"Yes" ) );
printf(" Error Detect/Cor : %s\n", val2str(spd_data[13]>>3, ddr4_ecc_vals));
printf(" Manufacturer : ");
switch (spd_data[320]&127)
{
case 0:
printf("%s\n", val2str(spd_data[321], jedec_id1_vals));
break;
case 1:
printf("%s\n", val2str(spd_data[321], jedec_id2_vals));
break;
case 2:
printf("%s\n", val2str(spd_data[321], jedec_id3_vals));
break;
case 3:
printf("%s\n", val2str(spd_data[321], jedec_id4_vals));
break;
case 4:
printf("%s\n", val2str(spd_data[321], jedec_id5_vals));
break;
default:
printf("%s\n", "JEDEC JEP106 update required");
}
u_int year = (spd_data[323]>>4)*10 + spd_data[323]&15;
u_int week = (spd_data[324]>>4)*10 + spd_data[324]&15;
printf(" Manufacture Date : year %4d week %2d\n",
2000 + year, week);
printf(" Serial Number : %02x%02x%02x%02x\n",
spd_data[325], spd_data[326], spd_data[327], spd_data[328]);
printf(" Part Number : ");
for (i=329; i <= 348; i++)
{
printf( "%c", spd_data[i]);
}
printf("\n");
}
else
{
size = spd_data[5] * (spd_data[31] << 2);
printf(" Memory Size : %d MB\n", size);
ii = (spd_data[3] & 0x0f) + (spd_data[4] & 0x0f) - 17;
k = ((spd_data[5] & 0x7) + 1) * spd_data[17];
if(ii > 0 && ii <= 12 && k > 0) {
printf(" Memory Size : %d MB\n", ((1 << ii) * k));
} else {
printf(" Memory Size INVALID: %d, %d, %d, %d\n", spd_data[3],
spd_data[4], spd_data[5], spd_data[17]);
}
printf(" Voltage Intf : %s\n",
val2str(spd_data[8], spd_voltage_vals));
printf(" Error Detect/Cor : %s\n",
@ -860,7 +1013,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
struct ipmi_rs * rsp;
struct ipmi_rq req;
struct fru_info fru;
uint8_t spd_data[256], msg_data[4];
uint8_t *spd_data, msg_data[4];
int len, offset;
msg_data[0] = id;
@ -888,11 +1041,20 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
lprintf(LOG_DEBUG, "fru.size = %d bytes (accessed by %s)",
fru.size, fru.access ? "words" : "bytes");
if (fru.size < 1) {
lprintf(LOG_ERR, " Invalid FRU size %d", fru.size);
return -1;
}
spd_data = malloc(fru.size);
if (spd_data == NULL) {
printf(" Unable to malloc memory for spd array of size=%d\n",
fru.size);
return -1;
}
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = GET_FRU_DATA;
@ -900,22 +1062,27 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
req.msg.data_len = 4;
offset = 0;
memset(spd_data, 0, 256);
memset(spd_data, 0, fru.size);
do {
int i;
msg_data[0] = id;
msg_data[1] = offset;
msg_data[2] = 0;
msg_data[1] = offset & 0xFF;
msg_data[2] = offset >> 8;
msg_data[3] = FRU_DATA_RQST_SIZE;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
free(spd_data);
spd_data = NULL;
return -1;
}
if (rsp->ccode > 0) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
free(spd_data);
spd_data = NULL;
/* Timeouts are acceptable. No DIMM in the socket */
if (rsp->ccode == 0xc3)
return 1;
@ -930,6 +1097,8 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
/* now print spd info */
ipmi_spd_print(spd_data, offset);
free(spd_data);
spd_data = NULL;
return 0;
}

View File

@ -44,6 +44,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#if HAVE_CONFIG_H
# include <config.h>
@ -356,6 +357,7 @@ int str2char(const char *str, int8_t * chr_ptr)
if (arg_long < INT8_MIN || arg_long > INT8_MAX) {
return (-3);
}
*chr_ptr = (uint8_t)arg_long;
return 0;
} /* str2char(...) */
@ -663,9 +665,10 @@ ipmi_start_daemon(struct ipmi_intf *intf)
close(fd);
}
open("/dev/null", O_RDWR);
dup(0);
dup(0);
fd = open("/dev/null", O_RDWR);
assert(0 == fd);
dup(fd);
dup(fd);
}
/* is_fru_id - wrapper for str-2-int FRU ID conversion. Message is printed
@ -756,3 +759,32 @@ is_ipmi_user_id(const char *argv_ptr, uint8_t *ipmi_uid_ptr)
IPMI_UID_MIN, IPMI_UID_MAX);
return (-1);
}
uint16_t
ipmi_get_oem_id(struct ipmi_intf *intf)
{
/* Execute a Get Board ID command to determine the board */
struct ipmi_rs *rsp;
struct ipmi_rq req;
uint16_t oem_id;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TSOL;
req.msg.cmd = 0x21;
req.msg.data_len = 0;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get Board ID command failed");
return 0;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Board ID command failed: %#x %s",
rsp->ccode, val2str(rsp->ccode, completion_code_vals));
return 0;
}
oem_id = rsp->data[0] | (rsp->data[1] << 8);
lprintf(LOG_DEBUG,"Board ID: %x", oem_id);
return oem_id;
}

291
lib/hpm2.c Normal file
View File

@ -0,0 +1,291 @@
/*
* Copyright (c) 2012 Pigeon Point Systems. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistribution 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.
*
* Neither the name of Pigeon Point Systems nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
* PIGEON POINT SYSTEMS ("PPS") AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* PPS OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF PPS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <ipmitool/bswap.h>
#include <ipmitool/hpm2.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/log.h>
#include <ipmitool/bswap.h>
#if HAVE_PRAGMA_PACK
# pragma pack(push, 1)
#endif
/* HPM.x Get Capabilities request */
struct hpmx_cmd_get_capabilities_rq {
uint8_t picmg_id;
uint8_t hpmx_id;
} ATTRIBUTE_PACKING;
/* HPM.2 Get Capabilities response */
struct hpm2_cmd_get_capabilities_rp {
uint8_t picmg_id;
struct hpm2_lan_attach_capabilities caps;
} ATTRIBUTE_PACKING;
#if HAVE_PRAGMA_PACK
# pragma pack(pop)
#endif
/* IPMI Get LAN Configuration Parameters command */
#define IPMI_LAN_GET_CONFIG 0x02
int hpm2_get_capabilities(struct ipmi_intf * intf,
struct hpm2_lan_attach_capabilities * caps)
{
struct ipmi_rq req;
struct ipmi_rs * rsp;
struct hpmx_cmd_get_capabilities_rq rq;
/* reset result */
memset(caps, 0, sizeof(struct hpm2_lan_attach_capabilities));
/* prepare request */
rq.picmg_id = 0;
rq.hpmx_id = 2;
/* prepare request */
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_PICMG;
req.msg.cmd = HPM2_GET_LAN_ATTACH_CAPABILITIES;
req.msg.data = (uint8_t *)&rq;
req.msg.data_len = sizeof(rq);
/* send */
rsp = intf->sendrecv(intf, &req);
if (!rsp) {
lprintf(LOG_NOTICE, "Error sending request.");
return -1;
}
if (rsp->ccode == 0xC1) {
lprintf(LOG_DEBUG, "IPM Controller is not HPM.2 compatible");
return rsp->ccode;
} else if (rsp->ccode) {
lprintf(LOG_NOTICE, "Get HPM.x Capabilities request failed,"
" compcode = %x", rsp->ccode);
return rsp->ccode;
}
/* check response length */
if (rsp->data_len < 2 || rsp->data_len > 10) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* check HPM.x identifier */
if (rsp->data[1] != 2) {
lprintf(LOG_NOTICE, "Bad HPM.x ID, id=%d", rsp->data[1]);
return rsp->ccode;
}
/*
* this hardly can happen, since completion code is already checked.
* but check for safety
*/
if (rsp->data_len < 4) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* copy HPM.2 capabilities */
memcpy(caps, rsp->data + 2, rsp->data_len - 2);
#if WORDS_BIGENDIAN
/* swap bytes to convert from little-endian format */
caps->lan_channel_mask = BSWAP_16(caps->lan_channel_mask);
#endif
/* check HPM.2 revision */
if (caps->hpm2_revision_id != HPM2_REVISION) {
lprintf(LOG_NOTICE, "Bad HPM.2 revision, rev=%d",
caps->hpm2_revision_id);
return -1;
}
if (!caps->lan_channel_mask) {
return -1;
}
/* check response length */
if (rsp->data_len < 8) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* check HPM.2 LAN parameters start */
if (caps->hpm2_lan_params_start < 0xC0) {
lprintf(LOG_NOTICE, "Bad HPM.2 LAN params start, start=%x",
caps->hpm2_lan_params_start);
return -1;
}
/* check HPM.2 LAN parameters revision */
if (caps->hpm2_lan_params_rev != HPM2_LAN_PARAMS_REV) {
lprintf(LOG_NOTICE, "Bad HPM.2 LAN params revision, rev=%d",
caps->hpm2_lan_params_rev);
return -1;
}
/* check for HPM.2 SOL extension */
if (!(caps->hpm2_caps & HPM2_CAPS_SOL_EXTENSION)) {
/* no further checks */
return 0;
}
/* check response length */
if (rsp->data_len < 10) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* check HPM.2 SOL parameters start */
if (caps->hpm2_sol_params_start < 0xC0) {
lprintf(LOG_NOTICE, "Bad HPM.2 SOL params start, start=%x",
caps->hpm2_sol_params_start);
return -1;
}
/* check HPM.2 SOL parameters revision */
if (caps->hpm2_sol_params_rev != HPM2_SOL_PARAMS_REV) {
lprintf(LOG_NOTICE, "Bad HPM.2 SOL params revision, rev=%d",
caps->hpm2_sol_params_rev);
return -1;
}
return 0;
}
int hpm2_get_lan_channel_capabilities(struct ipmi_intf * intf,
uint8_t hpm2_lan_params_start,
struct hpm2_lan_channel_capabilities * caps)
{
struct ipmi_rq req;
struct ipmi_rs * rsp;
uint8_t rq[4];
/* reset result */
memset(caps, 0, sizeof(struct hpm2_lan_channel_capabilities));
/* prepare request */
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_TRANSPORT;
req.msg.cmd = IPMI_LAN_GET_CONFIG;
req.msg.data = (uint8_t *)&rq;
req.msg.data_len = sizeof(rq);
/* prepare request data */
rq[0] = 0xE; /* sending channel */
rq[1] = hpm2_lan_params_start; /* HPM.2 Channel Caps */
rq[2] = rq[3] = 0;
/* send */
rsp = intf->sendrecv(intf, &req);
if (rsp) {
lprintf(LOG_NOTICE, "Error sending request");
return -1;
}
if (rsp->ccode == 0x80) {
lprintf(LOG_DEBUG, "HPM.2 Channel Caps parameter is not supported");
return rsp->ccode;
} else if (rsp->ccode) {
lprintf(LOG_NOTICE, "Get LAN Configuration Parameters request failed,"
" compcode = %x", rsp->ccode);
return rsp->ccode;
}
/* check response length */
if (rsp->data_len != sizeof (struct hpm2_lan_channel_capabilities) + 1) {
lprintf(LOG_NOTICE, "Bad response length, len=%d", rsp->data_len);
return -1;
}
/* check parameter revision */
if (rsp->data[0] !=
LAN_PARAM_REV(HPM2_LAN_PARAMS_REV, HPM2_LAN_PARAMS_REV)) {
lprintf(LOG_NOTICE, "Bad HPM.2 LAN parameter revision, rev=%d",
rsp->data[0]);
return -1;
}
/* copy parameter data */
memcpy(caps, &rsp->data[1], sizeof (struct hpm2_lan_channel_capabilities));
#if WORDS_BIGENDIAN
/* swap bytes to convert from little-endian format */
caps->max_inbound_pld_size = BSWAP_16(caps->max_inbound_pld_size);
caps->max_outbound_pld_size = BSWAP_16(caps->max_outbound_pld_size);
#endif
return 0;
}
int hpm2_detect_max_payload_size(struct ipmi_intf * intf)
{
struct hpm2_lan_attach_capabilities attach_caps;
struct hpm2_lan_channel_capabilities channel_caps;
int err;
/* query HPM.2 support */
err = hpm2_get_capabilities(intf, &attach_caps);
/* check if HPM.2 is supported */
if (err != 0 || !attach_caps.lan_channel_mask) {
return err;
}
/* query channel capabilities */
err = hpm2_get_lan_channel_capabilities(intf,
attach_caps.hpm2_lan_params_start, &channel_caps);
/* check if succeeded */
if (err != 0) {
return err;
}
/* update request and response sizes */
ipmi_intf_set_max_request_data_size(intf,
channel_caps.max_inbound_pld_size - 7);
ipmi_intf_set_max_response_data_size(intf,
channel_caps.max_outbound_pld_size - 8);
/* print debug info */
lprintf(LOG_DEBUG, "Set maximum request size to %d\n"
"Set maximum response size to %d",
intf->max_request_data_size, intf->max_response_data_size);
return 0;
}

View File

@ -754,6 +754,193 @@ ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
return 0;
}
static int
get_bootparam_options(char *optstring,
unsigned char *set_flag, unsigned char *clr_flag)
{
char *token;
char *saveptr = NULL;
int optionError = 0;
*set_flag = 0;
*clr_flag = 0;
static struct {
char *name;
unsigned char value;
char *desc;
} options[] = {
{"PEF", 0x10,
"Clear valid bit on reset/power cycle cause by PEF"},
{"timeout", 0x08,
"Automatically clear boot flag valid bit on timeout"},
{"watchdog", 0x04,
"Clear valid bit on reset/power cycle cause by watchdog"},
{"reset", 0x02,
"Clear valid bit on push button reset/soft reset"},
{"power", 0x01,
"Clear valid bit on power up via power push button or wake event"},
{NULL} /* End marker */
}, *op;
if (strncmp(optstring, "options=", 8) != 0) {
lprintf(LOG_ERR, "No options= keyword found \"%s\"", optstring);
return -1;
}
token = strtok_r(optstring + 8, ",", &saveptr);
while (token != NULL) {
int setbit = 0;
if (strcmp(token, "help") == 0) {
optionError = 1;
break;
}
if (strncmp(token, "no-", 3) == 0) {
setbit = 1;
token += 3;
}
for (op = options; op->name != NULL; ++op) {
if (strncmp(token, op->name, strlen(op->name)) == 0) {
if (setbit) {
*set_flag |= op->value;
} else {
*clr_flag |= op->value;
}
break;
}
}
if (op->name == NULL) {
/* Option not found */
optionError = 1;
if (setbit) {
token -=3;
}
lprintf(LOG_ERR, "Invalid option: %s", token);
}
token = strtok_r(NULL, ",", &saveptr);
}
if (optionError) {
lprintf(LOG_NOTICE, " Legal options are:");
lprintf(LOG_NOTICE, " %-8s: print this message", "help");
for (op = options; op->name != NULL; ++op) {
lprintf(LOG_NOTICE, " %-8s: %s", op->name, op->desc);
}
lprintf(LOG_NOTICE, " Any Option may be prepended with no-"
" to invert sense of operation\n");
return (-1);
}
return (0);
}
static int
ipmi_chassis_get_bootvalid(struct ipmi_intf * intf)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t msg_data[3];
uint8_t param_id = IPMI_CHASSIS_BOOTPARAM_FLAG_VALID;
memset(msg_data, 0, 3);
msg_data[0] = param_id & 0x7f;
msg_data[1] = 0;
msg_data[2] = 0;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_CHASSIS;
req.msg.cmd = 0x9;
req.msg.data = msg_data;
req.msg.data_len = 3;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR,
"Error Getting Chassis Boot Parameter %d", param_id);
return -1;
}
if (rsp->ccode > 0) {
lprintf(LOG_ERR, "Get Chassis Boot Parameter %d failed: %s",
param_id, val2str(rsp->ccode, completion_code_vals));
return -1;
}
if (verbose > 2)
printbuf(rsp->data, rsp->data_len, "Boot Option");
return(rsp->data[2]);
}
static int
ipmi_chassis_set_bootvalid(struct ipmi_intf *intf, uint8_t set_flag, uint8_t clr_flag)
{
int bootvalid;
uint8_t flags[5];
int rc = 0;
int use_progress = 1;
uint8_t param_id = IPMI_CHASSIS_BOOTPARAM_FLAG_VALID;
if (use_progress) {
/* set set-in-progress flag */
memset(flags, 0, 5);
flags[0] = 0x01;
rc = ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS, flags, 1);
if (rc < 0)
use_progress = 0;
}
memset(flags, 0, 5);
flags[0] = 0x01;
flags[1] = 0x01;
rc = ipmi_chassis_set_bootparam(intf, IPMI_CHASSIS_BOOTPARAM_INFO_ACK,
flags, 2);
if (rc < 0) {
if (use_progress) {
/* set-in-progress = set-complete */
memset(flags, 0, 5);
ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
flags, 1);
}
return -1;
}
bootvalid = ipmi_chassis_get_bootvalid(intf);
if (bootvalid < 0) {
if (use_progress) {
/* set-in-progress = set-complete */
memset(flags, 0, 5);
ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
flags, 1);
}
return -1;
}
flags[0] = (bootvalid & ~clr_flag) | set_flag;
rc = ipmi_chassis_set_bootparam(intf, param_id, flags, 1);
if (rc == 0) {
if (use_progress) {
/* set-in-progress = commit-write */
memset(flags, 0, 5);
flags[0] = 0x02;
ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
flags, 1);
}
}
if (use_progress) {
/* set-in-progress = set-complete */
memset(flags, 0, 5);
ipmi_chassis_set_bootparam(intf,
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
flags, 1);
}
return rc;
}
static int
ipmi_chassis_set_bootdev(struct ipmi_intf * intf, char * arg, uint8_t *iflags)
{
@ -946,6 +1133,23 @@ ipmi_power_main(struct ipmi_intf * intf, int argc, char ** argv)
return rc;
}
void
ipmi_chassis_set_bootflag_help()
{
unsigned char set_flag;
unsigned char clr_flag;
lprintf(LOG_NOTICE, "bootparam set bootflag <device> [options=...]");
lprintf(LOG_NOTICE, " Legal devices are:");
lprintf(LOG_NOTICE, " none : No override");
lprintf(LOG_NOTICE, " force_pxe : Force PXE boot");
lprintf(LOG_NOTICE, " force_disk : Force boot from default Hard-drive");
lprintf(LOG_NOTICE, " force_safe : Force boot from default Hard-drive, request Safe Mode");
lprintf(LOG_NOTICE, " force_diag : Force boot from Diagnostic Partition");
lprintf(LOG_NOTICE, " force_cdrom : Force boot from CD/DVD");
lprintf(LOG_NOTICE, " force_bios : Force boot into BIOS Setup");
get_bootparam_options("options=help", &set_flag, &clr_flag);
}
int
ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
{
@ -1036,26 +1240,27 @@ ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
else if (strncmp(argv[0], "bootparam", 9) == 0) {
if ((argc < 3) || (strncmp(argv[1], "help", 4) == 0)) {
lprintf(LOG_NOTICE, "bootparam get <param #>");
lprintf(LOG_NOTICE, "bootparam set bootflag <flag>");
lprintf(LOG_NOTICE, " force_pxe : Force PXE boot");
lprintf(LOG_NOTICE, " force_disk : Force boot from default Hard-drive");
lprintf(LOG_NOTICE, " force_safe : Force boot from default Hard-drive, request Safe Mode");
lprintf(LOG_NOTICE, " force_diag : Force boot from Diagnostic Partition");
lprintf(LOG_NOTICE, " force_cdrom : Force boot from CD/DVD");
lprintf(LOG_NOTICE, " force_bios : Force boot into BIOS Setup");
ipmi_chassis_set_bootflag_help();
}
else {
if (strncmp(argv[1], "get", 3) == 0) {
rc = ipmi_chassis_get_bootparam(intf, argv[2]);
}
else if (strncmp(argv[1], "set", 3) == 0) {
if (argc < 4) {
lprintf(LOG_NOTICE, "bootparam set <option> [value ...]");
unsigned char set_flag=0;
unsigned char clr_flag=0;
if (strncmp(argv[2], "help", 4) == 0 ||
argc < 4 || (argc >= 4 &&
strncmp(argv[2], "bootflag", 8) != 0)) {
ipmi_chassis_set_bootflag_help();
} else {
if (strncmp(argv[2], "bootflag", 8) == 0)
if (argc == 5) {
get_bootparam_options(argv[4], &set_flag, &clr_flag);
}
rc = ipmi_chassis_set_bootdev(intf, argv[3], NULL);
else
lprintf(LOG_NOTICE, "bootparam set <option> [value ...]");
if (argc == 5 && (set_flag != 0 || clr_flag != 0)) {
rc = ipmi_chassis_set_bootvalid(intf, set_flag, clr_flag);
}
}
}
else
@ -1166,7 +1371,7 @@ ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
token = strtok_r(NULL, ",", &saveptr);
}
if (optionError) {
lprintf(LOG_NOTICE, "Legal options are:");
lprintf(LOG_NOTICE, "Legal options settings are:");
lprintf(LOG_NOTICE, "\thelp:\tprint this message");
for (op = options; op->name != NULL; ++op) {
lprintf(LOG_NOTICE, "\t%s:\t%s", op->name, op->desc);

View File

@ -187,18 +187,60 @@ const struct dcmi_cmd dcmi_pwrmgmt_vals[] = {
/* set power limit commands */
const struct dcmi_cmd dcmi_pwrmgmt_set_usage_vals[] = {
{ 0x00, "action", " <sel_logging | power_off>" },
{ 0x00, "action", " <no_action | sel_logging | power_off>" },
{ 0x01, "limit", " <number in Watts>" },
{ 0x02, "correction", "<number in milliseconds>" },
{ 0x03, "sample", " <number in seconds>" },
{ 0xFF, NULL, NULL }
};
/* power management/get action commands */
const struct dcmi_cmd dcmi_pwrmgmt_get_action_vals[] = {
{ 0x00, "No Action", ""},
{ 0x01, "Hard Power Off & Log Event to SEL", ""},
{ 0x02, "OEM reserved (02h)", ""},
{ 0x03, "OEM reserved (03h)", ""},
{ 0x04, "OEM reserved (04h)", ""},
{ 0x05, "OEM reserved (05h)", ""},
{ 0x06, "OEM reserved (06h)", ""},
{ 0x07, "OEM reserved (07h)", ""},
{ 0x08, "OEM reserved (08h)", ""},
{ 0x09, "OEM reserved (09h)", ""},
{ 0x0a, "OEM reserved (0ah)", ""},
{ 0x0b, "OEM reserved (0bh)", ""},
{ 0x0c, "OEM reserved (0ch)", ""},
{ 0x0d, "OEM reserved (0dh)", ""},
{ 0x0e, "OEM reserved (0eh)", ""},
{ 0x0f, "OEM reserved (0fh)", ""},
{ 0x10, "OEM reserved (10h)", ""},
{ 0x11, "Log Event to SEL", ""},
{ 0xFF, NULL, NULL }
};
/* power management/set action commands */
const struct dcmi_cmd dcmi_pwrmgmt_action_vals[] = {
{ 0x00, "No Action", "" },
{ 0x01, "Hard Power Off & Log Event to SEL", "" },
{ 0x11, "Log Event to SEL", "" },
{ 0x00, "no_action", "No Action"},
{ 0x01, "power_off", "Hard Power Off & Log Event to SEL"},
{ 0x11, "sel_logging", "Log Event to SEL"},
{ 0x02, "oem_02", "OEM reserved (02h)"},
{ 0x03, "oem_03", "OEM reserved (03h)"},
{ 0x04, "oem_04", "OEM reserved (04h)"},
{ 0x05, "oem_05", "OEM reserved (05h)"},
{ 0x06, "oem_06", "OEM reserved (06h)"},
{ 0x07, "oem_07", "OEM reserved (07h)"},
{ 0x08, "oem_08", "OEM reserved (08h)"},
{ 0x09, "oem_09", "OEM reserved (09h)"},
{ 0x0a, "oem_0a", "OEM reserved (0ah)"},
{ 0x0b, "oem_0b", "OEM reserved (0bh)"},
{ 0x0c, "oem_0c", "OEM reserved (0ch)"},
{ 0x0d, "oem_0d", "OEM reserved (0dh)"},
{ 0x0e, "oem_0e", "OEM reserved (0eh)"},
{ 0x0f, "oem_0f", "OEM reserved (0fh)"},
{ 0x10, "oem_10", "OEM reserved (10h)"},
{ 0xFF, NULL, NULL }
};
@ -481,44 +523,14 @@ ipmi_dcmi_prnt_oobDiscover(struct ipmi_intf * intf)
intf->abort = 1;
intf->session->sol_data.sequence_number = 1;
/* open port to BMC */
memset(&s->addr, 0, sizeof(struct sockaddr_in));
s->addr.sin_family = AF_INET;
s->addr.sin_port = htons(s->port);
rc = inet_pton(AF_INET, (const char *)s->hostname, &s->addr.sin_addr);
if (rc <= 0) {
struct hostent *host = gethostbyname((const char *)s->hostname);
if (host == NULL) {
lprintf(LOG_ERR, "Address lookup for %s failed",
s->hostname);
if (ipmi_intf_socket_connect (intf) == -1) {
lprintf(LOG_ERR, "Could not open socket!");
return -1;
}
if (host->h_addrtype != AF_INET) {
lprintf(LOG_ERR,
"Address lookup for %s failed. Got %s, expected IPv4 address.",
s->hostname,
(host->h_addrtype == AF_INET6) ? "IPv6" : "Unknown");
return (-1);
}
s->addr.sin_family = host->h_addrtype;
memcpy(&s->addr.sin_addr, host->h_addr, host->h_length);
}
lprintf(LOG_DEBUG, "IPMI LAN host %s port %d",
s->hostname, ntohs(s->addr.sin_port));
intf->fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (intf->fd < 0) {
lperror(LOG_ERR, "Socket failed");
return -1;
}
/* connect to UDP socket so we get async errors */
rc = connect(intf->fd, (struct sockaddr *)&s->addr,
sizeof(struct sockaddr_in));
if (rc < 0) {
lperror(LOG_ERR, "Connect failed");
lperror(LOG_ERR, "Connect to %s failed",
s->hostname);
intf->close(intf);
return -1;
}
@ -1455,7 +1467,7 @@ ipmi_dcmi_pwr_prnt_glimit(struct ipmi_intf * intf)
(realCc == 0) ?
"Power Limit Active" : "No Active Power Limit");
printf(" Exception actions: %s\n",
val2str2(val.action, dcmi_pwrmgmt_action_vals));
val2str2(val.action, dcmi_pwrmgmt_get_action_vals));
printf(" Power Limit: %i Watts\n", val.limit);
printf(" Correction time: %i milliseconds\n", val.correction);
printf(" Sampling period: %i seconds\n", val.sample);
@ -1486,12 +1498,6 @@ ipmi_dcmi_pwr_slimit(struct ipmi_intf * intf, const char * option,
uint32_t lvalue = 0;
int i;
if (str2uint(value, &lvalue) != 0) {
lprintf(LOG_ERR, "Given %s '%s' is invalid.",
option, value);
return (-1);
}
rsp = ipmi_dcmi_pwr_glimit(intf); /* get the power limit settings */
# if 0
{
@ -1529,39 +1535,124 @@ ipmi_dcmi_pwr_slimit(struct ipmi_intf * intf, const char * option,
* sample period in seconds *
* val.sample = *(uint16_t*)(&rsp->data[12]);
*/
lprintf(LOG_INFO,
"DCMI IN Limit=%d Correction=%d Action=%d Sample=%d\n",
val.limit, val.correction, val.action, val.sample);
switch (str2val2(option, dcmi_pwrmgmt_set_usage_vals)) {
case 0x00:
/* action */
switch (str2val2(value, dcmi_pwrmgmt_action_vals)) {
case 0x00:
/* no_action */
val.action = 0;
break;
case 0x01:
/* power_off */
val.action = 1;
break;
case 0x02:
/* OEM reserved action */
val.action = 0x02;
break;
case 0x03:
/* OEM reserved action */
val.action = 0x03;
break;
case 0x04:
/* OEM reserved action */
val.action = 0x04;
break;
case 0x05:
/* OEM reserved action */
val.action = 0x05;
break;
case 0x06:
/* OEM reserved action */
val.action = 0x06;
break;
case 0x07:
/* OEM reserved action */
val.action = 0x07;
break;
case 0x08:
/* OEM reserved action */
val.action = 0x08;
break;
case 0x09:
/* OEM reserved action */
val.action = 0x09;
break;
case 0x0a:
/* OEM reserved action */
val.action = 0x0a;
break;
case 0x0b:
/* OEM reserved action */
val.action = 0x0b;
break;
case 0x0c:
/* OEM reserved action */
val.action = 0x0c;
break;
case 0x0d:
/* OEM reserved action */
val.action = 0x0d;
break;
case 0x0e:
/* OEM reserved action */
val.action = 0x0e;
break;
case 0x0f:
/* OEM reserved action */
val.action = 0x0f;
break;
case 0x10:
/* OEM reserved action */
val.action = 0x10;
break;
case 0x11:
/* sel_logging*/
val.action = 0x11;
break;
case 0xFF:
/* error - not a string we knew what to do with */
lprintf(LOG_ERR, "Given %s '%s' is invalid.",
option, value);
return -1;
}
break;
case 0x01:
/* limit */
if (str2uint(value, &lvalue) != 0) {
lprintf(LOG_ERR, "Given %s '%s' is invalid.",
option, value);
return (-1);
}
val.limit = *(uint16_t*)(&lvalue);
break;
case 0x02:
/* correction */
if (str2uint(value, &lvalue) != 0) {
lprintf(LOG_ERR, "Given %s '%s' is invalid.",
option, value);
return (-1);
}
val.correction = *(uint32_t*)(&lvalue);
break;
case 0x03:
/* sample */
if (str2uint(value, &lvalue) != 0) {
lprintf(LOG_ERR, "Given %s '%s' is invalid.",
option, value);
return (-1);
}
val.sample = *(uint16_t*)(&lvalue);
break;
case 0xff:
/* no valid options */
return -1;
}
lprintf(LOG_INFO, "DCMI OUT Limit=%d Correction=%d Action=%d Sample=%d\n", val.limit, val.correction, val.action, val.sample);
msg_data[0] = val.grp_id; /* Group Extension Identification */
msg_data[1] = 0x00; /* reserved */
@ -1726,6 +1817,10 @@ ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char **argv)
/* action */
switch (str2val2(argv[2], dcmi_pwrmgmt_action_vals)) {
case 0x00:
/* no_action */
data[4] = 0x00;
break;
case 0x01:
/* power_off */
data[4] = 0x01;
@ -1736,6 +1831,8 @@ ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char **argv)
break;
case 0xFF:
/* error - not a string we knew what to do with */
lprintf(LOG_ERR, "Given Action '%s' is invalid.",
argv[2]);
return -1;
}
/* limit */

Some files were not shown because too many files have changed in this diff Show More