mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Compare commits
265 Commits
IPMITOOL_1
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
be11d948f8 | ||
|
4b791f8bf6 | ||
|
9328748672 | ||
|
26b088193a | ||
|
9dfdf14270 | ||
|
707a2980f6 | ||
|
966d6e80b0 | ||
|
206dba615d | ||
|
8f0946a81e | ||
|
63d59a50a6 | ||
|
f033b5549e | ||
|
1edb0e27e4 | ||
|
4519b4baac | ||
|
19d78782d7 | ||
|
46fd8d942c | ||
|
a1dc78c456 | ||
|
4d25a93f49 | ||
|
65ba015f5c | ||
|
4d4f29f0b6 | ||
|
5ac7f6a54e | ||
|
a24a512bdd | ||
|
39ca56bf33 | ||
|
08151adef3 | ||
|
86ef8fb091 | ||
|
66cda7e18f | ||
|
15418696ea | ||
|
7c47cf75f4 | ||
|
b7adc1dcaf | ||
|
11c7605c0d | ||
|
5cf436056f | ||
|
cdac4e07f7 | ||
|
cd57365fc4 | ||
|
351dad24a2 | ||
|
fb47ae8d7c | ||
|
50479484a2 | ||
|
9a1c0e68ba | ||
|
1f429f1ed7 | ||
|
59b7d6cf8f | ||
|
6b1ce6c1ac | ||
|
6a3ded7333 | ||
|
61bb233c5b | ||
|
fb176a1995 | ||
|
d88bbf3c41 | ||
|
69cdef116a | ||
|
9a86189425 | ||
|
5a36080f92 | ||
|
682fec09ef | ||
|
e7550f722c | ||
|
d674bfdc9a | ||
|
050f5da631 | ||
|
7fd7c0f2ba | ||
|
e78144d2c7 | ||
|
7108884793 | ||
|
1245aaa387 | ||
|
50d8c36edf | ||
|
aee377bead | ||
|
b302d8202c | ||
|
3452cf1ca2 | ||
|
f3ffa616e6 | ||
|
16f937a117 | ||
|
3a1a9cb283 | ||
|
239ef6a4ef | ||
|
c6a0baee84 | ||
|
bc13db6304 | ||
|
8838e4b0e2 | ||
|
055719b7b9 | ||
|
38b120eb5a | ||
|
01b53a013b | ||
|
0cd847579f | ||
|
2158e6ea49 | ||
|
1f92c9ee23 | ||
|
b18619e14e | ||
|
84469a9c54 | ||
|
956ae2b372 | ||
|
e3fc775d26 | ||
|
6e037d6bfb | ||
|
9d5ea21df7 | ||
|
dfe17311d6 | ||
|
b97a110721 | ||
|
284adfe2e2 | ||
|
2a17967159 | ||
|
c3939dac2c | ||
|
f80effb1fc | ||
|
7ccea283dd | ||
|
d45572d71e | ||
|
9452be8718 | ||
|
41d7026946 | ||
|
840fb1cbb4 | ||
|
e824c23316 | ||
|
7a66d8725d | ||
|
63dd71c39c | ||
|
e60eac12cc | ||
|
dec04e79fd | ||
|
d9adbf12f1 | ||
|
5647cd16d2 | ||
|
42a023ff07 | ||
|
58c9263a28 | ||
|
0663814eec | ||
|
aa72d9c426 | ||
|
0854344db5 | ||
|
4b89f1b42d | ||
|
0e3e436eb6 | ||
|
eed9d5950e | ||
|
4dc962b614 | ||
|
6940a6717a | ||
|
51a2ab8180 | ||
|
af062a9a5e | ||
|
1724b031b3 | ||
|
9006f2b26d | ||
|
b7db637984 | ||
|
82d6629a66 | ||
|
c396a310ba | ||
|
002e1d95f5 | ||
|
2ee7aca4e4 | ||
|
efd28d1bc1 | ||
|
d95775288d | ||
|
ef78ef3792 | ||
|
2676ae43fd | ||
|
54abbaf0e8 | ||
|
bd0475ce4a | ||
|
b397a07e9e | ||
|
8071cf7389 | ||
|
ca7767793e | ||
|
a45704e5ea | ||
|
94f7646a8e | ||
|
62a04390e1 | ||
|
de1d5c9924 | ||
|
73d6af5782 | ||
|
c9510635d7 | ||
|
e11f463b4e | ||
|
619a02cf5d | ||
|
e65a96b38d | ||
|
9fa01f1a54 | ||
|
432ea31804 | ||
|
12e2f5da63 | ||
|
d818c2ff85 | ||
|
cdd9d51c5f | ||
|
95038ba01b | ||
|
b0d84e0f15 | ||
|
1b636434a6 | ||
|
400622760f | ||
|
b7b455a38c | ||
|
fa8e2ced19 | ||
|
55ec2df41f | ||
|
48f4fba39a | ||
|
df076b9547 | ||
|
51634fd77c | ||
|
3bfa1da201 | ||
|
08348f1b72 | ||
|
a8b3b6282b | ||
|
eb5f26060a | ||
|
feecd2bbf4 | ||
|
be3d57c013 | ||
|
f64044a3de | ||
|
3737b035e8 | ||
|
6b003c3852 | ||
|
8991f5a9a0 | ||
|
49384e47be | ||
|
6dcb168442 | ||
|
1c4a00d26b | ||
|
aef8a1ccb4 | ||
|
81761e6f60 | ||
|
715c7b8a1f | ||
|
92ee477cde | ||
|
6d515dd06b | ||
|
7941806a9b | ||
|
4631d3f942 | ||
|
272d9d0d9b | ||
|
0ca9c66b84 | ||
|
8b6d127bb1 | ||
|
34fc86bd75 | ||
|
9ec2232321 | ||
|
64727f59c4 | ||
|
5183b2c288 | ||
|
83fee27624 | ||
|
3e0ecc5edc | ||
|
8ea6094118 | ||
|
d6d9c85139 | ||
|
9a55136bfb | ||
|
4ac93853a6 | ||
|
a4c1040420 | ||
|
576d4855d9 | ||
|
f2780c5d86 | ||
|
dc9b4ebfc9 | ||
|
6e2b688e24 | ||
|
6c3d4b56c9 | ||
|
4f05b95f6c | ||
|
f0d5c17ea7 | ||
|
a4ac8ce4ab | ||
|
65a2c548d8 | ||
|
1283382e82 | ||
|
7772254b62 | ||
|
a8862d7508 | ||
|
081bde8e1b | ||
|
9e05c0b120 | ||
|
6f336d04f1 | ||
|
9d49a6edfe | ||
|
c70665c3d1 | ||
|
2ed677c388 | ||
|
03d2b53c97 | ||
|
4c155320be | ||
|
40d52b5fa1 | ||
|
0b6abe8cd9 | ||
|
f43a78bfc3 | ||
|
b44ec2fb65 | ||
|
e9716e216d | ||
|
f3ef88724f | ||
|
9ecfb762bd | ||
|
bb1a4cc805 | ||
|
232773d171 | ||
|
a8f3413dc2 | ||
|
29e7d26edb | ||
|
7747d86cc4 | ||
|
5491b12596 | ||
|
3db2bf6c4b | ||
|
5a684b54ed | ||
|
6d6411d2fc | ||
|
5c033c06ab | ||
|
72b4b25b05 | ||
|
3aade24297 | ||
|
329ebdff84 | ||
|
6ee52071dd | ||
|
249e092967 | ||
|
b3d258b234 | ||
|
928716244d | ||
|
2de8a5e1a9 | ||
|
861ffb4680 | ||
|
0310208383 | ||
|
e8e94d8976 | ||
|
e49a20eece | ||
|
6c00d448d5 | ||
|
2a78ff2482 | ||
|
27f2f00dc6 | ||
|
f222df3081 | ||
|
8c0e76c21a | ||
|
432f06db3f | ||
|
564aef2aff | ||
|
ef7564a7ac | ||
|
724f7329a3 | ||
|
f498e3e296 | ||
|
6d9c540f6b | ||
|
60723084e6 | ||
|
9d41136c9b | ||
|
ecb4cfbff8 | ||
|
1664902525 | ||
|
f004b4b719 | ||
|
ba01dc84b4 | ||
|
497f7767cd | ||
|
7b0302cef5 | ||
|
840f573083 | ||
|
41fa699ae9 | ||
|
b35a634908 | ||
|
bc7d23761d | ||
|
e45dc6234b | ||
|
5db314f694 | ||
|
77fe563503 | ||
|
7b102293e8 | ||
|
b57487e360 | ||
|
80345ac56a | ||
|
0ea110a247 | ||
|
076ffb5650 | ||
|
2cc196d518 | ||
|
89cffb984b | ||
|
3f7e82a6b4 | ||
|
c6cd49ea37 |
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: AlexanderAmelkin
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
*Please **DO NOT** report ANYTHING about 1.8.18, it is outdated. Please first check your alleged bug with the latest code from the top of the master branch here.*
|
||||||
|
|
||||||
|
**IPMITOOL Version**
|
||||||
|
|
||||||
|
Make sure you're reporting a bug in the latest code taken from `master` branch here, NOT a bug
|
||||||
|
that you've found in some version that you've got from your OS vendor or any source other than this repository.
|
||||||
|
|
||||||
|
```none
|
||||||
|
$ ipmitool -V
|
||||||
|
<output here>
|
||||||
|
```
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Using hardware/BMC '...'
|
||||||
|
2. Run `ipmitool ...`
|
||||||
|
3. Observe the abnormal reply:
|
||||||
|
```none
|
||||||
|
abnormal output example
|
||||||
|
```
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
120
.github/workflows/ci.yml
vendored
Normal file
120
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
# vi: set et ts=2 sw=2 :
|
||||||
|
name: build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linux:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-18.04, ubuntu-20.04, ubuntu-22.04 ]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt install \
|
||||||
|
automake \
|
||||||
|
gcc \
|
||||||
|
git \
|
||||||
|
libssl-dev \
|
||||||
|
libtool \
|
||||||
|
make \
|
||||||
|
wget
|
||||||
|
- name: install extra libraries
|
||||||
|
# This build job tries to verify as much of ipmitool code
|
||||||
|
# as possible, hence these libraries. They aren't usually
|
||||||
|
# needed for normal user builds:
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install \
|
||||||
|
libsystemd-dev \
|
||||||
|
libreadline-dev \
|
||||||
|
libfreeipmi-dev \
|
||||||
|
libusb-dev
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: bootstrap
|
||||||
|
run: ./bootstrap
|
||||||
|
- name: configure
|
||||||
|
run: |
|
||||||
|
# For Linux, build as many extra interfaces as possible
|
||||||
|
# to verify the code
|
||||||
|
./configure --enable-intf-dummy \
|
||||||
|
--enable-intf-dbus \
|
||||||
|
--enable-intf-usb \
|
||||||
|
--enable-intf-free
|
||||||
|
- name: make
|
||||||
|
run: make
|
||||||
|
- name: make check
|
||||||
|
run: make check
|
||||||
|
- name: make distcheck
|
||||||
|
run: make distcheck
|
||||||
|
|
||||||
|
macos:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ macos-10.15, macos-11, macos-12 ]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: install dependencies
|
||||||
|
run: brew install automake openssl libtool freeipmi wget
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: bootstrap
|
||||||
|
run: ./bootstrap
|
||||||
|
- name: configure
|
||||||
|
run: |
|
||||||
|
./configure --enable-intf-dummy \
|
||||||
|
LDFLAGS=-L/usr/local/opt/openssl@1.1/lib \
|
||||||
|
CFLAGS=-I/usr/local/opt/openssl@1.1/include
|
||||||
|
- name: make
|
||||||
|
run: make
|
||||||
|
- name: make check
|
||||||
|
run: make check
|
||||||
|
- name: make distcheck
|
||||||
|
run: make distcheck
|
||||||
|
|
||||||
|
windows:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ windows-2019, windows-2022 ]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: install dependencies
|
||||||
|
run: |-
|
||||||
|
choco install cygwin -y
|
||||||
|
choco install cyg-get -y
|
||||||
|
# Line continuation in PowerShell is backtick. Weird as Windows.
|
||||||
|
cyg-get gcc-g++ `
|
||||||
|
make `
|
||||||
|
automake `
|
||||||
|
autoconf `
|
||||||
|
m4 `
|
||||||
|
libtool `
|
||||||
|
libncurses-devel `
|
||||||
|
libreadline-devel `
|
||||||
|
libssl-devel `
|
||||||
|
dos2unix `
|
||||||
|
wget
|
||||||
|
echo "C:/tools/cygwin/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
echo "C:/tools/cygwin/usr/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: convert line ends
|
||||||
|
# checkout action on Windows apparently converts line ends
|
||||||
|
# so we have to convert them back because cygwin bash can't
|
||||||
|
# can't handle Windows line ends
|
||||||
|
run: dos2unix bootstrap configure.ac csv-revision
|
||||||
|
- name: bootstrap
|
||||||
|
run: bash -c "./bootstrap"
|
||||||
|
- name: configure
|
||||||
|
run: bash -c "./configure"
|
||||||
|
- name: make
|
||||||
|
run: make
|
||||||
|
- name: make check
|
||||||
|
run: make check
|
||||||
|
- name: make distcheck
|
||||||
|
run: make distcheck
|
27
.gitignore
vendored
27
.gitignore
vendored
@ -1,12 +1,39 @@
|
|||||||
|
.deps
|
||||||
|
.dirstamp
|
||||||
|
.libs
|
||||||
|
.*.swp
|
||||||
|
*.log
|
||||||
|
*.rej
|
||||||
|
*.orig
|
||||||
|
*.o
|
||||||
|
*.lo
|
||||||
|
*.la
|
||||||
|
*.*~
|
||||||
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
compile
|
compile
|
||||||
config.guess
|
config.guess
|
||||||
|
config.h
|
||||||
config.h.in
|
config.h.in
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
config.sub
|
config.sub
|
||||||
configure
|
configure
|
||||||
depcomp
|
depcomp
|
||||||
install-sh
|
install-sh
|
||||||
ltmain.sh
|
ltmain.sh
|
||||||
|
libtool
|
||||||
missing
|
missing
|
||||||
|
stamp-h1
|
||||||
|
control/ipmitool.spec
|
||||||
|
control/pkginfo
|
||||||
|
control/prototype
|
||||||
|
control/rpmmacros
|
||||||
|
src/ipmievd
|
||||||
|
src/ipmitool
|
||||||
|
doc/ipmievd.8
|
||||||
|
doc/ipmitool.1
|
||||||
|
cscope.out
|
||||||
|
tags
|
||||||
|
235
ChangeLog
235
ChangeLog
@ -1,3 +1,238 @@
|
|||||||
|
version 1.8.19 2022-08-31
|
||||||
|
* Cast type before the left shift
|
||||||
|
* sel: Fix the deasserted thresholds inequality
|
||||||
|
* man: Update the text for -C option
|
||||||
|
* chassis restart_cause: Add new causes
|
||||||
|
* sel: Remove redundant "Reserve SEL"
|
||||||
|
* zero initialize the recv structure on the stack
|
||||||
|
* zero initialize the recv structure on the stack
|
||||||
|
* ci: Add support for MacOS-11
|
||||||
|
* ci: Remove ubuntu-16.04 support
|
||||||
|
* sdr: Fix modifier unit
|
||||||
|
* Fix compile error
|
||||||
|
* Refactor bridging level detection to dedicated function
|
||||||
|
* Fix double bridge detection in get_max_(req|rsp)_data_size()
|
||||||
|
* ipmi_mc: Fix the IPM_DEV_FWREV1_MAJOR_MASK
|
||||||
|
* helper: Fix stderr file descriptor
|
||||||
|
* Fix codefactor-io / CodeFactor warnings
|
||||||
|
* Use /run instead of /var/run
|
||||||
|
* oem: Update product IDs for YADRO
|
||||||
|
* lan: Add processing of get/set specific CCs
|
||||||
|
* lan: Refactor pointer style
|
||||||
|
* doc: update lanplus doc to reflect default cipher suite change
|
||||||
|
* ekanalyzer: Fix internal use area off-by-one bug
|
||||||
|
* ekanalyzer frushow: Fix internal area size calc
|
||||||
|
* sel: Fix "power supply inactive" flag offset
|
||||||
|
* ci: Add support for Ubuntu 20.04
|
||||||
|
* ci: Fix Ubuntu builds
|
||||||
|
* Fix compiler warning
|
||||||
|
* Fix compiler warning
|
||||||
|
* Fix compiler warning
|
||||||
|
* ci: Update for GitHub Actions v2.274.2
|
||||||
|
* free: Fix implicit function declarations
|
||||||
|
* Use "#pragma once" for headers
|
||||||
|
* Remove unneeded execution bits from C source files and a header file
|
||||||
|
* Convert line endings to LF
|
||||||
|
* Fixed compiler warning.
|
||||||
|
* RPM support: fixed broken build due to use of headers from kernel
|
||||||
|
* imbapi: replace __FUNCTION__ to eleminate compiler warnings
|
||||||
|
* lanplus: remove unused variable
|
||||||
|
* hpmfwupg: Clean up / refactor
|
||||||
|
* fru: Fix crashes on 6-bit ASCII strings
|
||||||
|
* oem: Add product ID for YADRO VEGMAN
|
||||||
|
* configure.ac: add '--location' for curl to follow location
|
||||||
|
* configure.ac: replace '-#' by '--progress-bar' with curl
|
||||||
|
* Add version info to debug output
|
||||||
|
* doc, ci: Fix an error in package name for Windows
|
||||||
|
* doc: Fix a small typo in INSTALL
|
||||||
|
* RPM support: updated spec file changelog
|
||||||
|
* RPM support: simplified build process
|
||||||
|
* RPM support: fixed broken RPM build
|
||||||
|
* doc: Update INSTALL with Windows info
|
||||||
|
* ci: Add Windows/cygwin config
|
||||||
|
* doc: Update INSTALL for new CI
|
||||||
|
* ci: Add github workflow, drop travis
|
||||||
|
* Fix compatibility with OpenBSD and macOS
|
||||||
|
* dist: Fix dependencies and cleanup
|
||||||
|
* dist: Add missing ipmi_time.h header to packaging
|
||||||
|
* configure: Fix compatibility with non-bash systems
|
||||||
|
* Finalize refactoring of string comparisons
|
||||||
|
* channel: Refactor set_user_access option processing
|
||||||
|
* Refactor string comparisons
|
||||||
|
* sel: Fix OEM record definition example
|
||||||
|
* sdr: harden against bad records
|
||||||
|
* fru: fix memory leak in ipmi_spd_print_fru
|
||||||
|
* ipmi_sel_set_time: fix strptime() return check
|
||||||
|
* hpm: use portable __max() in hpmfwupg
|
||||||
|
* hpmfwupg: move variable definition to .c file
|
||||||
|
* sel: time: fix null pointer dereference in set
|
||||||
|
* fru, sdr: Fix id_string buffer overflows
|
||||||
|
* lanp: Fix buffer overflows in get_lan_param_select
|
||||||
|
* channel: Fix buffer overflow
|
||||||
|
* session: Fix buffer overflow in ipmi_get_session_info
|
||||||
|
* fru: Fix buffer overflow in ipmi_spd_print_fru
|
||||||
|
* fru: Fix buffer overflow vulnerabilities
|
||||||
|
* configure: Drop requirement for curses et. al libs
|
||||||
|
* configure: remove some duplicate code
|
||||||
|
* doc: Update INSTALL to fix installation errors
|
||||||
|
* ipmi_dcmi: fix typo in nm_policy_options initialization.
|
||||||
|
* Docs: Add info on packages to install on Ubuntu 16.04
|
||||||
|
* chassis: Refactor to get rid of strncmp()
|
||||||
|
* chassis: Refactor main for centralized exiting
|
||||||
|
* chassis: bootdev: Refactor more
|
||||||
|
* chassis: bootdev: Refactor to reduce nesting
|
||||||
|
* chassis: bootdev: Fix help message and its formatting
|
||||||
|
* chassis: bootparam/bootdev: Refactor for less magic
|
||||||
|
* oem: supermicro: Add product codes from IPMICFG
|
||||||
|
* doc: Update man page regarding `user set password`
|
||||||
|
* user: Cleanup/refactor ipmi_user_password()
|
||||||
|
* user: Improve password length handling
|
||||||
|
* user: Alter "set password" usage information
|
||||||
|
* intf: Add missing function declarations
|
||||||
|
* doc: fix URL in README
|
||||||
|
* event: Clean up event sending from a file
|
||||||
|
* event: Clean up the event sending code
|
||||||
|
* event: Fix event submission via SSIF
|
||||||
|
* make: Use DESTDIR to install IANA PEN database
|
||||||
|
* lanplus: Fix embedded bridged responses handling
|
||||||
|
* Update .gitignore
|
||||||
|
* mc: Fix reporting of manufacturers > 64K
|
||||||
|
* Add installation of enterprise-numbers database
|
||||||
|
* Update documentation in regard to IANA PEN registry
|
||||||
|
* Use configurable path to IANA PEN registry
|
||||||
|
* Load IANA PEN registry from a file
|
||||||
|
* dbus: Replace obsolete INCLUDES with AM_CPPFLAGS
|
||||||
|
* oem: name change from Newisys to Viking Enterprise Solutions
|
||||||
|
* Fix default interface to behave as it did before
|
||||||
|
* man: Add documentation for chassis bootmbox
|
||||||
|
* man: Update the chassis bootparam section
|
||||||
|
* chassis: Add boot initiator mailbox support
|
||||||
|
* chassis: Use command-specific completion code parser
|
||||||
|
* Add support for command-specific completion codes
|
||||||
|
* Add a helper htoipmi24() function
|
||||||
|
* Add a helper args2buf() function
|
||||||
|
* man: Cleanup the manpage formatting tags
|
||||||
|
* create_pen_list: only print if values are set
|
||||||
|
* chassis: Refactor to reduce code duplication
|
||||||
|
* chassis: Refactor to reduce code duplication
|
||||||
|
* sdr: Fix segfault on invalid unit types
|
||||||
|
* vendor: Add YADRO TATLIN Storage Controller ID
|
||||||
|
* exchange-bmc-os-info: Remove dependency on ipmi.service
|
||||||
|
* Add mechanism to configure to set the default interface
|
||||||
|
* ci: Update INSTALL to reflect recent changes
|
||||||
|
* ci: Set up matrix builds with Travis CI
|
||||||
|
* Enable Travis build of D-Bus interface
|
||||||
|
* add OpenBMC D-Bus interface
|
||||||
|
* Fix "ipmitool pef {status,info}" not printing final newline
|
||||||
|
* Remove unused include
|
||||||
|
* Fix IPMI DCMI message typo
|
||||||
|
* open: swap free() calls for free_n()
|
||||||
|
* open: checking received msg id against expectation
|
||||||
|
* open: fix whitespace
|
||||||
|
* Refactor free_n() function
|
||||||
|
* fru: swap free() calls for free_n()
|
||||||
|
* fru: Fix write chunk reduction code
|
||||||
|
* fru: add macro FRU_AREA macros
|
||||||
|
* fru: replace magic return codes with macros
|
||||||
|
* fru header: add return error codes specific to fru
|
||||||
|
* fru: fix ipmi_fru_picmg_ext_edit as bool
|
||||||
|
* fru: use bool with ipmi_fru_oemkontron_edit
|
||||||
|
* fru: change ipmi_fru_query_new_value to return bool
|
||||||
|
* fru: mark ipmi_fru_query_new_value as static
|
||||||
|
* fru: add fru_cc_rq2big helper method for code checks
|
||||||
|
* fru: cleanup ipmi_fru_upg_ekeying
|
||||||
|
* fru: use ipmi_cc defined maros for return codes
|
||||||
|
* fru: drop extraneous parentheses on negative returns
|
||||||
|
* fru: delete unused variable matchInstance
|
||||||
|
* fru: cleanup ipmi_fru_oemkontron_get
|
||||||
|
* fru: fixup array bounds checking
|
||||||
|
* hpm: Adhere to centralized exiting
|
||||||
|
* hpm: Minor refactoring
|
||||||
|
* hpm: Fix resource leak
|
||||||
|
* sol: Make interface timeout obey the -N option
|
||||||
|
* helper: add free_n method to handle clearing pointers
|
||||||
|
* cygwin: imb: Fix build error (wchar_t)
|
||||||
|
* lanplus: Fix segfault for truncated dcmi response
|
||||||
|
* Move led color static array to source file
|
||||||
|
* drop unused static arrays
|
||||||
|
* move static objects to source file
|
||||||
|
* cleanup all unused-parameter warnings
|
||||||
|
* use __UNUSED__ macro instead of gcc specific attribute
|
||||||
|
* implement __UNUSED__ macro for marking unused
|
||||||
|
* Add .dirstamp to .gitignore
|
||||||
|
* fru: Fix processing of unspecified board mfg. date
|
||||||
|
* [compiler-warnings-fixes] use correct fall through comment
|
||||||
|
* [compiler-warnings-fixes] ipmi_start_daemon: check return values
|
||||||
|
* [compiler-warnings-fixes] ipmi_sdr.c: remove unused function parameters
|
||||||
|
* lan: Fix processing disabled VLAN
|
||||||
|
* Make ipmitool respect system locale settings
|
||||||
|
* Fix strftime() non-literal argument warning
|
||||||
|
* Refactor timestamp handling
|
||||||
|
* doc: Update manpage with new contact info
|
||||||
|
* lanplus: Refactoring
|
||||||
|
* lanplus: Fix -C option processing
|
||||||
|
* lanplus: Auto-select 'best' cipher suite available
|
||||||
|
* lanplus: Fix compile with deprecated APIs disabled.
|
||||||
|
* doc: Update home page links
|
||||||
|
* doc: Update formatting of ipmitool man page
|
||||||
|
* sensor: Refactor ipmi_sensor_print_fc_threshold()
|
||||||
|
* sensor: Add support for csv output
|
||||||
|
* plugins: open: Properly enable event receiver (#35)
|
||||||
|
* lan: Refactoring: Remove unused function
|
||||||
|
* general: Get rid of some unused parameter warnings
|
||||||
|
* mc: guid: Implement encoding autodetection
|
||||||
|
* mc: guid: Fix timestamp decoding
|
||||||
|
* mc: guid: Add support for non-standard encodings
|
||||||
|
* mc: guid: Fix byte ordering to follow IPMI spec
|
||||||
|
* Refactoring: optimize pointer checks
|
||||||
|
* imb: Refactoring: remove duplicate code
|
||||||
|
* Refactoring: get rid of superfluous comparisons
|
||||||
|
* Refactoring. Improve code reuse ratio.
|
||||||
|
* general: Fix several misspellings
|
||||||
|
* mc: Fix compiler warnings
|
||||||
|
* general: Add array_byteswap() to helper
|
||||||
|
* lanplus: Make byteswapping generic
|
||||||
|
* framework: Update .gitignore
|
||||||
|
* framework: Switch to C11 standard with GNU extensions
|
||||||
|
* framework: ci: Add support for Travis CI
|
||||||
|
* oem: Add basic support for Quanta
|
||||||
|
* intf: Refactoring. Remove unused sendrsp()
|
||||||
|
* dummy: Add default dummy socket
|
||||||
|
* mc: Fix manufacturer ID masking
|
||||||
|
* Refactoring. Remove useless feature test macros.
|
||||||
|
* general: Make byteswapping arch-independent
|
||||||
|
* sel: Minor refactoring
|
||||||
|
* sdr: Refactor/optimize code. No functional changes.
|
||||||
|
* Add an option to display all dates in UTC
|
||||||
|
* mc: Code refactor to reduce copy-paste ratio
|
||||||
|
* mc: watchdog set: Refactor to reduce complexity
|
||||||
|
* mc: watchdog set: Fix intr setting
|
||||||
|
* mc: watchdog get: Update to match IPMI 2.0 spec
|
||||||
|
* mc: watchdog: Add `set` command
|
||||||
|
* framework: Make git ignore cscope.out
|
||||||
|
* plugins/open: Fix for interrupted select
|
||||||
|
* nm: Fix policy range (#12)
|
||||||
|
* Replace user_id masks with a macro (#8)
|
||||||
|
* fru: internaluse: Fix segmentation fault (#9)
|
||||||
|
* dcmi: Refactor
|
||||||
|
* ID:508 - Fix segfaults in dcmi command handlers
|
||||||
|
* vendor: Add YADRO VESNIN identification
|
||||||
|
* ID:491 - Fetch vendor IDs from IANA
|
||||||
|
* ID:472 - Fix The Most recent Addition/Erase date
|
||||||
|
* ID:480 - Call EVP_CIPHER_CTX_free() instead of EVP_CIPHER_CTX_cleanup()
|
||||||
|
* ID:480 - ipmitool coredumps in EVP_CIPHER_CTX_init
|
||||||
|
* Make git revision more descriptive
|
||||||
|
* ID:477 - fru: Fix decoding of non-text data in get_fru_area_str()
|
||||||
|
* ID:479 - ekanalyzer: fix processing of custom mfg. fields
|
||||||
|
* ID:478 - ekanalyzer: Fixed decoding of FRU fields
|
||||||
|
* Add some more configure/build/editor byproducts to .gitignore
|
||||||
|
* Add git hash and dirty mark to ipmitool version
|
||||||
|
* Prevent autoreconf from complaining about missing NEWS
|
||||||
|
* Add bootstrap support for Mac
|
||||||
|
* ID:474 - Compile fix on nonlinux systems
|
||||||
|
* ID:461 - Make compiler happier about changes related to OpenSSL 1.1
|
||||||
|
* ID:461 - OpenSSL 1.1 compatibility - "error: storage size of 'ctx' isn't known"
|
||||||
|
|
||||||
version 1.8.18 2016-10-08
|
version 1.8.18 2016-10-08
|
||||||
* Add mac2str() and str2mac() to print/parse MAC address
|
* Add mac2str() and str2mac() to print/parse MAC address
|
||||||
* Change formatting, remove commented-out code in
|
* Change formatting, remove commented-out code in
|
||||||
|
79
INSTALL
79
INSTALL
@ -9,17 +9,78 @@ are permitted in any medium without royalty provided the copyright
|
|||||||
notice and this notice are preserved. This file is offered as-is,
|
notice and this notice are preserved. This file is offered as-is,
|
||||||
without warranty of any kind.
|
without warranty of any kind.
|
||||||
|
|
||||||
|
Prerequisites
|
||||||
|
=============
|
||||||
|
|
||||||
|
This project requires at least gcc 4.8.1 as it uses some GNU
|
||||||
|
extensions and some C11 features. For `lanplus` interface the OpenSSL
|
||||||
|
library and development headers are required. As of July 2020, the
|
||||||
|
project is tested automatically to build cleanly for the following
|
||||||
|
64-bit operating systems using GitHub Actions workflow:
|
||||||
|
|
||||||
|
- Ubuntu 18.04 Bionic Beaver
|
||||||
|
- Ubuntu 20.04 Focal Fossa
|
||||||
|
- Ubuntu 22.04 Jammy Jellyfish
|
||||||
|
- MacOS X 10.15 Catalina
|
||||||
|
- MacOS 11 Big Sur
|
||||||
|
- MacOS 12 Monterey
|
||||||
|
- Microsoft Windows Server 2019
|
||||||
|
- Microsoft Windows Server 2022
|
||||||
|
|
||||||
|
It is also known to build successfully on Ubuntu 14.04 and Fedora 31,
|
||||||
|
but that is not automatically verified.
|
||||||
|
|
||||||
|
For Ubuntu 14.04+ it is recommended to do the following before building:
|
||||||
|
|
||||||
|
$ sudo apt install automake gcc git libreadline-dev libssl-dev \
|
||||||
|
libtool make wget
|
||||||
|
|
||||||
|
For Ubuntu 20.04+ you will also need this:
|
||||||
|
|
||||||
|
$ sudo apt install musl-dev
|
||||||
|
|
||||||
|
For Fedora 31 it is recommended to do the following before building:
|
||||||
|
|
||||||
|
$ sudo dnf install automake gcc git libtool make openssl-devel \
|
||||||
|
readline-devel wget
|
||||||
|
|
||||||
|
For MacOS with Xcode and homebrew installed, it is recommended to do the
|
||||||
|
following before building:
|
||||||
|
|
||||||
|
$ brew install automake openssl libtool freeipmi wget
|
||||||
|
$ export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
|
||||||
|
$ export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
|
||||||
|
|
||||||
|
To prepare for building in Windows it is recommended to use Chocolatey
|
||||||
|
and do the following using PowerShell:
|
||||||
|
|
||||||
|
PS C:\ipmitool> choco install cygwin -y
|
||||||
|
PS C:\ipmitool> choco install cyg-get -y
|
||||||
|
PS C:\ipmitool> cyg-get gcc-g++ make automake autoconf `
|
||||||
|
# m4 libtool libncurses-devel libreadline-devel libssl-devel `
|
||||||
|
# dos2unix wget
|
||||||
|
PS C:\ipmitool> $env:path="C:\tools\cygwin\usr\bin;$env:path"
|
||||||
|
PS C:\ipmitool> $env:path="C:\tools\cygwin\bin;$env:path"
|
||||||
|
PS C:\ipmitool> dos2unix bootstrap configure.ac csv-revision
|
||||||
|
|
||||||
Basic Installation
|
Basic Installation
|
||||||
==================
|
==================
|
||||||
|
|
||||||
Briefly, the shell command `./configure && make && make install'
|
Briefly, the followong shell command should configure, build, and
|
||||||
should configure, build, and install this package. The following
|
install this package:
|
||||||
more-detailed instructions are generic; see the `README' file for
|
|
||||||
instructions specific to this package. Some packages provide this
|
./bootstrap && ./configure && make && sudo make install
|
||||||
`INSTALL' file but do not implement all of the features documented
|
|
||||||
below. The lack of an optional feature in a given package is not
|
For Windows the above command must be run inside a cygwin bash
|
||||||
necessarily a bug. More recommendations for GNU packages can be found
|
shell.
|
||||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
|
||||||
|
The following more-detailed instructions are generic; see the
|
||||||
|
`README' file for instructions specific to this package. Some
|
||||||
|
packages provide this `INSTALL' file but do not implement all of the
|
||||||
|
features documented below. The lack of an optional feature in a given
|
||||||
|
package is not necessarily a bug. More recommendations for GNU
|
||||||
|
packages can be found in *note Makefile Conventions:
|
||||||
|
(standards)Makefile Conventions.
|
||||||
|
|
||||||
The `configure' shell script attempts to guess correct values for
|
The `configure' shell script attempts to guess correct values for
|
||||||
various system-dependent variables used during compilation. It uses
|
various system-dependent variables used during compilation. It uses
|
||||||
@ -124,7 +185,7 @@ architecture at a time in the source code directory. After you have
|
|||||||
installed the package for one architecture, use `make distclean' before
|
installed the package for one architecture, use `make distclean' before
|
||||||
reconfiguring for another architecture.
|
reconfiguring for another architecture.
|
||||||
|
|
||||||
On MacOS X 10.5 and later systems, you can create libraries and
|
On MacOS and later systems, you can create libraries and
|
||||||
executables that work on multiple system types--known as "fat" or
|
executables that work on multiple system types--known as "fat" or
|
||||||
"universal" binaries--by specifying multiple `-arch' options to the
|
"universal" binaries--by specifying multiple `-arch' options to the
|
||||||
compiler but only a single `-arch' option to the preprocessor. Like
|
compiler but only a single `-arch' option to the preprocessor. Like
|
||||||
|
48
Makefile.am
48
Makefile.am
@ -28,7 +28,7 @@
|
|||||||
# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
# 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.
|
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
DOCDIR = $(datadir)/doc/$(PACKAGE)
|
DOCDIR = $(docdir)
|
||||||
DOCLIST = $(top_srcdir)/README $(top_srcdir)/COPYING $(top_srcdir)/AUTHORS $(top_srcdir)/ChangeLog
|
DOCLIST = $(top_srcdir)/README $(top_srcdir)/COPYING $(top_srcdir)/AUTHORS $(top_srcdir)/ChangeLog
|
||||||
|
|
||||||
EXTRA_DIST = $(DOCLIST) bootstrap
|
EXTRA_DIST = $(DOCLIST) bootstrap
|
||||||
@ -41,15 +41,49 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure configure-stamp \
|
|||||||
$(distdir).tar.gz $(distdir).tar.bz2
|
$(distdir).tar.gz $(distdir).tar.bz2
|
||||||
|
|
||||||
SUBDIRS = lib src include doc contrib control
|
SUBDIRS = lib src include doc contrib control
|
||||||
|
IANA_PEN = http://www.iana.org/assignments/enterprise-numbers.txt
|
||||||
|
|
||||||
dist-hook:
|
dist-hook:
|
||||||
cp control/ipmitool.spec $(distdir)
|
cp control/ipmitool.spec $(distdir)
|
||||||
|
|
||||||
install-data-local:
|
.PHONY: install-pen-database uninstall-pen-database
|
||||||
|
.INTERMEDIATE: %.o %.la enterprise-numbers
|
||||||
|
|
||||||
|
if DOWNLOAD
|
||||||
|
|
||||||
|
enterprise-numbers:
|
||||||
|
@echo Downloading IANA PEN database...
|
||||||
|
@$(DOWNLOAD) "$(IANA_PEN)" > tmpfile.$$PPID || {\
|
||||||
|
echo "FAILED to download the IANA PEN database"; \
|
||||||
|
rm tmpfile.$$PPID; \
|
||||||
|
false; \
|
||||||
|
}
|
||||||
|
@mv tmpfile.$$PPID $@
|
||||||
|
|
||||||
|
install-pen-database: enterprise-numbers
|
||||||
|
mkdir -m 755 -p $(DESTDIR)$(IANADIR)
|
||||||
|
$(INSTALL_DATA) $< $(DESTDIR)$(IANADIR)/
|
||||||
|
|
||||||
|
uninstall-pen-database:
|
||||||
|
-rm -rf $(DESTDIR)$(IANADIR)/enterprise-numbers
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
install-pen-database:
|
||||||
|
@echo "*** NOT installing the IANA PEN database."
|
||||||
|
@echo "*** Don't know how to download it."
|
||||||
|
|
||||||
|
uninstall-pen-database:
|
||||||
|
@echo "*** NOT uninstalling the IANA PEN database."
|
||||||
|
@echo "*** It was installed manually (if ever)."
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
install-data-local: install-pen-database
|
||||||
mkdir -p $(DESTDIR)$(DOCDIR)
|
mkdir -p $(DESTDIR)$(DOCDIR)
|
||||||
$(INSTALL_DATA) $(DOCLIST) $(DESTDIR)$(DOCDIR)
|
$(INSTALL_DATA) $(DOCLIST) $(DESTDIR)$(DOCDIR)
|
||||||
|
|
||||||
uninstall-local:
|
uninstall-local: uninstall-pen-database
|
||||||
-rm -rf $(DESTDIR)$(DOCDIR)
|
-rm -rf $(DESTDIR)$(DOCDIR)
|
||||||
|
|
||||||
.PHONY: pkg
|
.PHONY: pkg
|
||||||
@ -67,12 +101,8 @@ SRCDIR = ${shell cd $(top_srcdir) ; pwd | sed -e 's,^[^:\\/]:[\\/],/,'}
|
|||||||
RPMDIR = $(BUILDDIR)/rpmbuild
|
RPMDIR = $(BUILDDIR)/rpmbuild
|
||||||
|
|
||||||
.PHONY: rpm
|
.PHONY: rpm
|
||||||
rpm: control/ipmitool.spec dist
|
rpm: dist
|
||||||
mkdir -p $(RPMDIR)/{BUILD,RPMS,SRPMS,SOURCES,SPECS,tmp}
|
@RPMBUILD@ -ta --define "_topdir $(RPMDIR)" $(distdir).tar.gz
|
||||||
cp control/ipmitool.spec $(RPMDIR)/SPECS
|
|
||||||
BUILDDIR=$(RPMDIR) CONFIGDIR=$(BUILDDIR)/control \
|
|
||||||
@RPMBUILD@ -ba --rcfile $(SRCDIR)/control/rpmrc \
|
|
||||||
$(RPMDIR)/SPECS/ipmitool.spec
|
|
||||||
|
|
||||||
.PHONY: clean-rpm
|
.PHONY: clean-rpm
|
||||||
clean-rpm:
|
clean-rpm:
|
||||||
|
15
README
15
README
@ -42,8 +42,8 @@ Requirements
|
|||||||
============
|
============
|
||||||
Obviously the largest requirement is hardware with a service processor
|
Obviously the largest requirement is hardware with a service processor
|
||||||
that supports the IPMI specification. Many x86-based servers are now
|
that supports the IPMI specification. Many x86-based servers are now
|
||||||
comming with IPMI support, check with your preferred hardware vendor
|
coming with IPMI support, check with your preferred hardware vendor
|
||||||
about available prodcuts.
|
about available products.
|
||||||
|
|
||||||
Once you are certain you have the required hardware, you then need to
|
Once you are certain you have the required hardware, you then need to
|
||||||
decide how you want to access the BMC. The most common case involve
|
decide how you want to access the BMC. The most common case involve
|
||||||
@ -126,7 +126,7 @@ hardware will come with a utility (often a DOS bootable CD) for configuring
|
|||||||
enabling the LAN interface as well.
|
enabling the LAN interface as well.
|
||||||
|
|
||||||
In order to support the IPMIv2.0 interface you must have an OpenSSL library
|
In order to support the IPMIv2.0 interface you must have an OpenSSL library
|
||||||
with the required encrytion functions. Recent distributions should have
|
with the required encryption functions. Recent distributions should have
|
||||||
no problems. The IPMIv1.5 interface will attempt to use OpenSSL for MD5
|
no problems. The IPMIv1.5 interface will attempt to use OpenSSL for MD5
|
||||||
hash function at compile time but if that is not found it will use an
|
hash function at compile time but if that is not found it will use an
|
||||||
internal library.
|
internal library.
|
||||||
@ -396,16 +396,13 @@ ipmievd: Memory Sensor 01 - Correctable ECC
|
|||||||
Resources
|
Resources
|
||||||
=========
|
=========
|
||||||
IPMItool homepage
|
IPMItool homepage
|
||||||
http://ipmitool.sourceforge.net
|
http://github.com/ipmitool/ipmitool
|
||||||
|
|
||||||
IPMItool manpage
|
IPMItool manpage
|
||||||
http://ipmitool.sourceforge.net/manpage.html
|
https://github.com/ipmitool/ipmitool/blob/master/doc/ipmitool.1.in
|
||||||
|
|
||||||
IPMItool overview paper from Linux.conf.au 2004
|
|
||||||
http://ipmitool.sourceforge.net/lca2004_ipmitool.pdf
|
|
||||||
|
|
||||||
Intelligent Platform Management Interface specification
|
Intelligent Platform Management Interface specification
|
||||||
http://www.intel.com/design/servers/ipmi/spec.htm
|
https://www.intel.com/content/www/us/en/servers/ipmi/ipmi-home.html
|
||||||
|
|
||||||
OpenIPMI project: Linux IPMI kernel driver and userland library
|
OpenIPMI project: Linux IPMI kernel driver and userland library
|
||||||
http://openipmi.sourceforge.net
|
http://openipmi.sourceforge.net
|
||||||
|
10
bootstrap
10
bootstrap
@ -31,7 +31,15 @@
|
|||||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
aclocal
|
aclocal
|
||||||
libtoolize --automake --copy
|
|
||||||
|
case `uname` in
|
||||||
|
Darwin*)
|
||||||
|
glibtoolize --automake --copy
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
libtoolize --automake --copy
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
autoheader
|
autoheader
|
||||||
automake --foreign --add-missing --copy
|
automake --foreign --add-missing --copy
|
||||||
|
142
configure.ac
142
configure.ac
@ -1,10 +1,12 @@
|
|||||||
dnl
|
dnl
|
||||||
dnl autoconf for ipmitool
|
dnl autoconf for ipmitool
|
||||||
dnl
|
dnl
|
||||||
AC_INIT([ipmitool], [1.8.18-csv])
|
m4_define([git_suffix], m4_esyscmd_s(./csv-revision))
|
||||||
|
AC_INIT([ipmitool], [1.8.19git_suffix])
|
||||||
AC_CONFIG_SRCDIR([src/ipmitool.c])
|
AC_CONFIG_SRCDIR([src/ipmitool.c])
|
||||||
|
AC_CONFIG_COMMANDS_PRE([export prefix=$prefix])
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE([foreign])
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
AC_PREREQ(2.50)
|
AC_PREREQ(2.50)
|
||||||
AC_SUBST(ac_configure_args)
|
AC_SUBST(ac_configure_args)
|
||||||
@ -32,7 +34,7 @@ AC_CHECK_FUNCS([alarm gethostbyname getaddrinfo getifaddrs socket select])
|
|||||||
AC_CHECK_FUNCS([memmove memset strchr strdup strerror])
|
AC_CHECK_FUNCS([memmove memset strchr strdup strerror])
|
||||||
AC_CHECK_FUNCS([getpassphrase])
|
AC_CHECK_FUNCS([getpassphrase])
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -Wall -Wextra -std=gnu99 -pedantic -Wformat -Wformat-nonliteral"
|
CFLAGS="$CFLAGS -Wall -Wextra -std=gnu11 -pedantic -Wformat -Wformat-nonliteral"
|
||||||
|
|
||||||
AM_PROG_LIBTOOL
|
AM_PROG_LIBTOOL
|
||||||
LIBTOOL="$LIBTOOL --silent"
|
LIBTOOL="$LIBTOOL --silent"
|
||||||
@ -52,12 +54,42 @@ if test "x$exec_prefix" = "xNONE"; then
|
|||||||
exec_prefix="$prefix"
|
exec_prefix="$prefix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl allow enabling/disabling the fetching of the IANA PEN registry
|
||||||
|
AC_ARG_ENABLE([registry-download],
|
||||||
|
[AC_HELP_STRING([--enable-registry-download],
|
||||||
|
[download/install the IANA PEN registry [default=yes]])],
|
||||||
|
[xenable_registry_download=$enableval],
|
||||||
|
[xenable_registry_download=yes])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([DOWNLOAD], [false])
|
||||||
|
|
||||||
|
if test "x$xenable_registry_download" = "xyes"; then
|
||||||
|
AC_CHECK_PROG([WGET], [wget], [wget])
|
||||||
|
AC_CHECK_PROG([CURL], [curl], [curl])
|
||||||
|
|
||||||
|
if test "x$WGET" = "x" && test "x$CURL" = "x"; then
|
||||||
|
AC_MSG_WARN([** Neither wget nor curl could be found.])
|
||||||
|
AC_MSG_WARN([** IANA PEN database will not be installed by `make install` !])
|
||||||
|
else
|
||||||
|
AM_CONDITIONAL([DOWNLOAD], [true])
|
||||||
|
if test "x$WGET" != "x"; then
|
||||||
|
DOWNLOAD="$WGET -c -nd -O -"
|
||||||
|
else
|
||||||
|
DOWNLOAD="$CURL --location --progress-bar"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_WARN([** Download is: $DOWNLOAD])
|
||||||
|
AC_SUBST(DOWNLOAD, $DOWNLOAD)
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl set default option values
|
dnl set default option values
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
xenable_all_options=yes
|
xenable_all_options=yes
|
||||||
xenable_intf_bmc=no
|
xenable_intf_bmc=no
|
||||||
|
xenable_intf_dbus=no
|
||||||
xenable_intf_dummy=no
|
xenable_intf_dummy=no
|
||||||
xenable_intf_imb=yes
|
xenable_intf_imb=yes
|
||||||
xenable_intf_lipmi=yes
|
xenable_intf_lipmi=yes
|
||||||
@ -190,6 +222,14 @@ AC_CHECK_LIB([crypto], [MD2_Init],
|
|||||||
fi],
|
fi],
|
||||||
[], [-lcrypto])
|
[], [-lcrypto])
|
||||||
|
|
||||||
|
dnl check for libsystemd in case dbus-intf is requested
|
||||||
|
AC_CHECK_LIB([systemd], [sd_bus_default],
|
||||||
|
[
|
||||||
|
LIBS="$LIBS -lsystemd"
|
||||||
|
have_systemd=yes
|
||||||
|
],
|
||||||
|
[ have_systemd=no],[])
|
||||||
|
|
||||||
dnl enable IPMIv1.5 LAN interface
|
dnl enable IPMIv1.5 LAN interface
|
||||||
AC_ARG_ENABLE([intf-lan],
|
AC_ARG_ENABLE([intf-lan],
|
||||||
[AC_HELP_STRING([--enable-intf-lan],
|
[AC_HELP_STRING([--enable-intf-lan],
|
||||||
@ -553,6 +593,25 @@ if test "x$xenable_intf_bmc" = "xyes"; then
|
|||||||
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB bmc/libintf_bmc.la"
|
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB bmc/libintf_bmc.la"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl enable IPMI dbus interface
|
||||||
|
AC_ARG_ENABLE([intf-dbus],
|
||||||
|
[AC_HELP_STRING([--enable-intf-dbus],
|
||||||
|
[enable IPMI dbus interface [default=no]])],
|
||||||
|
[xenable_intf_dbus=$enableval],
|
||||||
|
[xenable_intf_dbus=no])
|
||||||
|
if test "x$xenable_intf_dbus" != "xno"; then
|
||||||
|
if test "x$have_systemd" != "xyes"; then
|
||||||
|
AC_MSG_ERROR([** Unable to find libsystemd required by dbus-intf.])
|
||||||
|
xenable_intf_dbus=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "x$xenable_intf_dbus" = "xyes"; then
|
||||||
|
AC_DEFINE(IPMI_INTF_DBUS, [1], [Define to 1 to enable dbus interface.])
|
||||||
|
AC_SUBST(INTF_DBUS, [dbus])
|
||||||
|
AC_SUBST(INTF_DBUS_LIB, [libintf_dbus.la])
|
||||||
|
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB dbus/libintf_dbus.la"
|
||||||
|
fi
|
||||||
|
|
||||||
dnl enable Dummy interface for testing
|
dnl enable Dummy interface for testing
|
||||||
AC_ARG_ENABLE([intf-dummy],
|
AC_ARG_ENABLE([intf-dummy],
|
||||||
[AC_HELP_STRING([--enable-intf-dummy],
|
[AC_HELP_STRING([--enable-intf-dummy],
|
||||||
@ -567,30 +626,22 @@ fi
|
|||||||
|
|
||||||
AC_SUBST(IPMITOOL_INTF_LIB)
|
AC_SUBST(IPMITOOL_INTF_LIB)
|
||||||
|
|
||||||
if test "x$xenable_ipmishell" = "xyes"; then
|
|
||||||
AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses readline termcap])
|
|
||||||
AC_SEARCH_LIBS([initscr], [ncurses curses], [have_curses=yes])
|
|
||||||
AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
|
|
||||||
if test "x$have_curses" != "xyes" || test "x$have_readline" != "xyes"; then
|
|
||||||
xenable_ipmishell=no
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl check for readline library to enable ipmi shell
|
|
||||||
AC_ARG_ENABLE([ipmishell],
|
AC_ARG_ENABLE([ipmishell],
|
||||||
[AC_HELP_STRING([--enable-ipmishell],
|
[AC_HELP_STRING([--enable-ipmishell],
|
||||||
[enable IPMI shell interface [default=auto]])],
|
[enable IPMI shell interface [default=auto]])],
|
||||||
[xenable_ipmishell=$enableval],
|
[xenable_ipmishell=$enableval],
|
||||||
[])
|
[])
|
||||||
|
|
||||||
|
dnl check for readline library to enable ipmi shell
|
||||||
if test "x$xenable_ipmishell" = "xyes"; then
|
if test "x$xenable_ipmishell" = "xyes"; then
|
||||||
AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses readline termcap])
|
PKG_PROG_PKG_CONFIG
|
||||||
AC_SEARCH_LIBS([initscr], [ncurses curses], [have_curses=yes])
|
PKG_CHECK_MODULES([READLINE], [readline],
|
||||||
AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
|
[LIBS="$LIBS $READLINE_LIBS" have_readline=yes],
|
||||||
if test "x$have_curses" != "xyes"; then
|
[AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])]
|
||||||
AC_MSG_ERROR([** Unable to find curses required by ipmishell.])
|
)
|
||||||
fi
|
|
||||||
if test "x$have_readline" != "xyes"; then
|
if test "x$have_readline" != "xyes"; then
|
||||||
AC_MSG_ERROR([** Unable to find readline required by ipmishell.])
|
AC_MSG_ERROR([** Unable to find readline required by ipmishell.])
|
||||||
|
xenable_ipmishell=no
|
||||||
fi
|
fi
|
||||||
AC_DEFINE(HAVE_READLINE, [1], [Define to 1 if readline present.])
|
AC_DEFINE(HAVE_READLINE, [1], [Define to 1 if readline present.])
|
||||||
fi
|
fi
|
||||||
@ -642,6 +693,50 @@ AC_TRY_COMPILE([],[
|
|||||||
[Define to 1 if you need to use #pragma pack instead of __attribute__ ((packed))])]
|
[Define to 1 if you need to use #pragma pack instead of __attribute__ ((packed))])]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
dnl if no environment variable is set, set the default value for the default intf
|
||||||
|
if test "${xenable_intf_open}" = "yes"; then
|
||||||
|
DEFAULT_INTF_NO_ENV=open
|
||||||
|
else dnl macOS does not build open interface, it defaults to lan
|
||||||
|
DEFAULT_INTF_NO_ENV=lan
|
||||||
|
fi
|
||||||
|
dnl allow for a default interface to be set on configure
|
||||||
|
AC_ARG_VAR(DEFAULT_INTF, [Set the default interface to use (default='open' if available, 'lan' otherwise)])
|
||||||
|
|
||||||
|
dnl set the default value for the default interface environment variable
|
||||||
|
if test "x${DEFAULT_INTF}" = "x"; then
|
||||||
|
echo "DEFAULT_INTF not found in environment; setting to ${DEFAULT_INTF_NO_ENV}"
|
||||||
|
DEFAULT_INTF=${DEFAULT_INTF_NO_ENV}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x"`eval "echo \\\${xenable_intf_${DEFAULT_INTF}}"` != "xyes"; then
|
||||||
|
AC_MSG_ERROR([** Cannot set ${DEFAULT_INTF} as default; intf-${DEFAULT_INTF} is not enabled.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_ARG_VAR(IANADIR, [Configure the path to IANA PEN dictionary (default=DATAROOTDIR/misc)])
|
||||||
|
AC_ARG_VAR(IANAUSERDIR, [Configure the path to IANA PEN dictionary wihtin the user's HOME directory (default=.local/usr/share/misc)])
|
||||||
|
|
||||||
|
if test "x${IANADIR}" = "x"; then
|
||||||
|
IANADIR=`eval echo "${datarootdir}/misc"`
|
||||||
|
echo Set IANA PEN dictionary search path to ${IANADIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x${IANAUSERDIR}" = "x"; then
|
||||||
|
IANAUSERDIR=".local/usr/share/misc"
|
||||||
|
echo Set user\'s IANA PEN dictionary search path to ${IANAUSERDIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
AH_TEMPLATE([IANADIR],[The path to system IANA PEN dictionary])
|
||||||
|
AC_DEFINE_UNQUOTED(IANADIR, "`eval "echo ${IANADIR}"`", [])
|
||||||
|
|
||||||
|
AH_TEMPLATE([IANAUSERDIR],[The subpath to user IANA PEN dictionary within the user's HOME])
|
||||||
|
AC_DEFINE_UNQUOTED(IANAUSERDIR, "`eval "echo ${IANAUSERDIR}"`", [])
|
||||||
|
|
||||||
|
AH_TEMPLATE([PATH_SEPARATOR], [The path separator string])
|
||||||
|
#if defined _WIN32 || defined __CYGWIN__
|
||||||
|
AC_DEFINE(PATH_SEPARATOR, "\\")
|
||||||
|
#else
|
||||||
|
AC_DEFINE(PATH_SEPARATOR, "/")
|
||||||
|
#endif
|
||||||
|
|
||||||
dnl Generate files for build
|
dnl Generate files for build
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
@ -650,7 +745,6 @@ AC_CONFIG_FILES([Makefile
|
|||||||
control/Makefile
|
control/Makefile
|
||||||
control/pkginfo
|
control/pkginfo
|
||||||
control/prototype
|
control/prototype
|
||||||
control/rpmmacros
|
|
||||||
control/ipmitool.spec
|
control/ipmitool.spec
|
||||||
lib/Makefile
|
lib/Makefile
|
||||||
include/Makefile
|
include/Makefile
|
||||||
@ -663,23 +757,27 @@ AC_CONFIG_FILES([Makefile
|
|||||||
src/plugins/free/Makefile
|
src/plugins/free/Makefile
|
||||||
src/plugins/imb/Makefile
|
src/plugins/imb/Makefile
|
||||||
src/plugins/bmc/Makefile
|
src/plugins/bmc/Makefile
|
||||||
|
src/plugins/dbus/Makefile
|
||||||
src/plugins/usb/Makefile
|
src/plugins/usb/Makefile
|
||||||
src/plugins/lipmi/Makefile
|
src/plugins/lipmi/Makefile
|
||||||
src/plugins/serial/Makefile
|
src/plugins/serial/Makefile
|
||||||
src/plugins/dummy/Makefile])
|
src/plugins/dummy/Makefile
|
||||||
|
doc/ipmitool.1
|
||||||
|
doc/ipmievd.8])
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
AC_MSG_RESULT([])
|
AC_MSG_RESULT([])
|
||||||
AC_MSG_RESULT([ipmitool $VERSION])
|
AC_MSG_RESULT([ipmitool $VERSION])
|
||||||
AC_MSG_RESULT([])
|
AC_MSG_RESULT([])
|
||||||
AC_MSG_RESULT([Interfaces])
|
AC_MSG_RESULT([Interfaces (default=$DEFAULT_INTF)])
|
||||||
AC_MSG_RESULT([ lan : $xenable_intf_lan])
|
AC_MSG_RESULT([ lan : $xenable_intf_lan])
|
||||||
AC_MSG_RESULT([ lanplus : $xenable_intf_lanplus])
|
AC_MSG_RESULT([ lanplus : $xenable_intf_lanplus])
|
||||||
AC_MSG_RESULT([ open : $xenable_intf_open])
|
AC_MSG_RESULT([ open : $xenable_intf_open])
|
||||||
AC_MSG_RESULT([ free : $xenable_intf_free])
|
AC_MSG_RESULT([ free : $xenable_intf_free])
|
||||||
AC_MSG_RESULT([ imb : $xenable_intf_imb])
|
AC_MSG_RESULT([ imb : $xenable_intf_imb])
|
||||||
AC_MSG_RESULT([ bmc : $xenable_intf_bmc])
|
AC_MSG_RESULT([ bmc : $xenable_intf_bmc])
|
||||||
|
AC_MSG_RESULT([ dbus : $xenable_intf_dbus])
|
||||||
AC_MSG_RESULT([ usb : $xenable_intf_usb])
|
AC_MSG_RESULT([ usb : $xenable_intf_usb])
|
||||||
AC_MSG_RESULT([ lipmi : $xenable_intf_lipmi])
|
AC_MSG_RESULT([ lipmi : $xenable_intf_lipmi])
|
||||||
AC_MSG_RESULT([ serial : $xenable_intf_serial])
|
AC_MSG_RESULT([ serial : $xenable_intf_serial])
|
||||||
|
@ -27,9 +27,9 @@ TRAPD_BMC_CONF="${SNMPD_BMC_CONF_DIR}/snmptrapd.local.conf"
|
|||||||
TRAPD_CONF="/etc/snmp/snmptrapd.conf"
|
TRAPD_CONF="/etc/snmp/snmptrapd.conf"
|
||||||
|
|
||||||
LOCKFILE="/var/lock/subsys/bmc-snmp-proxy"
|
LOCKFILE="/var/lock/subsys/bmc-snmp-proxy"
|
||||||
BMC_INFO="/var/run/bmc-info"
|
BMC_INFO="/run/bmc-info"
|
||||||
|
|
||||||
IPMITOOL=`which ipmitool`
|
IPMITOOL=$(which ipmitool)
|
||||||
|
|
||||||
#Default config
|
#Default config
|
||||||
BMC_COMMUNITY="public"
|
BMC_COMMUNITY="public"
|
||||||
@ -158,7 +158,7 @@ pick_alert_dest()
|
|||||||
{
|
{
|
||||||
test_ip="$1"
|
test_ip="$1"
|
||||||
# We have 4 IPv4 and 4 IPv6 alert dest. We will set IPv4 for now.
|
# We have 4 IPv4 and 4 IPv6 alert dest. We will set IPv4 for now.
|
||||||
for ALERT_DEST in `seq 1 4`
|
for ALERT_DEST in $(seq 1 4)
|
||||||
do
|
do
|
||||||
temp_ip=$(${IPMITOOL} lan alert print ${CHANNEL} ${ALERT_DEST}\
|
temp_ip=$(${IPMITOOL} lan alert print ${CHANNEL} ${ALERT_DEST}\
|
||||||
2>/dev/null| sed -n "s#^Alert IP Address.*: ##p")
|
2>/dev/null| sed -n "s#^Alert IP Address.*: ##p")
|
||||||
@ -178,7 +178,7 @@ config_bmc_alert_dest()
|
|||||||
{
|
{
|
||||||
# call with enable|disable
|
# call with enable|disable
|
||||||
# Pick the first active LAN channel
|
# Pick the first active LAN channel
|
||||||
for CHANNEL in `seq 1 14`
|
for CHANNEL in $(seq 1 14)
|
||||||
do
|
do
|
||||||
[ $(${IPMITOOL} -I open channel info ${CHANNEL} 2>/dev/null \
|
[ $(${IPMITOOL} -I open channel info ${CHANNEL} 2>/dev/null \
|
||||||
| grep -q "802\.3") ] || break
|
| grep -q "802\.3") ] || break
|
||||||
|
@ -5,7 +5,7 @@ After=exchange-bmc-os-info.service
|
|||||||
Requires=exchange-bmc-os-info.service
|
Requires=exchange-bmc-os-info.service
|
||||||
PartOf=exchange-bmc-os-info.service
|
PartOf=exchange-bmc-os-info.service
|
||||||
|
|
||||||
ConditionPathExists=/var/run/bmc-info
|
ConditionPathExists=/run/bmc-info
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
# Description: Script to set OS information in the BMC; fetch BMC IP/URL
|
# Description: Script to set OS information in the BMC; fetch BMC IP/URL
|
||||||
# and set in the OS for use by other scripts/user.
|
# and set in the OS for use by other scripts/user.
|
||||||
#
|
#
|
||||||
# BMC IP and URL are made available in /var/run/bmc-info
|
# BMC IP and URL are made available in /run/bmc-info
|
||||||
#
|
#
|
||||||
# Example to launch BMC web-interface:
|
# Example to launch BMC web-interface:
|
||||||
# # . /var/run/bmc-info
|
# # . /run/bmc-info
|
||||||
# # xdg-open $BMC_URL
|
# # xdg-open $BMC_URL
|
||||||
#
|
#
|
||||||
# See here for details:
|
# See here for details:
|
||||||
@ -42,7 +42,7 @@
|
|||||||
#############################################################################
|
#############################################################################
|
||||||
CONFIGFILE=/etc/sysconfig/exchange-bmc-os-info
|
CONFIGFILE=/etc/sysconfig/exchange-bmc-os-info
|
||||||
IPMI_TOOL=/usr/bin/ipmitool
|
IPMI_TOOL=/usr/bin/ipmitool
|
||||||
BMC_INFO=/var/run/bmc-info
|
BMC_INFO=/run/bmc-info
|
||||||
|
|
||||||
# BMC Manufacturer ID used in 'oem_set_os_version' and 'oem_get_bmc_url'
|
# BMC Manufacturer ID used in 'oem_set_os_version' and 'oem_get_bmc_url'
|
||||||
DELL="674"
|
DELL="674"
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Exchange Information between BMC and OS
|
Description=Exchange Information between BMC and OS
|
||||||
After=ipmi.service network.target
|
After=network.target
|
||||||
Requires=ipmi.service
|
AssertFileIsExecutable=/usr/bin/ipmitool
|
||||||
|
AssertPathExistsGlob=/dev/ipmi*
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
@ -22,7 +22,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|||||||
DESC="IPMI event daemon"
|
DESC="IPMI event daemon"
|
||||||
NAME=ipmievd
|
NAME=ipmievd
|
||||||
DAEMON=/usr/sbin/$NAME
|
DAEMON=/usr/sbin/$NAME
|
||||||
PIDFILE=/var/run/$NAME.pid
|
PIDFILE=/run/$NAME.pid
|
||||||
SCRIPTNAME=/etc/init.d/$NAME
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
|
||||||
# Gracefully exit if the package has been removed.
|
# Gracefully exit if the package has been removed.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x01","0x00","Chassis Number","R","R","0x00","CPU shutdown - Potential cause "triple fault" a software address problem"
|
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x01","0x00","Chassis Number","R","R","0x00","CPU shutdown - Potential cause 'triple fault' a software address problem"
|
||||||
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x02","0x01","Chassis Number","Failed Memory Card","Spare Memory Card","0x00","Memory Mirrored Failover Occurred - System running from mirrored memory image"
|
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x02","0x01","Chassis Number","Failed Memory Card","Spare Memory Card","0x00","Memory Mirrored Failover Occurred - System running from mirrored memory image"
|
||||||
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x02","0x04","Chassis Number","Memory Card","Completion Code (0x00=Success)","0x00","Memory hot replace event"
|
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x02","0x04","Chassis Number","Memory Card","Completion Code (0x00=Success)","0x00","Memory hot replace event"
|
||||||
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x02","0x05","Chassis Number","Memory Card","Memory Size (in 512MB units)","0x00","Memory hot add event"
|
"0xC1","XX","XX","XX","XX","XX","XX","XX","0x02","0x05","Chassis Number","Memory Card","Memory Size (in 512MB units)","0x00","Memory hot add event"
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
EXTRA_DIST = pkginfo.in prototype.in \
|
EXTRA_DIST = pkginfo.in prototype.in \
|
||||||
ipmitool.spec.in rpmmacros.in rpmrc
|
ipmitool.spec.in
|
||||||
|
|
||||||
dist-hook: pkginfo prototype rpmmacros
|
dist-hook: pkginfo prototype
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
|
%define debug_package %{nil}
|
||||||
|
|
||||||
Name: ipmitool
|
Name: ipmitool
|
||||||
Summary: ipmitool - Utility for IPMI control
|
Summary: ipmitool - Utility for IPMI control
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Release: @RPM_RELEASE@%{?_distro:.%{_distro}}
|
Release: @RPM_RELEASE@%{?_distro:.%{_distro}}
|
||||||
License: BSD
|
License: BSD
|
||||||
Group: Utilities
|
Group: Utilities
|
||||||
Packager: Jim Mankovich <jmank@hp.com>
|
#Packager: PackagerName <packager@example.com>
|
||||||
|
Distribution: GitHub Build
|
||||||
Source: %{name}-%{version}.tar.gz
|
Source: %{name}-%{version}.tar.gz
|
||||||
Buildroot: /var/tmp/ipmitool-root
|
Buildroot: /var/tmp/ipmitool-root
|
||||||
|
|
||||||
@ -31,7 +34,7 @@ fi
|
|||||||
%setup
|
%setup
|
||||||
|
|
||||||
%build
|
%build
|
||||||
./configure --with-kerneldir \
|
./configure \
|
||||||
--with-rpm-distro=@DISTRO@ \
|
--with-rpm-distro=@DISTRO@ \
|
||||||
--prefix=%{_prefix} \
|
--prefix=%{_prefix} \
|
||||||
--bindir=%{_bindir} \
|
--bindir=%{_bindir} \
|
||||||
@ -56,11 +59,632 @@ fi
|
|||||||
%attr(755,root,root) %{_bindir}/*
|
%attr(755,root,root) %{_bindir}/*
|
||||||
%attr(755,root,root) %{_sbindir}/*
|
%attr(755,root,root) %{_sbindir}/*
|
||||||
%{_datadir}/ipmitool/*
|
%{_datadir}/ipmitool/*
|
||||||
|
%{_datadir}/misc/*
|
||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
%doc %{_datadir}/doc/ipmitool
|
%doc %{_datadir}/doc/ipmitool
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Oct 8 2016 <gilles.buloz@kontron.com> 1.8.18-1
|
||||||
|
- Add mac2str() and str2mac() to print/parse MAC address
|
||||||
|
- Change formatting, remove commented-out code in
|
||||||
|
src/plugins/imb/imbapi.c
|
||||||
|
- Export find_lan_channel() as global
|
||||||
|
- Expose _ipmi_get_channel_info()
|
||||||
|
- Extend buf2str to allow separator
|
||||||
|
- Fix indentation of #define in src/plugins/imb/imbapi.c
|
||||||
|
- Fix missing `goto out_free;` when ipmi_parse_hex() returns (-1)
|
||||||
|
- Fix warning for buf2str argument
|
||||||
|
- ID 408 - fix sel list last X listing
|
||||||
|
- ID: 38 - Protocol violating SOL retries when talking to
|
||||||
|
SIMSO-HTC
|
||||||
|
- ID: 459 - Fix reading FRU on Artesyn (Emerson) shelf manager,
|
||||||
|
MF105.
|
||||||
|
- ID: 464 - ipmievd crash fix in log_event
|
||||||
|
- ID:230 - check return value of malloc() in lib/ipmi_ekanalyzer.c
|
||||||
|
- ID:261 - Fix err. output consistency for % ipmitool chassis
|
||||||
|
INV_PARAM;
|
||||||
|
- ID:287 - Fix print-out of DDR3 SDRAM Serial Number
|
||||||
|
- ID:287 - Remove trailing white-spaces from dimm_spd.c
|
||||||
|
- ID:289 - bmx-snmp-proxy: PEF alerting does not work for
|
||||||
|
multiple destinations
|
||||||
|
- ID:312 - BREAKING CHANGE - Re-design of PEF user interface
|
||||||
|
- ID:312 - Fix bitmask in _ipmi_set_pef_policy_entry()
|
||||||
|
- ID:335 - Check return value of fseek(), prevent segfault
|
||||||
|
- ID:335 - Check return value of fseek(), prevent segfault
|
||||||
|
- ID:355 - Comment out statement without effect in lib/ipmi_sel.c
|
||||||
|
- ID:355 - Fix 'missing initializer' in struct lan_param
|
||||||
|
- ID:355 - Fix ``warning: ISO C forbids zero-size array 'data'''
|
||||||
|
- ID:355 - Fix different pointer type in lib/ipmi_picmg.c
|
||||||
|
- ID:355 - Fix missing struct initializers in lib/ipmi_firewall.c
|
||||||
|
- ID:355 - Fix printf format in lib/ipmi_sunoem.c
|
||||||
|
- ID:355 - Fix printf() related warnings in lib/ipmi_delloem.c
|
||||||
|
- ID:355 - Fix signedness warnings in lib/ipmi_sdr.c
|
||||||
|
- ID:355 - Fix statements without effect in lib/ipmi_ekanalyzer.c
|
||||||
|
- ID:355 - Move section_id from ipmi_fru. to ipmi_fru.c
|
||||||
|
- ID:355 - Replace DEBUG() macro with lprintf(LOG_DEBUG, ...)
|
||||||
|
- ID:375 - Add lan6 subcommand to handle IPv6 LAN parameters
|
||||||
|
- ID:400 - Add support for VITA-specific sensor types and events.
|
||||||
|
- ID:441 - Add support for HMAC_MD5 and HMAC_SHA256
|
||||||
|
- ID:443 - Disable USB driver by default on non-Linux systems
|
||||||
|
- ID:444 - Cleanup of defaults in configure.ac
|
||||||
|
- ID:445 - Fix of compilation on FreeBSD
|
||||||
|
- ID:446 - Fix broken firewall reset iterator
|
||||||
|
- ID:447 - Fix access beyond array limits in serial_terminal
|
||||||
|
- ID:449 - ipmitool close console session for sol deactivate
|
||||||
|
command
|
||||||
|
- ID:451 - Modify the memory ecc error display of SEL for new
|
||||||
|
supermicro motherboards.
|
||||||
|
- ID:452 - Add PICMG extension 5.x for PICMG extension check
|
||||||
|
- ID:454 - Add support for PICMG 3.1 R2.0 Link Types and Link
|
||||||
|
Classes.
|
||||||
|
- ID:456 - Unable to disable the VLAN ID using ipmitool
|
||||||
|
- ID:457 - Display User ID enable/disable status
|
||||||
|
- ID:463 - Removal of Nokia Siemens Networks
|
||||||
|
- ID:465 - Supermicro memory ecc Modify the memory ecc error
|
||||||
|
display of SEL for new supermicro boards.
|
||||||
|
- Moved ipmi_parse_hex() to helper.c
|
||||||
|
- Re-work ipmi_mc_get_guid() and turn it into reusable code
|
||||||
|
- Revert "ID:335 - Check return value of fseek(), prevent segfault"
|
||||||
|
- Rewrite code with the notion that Kg is binary data, not string
|
||||||
|
|
||||||
|
* Sun May 1 2016 <gilles.buloz@kontron.com> 1.8.17-1
|
||||||
|
- Add INSTALL and NEWS, mandated by autoconf
|
||||||
|
- Added missing ipmi_sel_supermicro.h to template Makefile.am
|
||||||
|
- Check rsp->data_len in ipmi_sel_get_info()
|
||||||
|
- Fix "redirecting incorrect #include <sys/poll.h> to <poll.h>"
|
||||||
|
warning with musl libc
|
||||||
|
- Fix automake compatibility warnings
|
||||||
|
- Fix implicit declaration of function
|
||||||
|
'get_nic_selection_mode_12g' in lib/ipmi_delloem.c
|
||||||
|
- Fix implicit declaration of function 'ipmi_get_oem' in
|
||||||
|
src/plugins/imb/imb.c
|
||||||
|
- Fix implicit declaration of function 'ipmi_get_oem' in
|
||||||
|
src/plugins/lanplus/lanplus.c
|
||||||
|
- Fix implicit declaration of function 'ipmi_get_oem' in
|
||||||
|
src/plugins/open/open.c
|
||||||
|
- Fix implicit declarations of functions 'HpmfwupgPreUpgradeCheck'
|
||||||
|
and 'ipmi_intf_get_max_request_data_size' in lib/ipmi_hpmfwupg.c
|
||||||
|
- Fix implicit declarations of functions
|
||||||
|
'ipmi_intf_set_max_request_data_size' and
|
||||||
|
'ipmi_intf_set_max_response_data_size' in lib/hpm2.c
|
||||||
|
- Fix implicit function declaration of
|
||||||
|
ipmi_intf_get_max_response_data_size in lib/ipmi_sdr.c
|
||||||
|
- Fix several implicit declarations of functions in
|
||||||
|
lib/ipmi_main.c
|
||||||
|
- Fix several implicit function declarations in lib/ipmi_fru.c
|
||||||
|
- Fix warning: suggest parentheses around '+' inside '<<'
|
||||||
|
in lib/ipmi_main.c
|
||||||
|
- Fix warning: suggest parentheses around arithmetic in operand of
|
||||||
|
'|' in include/ipmitool/hpm2
|
||||||
|
- Get rid of old INCLUDES macro, use AM_CPPFLAGS instead.
|
||||||
|
- ID 440 - Fix 'unknown type name fd_set error.
|
||||||
|
- ID 440 - remove obsolete headers from lib/ipmi_sunoem.c
|
||||||
|
- ID:322 - let 'ekanalyzer frushow' run without a working
|
||||||
|
IPMI target
|
||||||
|
- ID:355 - Add #include <strings.h> to lib/ipmi_sel.c
|
||||||
|
- ID:355 - Add macros and #include and reduce number of warnings
|
||||||
|
- ID:355 - Change CFLAG -std=c99 to -std=gnu99
|
||||||
|
- ID:355 - Move Super Micro stuff into dedicated header file
|
||||||
|
- ID:355 - Remove declared, but not used variables
|
||||||
|
- ID:404 - Edit FRU information update problem
|
||||||
|
- ID:405 - Use meaningful Generator ID for "ipmitool sel add"
|
||||||
|
- ID:407 - Avoid assert on mismatched session ID
|
||||||
|
- ID:409 - Fix IPv6 socket creation on Windows/Cygwin.
|
||||||
|
- ID:410 - Disable USB interface for Windows/Cygwin by default.
|
||||||
|
- ID:410 - Enable/disable USB interface by "auto"
|
||||||
|
- ID:411 - Fix HPM.2 revision check for R1.1 and subsequent
|
||||||
|
specification revisions.
|
||||||
|
- ID:412 - Check errors when setting a user password.
|
||||||
|
- ID:413 - Print new line chne character when setting user
|
||||||
|
privilege.
|
||||||
|
- ID:414 - ekanalyzer frushow fails to show 'Product Info'
|
||||||
|
correctly
|
||||||
|
- ID:417 - Fix some typos
|
||||||
|
- ID:418 - Fix Compiling under Mac OS X
|
||||||
|
- ID:419 - List dummy.h in Makefile.am, so it gets included in
|
||||||
|
a release tarball
|
||||||
|
- ID:421 - Fix memleak for sol output
|
||||||
|
- ID:423 - Don't assume internal use area is present in ekanalyzer
|
||||||
|
- ID:424 - Update dimm_spd.c with data from the latest JEDEC List
|
||||||
|
- ID:425 - Disable USB interface for OS X/darwin
|
||||||
|
- ID:426 - Fallback to run-time detection of PAGESIZE if
|
||||||
|
compile-time detection is not supported
|
||||||
|
- ID:426 - Include sys/socket.h instead of asm/socket.h
|
||||||
|
- ID:426 - Include wchar.h instead of defining wchar_t ourselves
|
||||||
|
- ID:427 - Cleanup comment in ipmi_sdr_get_header()
|
||||||
|
- ID:427 - The first two bytes of dumped raw SDR data is wrong.
|
||||||
|
- ID:428 - Update IANA numbers / Product Name for IBM and ADLINK
|
||||||
|
- ID:430 - Change Nokia Siemens Networks to Nokia Solutions
|
||||||
|
and Networks
|
||||||
|
- ID:431 - Fix correct interpretation of led states
|
||||||
|
- ID:437 - sel: Fix "sel time set <time>"
|
||||||
|
- Make bootstrap script part of dist packages
|
||||||
|
- Remove #if 0 code aka not-compiled-in
|
||||||
|
- Remove trailing white-spaces in lib/log.c
|
||||||
|
- git-ignore autoconf-generated files
|
||||||
|
|
||||||
|
* Sun Nov 22 2015 <gilles.buloz@kontron.com> 1.8.16-1
|
||||||
|
- Add _ipmi_get_channel_access() and _ipmi_get_channel_info()
|
||||||
|
- Add _ipmi_get_user_access() and _ipmi_set_user_access()
|
||||||
|
- Add _ipmi_get_user_name()
|
||||||
|
- Add _ipmi_set_channel_access() function
|
||||||
|
- Add _ipmi_set_user_password() function
|
||||||
|
- Add limits check in get_cmdline_macaddr()
|
||||||
|
- Change expression in ipmi_pef_get_info() in order to silence Coverity
|
||||||
|
- Change expression in ipmi_pef_list_policies() in order to silence Coverity
|
||||||
|
- Code cleanup in ipmi_user_main()
|
||||||
|
- Create ask_password() and re-use code
|
||||||
|
- Delete dead code from ipmi_sunoem_echo() - CID#1261338
|
||||||
|
- Don't output pidfile before parsing command line arguments
|
||||||
|
- Don't use tmp variable since it's not necessary in ipmi_user_test()
|
||||||
|
- Fix 'user help' output
|
||||||
|
- Fix Assign instead of compare in KfwumGetDeviceInfo() - CID#1149034
|
||||||
|
- Fix Identical code for different branches in ipmi_tsol_main() -
|
||||||
|
CID#1261346
|
||||||
|
- Fix big parameter passed by value in ipmi_sel_oem_match() - CID#1261347
|
||||||
|
- Fix dead code in ipmi_firewall_reset() - CID#1261342
|
||||||
|
- Fix eval logic in ipmi_user_priv()
|
||||||
|
- Fix file descriptor leak in ipmi_exec_main() - CID#1149040
|
||||||
|
- Fix identical code for diff branches in DellOEM - CID#1261326
|
||||||
|
- Fix memory leak in get_supermicro_evt_desc()
|
||||||
|
- Fix memory leak in ipmi_ek_display_board_info_area() - CID#1149051
|
||||||
|
- Fix missing return in ipmi_kontronoem_main() - CID#1261317
|
||||||
|
- Fix of previous commit - memset() expects pointer
|
||||||
|
- Fix out-of-bound-reads in get_supermicro_evt_desc()
|
||||||
|
- Fix resource leak in fru_area_print_board() - CDI#1149048
|
||||||
|
- Fix resource leak in fru_area_print_chassis() - CID#1149047
|
||||||
|
- Fix resource leak in fru_area_print_product() - CID#1149046
|
||||||
|
- Fix resource leak in ipmi_kontron_set_serial_number() - CID#1149041
|
||||||
|
- Fix typo vlan->VLAN in ipmi_lan_set_vlan_id() and
|
||||||
|
ipmi_lan_set_vlan_priority()
|
||||||
|
- Fix uninitialized struct in ipmi_fru_upg_ekeying() - CID#1149065
|
||||||
|
- Fix user input validation in Channel and User sub-commands
|
||||||
|
- Fix wrong size argument in ipmi_sdr_list_cache_fromfile() - CID#1149056
|
||||||
|
- Fix/remove pointer cast in _ipmi_set_user_access()
|
||||||
|
- Hook functions in ipmi_user to _ipmi_set_user_password()
|
||||||
|
- Hook ipmi_get_channel_info() to _ipmi_get_*()
|
||||||
|
- Hook ipmi_get_channel_medium() to new _ipmi_get_*() functions
|
||||||
|
- Hook ipmi_lan_set_password() to _ipmi_set_user_password()
|
||||||
|
- Hook ipmi_print_user_list() and friends to _ipmi_* functions
|
||||||
|
- Hook ipmi_set_alert_enable() to _ipmi_*()
|
||||||
|
- Hook ipmi_set_user_access() to _ipmi_set_user_access()
|
||||||
|
- Hook ipmi_user_priv() to _ipmi_set_user_access()
|
||||||
|
- ID:307 - Intel I82751 super pass through mode fixup
|
||||||
|
- ID:355 - Fix compiler warnings for Dummy Interface
|
||||||
|
- ID:380 - raw commands override retry and timeout values
|
||||||
|
- ID:319 - Interface safe re-open
|
||||||
|
- ID:320 - Add VITA 46.11 support
|
||||||
|
- ID:333 - Set read timeout to 15s in OpenIPMI interface
|
||||||
|
- ID:336 - ipmitool does not fall back to IPv4 for IPMI v2 / RMCP+ sessions
|
||||||
|
- ID:343 - Print actual sensor thresholds in 'sensors' comand
|
||||||
|
- ID:343 - Remove AC_FUNC_MALLOC
|
||||||
|
- ID:344 - Fix HPM.2 long message support
|
||||||
|
- ID:345 - Do not do several close session retries when catching SIGINT
|
||||||
|
- ID:346 - lib/ipmi_sdradd.c ipmi_sdr_read_record has a file descriptor leak
|
||||||
|
- ID:347 - Incorrect reserved channel number
|
||||||
|
- ID:348 - Add support for the "System Firmware Version"
|
||||||
|
- ID:349 - user set password - add option to choose 16/20 byte password
|
||||||
|
- ID:354 - Replace obsolete u_int with uint32_t in dimm_spd.c
|
||||||
|
- ID:354 - Replace obsolete u_int[0-9]+_t with standardized types in Free
|
||||||
|
iface
|
||||||
|
- ID:354 - forcefully switch to C99 and more strict CFLAGS
|
||||||
|
- ID:354 - replace/drop caddr_t in IMB
|
||||||
|
- ID:354 - struct member h_addr has been replaced
|
||||||
|
- ID:354 - uint8_t >= 0 is always true, don't test it
|
||||||
|
- ID:355 - Fix Enumeration value not handled in ipmi_get_event_desc()
|
||||||
|
- ID:355 - Fix ``ISO C forbids omitting the middle term of a ?: expression''
|
||||||
|
- ID:355 - Fix ``obsolete use of designated initializer with ¿:¿'' warning
|
||||||
|
- ID:355 - Fix comparison of unsigned expression
|
||||||
|
- ID:355 - Fix compiler warnings
|
||||||
|
- ID:355 - Fix compiler warnings in dimm_spd.c
|
||||||
|
- ID:355 - Fix couple compiler warnings in ipmi_lanp.h
|
||||||
|
- ID:355 - Fix formatting warning in get_cmdline_ipaddr()
|
||||||
|
- ID:355 - Fix zero-length format string warning in
|
||||||
|
get_supermicro_evt_desc()
|
||||||
|
- ID:355 - Remove defined but unused variable in _set_command_enables()
|
||||||
|
- ID:355 - remove unused variables from ipmi_dcmi.c
|
||||||
|
- ID:357 - out-of-bound access in DDR4 code ID:356 - DIMM4 Die Count is
|
||||||
|
unreachable
|
||||||
|
- ID:357 - out-of-bound access in DDR4 code
|
||||||
|
- ID:358 - check data length in else branch of ipmi_spd_print()
|
||||||
|
- ID:361 - Add a OEM IANA information
|
||||||
|
- ID:363 - Node Manager feature patch.
|
||||||
|
- ID:363 - fix Coverity issues in NM implementation
|
||||||
|
- ID:364 - Fix for serial-basic interface bridging
|
||||||
|
- ID:365 - Fix for ipmitool crash when using serial-terminal interface
|
||||||
|
- ID:366 - Properly clean LAN and LAN+ interfaces on close
|
||||||
|
- ID:367 - Fix building of non-bridged LAN interface commands
|
||||||
|
- ID:368 - Fix handling of bridging-related parameters
|
||||||
|
- ID:369 - Fix lanplus interface bridging and response matching
|
||||||
|
- ID:370 - add anonymous union support in CFLAGS for older gcc
|
||||||
|
- ID:371 - add ericsson oem
|
||||||
|
- ID:373 - Fix compilation of IMB on Windows
|
||||||
|
- ID:374 - Check/set LED Duration correctly
|
||||||
|
- ID:376 - Add means to configure "Bad Password Threshold"
|
||||||
|
- ID:381 - Script to log installation status as SEL events
|
||||||
|
- ID:382 - Fix memcpy() params in HpmFwupgActionUploadFirmware()
|
||||||
|
- ID:383 - Fix compile-time error in src/plugins/lan/lan.c
|
||||||
|
- ID:384 - Fix compilation under cygwin64
|
||||||
|
- ID:388 - Fix Error message always printed if BMC does not support VITA
|
||||||
|
- ID:388 - Handle ccode 0xCC as well in VITA discovery
|
||||||
|
- ID:388 - Turn all messages into LOG_INFO in VITA discovery
|
||||||
|
- ID:389 - Add on of Advantech IANA number
|
||||||
|
- ID:390 - Support for new Communication Interface (USB Medium)
|
||||||
|
- ID:391 - changing data_len from 17 to 16 according to ipmi spec 22.29,
|
||||||
|
first byte is completion code
|
||||||
|
- ID:392 - _ipmi_get_user_name() work-around for some BMCs
|
||||||
|
- ID:393 - ipmitool man page addition for Node Manager support.
|
||||||
|
- ID:394 - close fp if isn't NULL and set it NULL afterwards in USB plugin
|
||||||
|
- ID:394 - plugins/usb: Fix probe for SCSI devices
|
||||||
|
- ID:395 - Fix fru string without resizing it
|
||||||
|
- ID:396 - Fixed invalid length check in picmg led cap command.
|
||||||
|
- ID:397 - Fixed picmg policy set command.
|
||||||
|
- ID:398 - Fixed channel setaccess command.
|
||||||
|
- ID:399 - Fixed channel getciphers command.
|
||||||
|
- ID:401 - Fixed 30 second delay when activating SOL on 'dumb' Intel MACs.
|
||||||
|
- ID:402 - Misguiding error print-out when using some 'lan' commands.
|
||||||
|
- Init user_access_t struct in ipmi_user_priv()
|
||||||
|
- Make user User Privilege Limit is within range
|
||||||
|
- Node Manager Feature, correct 1268194 missing break.
|
||||||
|
- Output pidfile only in verbose mode
|
||||||
|
- Print error message to STDERR in ipmi_channel.c
|
||||||
|
- Re-work 'channel getaccess' and 'channel setaccess'
|
||||||
|
- Re-work ccode eval in ipmi_get_channel_medium()
|
||||||
|
- Remove commented-out code in ipmi_picmg_clk_set() - CID#1261339
|
||||||
|
- Remove dead code - rsp can't be NULL at this point - CID#1149005
|
||||||
|
- Remove dead code in fru_area_print_board() - CID#1149001
|
||||||
|
- Remove dead code in fru_area_print_chassis() - CID#1149000
|
||||||
|
- Remove dead code in fru_area_print_product() - CID#1148999
|
||||||
|
- Remove dead(duplicate) code from ipmi_sol_main() - CID#1148996
|
||||||
|
- Remove get_channel_access_rsp and get_channel_info_rsp structs
|
||||||
|
- Remove ipmi_user_set_password()
|
||||||
|
- Remove length checks in get_supermicro_evt_desc()
|
||||||
|
- Remove redundant user-input conversion from ipmi_sel_delete()
|
||||||
|
- Remove trailing white-spaces in ipmi_user.c
|
||||||
|
- Remove trailing white-spaces in ipmi_user.c
|
||||||
|
- Remove trailing white-spaces in src/plugins/dummy/dummy.c
|
||||||
|
- Remove unused variable from ipmi_get_channel_cipher_suites()
|
||||||
|
- Replace deprecated bzero() with memset()
|
||||||
|
- Replace s6_addr16 with s6_addr since Mac OS X does not have it
|
||||||
|
- Rewrite ipmi_set_channel_access()
|
||||||
|
- Split ipmi_user_main() into smaller functions
|
||||||
|
- ipmi_print_user_summary() to utilize _ipmi_get_user_access()
|
||||||
|
- ipmitool delloem: ipmitool delloem extension always return success - fix
|
||||||
|
it
|
||||||
|
|
||||||
|
* Mon Nov 24 2014 <gilles.buloz@kontron.com> 1.8.15-1
|
||||||
|
- 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
|
||||||
|
|
||||||
|
* Mon May 5 2014 <gilles.buloz@kontron.com> 1.8.14-1
|
||||||
|
- 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
|
||||||
|
|
||||||
|
* Mon Sep 9 2013 <gilles.buloz@kontron.com> 1.8.13-1
|
||||||
|
- ID: 3611905 - Direct Serial Basic/Terminal Mode Interface drivers
|
||||||
|
- ID: 3577766 - configure's knobs and switches don't work
|
||||||
|
- ID: 3611253 - do not override OS-default values for interfaces
|
||||||
|
- ID: 65 - Fixes for configure.in for cross compilation
|
||||||
|
- ID: 3571153 - OpenIPMI/ipmievd fails to compile on Solaris
|
||||||
|
- numerous ipmitool man page updates
|
||||||
|
- ID: 3611226 - Bridging support for PICMG Platforms
|
||||||
|
- Add support for getsysinfo/setsysinfo commands to ipmi mc
|
||||||
|
- Cleanup Dell OEM code to use new sysinfo interface
|
||||||
|
- ID: 93 - str-to-int conversion is weak
|
||||||
|
- ID: 3582307 - ipmi_fru - ipmi_fru_main() return codes
|
||||||
|
- ID: 3582310 - ipmi_fru - ipmi_fru_main() - misuse of printf()
|
||||||
|
- ID: 3576213 - ipmi_fru - unused variable
|
||||||
|
- ID: 3578276 - ipmi_fru - free() on freed memory possible
|
||||||
|
- ID: 3578275 - ipmi_fru - memory leaks
|
||||||
|
- ID: 3528271 - ipmi_fru - possible *flow via FRUID
|
||||||
|
- ID: 3578277 - ipmi_fru - possible NULL pointer
|
||||||
|
- ID: 3612372 - Recognize Broadcom IANA number and BCM5725 product
|
||||||
|
- ID: 3608758 - add IPMI_NETFN_OEM
|
||||||
|
- ID: 143 - Reversed 'channel authcap' capabilities
|
||||||
|
Fixes reversed IPMIv1.5/2.0 'channel authcap' capabilities
|
||||||
|
- ID: 3587318 - "dcmi discover" is not DCMI 1.5 compatible
|
||||||
|
- ID: 3608757 - ipmi_fru - various fixes
|
||||||
|
- ID: 3598203 - 'mc getsysinfo|setsysinfo' needs a bit of re-work
|
||||||
|
- ID: 3597782 - ipmi_mc - sysinfo_param() has two consecutive returns
|
||||||
|
- ID: 3597781 - 'mc getsysinfo|setsysinfo' help has typos
|
||||||
|
- ID: 3608763 - ipmi_sdr - code cleanup & output display cleanup
|
||||||
|
- ID: 3610286 - ipmi_sdr - ipmi_sdr_print_type - incorrect eval
|
||||||
|
- ID: 3600930 - ipmi_sdr - code cleanup
|
||||||
|
- ID: 3602439 - ipmi_sdr - memory leaks
|
||||||
|
- ID: 3595199 - ipmi_sdr - Add support for 'ipmitool sdr <list|elist> help'
|
||||||
|
- ID: 3592773 - 'ipmitool sdr info'; prints incorrect info
|
||||||
|
- ID: 3592770 - 'ipmitool sdr list|elist INV_INPUT' return code
|
||||||
|
- ID: 3577159 - ipmi_sdr - uint32_t cast to uint8_t and back
|
||||||
|
- ID: 3528368 - ipmi_sdr - possible int *flow
|
||||||
|
- ID: 226 - ipmi_sdradd - typo
|
||||||
|
- ID: 258 - ipmi_sdradd - error printed on STDOUT
|
||||||
|
- Fixed ipmievd start under systemd.
|
||||||
|
- ID: 3608760 - Add bswap.h to ipmi_chassis.c and ipmi_pef.c
|
||||||
|
- ID: 3564701 - ipmitool 1.8.12 doesn't build on big endian architectures
|
||||||
|
- ID: 3600907 - defined value for "Chassis may not support Force Identify"
|
||||||
|
- ID: 256 - ipmitool could crash when IPv6 address is returned
|
||||||
|
- ID: 211 - 'lib/ipmi_dcmi.c' - typo & error printed on STDOUT
|
||||||
|
- ID: 3612237 - If DCMI command fails, incorrect completion code is printed
|
||||||
|
- ID: 3608149 - ipmitool - set pointer to NULL after free()
|
||||||
|
- ID: 3603419 - DCMI - waste of resources
|
||||||
|
- ID: 3600908 - DMCI - crash in ipmi_print_sensor_info(), NULL ref
|
||||||
|
- ID: 3609985 - delloem : Wrong MAC returned when flex addressing is enabled
|
||||||
|
- ID: 113 - delloem exec file won't handle more than one command
|
||||||
|
- ID: 28 - delloem - clean up the code
|
||||||
|
- ID: 3608261 - delloem - code formatting
|
||||||
|
- ID: 3528247 - delloem - fix possible *int flows
|
||||||
|
- ID: 3600910 - delloem - code cleanup
|
||||||
|
- ID: 3576211 - delloem - unused variable
|
||||||
|
- ID: 3578022 - delloem - fix typos
|
||||||
|
- ID: 263 - ipmi_ek* - cleanup
|
||||||
|
- ID: 3308765 - ipmi_ek* - cleanup
|
||||||
|
- ID: 3586228 - ipmi_ek* - ipmi_ekanalyzer_usage() rework
|
||||||
|
- ID: 3528388 - ipmi_ek* - a typo in error message
|
||||||
|
- ID: 3576212 - ipmi_event - better rsp handling
|
||||||
|
- ID: 3607393 - ipmi_event - redundant '\n' in error message
|
||||||
|
- ID: 153 - ipmi_firewall - printf() used instead of lprintf()
|
||||||
|
- ID: 3608003 - ipmi_fru - atol() should be replaced with str2*()
|
||||||
|
- ID: 3600911 - ipmi_fru - fix multiple increments in args to printf
|
||||||
|
- ID: 3600914 - no more crash on no response. allow more send/recv loops of waiting.
|
||||||
|
- ID: 70 - Fixes and updates for ipmitool hpm
|
||||||
|
- ID: 3528308 - ipmi_hpmfwupg - possible int *flow
|
||||||
|
- ID: 3608762 - ipmi_hpmfwup - Fixed help messages for hpm command
|
||||||
|
- ID: 3607981 - ipmi_lanp - replace atoi() calls
|
||||||
|
- ID: 3607320 - ipmi_lanp - possible NULL reference
|
||||||
|
- ID: 3600926 - ipmi_lanp - code cleanup
|
||||||
|
- ID: 3613575 - memory leak - ipmi_password_file_read()
|
||||||
|
- ID: 3522740 - reading password from file is limited to 16byte passwords
|
||||||
|
- ID: 3613605 - ipmi_main - call free() on pointer to static data
|
||||||
|
- ID: 3608761 - ipmi_main - PICMG Get Device Locator was never run
|
||||||
|
- ID: 3577155 - ipmi_main' - memory leaks
|
||||||
|
- ID: 239 - typo in 'mc selftest', add details
|
||||||
|
- ID: 3597471 - ipmi_mc - needs a bit of re-work - rc, inv. options
|
||||||
|
- ID: 3597468 - ipmi_mc - print_mc_usage() prints to STDOUT
|
||||||
|
- ID: 3597469 - 'mc watchdog off' prints on STDERR, should be STDOUT
|
||||||
|
- ID: 3597470 - 'mc watchdog reset' prints on STDERR, should be STDOUT
|
||||||
|
- ID: 3611254 - OEM handle for Intel 82751 in SPT mode
|
||||||
|
- ID: 3600927 - change eval order of input param in ipmi_oem_setup()
|
||||||
|
- ID: 3600928 - ipmi_pef - code cleanup
|
||||||
|
- ID: 3592732 - ipmi_picmg.c - printf() misuse
|
||||||
|
- ID: 3528310 - ipmi_picmg.c - NULL reference
|
||||||
|
- ID: 3528347 - ipmi_raw.c - possible int *flow
|
||||||
|
- ID: 3587913 - Command % ipmitool raw help; returns 1
|
||||||
|
- Added code to support sensors on other luns (On behalf of Kontron Germany)
|
||||||
|
- ID: 3611912 - Add missing newlines when cvs output is specified
|
||||||
|
- ID: 244 - ipmi_sel - "0.0" displayed for unspecified threshold values
|
||||||
|
- ID: 3612371 - Typo in impi_sel debug output
|
||||||
|
- ID: 3016359 - ipmi_sel - Get SEL Alloc Information is incorrect
|
||||||
|
- ID: 3568976 - 'sel set time' behaviour is inconsistent
|
||||||
|
- ID: 3528371 - ipmi_sensor - possible int *flow
|
||||||
|
- ID: 3601265 - 'ipmitool sensor get' leaks memory
|
||||||
|
- ID: 3601106 - 'ipmitool sensor get NACname' output incorrect/inconsistent
|
||||||
|
- ID: 3608007 - ipmi_session - typo in error message
|
||||||
|
- ID: 101 - ipmi_sol - possible int *flow
|
||||||
|
- ID: 3600933 - ipmi_sol - use of deprecated bzero()
|
||||||
|
- ID: 3609472 - ipmi_sol - Add the instance to the SOL commands
|
||||||
|
- ID: 3588726 - 'ipmitool sol payload status ...;'segfaults on no rsp
|
||||||
|
- ID: 3522731 - ipmi_sol - ipmi_get_sol_info() returns always 0
|
||||||
|
- ID: 3613042 - add missing Entity IDs
|
||||||
|
- ID: 3611306 - ipmi_tsol - fix always fail in case of error
|
||||||
|
- ID: 259 - ipmi_user - memory leak
|
||||||
|
- ID: 260 - ipmi_user - replace atoi() call
|
||||||
|
- ID: 2871903 - ipmitool user priv incorrectly sets Link Auth
|
||||||
|
- ID: 3600960 - check the copy of password exists
|
||||||
|
- ID: 3609473 - Add assertion/deassertion to threshold events
|
||||||
|
- ID: 104 - ipmishell - possible int *flow
|
||||||
|
- ID: 262 - 'set' segfaults when no IPMI inf present
|
||||||
|
- ID: 257 ipmitool exec segfaults if invalid input given
|
||||||
|
- ID: 254 - Fix retry of authentication capabilities retrieval
|
||||||
|
- ID: 3611303 - lan - error check is missing braces
|
||||||
|
- ID: 253 - Fix lanplus retransmission
|
||||||
|
- ID: 212 - 'lib/ipmi_dcmi.c' - possible int *flow
|
||||||
|
- ID: 264 - incorrect array index in get_lan_param_select()
|
||||||
|
- ID: 269 - Fixes for configure.in for cross compilation
|
||||||
|
- ID: 267 - Corruption in "lan alert print" output
|
||||||
|
- ID: 41 - ipmi_sel_interpret() - clean up formatting, indentation
|
||||||
|
- ID: 242 - Incorrect DCMI Power Reading "IPMI timestamp" interpretation
|
||||||
|
- ID: 229 - 'lib/ipmi_ekanalyzer.c' - a typo ``Too few argument!''
|
||||||
|
- ID: 266 - file descriptor leak in ipmi_fwum and ipmi_ekanalyzer
|
||||||
|
- ID: 99 - 'lib/ipmi_sel.c' - possible int *flow
|
||||||
|
- ID: 222 - 'lib/ipmi_sdr.c' - a typo 'Not Reading' -> 'No Reading'
|
||||||
|
- ID: 35 - Script to setup redirection of SNMP to/from BMC
|
||||||
|
- ID: 273 - Reduce SOL Input buffer size by SOL header size
|
||||||
|
|
||||||
|
|
||||||
|
* Thu Aug 9 2012 <gilles.buloz@kontron.com> 1.8.12-1
|
||||||
|
- Added IPMB dual bridge support (no need for driver support)
|
||||||
|
- Enable compiler warnings and resolve all compiler warning so that
|
||||||
|
ipmitool compiles and links with no warning or error messages
|
||||||
|
- add ipmishell line to configure
|
||||||
|
- fail configure when no curses or readline is found
|
||||||
|
- support sensor bridging in free interface
|
||||||
|
- applied fix for issue #2865160 (AIX build)
|
||||||
|
- Document the ipmitool dcmi commands in the ipmitool man page
|
||||||
|
- Document that some commands are blocked by OpenIPMI. ID 2962306
|
||||||
|
- Document the -N and -R options per tracker ID 3489643
|
||||||
|
- fix manpage misdocumentation on cipher suite privilige configuration
|
||||||
|
- Add build support for Dell OEM commands
|
||||||
|
- Add new Dell OEM commands and update man page
|
||||||
|
- added hpm and fwum in man page
|
||||||
|
- man page update for fwum and hpm commands
|
||||||
|
- Added documentation for 'ime' operating mode, used to update Intel ME.
|
||||||
|
- add new -Y option to prompt user to enter kgkey
|
||||||
|
- Add DCMI module (Data Center Management Interface)
|
||||||
|
- fixed oem/iana data type to allow 24 bits definition
|
||||||
|
- Fixed AMC point-to-point record parsing in FRU
|
||||||
|
- Fixed detection of packing support in GCC
|
||||||
|
- Added packing support detection magic on all packed structures
|
||||||
|
in project
|
||||||
|
- Dell specific mac sub command is updated to support the latest 12G
|
||||||
|
Dell servers. Support for virtual mac is also implemented.
|
||||||
|
- Use consistent netfn/cmd for getsysinfo command
|
||||||
|
- Add Dell OEM network commands
|
||||||
|
- Resolve incorect Board Mfg Data due to incorrect date constant
|
||||||
|
- Update ipmi_fru.h to SMBIOS spec 2.6.1 - ID 2916398
|
||||||
|
- Support for analog readings in discrete sensors on HP platforms.
|
||||||
|
- Change device id mask (IPM_DEV_DEVICE_ID_REV_MASK) 0x07 for 0x0F.
|
||||||
|
As per in IPMI spec V2:
|
||||||
|
- Added PICMG clock e-keying and bused resource control identifiers
|
||||||
|
- Added PICMG major version (ATCA/AMC/uTCA) identifiers
|
||||||
|
- Correct Threshold/Discrete Sensor Display - Patch Tracker ID 3508759
|
||||||
|
- Sensor units now handle percentage units - ID 3014014
|
||||||
|
- Fixes ID 3421347 Sensor list command should use channel field from SDR
|
||||||
|
- Added packing directive for ARM cross compile with GCC 3.4.5,
|
||||||
|
otherwise the sdr structures gets padded and the pointer cast
|
||||||
|
result in incorrect alignement
|
||||||
|
- Added 'sdr fill sensors nosats' support to speed up SDR discovery
|
||||||
|
- Added SDR name display during discovery (with -v)
|
||||||
|
- Added support for sensor types - Processor related sensor
|
||||||
|
type 0x07, system incharectorization 0x20, Memory sensor type.
|
||||||
|
- Give more description for SEL which is generated for Uncorrectable
|
||||||
|
ECC and errors with respect to each Memory Bank,Card or DIMM.
|
||||||
|
The Sensor type supporting this are 0x0C and 0x10.
|
||||||
|
- Add more details about Version Change event (source of
|
||||||
|
firmware update)
|
||||||
|
- enhanced PICMG fru control
|
||||||
|
- Integrated Andy Wray's DDR3 SPD parser patch
|
||||||
|
- Adds function str2uint() to convert from string to uint32_t with
|
||||||
|
checks for valid input.
|
||||||
|
- Fix possible buffer overflow in buf2str()
|
||||||
|
- Fixes ID 3485004 - misuse of strtol()
|
||||||
|
- Replaces calls to strtol() with str2uchar() calls and adds error
|
||||||
|
messages if invalid input is given.
|
||||||
|
- Don't overwite the iflags bits prior to setting the boot parameters.
|
||||||
|
This fixes ipmitool so that
|
||||||
|
chassis bootdev bios clear-cmos=yes
|
||||||
|
will correctly clear the bios cmos.
|
||||||
|
- Clarify DCMI get limit activation (add if activate or not).
|
||||||
|
- Bug fixes for delloem lan command. This includes the support for 12G
|
||||||
|
Dell license and 12G LAN Specific command.
|
||||||
|
- delloem commands should not be executed before parsing command line.
|
||||||
|
- Fix stack overflow in delloem setled
|
||||||
|
- Fix delloem powermonitor on big-endian platforms.
|
||||||
|
- ipmitool delloem powermonitor command should convert data from
|
||||||
|
network-format to the native one, otherwise it shows garbage
|
||||||
|
on ppc/ppc64 platform.
|
||||||
|
- Add ipmi_getsysinfo command
|
||||||
|
- Add support for drive backplane SetLED functionality
|
||||||
|
- Fix for Platform Event Message incorrect Generator ID
|
||||||
|
- Fix fru print so that it will display FRU info from satellite
|
||||||
|
controllers.
|
||||||
|
- Add support for AMC type 17h record.
|
||||||
|
- Fix in fru edit. It is now possible to edit field 0 of sections
|
||||||
|
- New FRU get OEM record command
|
||||||
|
- fixed segfault for fru edit when "field id" is not supported and
|
||||||
|
added user feedback for string substitution(success or failure)
|
||||||
|
- Improvement to hpm upgrade during activation. This resolves issue
|
||||||
|
where activation seems to have failed because ipmitool received
|
||||||
|
an unsupported completion code.
|
||||||
|
- hpm Fixes for multi-platform support.
|
||||||
|
- hpm Fix for timeouts during firmware rollback. If completion code
|
||||||
|
is C3, wait till timeout has expired before reporting it.
|
||||||
|
- hpm During manual rollback, code now gets target capabilities
|
||||||
|
instead of using a default timeout of 60 seconds.
|
||||||
|
- Added firmware auxilliary bytes to hpm outputs
|
||||||
|
- hpm Add support for BIG Buffer (Use when -z option is used)
|
||||||
|
- Fix the case where ipmitool loses the iol connection during the upload
|
||||||
|
block process. Once IPMITool was successfully sent the first
|
||||||
|
byte, IPMITool will not resize the block size.
|
||||||
|
- Fix the problem when we try to upgrade specific component and the
|
||||||
|
component is already updated,
|
||||||
|
- updated HPM firmware agent to version 1.04
|
||||||
|
- Fix exit code to return zero on '-o list' or '-o help' option
|
||||||
|
- limit length of user name and password that can be supplied by user.
|
||||||
|
Password is limited to 16 bytes, resp. 20 bytes, for LAN, resp.
|
||||||
|
LAN+, interface. User name is limited to 16 bytes, no interface
|
||||||
|
limitations. ID 3184687, ID 3001519
|
||||||
|
- Add retry / timeout options for LAN
|
||||||
|
- Changed default cipher suite to 1 instead of 3 for iol20
|
||||||
|
- added fix for tracker ID 2849300 "Incorrect Firmware Revision"
|
||||||
|
- avoid reopening the interface when already opened
|
||||||
|
- Remove message for unsupported PEF capabilities that return valid
|
||||||
|
CC (80h)
|
||||||
|
- Added OEM byte (47) to verbose output
|
||||||
|
- Add option to provide a list when filling sdr repository
|
||||||
|
- SDR discovery speedups
|
||||||
|
- Added support for Dell specific sensors
|
||||||
|
- Fix segmentation fault on unrecognize OEM events.
|
||||||
|
- changed SEL timestamp formatting for 'preinit' SEL entries, allowing
|
||||||
|
the number of seconds to be displayed.
|
||||||
|
- Added sensor raw data in verbose mode. Useful for OEM sensor type.
|
||||||
|
- Add sensor hysteresis (positive & negative) to the following command
|
||||||
|
ipmitool sensor -v
|
||||||
|
- Fixes bug ID 3484936 - missing user input validation
|
||||||
|
- Add missing RMCP+ auth type strings
|
||||||
|
- Add new Kontron Product in ipmi_strings for product ID. Kontron
|
||||||
|
KTC5520/EATX Server Motherboard with integrated iBMC/KVM/VM
|
||||||
|
added identification support for Kontron AT8050 ATCA board
|
||||||
|
- Constrain setting of the username to no greater than 16 characters
|
||||||
|
per the IPMI specification. ID 3001519
|
||||||
|
- Constrain User ID between 1 and 63. ID 3519225
|
||||||
|
- Fixes ID 3485340 - user input not handled in 'lib/ipmi_user.c'
|
||||||
|
- Fixes ignorance of existing daemon PID file which results in PID being
|
||||||
|
overwritten. Adds proper umask() before writing PID file.
|
||||||
|
- applied fix for ID 2865111 (AIX build)
|
||||||
|
- Fix a proplem when using bridged IPMI commands on the lanplus
|
||||||
|
interface (-I lanplus with -b -t or -m switches) resulting in
|
||||||
|
"Close Session command failure".
|
||||||
|
- Add fix with usage of CFh (duplicate request). Usefull for
|
||||||
|
slow commands
|
||||||
|
- Fix issue with sequence number. (Speed up transfer)
|
||||||
|
|
||||||
* Wed Feb 25 2009 <pere@hungry.com> 1.8.11-1
|
* Wed Feb 25 2009 <pere@hungry.com> 1.8.11-1
|
||||||
- Fix new GCC compilation issues in regards to Packing
|
- Fix new GCC compilation issues in regards to Packing
|
||||||
- Fix Tracker bug #1642710 - ipmi_kcs_drv being loaded/unloaded
|
- Fix Tracker bug #1642710 - ipmi_kcs_drv being loaded/unloaded
|
||||||
@ -257,7 +881,7 @@ fi
|
|||||||
- Make ipmievd generate pidfile
|
- Make ipmievd generate pidfile
|
||||||
- Add initscripts for ipmievd
|
- Add initscripts for ipmievd
|
||||||
|
|
||||||
* Mon Jan 17 2006 <duncan@iceblink.org> 1.8.6-1
|
* Tue Jan 17 2006 <duncan@iceblink.org> 1.8.6-1
|
||||||
- Fix memory corruption when sending encrypted SOL traffic
|
- Fix memory corruption when sending encrypted SOL traffic
|
||||||
- Add keepalive timer to IPMIv2 SOL sessions
|
- Add keepalive timer to IPMIv2 SOL sessions
|
||||||
|
|
||||||
@ -325,7 +949,7 @@ fi
|
|||||||
- new "shell" and "exec" commands
|
- new "shell" and "exec" commands
|
||||||
- lots of other contributed patches
|
- lots of other contributed patches
|
||||||
|
|
||||||
* Sat May 27 2004 <duncan@iceblink.org> 1.5.9-1
|
* Thu May 27 2004 <duncan@iceblink.org> 1.5.9-1
|
||||||
- Add ability to get a particular sensor by name
|
- Add ability to get a particular sensor by name
|
||||||
- Add ability to set a particular sensor threshold
|
- Add ability to set a particular sensor threshold
|
||||||
- Add support for displaying V2 channel authentication levels
|
- Add support for displaying V2 channel authentication levels
|
||||||
@ -359,7 +983,7 @@ fi
|
|||||||
- Fix SEL event decoding for generic events
|
- Fix SEL event decoding for generic events
|
||||||
- Handle empty SEL gracefully when doing "sel list"
|
- Handle empty SEL gracefully when doing "sel list"
|
||||||
- Fix sdr handling of sensors that do not return a reading
|
- Fix sdr handling of sensors that do not return a reading
|
||||||
- Fix for CSV display of sensor readings/units from Fredrik Öhrn
|
- Fix for CSV display of sensor readings/units from Fredrik Öhrn
|
||||||
|
|
||||||
* Tue Nov 25 2003 <duncan@iceblink.org> 1.5.5-1
|
* Tue Nov 25 2003 <duncan@iceblink.org> 1.5.5-1
|
||||||
- Add -U option for setting LAN username
|
- Add -U option for setting LAN username
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
%_topdir %(echo $BUILDDIR)
|
|
||||||
%_sourcedir %{_topdir}/..
|
|
||||||
%_specdir %{_sourcedir}
|
|
||||||
%_tmppath %{_topdir}/tmp
|
|
||||||
%_builddir %{_topdir}/BUILD
|
|
||||||
%_buildroot %{_topdir}/%{_tmppath}/%{name}-%{version}-root
|
|
||||||
%_rpmdir %{_topdir}/RPMS
|
|
||||||
%_srcrpmdir %{_topdir}/SRPMS
|
|
||||||
%_distro @DISTRO@
|
|
||||||
%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
|
|
||||||
%packager jmank@hp.com
|
|
||||||
%distribution Sourceforge Build
|
|
@ -1,8 +0,0 @@
|
|||||||
macrofiles: /usr/lib/rpm/macros:/usr/lib/rpm/%{_target}/macros:/etc/rpm/macros.specspo:/etc/rpm/macros:/etc/rpm/%{_target}/macros:%(echo $CONFIGDIR)/rpmmacros
|
|
||||||
|
|
||||||
buildarchtranslate: athlon: i386
|
|
||||||
buildarchtranslate: i686: i386
|
|
||||||
buildarchtranslate: i586: i386
|
|
||||||
buildarchtranslate: i486: i386
|
|
||||||
buildarchtranslate: i386: i386
|
|
||||||
|
|
10
csv-revision
Executable file
10
csv-revision
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
git describe --first-parent --tags 2>/dev/null | (
|
||||||
|
IFS=- read tag rev hash
|
||||||
|
if [ $? ] && [ -n "$rev" ]; then
|
||||||
|
echo .$rev.$hash
|
||||||
|
elif [ -d .git ]; then
|
||||||
|
echo .0.gsnapshot
|
||||||
|
fi
|
||||||
|
)
|
@ -145,7 +145,7 @@ placed at the end of commands to get option usage help.
|
|||||||
> ipmievd help
|
> ipmievd help
|
||||||
.br
|
.br
|
||||||
Commands:
|
Commands:
|
||||||
open Use OpenIPMI for asyncronous notification of events
|
open Use OpenIPMI for asynchronous notification of events
|
||||||
sel Poll SEL for notification of events
|
sel Poll SEL for notification of events
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
@ -174,7 +174,7 @@ Do NOT become a daemon, instead log all messages to stderr.
|
|||||||
.TP
|
.TP
|
||||||
\fIpidfile\fP=<\fBfilename\fR>
|
\fIpidfile\fP=<\fBfilename\fR>
|
||||||
Save process ID to this file when in daemon mode. Defaults to
|
Save process ID to this file when in daemon mode. Defaults to
|
||||||
/var/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
|
/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
|
||||||
number -- defaults to 0).
|
number -- defaults to 0).
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ Do NOT become a daemon, instead log all messages to stderr.
|
|||||||
.TP
|
.TP
|
||||||
\fIpidfile\fP=<\fBfilename\fR>
|
\fIpidfile\fP=<\fBfilename\fR>
|
||||||
Save process ID to this file when in daemon mode. Defaults to
|
Save process ID to this file when in daemon mode. Defaults to
|
||||||
/var/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
|
/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
|
||||||
number -- defaults to 0).
|
number -- defaults to 0).
|
||||||
.TP
|
.TP
|
||||||
\fItimeout\fP=<\fBseconds\fR>
|
\fItimeout\fP=<\fBseconds\fR>
|
||||||
@ -217,6 +217,16 @@ Reading Sensors...
|
|||||||
.br
|
.br
|
||||||
Waiting for Events...
|
Waiting for Events...
|
||||||
.br
|
.br
|
||||||
|
|
||||||
|
.SH FILES
|
||||||
|
.TP
|
||||||
|
.B @IANADIR@/enterprise-numbers
|
||||||
|
system IANA PEN registry taken from http://www.iana.org/assignments/enterprise-numbers
|
||||||
|
.TP
|
||||||
|
.B ~/@IANAUSERDIR@/enterprise-numbers
|
||||||
|
user's override for the system IANA PEN registry, this file if it exists is loaded instead
|
||||||
|
of the system registry (see above).
|
||||||
|
|
||||||
.SH "AUTHOR"
|
.SH "AUTHOR"
|
||||||
Duncan Laurie <duncan@iceblink.org>
|
Duncan Laurie <duncan@iceblink.org>
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
@ -3,12 +3,13 @@
|
|||||||
ipmitool \- utility for controlling IPMI\-enabled devices
|
ipmitool \- utility for controlling IPMI\-enabled devices
|
||||||
.SH "SYNOPSIS"
|
.SH "SYNOPSIS"
|
||||||
|
|
||||||
ipmitool [ <options> ] <command> [ <sub-commands and sub-options> ]
|
.BR ipmitool
|
||||||
|
[ <options> ] <command> [ <sub-commands and sub-options> ]
|
||||||
|
|
||||||
<options> := [ <general-options> | <conditional-opts> ]
|
<options> := [ <general-options> | <conditional-opts> ]
|
||||||
.br
|
|
||||||
Any recognized option is accepted. Conditional options may be ignored or it's usage postponed until shell or exec processes relevant command.
|
Any recognized option is accepted. Conditional options may be ignored or it's
|
||||||
.br
|
usage postponed until shell or exec processes relevant command.
|
||||||
|
|
||||||
<general\-options> := [ \-h | \-V | \-v | \-I <interface> | \-H <address> |
|
<general\-options> := [ \-h | \-V | \-v | \-I <interface> | \-H <address> |
|
||||||
\-d <N> | \-p <port> | \-c | \-U <username> |
|
\-d <N> | \-p <port> | \-c | \-U <username> |
|
||||||
@ -66,8 +67,9 @@ called \fIOpenIPMI\fP and it is included in standard distributions.
|
|||||||
On Solaris this driver is called \fIBMC\fP and is included in Solaris 10.
|
On Solaris this driver is called \fIBMC\fP and is included in Solaris 10.
|
||||||
Management of a remote station requires the IPMI\-over\-LAN interface to be
|
Management of a remote station requires the IPMI\-over\-LAN interface to be
|
||||||
enabled and configured. Depending on the particular requirements of each
|
enabled and configured. Depending on the particular requirements of each
|
||||||
system it may be possible to enable the LAN interface using ipmitool over
|
system it may be possible to enable the LAN interface using
|
||||||
the system interface.
|
.BR ipmitool
|
||||||
|
over the system interface.
|
||||||
.SH "OPTIONS"
|
.SH "OPTIONS"
|
||||||
.TP
|
.TP
|
||||||
\fB\-a\fR
|
\fB\-a\fR
|
||||||
@ -95,9 +97,14 @@ This is not available with all commands.
|
|||||||
.TP
|
.TP
|
||||||
\fB\-C\fR <\fIciphersuite\fP>
|
\fB\-C\fR <\fIciphersuite\fP>
|
||||||
The remote server authentication, integrity, and encryption algorithms
|
The remote server authentication, integrity, and encryption algorithms
|
||||||
to use for IPMIv2.0 \fIlanplus\fP connections. See table 22\-19 in the
|
to use for IPMIv2.0 \fIlanplus\fP connections. See table 22\-20 in the
|
||||||
IPMIv2.0 specification. The default is 3 which specifies RAKP\-HMAC\-SHA1
|
IPMI v2.0 specification. The default is 17 which specifies RAKP\-HMAC\-SHA256
|
||||||
authentication, HMAC\-SHA1\-96 integrity, and AES\-CBC\-128 encryption algorithms.
|
authentication, HMAC\-SHA256\-128 integrity, and AES\-CBC\-128 encryption algorithms.
|
||||||
|
|
||||||
|
NOTE: In
|
||||||
|
.BR ipmitool
|
||||||
|
1.8.18 and earlier the default was 3, which was insecure and was not supported
|
||||||
|
by some more recent BMC implementations.
|
||||||
.TP
|
.TP
|
||||||
\fB\-d \fIN\fP\fR
|
\fB\-d \fIN\fP\fR
|
||||||
Use device number N to specify the /dev/ipmiN (or
|
Use device number N to specify the /dev/ipmiN (or
|
||||||
@ -212,7 +219,7 @@ Increase verbose output level. This option may be specified
|
|||||||
multiple times to increase the level of debug output. If given
|
multiple times to increase the level of debug output. If given
|
||||||
three times you will get hexdumps of all incoming and
|
three times you will get hexdumps of all incoming and
|
||||||
outgoing packets. Using it five times provides details
|
outgoing packets. Using it five times provides details
|
||||||
on request and expected reply procesing. The \fIhpm\fP commands
|
on request and expected reply processing. The \fIhpm\fP commands
|
||||||
\fItargetcap\fP \fIcompprop\fP \fIabort\fP \fIupgstatus\fP
|
\fItargetcap\fP \fIcompprop\fP \fIabort\fP \fIupgstatus\fP
|
||||||
\fIrollback\fP \fIrollbackstatus\fP \fIselftestresult\fP increases
|
\fIrollback\fP \fIrollbackstatus\fP \fIselftestresult\fP increases
|
||||||
the verbosity level
|
the verbosity level
|
||||||
@ -234,8 +241,9 @@ Prompt for the Kg key for IPMIv2.0 authentication.
|
|||||||
Change Size of Communication Channel. (OEM)
|
Change Size of Communication Channel. (OEM)
|
||||||
|
|
||||||
.LP
|
.LP
|
||||||
If no password method is specified then ipmitool will prompt the
|
If no password method is specified then
|
||||||
user for a password. If no password is entered at the prompt,
|
.BR ipmitool
|
||||||
|
will prompt the user for a password. If no password is entered at the prompt,
|
||||||
the remote server password will default to NULL.
|
the remote server password will default to NULL.
|
||||||
.SH "SECURITY"
|
.SH "SECURITY"
|
||||||
There are several security issues be be considered before enabling the
|
There are several security issues be be considered before enabling the
|
||||||
@ -256,19 +264,23 @@ system. It is thus recommended that IPMI password management only be done
|
|||||||
over IPMIv2.0 \fIlanplus\fP interface or the system interface on the
|
over IPMIv2.0 \fIlanplus\fP interface or the system interface on the
|
||||||
local station.
|
local station.
|
||||||
|
|
||||||
For IPMI v1.5, the maximum password length is 16 characters.
|
For IPMI v1.5, the maximum password length is 16 characters; longer
|
||||||
Passwords longer than 16 characters will be truncated.
|
passwords might be truncated or rejected by the server, or rejected
|
||||||
|
by
|
||||||
|
.BR ipmitool .
|
||||||
|
|
||||||
|
For IPMI v2.0, the maximum password length is 20 characters; longer
|
||||||
|
passwords will be rejected by
|
||||||
|
.BR ipmitool .
|
||||||
|
|
||||||
For IPMI v2.0, the maximum password length is 20 characters;
|
|
||||||
longer passwords are truncated.
|
|
||||||
.SH "COMMANDS"
|
.SH "COMMANDS"
|
||||||
.TP
|
.TP
|
||||||
\fIhelp\fP
|
\fIhelp\fP
|
||||||
This can be used to get command\-line help on ipmitool
|
This can be used to get command\-line help on
|
||||||
commands. It may also be placed at the end of commands
|
.BR ipmitool
|
||||||
to get option usage help.
|
commands. It may also be placed at the end of commands to get option usage help.
|
||||||
|
|
||||||
ipmitool help
|
> ipmitool help
|
||||||
.br
|
.br
|
||||||
Commands:
|
Commands:
|
||||||
bmc Deprecated. Use mc
|
bmc Deprecated. Use mc
|
||||||
@ -381,39 +393,23 @@ application (ipmi or sol) on the given channel.
|
|||||||
\fIstatus\fP
|
\fIstatus\fP
|
||||||
|
|
||||||
Status information related to power, buttons, cooling, drives and faults.
|
Status information related to power, buttons, cooling, drives and faults.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIpower\fP
|
\fIpower\fP
|
||||||
.RS
|
.RS
|
||||||
.TP
|
.TP
|
||||||
\fIstatus\fP
|
\fIstatus\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIon\fP
|
\fIon\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIoff\fP
|
\fIoff\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIcycle\fP
|
\fIcycle\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIreset\fP
|
\fIreset\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIdiag\fP
|
\fIdiag\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIsoft\fP
|
\fIsoft\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\fIidentify\fP [<seconds>|force]
|
\fIidentify\fP [<seconds>|force]
|
||||||
@ -425,8 +421,6 @@ Default is 15 seconds.
|
|||||||
0 - Off
|
0 - Off
|
||||||
.br
|
.br
|
||||||
force - To turn on indefinitely
|
force - To turn on indefinitely
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIpolicy\fP
|
\fIpolicy\fP
|
||||||
|
|
||||||
@ -436,34 +430,22 @@ What to do when power is restored.
|
|||||||
\fIlist\fP
|
\fIlist\fP
|
||||||
|
|
||||||
Show available options.
|
Show available options.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIalways-on\fP
|
\fIalways-on\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIprevious\fP
|
\fIprevious\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIalways-off\fP
|
\fIalways-off\fP
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fIrestart_cause\fP
|
\fIrestart_cause\fP
|
||||||
|
|
||||||
Last restart cause.
|
Last restart cause.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIpoh\fP
|
\fIpoh\fP
|
||||||
|
|
||||||
Get power on hours.
|
Get power on hours.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIbootdev\fP
|
\fIbootdev\fP
|
||||||
.RS
|
.RS
|
||||||
@ -471,95 +453,123 @@ Get power on hours.
|
|||||||
\fInone\fP
|
\fInone\fP
|
||||||
|
|
||||||
Do not change boot device order.
|
Do not change boot device order.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIpxe\fP
|
\fIpxe\fP
|
||||||
|
|
||||||
Force PXE boot.
|
Force PXE boot.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIdisk\fP
|
\fIdisk\fP
|
||||||
|
|
||||||
Force boot from default Hard-drive.
|
Force boot from default Hard-drive.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIsafe\fP
|
\fIsafe\fP
|
||||||
|
|
||||||
Force boot from default Hard-drive, request Safe Mode.
|
Force boot from default Hard-drive, request Safe Mode.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIdiag\fP
|
\fIdiag\fP
|
||||||
|
|
||||||
Force boot from Diagnostic Partition.
|
Force boot from Diagnostic Partition.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIcdrom\fP
|
\fIcdrom\fP
|
||||||
|
|
||||||
Force boot from CD/DVD.
|
Force boot from CD/DVD.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIbios\fP
|
\fIbios\fP
|
||||||
|
|
||||||
Force boot into BIOS Setup.
|
Force boot into BIOS Setup.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIfloppy\fP
|
\fIfloppy\fP
|
||||||
|
|
||||||
Force boot from Floppy/primary removable media.
|
Force boot from Floppy/primary removable media.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fIbootparam\fP
|
\fIbootmbox\fP \fIget\fP [text] [block <\fBblock#\fP>]
|
||||||
|
|
||||||
|
Read the Boot Initiator Mailbox in hex dump or in text mode.
|
||||||
|
|
||||||
|
By default the whole mailbox is read. If block number is specified,
|
||||||
|
that particular block is read. For block 0 or when the whole
|
||||||
|
mailbox is read, the Boot Initiator IANA Enterprise Number and
|
||||||
|
the corresponding enterprise name are printed.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fIbootmbox\fP \fIset\fP text [block <\fBblock#\fP>] <\fBIANA_PEN\fP> "<\fBdata_string\fP>"
|
||||||
|
|
||||||
|
Write the specified <block> or the entire Boot Initiator Mailbox in text mode.
|
||||||
|
It is required to specify a decimal IANA Enterprise Number recognized
|
||||||
|
by the boot initiator on the target system. Refer to your target system
|
||||||
|
manufacturer for details. The rest of the arguments are a text string.
|
||||||
|
|
||||||
|
When single block write is requested, the total length of <data> may not
|
||||||
|
exceed 13 bytes for block 0, or 16 bytes otherwise.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fIbootmbox\fP \fIset\fP [block <\fBblock#\fP>] <\fBIANA_PEN\fP> <\fBdata_byte\fP> [<\fBdata_byte\fP> ...]
|
||||||
|
|
||||||
|
Same as above, but the arguments after IANA PEN are separate
|
||||||
|
data byte values separated by spaces.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fIbootparam\fP \fIget\fP <\fBopt_id\fR> [<\fBopt_param\fR>]
|
||||||
|
|
||||||
|
Get value of system boot option number <\fBopt_id\fR>. Some boot
|
||||||
|
options (e.g. option 7) can also take an optional numeric parameter.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fIbootparam\fP \fIset\fP bootflag <\fBdevice\fR> [options=...]
|
||||||
|
|
||||||
|
Set a boot flag. Valid devices are:
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
.TP
|
.IP \fIforce_pxe\fP
|
||||||
\fIforce_pxe\fP
|
|
||||||
|
|
||||||
Force PXE boot
|
Force PXE boot
|
||||||
.RS
|
.IP \fIforce_disk\fP
|
||||||
.RE
|
|
||||||
.TP
|
|
||||||
\fIforce_disk\fP
|
|
||||||
|
|
||||||
Force boot from default Hard-drive
|
Force boot from default Hard-drive
|
||||||
.RS
|
.IP \fIforce_safe\fP
|
||||||
.RE
|
|
||||||
.TP
|
|
||||||
\fIforce_safe\fP
|
|
||||||
|
|
||||||
Force boot from default Hard-drive, request Safe Mode
|
Force boot from default Hard-drive, request Safe Mode
|
||||||
.RS
|
.IP \fIforce_diag\fP
|
||||||
.RE
|
|
||||||
.TP
|
|
||||||
\fIforce_diag\fP
|
|
||||||
|
|
||||||
Force boot from Diagnostic Partition
|
Force boot from Diagnostic Partition
|
||||||
.RS
|
.IP \fIforce_cdrom\fP
|
||||||
.RE
|
|
||||||
.TP
|
|
||||||
\fIforce_cdrom\fP
|
|
||||||
|
|
||||||
Force boot from CD/DVD
|
Force boot from CD/DVD
|
||||||
.RS
|
.IP \fIforce_bios\fP
|
||||||
.RE
|
|
||||||
.TP
|
|
||||||
\fIforce_bios\fP
|
|
||||||
|
|
||||||
Force boot into BIOS Setup
|
Force boot into BIOS Setup
|
||||||
.RS
|
|
||||||
.RE
|
.PP
|
||||||
|
Valid options are:
|
||||||
|
|
||||||
|
.IP \fIPEF\fP
|
||||||
|
|
||||||
|
Clear valid bit on reset/power cycle cause by PEF
|
||||||
|
|
||||||
|
.IP \fItimeout\fP
|
||||||
|
|
||||||
|
Automatically clear boot flag valid bit on timeout
|
||||||
|
|
||||||
|
.IP \fIwatchdog\fP
|
||||||
|
|
||||||
|
Clear valid bit on reset/power cycle cause by watchdog
|
||||||
|
|
||||||
|
.IP \fIreset\fP
|
||||||
|
|
||||||
|
Clear valid bit on push button reset/soft reset
|
||||||
|
|
||||||
|
.IP \fIpower\fP
|
||||||
|
|
||||||
|
Clear valid bit on power up via power push button or wake event
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fIselftest\fP
|
\fIselftest\fP
|
||||||
.RS
|
|
||||||
.RE
|
Get the chassis self-test results
|
||||||
|
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\fIdcmi\fP
|
\fIdcmi\fP
|
||||||
@ -954,8 +964,6 @@ Shows Extended SD Card information.
|
|||||||
\fIecho\fP
|
\fIecho\fP
|
||||||
|
|
||||||
For echoing lines to stdout in scripts.
|
For echoing lines to stdout in scripts.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIekanalyzer\fP <\fBcommand\fR> <\fBxx=filename1\fR> <\fBxx=filename2\fR> [<\fBrc=filename3\fR>] \fB...\fR
|
\fIekanalyzer\fP <\fBcommand\fR> <\fBxx=filename1\fR> <\fBxx=filename2\fR> [<\fBrc=filename3\fR>] \fB...\fR
|
||||||
.RS
|
.RS
|
||||||
@ -1215,7 +1223,8 @@ Get a list of all the possible Sensor States and pre-defined Sensor State
|
|||||||
Shortcuts available for a particular sensor. \fBsensorid\fR is the character
|
Shortcuts available for a particular sensor. \fBsensorid\fR is the character
|
||||||
string representation of the sensor and must be enclosed in double quotes
|
string representation of the sensor and must be enclosed in double quotes
|
||||||
if it includes white space. Several different commands including
|
if it includes white space. Several different commands including
|
||||||
\fIipmitool sensor list\fP may be used to obtain a list that includes
|
.BR ipmitool
|
||||||
|
\fIsensor list\fP may be used to obtain a list that includes
|
||||||
the \fBsensorid\fR strings representing the sensors on a given system.
|
the \fBsensorid\fR strings representing the sensors on a given system.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -1277,7 +1286,9 @@ Finding sensor PS 2T Fan Fault... ok
|
|||||||
\fIexec\fP <\fBfilename\fR>
|
\fIexec\fP <\fBfilename\fR>
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
Execute ipmitool commands from \fIfilename\fR. Each line is a
|
Execute
|
||||||
|
.BR ipmitool
|
||||||
|
commands from \fIfilename\fR. Each line is a
|
||||||
complete command. The syntax of the commands are defined by the
|
complete command. The syntax of the commands are defined by the
|
||||||
COMMANDS section in this manpage. Each line may have an optional
|
COMMANDS section in this manpage. Each line may have an optional
|
||||||
comment at the end of the line, delimited with a `#' symbol.
|
comment at the end of the line, delimited with a `#' symbol.
|
||||||
@ -1504,20 +1515,14 @@ Show firmware upgrade log.
|
|||||||
\fIlist\fP
|
\fIlist\fP
|
||||||
|
|
||||||
List All Generic Device Locators.
|
List All Generic Device Locators.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIread\fP <\fBsdr name\fR> <\fBfile\fR>
|
\fIread\fP <\fBsdr name\fR> <\fBfile\fR>
|
||||||
|
|
||||||
Read to file eeprom specify by Generic Device Locators.
|
Read to file eeprom specify by Generic Device Locators.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIwrite\fP <\fBsdr name\fR> <\fBfile\fR>
|
\fIwrite\fP <\fBsdr name\fR> <\fBfile\fR>
|
||||||
|
|
||||||
Write from file eeprom specify by Generic Device Locators
|
Write from file eeprom specify by Generic Device Locators
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\fIhpm\fP
|
\fIhpm\fP
|
||||||
@ -1692,7 +1697,9 @@ user, operator, admin, oem.
|
|||||||
\fIactivate\fP
|
\fIactivate\fP
|
||||||
.br
|
.br
|
||||||
|
|
||||||
Causes ipmitool to enter Intel IPMI v1.5 Serial Over LAN mode. An RMCP+
|
Causes
|
||||||
|
.BR ipmitool
|
||||||
|
to enter Intel IPMI v1.5 Serial Over LAN mode. An RMCP+
|
||||||
connection is made to the BMC, the terminal is set to raw mode, and user
|
connection is made to the BMC, the terminal is set to raw mode, and user
|
||||||
input is sent to the serial console on the remote server. On exit,
|
input is sent to the serial console on the remote server. On exit,
|
||||||
the SOL payload mode is deactivated and the terminal is reset to its
|
the SOL payload mode is deactivated and the terminal is reset to its
|
||||||
@ -1704,9 +1711,9 @@ Special escape sequences are provided to control the SOL session:
|
|||||||
.TP
|
.TP
|
||||||
\fI~.\fP Terminate connection
|
\fI~.\fP Terminate connection
|
||||||
.TP
|
.TP
|
||||||
\fI~^Z\fP Suspend ipmitool
|
\fI~^Z\fP Suspend \fBipmitool\fR
|
||||||
.TP
|
.TP
|
||||||
\fI~^X\fP Suspend ipmitool, but don't restore tty on restart
|
\fI~^X\fP Suspend \fBipmitool\fR, but don't restore tty on restart
|
||||||
.TP
|
.TP
|
||||||
\fI~B\fP Send break
|
\fI~B\fP Send break
|
||||||
.TP
|
.TP
|
||||||
@ -1744,7 +1751,8 @@ Select the next boot order on the Kontron CP6012.
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
These commands will allow you to configure IPMI LAN channels
|
These commands will allow you to configure IPMI LAN channels
|
||||||
with network information so they can be used with the ipmitool
|
with network information so they can be used with the
|
||||||
|
..BR ipmitool
|
||||||
\fIlan\fP and \fIlanplus\fP interfaces. \fINOTE\fR: To
|
\fIlan\fP and \fIlanplus\fP interfaces. \fINOTE\fR: To
|
||||||
determine on which channel the LAN interface is located, issue
|
determine on which channel the LAN interface is located, issue
|
||||||
the `channel info \fInumber\fR' command until you come across
|
the `channel info \fInumber\fR' command until you come across
|
||||||
@ -2017,9 +2025,74 @@ The default will clear statistics on the first found LAN channel.
|
|||||||
|
|
||||||
Instructs the BMC to perform a warm or cold reset.
|
Instructs the BMC to perform a warm or cold reset.
|
||||||
.TP
|
.TP
|
||||||
\fIguid\fP
|
\fIguid\fP [\fBsmbios\fR|\fBrfc4122\fR|\fBipmi\fR|\fBdump\fR]
|
||||||
|
|
||||||
Display the Management Controller Globally Unique IDentifier.
|
Display the Management Controller Globally Unique IDentifier.
|
||||||
|
|
||||||
|
.RS
|
||||||
|
.TP
|
||||||
|
\fIauto\fP
|
||||||
|
.br
|
||||||
|
|
||||||
|
This is the default behavior for
|
||||||
|
.BR ipmitool (1).
|
||||||
|
|
||||||
|
Try to automatically detect the encoding based on the value of the
|
||||||
|
version field and (for version 1) the timestamp. The version is
|
||||||
|
considered valid if it is 1 through 5, and the timestamp is valid
|
||||||
|
if the year is past or equal to UNIX Epoch (1970) and is before or
|
||||||
|
equal to the current year.
|
||||||
|
|
||||||
|
If multiple encodings happen to have valid version fields, then
|
||||||
|
precedence takes the one with version 1 and a valid timestamp. If
|
||||||
|
neither one has that, then the precedence order is as follows:
|
||||||
|
\fIsmbios\fP, \fIipmi\fP, \fIrfc4122\fP.
|
||||||
|
|
||||||
|
If neither encoding yields a valid version field, then
|
||||||
|
.BR ipmitool (1)
|
||||||
|
defaults to \fIdump\fP mode.
|
||||||
|
|
||||||
|
If this option is in use, then
|
||||||
|
.BR ipmitool (1)
|
||||||
|
will also print out the detected encoding and warn
|
||||||
|
regarding IPMI specification violation if the encoding isn't \fIipmi\fP.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fIsmbios\fP
|
||||||
|
.br
|
||||||
|
|
||||||
|
Decode GUID as if it was sent by BMC as prescribed by SMBIOS specification.
|
||||||
|
|
||||||
|
\fBNOTE:\fR This is a violation of IPMI specification, but many BMC implementations do
|
||||||
|
it this way. If your BMC's GUID is shown correctly using this option, you
|
||||||
|
may want to inform your BMC manufacturer that they have a bug.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fIipmi\fP
|
||||||
|
.br
|
||||||
|
|
||||||
|
Decode GUID according to IPMI specification. It MUST show the correct GUID.
|
||||||
|
If it doesn't, try other options and inform your BMC manufacturer of the bug.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fIrfc4122\fP or \fIrfc\fP
|
||||||
|
.br
|
||||||
|
|
||||||
|
Decode GUID as if it was sent by BMC as prescribed by RFC4122 specification.
|
||||||
|
|
||||||
|
\fBNOTE:\fR This is a violation of IPMI specification.
|
||||||
|
If your BMC's GUID is shown correctly using this option, you
|
||||||
|
may want to inform your BMC manufacturer that they have a bug.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fIdump\fP
|
||||||
|
.br
|
||||||
|
|
||||||
|
Dump as hex the data received from BMC in response to Get Device GUID command.
|
||||||
|
No decoding or interpretation is performed. First received byte is dumped first.
|
||||||
|
|
||||||
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fIinfo\fP
|
\fIinfo\fP
|
||||||
.br
|
.br
|
||||||
@ -2886,7 +2959,9 @@ A list of all entity ids can be found in the IPMI specifications.
|
|||||||
|
|
||||||
Dumps raw SDR data to a file. This data file can then be used as
|
Dumps raw SDR data to a file. This data file can then be used as
|
||||||
a local SDR cache of the remote managed system with the \fI\-S <file>\fP
|
a local SDR cache of the remote managed system with the \fI\-S <file>\fP
|
||||||
option on the ipmitool command line. This can greatly improve performance
|
option on the
|
||||||
|
.BR ipmitool
|
||||||
|
command line. This can greatly improve performance
|
||||||
over system interface or remote LAN.
|
over system interface or remote LAN.
|
||||||
.TP
|
.TP
|
||||||
\fIfill\fP \fIsensors\fP
|
\fIfill\fP \fIsensors\fP
|
||||||
@ -2969,7 +3044,9 @@ Print information on the specified SEL Record entry.
|
|||||||
\fIsave\fP <\fBfile\fR>
|
\fIsave\fP <\fBfile\fR>
|
||||||
|
|
||||||
Save SEL records to a text file that can be fed back into the
|
Save SEL records to a text file that can be fed back into the
|
||||||
\fIevent file\fP ipmitool command. This can be useful for
|
\fIevent file\fP
|
||||||
|
.BR ipmitool
|
||||||
|
command. This can be useful for
|
||||||
testing Event generation by building an appropriate Platform
|
testing Event generation by building an appropriate Platform
|
||||||
Event Message file based on existing events. Please see the
|
Event Message file based on existing events. Please see the
|
||||||
available help for the 'event file ...' command for a description of
|
available help for the 'event file ...' command for a description of
|
||||||
@ -2978,12 +3055,16 @@ the format of this file.
|
|||||||
\fIwriteraw\fP <\fBfile\fR>
|
\fIwriteraw\fP <\fBfile\fR>
|
||||||
|
|
||||||
Save SEL records to a file in raw, binary format. This file can
|
Save SEL records to a file in raw, binary format. This file can
|
||||||
be fed back to the \fIsel readraw\fP ipmitool command for viewing.
|
be fed back to the \fIsel readraw\fP
|
||||||
|
.BR ipmitool
|
||||||
|
command for viewing.
|
||||||
.TP
|
.TP
|
||||||
\fIreadraw\fP <\fBfile\fR>
|
\fIreadraw\fP <\fBfile\fR>
|
||||||
|
|
||||||
Read and display SEL records from a binary file. Such a file can
|
Read and display SEL records from a binary file. Such a file can
|
||||||
be created using the \fIsel writeraw\fP ipmitool command.
|
be created using the \fIsel writeraw\fP
|
||||||
|
.BR ipmitool
|
||||||
|
command.
|
||||||
.TP
|
.TP
|
||||||
\fItime\fP
|
\fItime\fP
|
||||||
.RS
|
.RS
|
||||||
@ -3068,50 +3149,34 @@ or by using the keyword `all' to specify all sessions.
|
|||||||
\fIhostname\fP <\fBhost\fR>
|
\fIhostname\fP <\fBhost\fR>
|
||||||
|
|
||||||
Session hostname.
|
Session hostname.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIusername\fP <\fBuser\fR>
|
\fIusername\fP <\fBuser\fR>
|
||||||
|
|
||||||
Session username.
|
Session username.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIpassword\fP <\fBpass\fR>
|
\fIpassword\fP <\fBpass\fR>
|
||||||
|
|
||||||
Session password.
|
Session password.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIprivlvl\fP <\fBlevel\fR>
|
\fIprivlvl\fP <\fBlevel\fR>
|
||||||
|
|
||||||
Session privilege level force.
|
Session privilege level force.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIauthtype\fP <\fBtype\fR>
|
\fIauthtype\fP <\fBtype\fR>
|
||||||
|
|
||||||
Authentication type force.
|
Authentication type force.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIlocaladdr\fP <\fBaddr\fR>
|
\fIlocaladdr\fP <\fBaddr\fR>
|
||||||
|
|
||||||
Local IPMB address.
|
Local IPMB address.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fItargetaddr\fP <\fBaddr\fR>
|
\fItargetaddr\fP <\fBaddr\fR>
|
||||||
|
|
||||||
Remote target IPMB address.
|
Remote target IPMB address.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIport\fP <\fBport\fR>
|
\fIport\fP <\fBport\fR>
|
||||||
|
|
||||||
Remote RMCP port.
|
Remote RMCP port.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIcsv\fP [\fBlevel\fR]
|
\fIcsv\fP [\fBlevel\fR]
|
||||||
|
|
||||||
@ -3119,22 +3184,21 @@ Enable output in comma separated format.
|
|||||||
Affects following commands:
|
Affects following commands:
|
||||||
\fIuser\fP, \fIchannel\fP, \fIisol\fP, \fIsunoem\fP,
|
\fIuser\fP, \fIchannel\fP, \fIisol\fP, \fIsunoem\fP,
|
||||||
\fIsol\fP, \fIsensor\fP, \fIsdr\fP, \fIsel\fP, \fIsession\fP.
|
\fIsol\fP, \fIsensor\fP, \fIsdr\fP, \fIsel\fP, \fIsession\fP.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.TP
|
.TP
|
||||||
\fIverbose\fP [\fBverbose\fR]
|
\fIverbose\fP [\fBverbose\fR]
|
||||||
|
|
||||||
Verbosity level.
|
Verbosity level.
|
||||||
.RS
|
|
||||||
.RE
|
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\fIshell\fP
|
\fIshell\fP
|
||||||
.RS
|
.RS
|
||||||
This command will launch an interactive shell which you can use
|
This command will launch an interactive shell which you can use
|
||||||
to send multiple ipmitool commands to a BMC and see the responses.
|
to send multiple
|
||||||
This can be useful instead of running the full ipmitool command each
|
.BR ipmitool
|
||||||
time. Some commands will make use of a Sensor Data Record cache
|
commands to a BMC and see the responses. This can be useful instead of
|
||||||
|
running the full
|
||||||
|
.BR ipmitool
|
||||||
|
command each time. Some commands will make use of a Sensor Data Record cache
|
||||||
and you will see marked improvement in speed if these commands
|
and you will see marked improvement in speed if these commands
|
||||||
are able to reuse the same cache in a shell session. LAN sessions
|
are able to reuse the same cache in a shell session. LAN sessions
|
||||||
will send a periodic keepalive command to keep the IPMI session
|
will send a periodic keepalive command to keep the IPMI session
|
||||||
@ -3210,7 +3274,9 @@ by the IPMI over serial channel.
|
|||||||
\fIactivate\fP [\fIusesolkeepalive\fP | \fInokeepalive\fP] [\fIinstance=<number>\fP]
|
\fIactivate\fP [\fIusesolkeepalive\fP | \fInokeepalive\fP] [\fIinstance=<number>\fP]
|
||||||
.br
|
.br
|
||||||
|
|
||||||
Causes ipmitool to enter Serial Over LAN
|
Causes
|
||||||
|
.BR ipmitool
|
||||||
|
to enter Serial Over LAN
|
||||||
mode, and is only available when using the lanplus
|
mode, and is only available when using the lanplus
|
||||||
interface. An RMCP+ connection is made to the BMC,
|
interface. An RMCP+ connection is made to the BMC,
|
||||||
the terminal is set to raw mode, and user input is
|
the terminal is set to raw mode, and user input is
|
||||||
@ -3469,12 +3535,13 @@ Displays a list of user information for all defined userids.
|
|||||||
|
|
||||||
Sets the username associated with the given userid.
|
Sets the username associated with the given userid.
|
||||||
.TP
|
.TP
|
||||||
\fIpassword\fP <\fBuserid\fR> [<\fBpassword\fR>]
|
\fIpassword\fP <\fBuserid\fR> [<\fBpassword\fR> [<\fB16|20\fR>]]
|
||||||
.br
|
.br
|
||||||
|
|
||||||
Sets the password for the given userid. If no password is given,
|
Sets the password for the given userid. If no password is given,
|
||||||
the password is cleared (set to the NULL password). Be careful when
|
the password is cleared (set to the NULL password). Be careful when
|
||||||
removing passwords from administrator\-level accounts.
|
removing passwords from administrator\-level accounts. If specified,
|
||||||
|
16 or 20 determines the maximum password length.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\fIdisable\fP <\fBuserid\fR>
|
\fIdisable\fP <\fBuserid\fR>
|
||||||
@ -3500,7 +3567,9 @@ Determine whether a password has been stored as 16 or 20 bytes.
|
|||||||
.RE
|
.RE
|
||||||
|
|
||||||
.SH "OPEN INTERFACE"
|
.SH "OPEN INTERFACE"
|
||||||
The ipmitool \fIopen\fP interface utilizes the OpenIPMI
|
The
|
||||||
|
.BR ipmitool
|
||||||
|
\fIopen\fP interface utilizes the OpenIPMI
|
||||||
kernel device driver. This driver is present in all modern
|
kernel device driver. This driver is present in all modern
|
||||||
2.4 and all 2.6 kernels and it should be present in recent
|
2.4 and all 2.6 kernels and it should be present in recent
|
||||||
Linux distribution kernels. There are also IPMI driver
|
Linux distribution kernels. There are also IPMI driver
|
||||||
@ -3509,7 +3578,9 @@ the OpenIPMI homepage.
|
|||||||
|
|
||||||
The required kernel modules is different for 2.4 and 2.6
|
The required kernel modules is different for 2.4 and 2.6
|
||||||
kernels. The following kernel modules must be loaded on
|
kernels. The following kernel modules must be loaded on
|
||||||
a 2.4\-based kernel in order for ipmitool to work:
|
a 2.4\-based kernel in order for
|
||||||
|
.BR ipmitool
|
||||||
|
to work:
|
||||||
.TP
|
.TP
|
||||||
.B ipmi_msghandler
|
.B ipmi_msghandler
|
||||||
Incoming and outgoing message handler for IPMI interfaces.
|
Incoming and outgoing message handler for IPMI interfaces.
|
||||||
@ -3521,7 +3592,9 @@ An IPMI Keyboard Controller Style (KCS) interface driver for the message handler
|
|||||||
Linux character device interface for the message handler.
|
Linux character device interface for the message handler.
|
||||||
.LP
|
.LP
|
||||||
The following kernel modules must be loaded on
|
The following kernel modules must be loaded on
|
||||||
a 2.6\-based kernel in order for ipmitool to work:
|
a 2.6\-based kernel in order for
|
||||||
|
.BR ipmitool
|
||||||
|
to work:
|
||||||
.TP
|
.TP
|
||||||
.B ipmi_msghandler
|
.B ipmi_msghandler
|
||||||
Incoming and outgoing message handler for IPMI interfaces.
|
Incoming and outgoing message handler for IPMI interfaces.
|
||||||
@ -3549,19 +3622,22 @@ entry with:
|
|||||||
|
|
||||||
.I mknod /dev/ipmi0 c 254 0
|
.I mknod /dev/ipmi0 c 254 0
|
||||||
|
|
||||||
ipmitool includes some sample initialization scripts that
|
.BR ipmitool
|
||||||
|
includes some sample initialization scripts that
|
||||||
can perform this task automatically at start\-up.
|
can perform this task automatically at start\-up.
|
||||||
|
|
||||||
In order to have ipmitool use the OpenIPMI device interface
|
In order to have
|
||||||
|
.BR ipmitool
|
||||||
|
use the OpenIPMI device interface
|
||||||
you can specify it on the command line:
|
you can specify it on the command line:
|
||||||
.PP
|
.PP
|
||||||
ipmitool \fB\-I\fR \fIopen\fP <\fIcommand\fP>
|
> ipmitool \fB\-I\fR \fIopen\fP <\fIcommand\fP>
|
||||||
.SH "BMC INTERFACE"
|
.SH "BMC INTERFACE"
|
||||||
The ipmitool bmc interface utilizes the \fIbmc\fP device driver as
|
The ipmitool bmc interface utilizes the \fIbmc\fP device driver as
|
||||||
provided by Solaris 10 and higher. In order to force ipmitool to make
|
provided by Solaris 10 and higher. In order to force ipmitool to make
|
||||||
use of this interface you can specify it on the command line:
|
use of this interface you can specify it on the command line:
|
||||||
.PP
|
.PP
|
||||||
ipmitool \fB\-I\fR \fIbmc\fP <\fIcommand\fP>
|
> ipmitool \fB\-I\fR \fIbmc\fP <\fIcommand\fP>
|
||||||
|
|
||||||
The following files are associated with the bmc driver:
|
The following files are associated with the bmc driver:
|
||||||
|
|
||||||
@ -3575,13 +3651,18 @@ The following files are associated with the bmc driver:
|
|||||||
.B /dev/bmc
|
.B /dev/bmc
|
||||||
Character device node used to communicate with the bmc driver.
|
Character device node used to communicate with the bmc driver.
|
||||||
.SH "LIPMI INTERFACE"
|
.SH "LIPMI INTERFACE"
|
||||||
The ipmitool \fIlipmi\fP interface uses the Solaris 9 IPMI kernel device driver.
|
The
|
||||||
|
.BR ipmitool
|
||||||
|
\fIlipmi\fP interface uses the Solaris 9 IPMI kernel device driver.
|
||||||
It has been superceeded by the \fIbmc\fP interface on Solaris 10. You can tell
|
It has been superceeded by the \fIbmc\fP interface on Solaris 10. You can tell
|
||||||
ipmitool to use this interface by specifying it on the command line.
|
.BR ipmitool
|
||||||
|
to use this interface by specifying it on the command line.
|
||||||
|
|
||||||
ipmitool \fB\-I\fR \fIlipmi\fP <\fIexpression\fP>
|
> ipmitool \fB\-I\fR \fIlipmi\fP <\fIexpression\fP>
|
||||||
.SH "LAN INTERFACE"
|
.SH "LAN INTERFACE"
|
||||||
The ipmitool \fIlan\fP interface communicates with the BMC
|
The
|
||||||
|
.BR ipmitool
|
||||||
|
\fIlan\fP interface communicates with the BMC
|
||||||
over an Ethernet LAN connection using UDP under IPv4. UDP
|
over an Ethernet LAN connection using UDP under IPv4. UDP
|
||||||
datagrams are formatted to contain IPMI request/response
|
datagrams are formatted to contain IPMI request/response
|
||||||
messages with a IPMI session headers and RMCP headers.
|
messages with a IPMI session headers and RMCP headers.
|
||||||
@ -3594,20 +3675,24 @@ datagrams to port 623.
|
|||||||
The LAN interface is an authentication multi\-session connection;
|
The LAN interface is an authentication multi\-session connection;
|
||||||
messages delivered to the BMC can (and should) be authenticated
|
messages delivered to the BMC can (and should) be authenticated
|
||||||
with a challenge/response protocol with either straight
|
with a challenge/response protocol with either straight
|
||||||
password/key or MD5 message\-digest algorithm. ipmitool will
|
password/key or MD5 message\-digest algorithm.
|
||||||
attempt to connect with administrator privilege level as this
|
.BR ipmitool
|
||||||
|
will attempt to connect with administrator privilege level as this
|
||||||
is required to perform chassis power functions.
|
is required to perform chassis power functions.
|
||||||
|
|
||||||
You can tell ipmitool to use the lan interface with the
|
You can tell
|
||||||
|
.BR ipmitool
|
||||||
|
to use the lan interface with the
|
||||||
\fB\-I\fR \fIlan\fP option:
|
\fB\-I\fR \fIlan\fP option:
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
ipmitool \fB\-I\fR \fIlan\fP \fB\-H\fR <\fIhostname\fP>
|
> ipmitool \fB\-I\fR \fIlan\fP \fB\-H\fR <\fIhostname\fP>
|
||||||
[\fB\-U\fR <\fIusername\fP>] [\fB\-P\fR <\fIpassword\fP>] <\fIcommand\fP>
|
[\fB\-U\fR <\fIusername\fP>] [\fB\-P\fR <\fIpassword\fP>] <\fIcommand\fP>
|
||||||
|
|
||||||
A hostname must be given on the command line in order to use the
|
A hostname must be given on the command line in order to use the
|
||||||
lan interface with ipmitool. The password field is optional;
|
lan interface with \fBipmitool\fR. The password field is optional;
|
||||||
if you do not provide a password on the command line, ipmitool
|
if you do not provide a password on the command line,
|
||||||
|
.BR ipmitool
|
||||||
will attempt to connect without authentication. If you specify a
|
will attempt to connect without authentication. If you specify a
|
||||||
password it will use MD5 authentication if supported by the BMC
|
password it will use MD5 authentication if supported by the BMC
|
||||||
and straight password/key otherwise, unless overridden with a
|
and straight password/key otherwise, unless overridden with a
|
||||||
@ -3620,63 +3705,78 @@ interface uses the RMCP+ protocol as described in the IPMI v2.0
|
|||||||
specification. RMCP+ allows for improved authentication and data
|
specification. RMCP+ allows for improved authentication and data
|
||||||
integrity checks, as well as encryption and the ability to carry
|
integrity checks, as well as encryption and the ability to carry
|
||||||
multiple types of payloads. Generic Serial Over LAN support
|
multiple types of payloads. Generic Serial Over LAN support
|
||||||
requires RMCP+, so the ipmitool \fIsol activate\fP command
|
requires RMCP+, so the
|
||||||
|
.BR ipmitool
|
||||||
|
\fIsol activate\fP command
|
||||||
requires the use of the \fIlanplus\fP interface.
|
requires the use of the \fIlanplus\fP interface.
|
||||||
|
|
||||||
RMCP+ session establishment uses a symmetric challenge\-response
|
RMCP+ session establishment uses a symmetric challenge\-response
|
||||||
protocol called RAKP (\fBRemote Authenticated Key\-Exchange Protocol\fR)
|
protocol called RAKP (\fBRemote Authenticated Key\-Exchange Protocol\fR)
|
||||||
which allows the negotiation of many options. ipmitool does not
|
which allows the negotiation of many options.
|
||||||
|
.BR ipmitool
|
||||||
|
does not
|
||||||
yet allow the user to specify the value of every option, defaulting
|
yet allow the user to specify the value of every option, defaulting
|
||||||
to the most obvious settings marked as required in the v2.0
|
to the most obvious settings marked as required in the v2.0
|
||||||
specification. Authentication and integrity HMACS are produced with
|
specification. Authentication and integrity HMACS are produced with
|
||||||
SHA1, and encryption is performed with AES\-CBC\-128. Role\-level logins
|
SHA1, and encryption is performed with AES\-CBC\-128. Role\-level logins
|
||||||
are not yet supported.
|
are not yet supported.
|
||||||
|
|
||||||
ipmitool must be linked with the \fIOpenSSL\fP library in order to
|
.BR ipmitool
|
||||||
|
must be linked with the \fIOpenSSL\fP library in order to
|
||||||
perform the encryption functions and support the \fIlanplus\fP
|
perform the encryption functions and support the \fIlanplus\fP
|
||||||
interface. If the required packages are not found it will not be
|
interface. If the required packages are not found it will not be
|
||||||
compiled in and supported.
|
compiled in and supported.
|
||||||
|
|
||||||
You can tell ipmitool to use the lanplus interface with the
|
You can tell
|
||||||
|
.BR ipmitool
|
||||||
|
to use the lanplus interface with the
|
||||||
\fB\-I\fR \fIlanplus\fP option:
|
\fB\-I\fR \fIlanplus\fP option:
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
ipmitool \fB\-I\fR \fIlanplus\fP
|
> ipmitool \fB\-I\fR \fIlanplus\fP
|
||||||
\fB\-H\fR <\fIhostname\fP>
|
\fB\-H\fR <\fIhostname\fP>
|
||||||
[\fB\-U\fR <\fIusername\fP>]
|
[\fB\-U\fR <\fIusername\fP>]
|
||||||
[\fB\-P\fR <\fIpassword\fP>]
|
[\fB\-P\fR <\fIpassword\fP>]
|
||||||
<\fIcommand\fP>
|
<\fIcommand\fP>
|
||||||
|
|
||||||
A hostname must be given on the command line in order to use the
|
A hostname must be given on the command line in order to use the
|
||||||
lan interface with ipmitool. With the exception of the \fB\-A\fR and
|
lan interface with \fBipmitool\fR. With the exception of the \fB\-A\fR and
|
||||||
\fB\-C\fR options the rest of the command line options are identical to
|
\fB\-C\fR options the rest of the command line options are identical to
|
||||||
those available for the \fIlan\fP interface.
|
those available for the \fIlan\fP interface.
|
||||||
|
|
||||||
The \fB\-C\fR option allows you specify the authentication, integrity,
|
The \fB\-C\fR option allows you specify the authentication, integrity,
|
||||||
and encryption algorithms to use for for \fIlanplus\fP session based
|
and encryption algorithms to use for for \fIlanplus\fP session based
|
||||||
on the cipher suite ID found in the IPMIv2.0 specification in table
|
on the cipher suite ID found in the IPMIv2.0 specification in table
|
||||||
22\-19. The default cipher suite is \fI3\fP which specifies
|
22\-20. The default cipher suite is \fI17\fP which specifies
|
||||||
RAKP\-HMAC\-SHA1 authentication, HMAC\-SHA1\-96 integrity, and AES\-CBC\-128
|
RAKP\-HMAC\-SHA256 authentication, HMAC\-SHA256\-128 integrity, and
|
||||||
encryption algorightms.
|
AES\-CBC\-128 encryption algorightms.
|
||||||
|
|
||||||
.SH "FREE INTERFACE"
|
.SH "FREE INTERFACE"
|
||||||
.LP
|
.LP
|
||||||
The ipmitool \fIfree\fP interface utilizes the FreeIPMI libfreeipmi
|
The
|
||||||
|
.BR ipmitool
|
||||||
|
\fIfree\fP interface utilizes the FreeIPMI libfreeipmi
|
||||||
drivers.
|
drivers.
|
||||||
.LP
|
.LP
|
||||||
You can tell ipmitool to use the FreeIPMI interface with the \-I option:
|
You can tell
|
||||||
|
.BR ipmitool
|
||||||
|
to use the FreeIPMI interface with the \-I option:
|
||||||
.PP
|
.PP
|
||||||
ipmitool \fB\-I\fR \fIfree\fP <\fIcommand\fP>
|
> ipmitool \fB\-I\fR \fIfree\fP <\fIcommand\fP>
|
||||||
|
|
||||||
|
|
||||||
.SH "IMB INTERFACE"
|
.SH "IMB INTERFACE"
|
||||||
.LP
|
.LP
|
||||||
The ipmitool \fIimb\fP interface supports the Intel IMB (Intel
|
The
|
||||||
|
.BR ipmitool
|
||||||
|
\fIimb\fP interface supports the Intel IMB (Intel
|
||||||
Inter-module Bus) Interface through the /dev/imb device.
|
Inter-module Bus) Interface through the /dev/imb device.
|
||||||
.LP
|
.LP
|
||||||
You can tell ipmitool to use the IMB interface with the \-I option:
|
You can tell
|
||||||
|
.BR ipmitool
|
||||||
|
to use the IMB interface with the \-I option:
|
||||||
.PP
|
.PP
|
||||||
ipmitool \fB\-I\fR \fIimb\fP <\fIcommand\fP>
|
> ipmitool \fB\-I\fR \fIimb\fP <\fIcommand\fP>
|
||||||
|
|
||||||
.SH "EXAMPLES"
|
.SH "EXAMPLES"
|
||||||
.TP
|
.TP
|
||||||
@ -3728,12 +3828,28 @@ Chassis Power is on
|
|||||||
.br
|
.br
|
||||||
Chassis Power Control: Up/On
|
Chassis Power Control: Up/On
|
||||||
|
|
||||||
.SH "AUTHOR"
|
.SH FILES
|
||||||
Duncan Laurie <duncan@iceblink.org>
|
.TP
|
||||||
|
.B @IANADIR@/enterprise-numbers
|
||||||
|
system IANA PEN registry taken from http://www.iana.org/assignments/enterprise-numbers
|
||||||
|
.TP
|
||||||
|
.B ~/@IANAUSERDIR@/enterprise-numbers
|
||||||
|
user's override for the system IANA PEN registry, this file if it exists is loaded instead
|
||||||
|
of the system registry (see above).
|
||||||
|
|
||||||
|
.SH "AUTHORS"
|
||||||
|
Originally written by Duncan Laurie <duncan@iceblink.org>.
|
||||||
|
.br
|
||||||
|
Numerous contributors over time.
|
||||||
|
|
||||||
|
.SH "BUGS"
|
||||||
|
Any bugs found in \fIipmitool\fP please report via \fIGitHub\fP issue system at
|
||||||
|
https://github.com/ipmitool/ipmitool/issues
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.TP
|
.TP
|
||||||
IPMItool Homepage
|
IPMItool Homepage
|
||||||
http://ipmitool.sourceforge.net
|
http://github.com/ipmitool/ipmitool
|
||||||
.TP
|
.TP
|
||||||
Intelligent Platform Management Interface Specification
|
Intelligent Platform Management Interface Specification
|
||||||
http://www.intel.com/design/servers/ipmi
|
http://www.intel.com/design/servers/ipmi
|
@ -39,4 +39,5 @@ noinst_HEADERS = log.h bswap.h hpm2.h helper.h ipmi.h ipmi_cc.h ipmi_intf.h \
|
|||||||
ipmi_fwum.h ipmi_main.h ipmi_tsol.h ipmi_firewall.h \
|
ipmi_fwum.h ipmi_main.h ipmi_tsol.h ipmi_firewall.h \
|
||||||
ipmi_kontronoem.h ipmi_ekanalyzer.h ipmi_gendev.h ipmi_ime.h \
|
ipmi_kontronoem.h ipmi_ekanalyzer.h ipmi_gendev.h ipmi_ime.h \
|
||||||
ipmi_delloem.h ipmi_dcmi.h ipmi_vita.h ipmi_sel_supermicro.h \
|
ipmi_delloem.h ipmi_dcmi.h ipmi_vita.h ipmi_sel_supermicro.h \
|
||||||
ipmi_cfgp.h ipmi_lanp6.h
|
ipmi_cfgp.h ipmi_lanp6.h ipmi_quantaoem.h ipmi_time.h
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_BSWAP_H
|
#pragma once
|
||||||
#define IPMI_BSWAP_H
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -49,5 +48,3 @@
|
|||||||
# define BSWAP_32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) |\
|
# define BSWAP_32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) |\
|
||||||
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
|
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* IPMI_BSWAP_H */
|
|
||||||
|
@ -30,13 +30,16 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_HELPER_H
|
#pragma once
|
||||||
#define IPMI_HELPER_H
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h> /* For free() */
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
@ -50,6 +53,12 @@
|
|||||||
#define tboolean int
|
#define tboolean int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define __UNUSED__(x) x __attribute__((unused))
|
||||||
|
#else
|
||||||
|
#define __UNUSED__(x) x
|
||||||
|
#endif
|
||||||
|
|
||||||
/* IPMI spec. - UID 0 reserved, 63 maximum UID which can be used */
|
/* IPMI spec. - UID 0 reserved, 63 maximum UID which can be used */
|
||||||
#ifndef IPMI_UID_MIN
|
#ifndef IPMI_UID_MIN
|
||||||
# define IPMI_UID_MIN 1
|
# define IPMI_UID_MIN 1
|
||||||
@ -61,7 +70,7 @@
|
|||||||
struct ipmi_intf;
|
struct ipmi_intf;
|
||||||
|
|
||||||
struct valstr {
|
struct valstr {
|
||||||
uint16_t val;
|
uint32_t val;
|
||||||
const char * str;
|
const char * str;
|
||||||
};
|
};
|
||||||
struct oemvalstr {
|
struct oemvalstr {
|
||||||
@ -70,8 +79,12 @@ struct oemvalstr {
|
|||||||
const char * str;
|
const char * str;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char * val2str(uint16_t val, const struct valstr * vs);
|
const char *
|
||||||
const char * oemval2str(uint32_t oem,uint16_t val, const struct oemvalstr * vs);
|
specific_val2str(uint32_t val,
|
||||||
|
const struct valstr *specific,
|
||||||
|
const struct valstr *generic);
|
||||||
|
const char *val2str(uint32_t val, const struct valstr * vs);
|
||||||
|
const char *oemval2str(uint32_t oem, uint32_t val, const struct oemvalstr * vs);
|
||||||
|
|
||||||
int str2double(const char * str, double * double_ptr);
|
int str2double(const char * str, double * double_ptr);
|
||||||
int str2long(const char * str, int64_t * lng_ptr);
|
int str2long(const char * str, int64_t * lng_ptr);
|
||||||
@ -83,6 +96,8 @@ int str2ushort(const char * str, uint16_t * ushrt_ptr);
|
|||||||
int str2char(const char * str, int8_t * chr_ptr);
|
int str2char(const char * str, int8_t * chr_ptr);
|
||||||
int str2uchar(const char * str, uint8_t * uchr_ptr);
|
int str2uchar(const char * str, uint8_t * uchr_ptr);
|
||||||
|
|
||||||
|
bool args2buf(int argc, char *argv[], uint8_t *out, size_t len);
|
||||||
|
|
||||||
int eval_ccode(const int ccode);
|
int eval_ccode(const int ccode);
|
||||||
|
|
||||||
int is_fru_id(const char *argv_ptr, uint8_t *fru_id_ptr);
|
int is_fru_id(const char *argv_ptr, uint8_t *fru_id_ptr);
|
||||||
@ -90,7 +105,11 @@ int is_ipmi_channel_num(const char *argv_ptr, uint8_t *channel_ptr);
|
|||||||
int is_ipmi_user_id(const char *argv_ptr, uint8_t *ipmi_uid_ptr);
|
int is_ipmi_user_id(const char *argv_ptr, uint8_t *ipmi_uid_ptr);
|
||||||
int is_ipmi_user_priv_limit(const char *argv_ptr, uint8_t *ipmi_priv_limit_ptr);
|
int is_ipmi_user_priv_limit(const char *argv_ptr, uint8_t *ipmi_priv_limit_ptr);
|
||||||
|
|
||||||
uint16_t str2val(const char * str, const struct valstr * vs);
|
uint32_t str2val32(const char *str, const struct valstr *vs);
|
||||||
|
static inline uint16_t str2val(const char *str, const struct valstr *vs)
|
||||||
|
{
|
||||||
|
return (uint16_t)str2val32(str, vs);
|
||||||
|
}
|
||||||
void print_valstr(const struct valstr * vs, const char * title, int loglevel);
|
void print_valstr(const struct valstr * vs, const char * title, int loglevel);
|
||||||
void print_valstr_2col(const struct valstr * vs, const char * title, int loglevel);
|
void print_valstr_2col(const struct valstr * vs, const char * title, int loglevel);
|
||||||
|
|
||||||
@ -109,6 +128,86 @@ FILE * ipmi_open_file(const char * file, int rw);
|
|||||||
void ipmi_start_daemon(struct ipmi_intf *intf);
|
void ipmi_start_daemon(struct ipmi_intf *intf);
|
||||||
uint16_t ipmi_get_oem_id(struct ipmi_intf *intf);
|
uint16_t ipmi_get_oem_id(struct ipmi_intf *intf);
|
||||||
|
|
||||||
|
#define IS_SET(v, b) ((v) & (1 << (b)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free the memory and clear the pointer.
|
||||||
|
* @param[in] ptr - a pointer to your pointer to free.
|
||||||
|
*/
|
||||||
|
static inline void free_n(void *ptr) {
|
||||||
|
void **pptr = (void **)ptr;
|
||||||
|
|
||||||
|
if (pptr && *pptr) {
|
||||||
|
free(*pptr);
|
||||||
|
*pptr = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* le16toh(), hto16le(), et. al. don't exist for Windows or Apple */
|
||||||
|
/* For portability, let's simply define our own versions here */
|
||||||
|
|
||||||
|
/* IPMI is always little-endian */
|
||||||
|
static inline uint16_t ipmi16toh(void *ipmi16)
|
||||||
|
{
|
||||||
|
uint8_t *ipmi = (uint8_t *)ipmi16;
|
||||||
|
uint16_t h;
|
||||||
|
|
||||||
|
h = (uint16_t)ipmi[1] << 8; /* MSB */
|
||||||
|
h |= ipmi[0]; /* LSB */
|
||||||
|
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void htoipmi16(uint16_t h, uint8_t *ipmi)
|
||||||
|
{
|
||||||
|
ipmi[0] = h & 0xFF; /* LSB */
|
||||||
|
ipmi[1] = h >> 8; /* MSB */
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t ipmi24toh(void *ipmi24)
|
||||||
|
{
|
||||||
|
uint8_t *ipmi = (uint8_t *)ipmi24;
|
||||||
|
uint32_t h = 0;
|
||||||
|
|
||||||
|
h = (uint32_t)ipmi[2] << 16; /* MSB */
|
||||||
|
h |= ipmi[1] << 8;
|
||||||
|
h |= ipmi[0]; /* LSB */
|
||||||
|
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void htoipmi24(uint32_t h, uint8_t *ipmi)
|
||||||
|
{
|
||||||
|
ipmi[0] = h & 0xFF; /* LSB */
|
||||||
|
ipmi[1] = (h >> 8) & 0xFF;
|
||||||
|
ipmi[2] = (h >> 16) & 0xFF; /* MSB */
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t ipmi32toh(void *ipmi32)
|
||||||
|
{
|
||||||
|
uint8_t *ipmi = ipmi32;
|
||||||
|
uint32_t h;
|
||||||
|
|
||||||
|
h = (uint32_t)ipmi[3] << 24; /* MSB */
|
||||||
|
h |= ipmi[2] << 16;
|
||||||
|
h |= ipmi[1] << 8;
|
||||||
|
h |= ipmi[0]; /* LSB */
|
||||||
|
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void htoipmi32(uint32_t h, uint8_t *ipmi)
|
||||||
|
{
|
||||||
|
ipmi[0] = h & 0xFF; /* LSB */
|
||||||
|
ipmi[1] = (h >> 8) & 0xFF;
|
||||||
|
ipmi[2] = (h >> 16) & 0xFF;
|
||||||
|
ipmi[3] = (h >> 24) & 0xFF; /* MSB */
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t *array_byteswap(uint8_t *buffer, size_t length);
|
||||||
|
uint8_t *array_ntoh(uint8_t *buffer, size_t length);
|
||||||
|
uint8_t *array_letoh(uint8_t *buffer, size_t length);
|
||||||
|
|
||||||
#define ipmi_open_file_read(file) ipmi_open_file(file, 0)
|
#define ipmi_open_file_read(file) ipmi_open_file(file, 0)
|
||||||
#define ipmi_open_file_write(file) ipmi_open_file(file, 1)
|
#define ipmi_open_file_write(file) ipmi_open_file(file, 1)
|
||||||
|
|
||||||
@ -127,5 +226,3 @@ uint16_t ipmi_get_oem_id(struct ipmi_intf *intf);
|
|||||||
#ifndef __maxlen
|
#ifndef __maxlen
|
||||||
# define __maxlen(a, b) ({ int x=strlen(a); int y=strlen(b); (x > y) ? x : y;})
|
# define __maxlen(a, b) ({ int x=strlen(a); int y=strlen(b); (x > y) ? x : y;})
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* IPMI_HELPER_H */
|
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
* EVEN IF PPS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF PPS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <ipmitool/ipmi_intf.h>
|
#include <ipmitool/ipmi_intf.h>
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_H
|
#pragma once
|
||||||
#define IPMI_H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -259,6 +258,8 @@ struct ipmi_rs {
|
|||||||
|
|
||||||
typedef enum IPMI_OEM {
|
typedef enum IPMI_OEM {
|
||||||
IPMI_OEM_UNKNOWN = 0,
|
IPMI_OEM_UNKNOWN = 0,
|
||||||
|
IPMI_OEM_DEBUG = 0xFFFFFE, /* Hoping IANA won't hit this soon */
|
||||||
|
IPMI_OEM_RESERVED = 0x0FFFFF, /* As per IPMI 2.0 specification */
|
||||||
/* 2 for [IBM] */
|
/* 2 for [IBM] */
|
||||||
IPMI_OEM_IBM_2 = 2,
|
IPMI_OEM_IBM_2 = 2,
|
||||||
IPMI_OEM_HP = 11,
|
IPMI_OEM_HP = 11,
|
||||||
@ -281,7 +282,7 @@ typedef enum IPMI_OEM {
|
|||||||
IPMI_OEM_MAGNUM = 5593,
|
IPMI_OEM_MAGNUM = 5593,
|
||||||
IPMI_OEM_TYAN = 6653,
|
IPMI_OEM_TYAN = 6653,
|
||||||
IPMI_OEM_QUANTA = 7244,
|
IPMI_OEM_QUANTA = 7244,
|
||||||
IPMI_OEM_NEWISYS = 9237,
|
IPMI_OEM_VIKING = 9237,
|
||||||
IPMI_OEM_ADVANTECH = 10297,
|
IPMI_OEM_ADVANTECH = 10297,
|
||||||
IPMI_OEM_FUJITSU_SIEMENS = 10368,
|
IPMI_OEM_FUJITSU_SIEMENS = 10368,
|
||||||
IPMI_OEM_AVOCENT = 10418,
|
IPMI_OEM_AVOCENT = 10418,
|
||||||
@ -300,9 +301,8 @@ typedef enum IPMI_OEM {
|
|||||||
IPMI_OEM_ADLINK_24339 = 24339,
|
IPMI_OEM_ADLINK_24339 = 24339,
|
||||||
IPMI_OEM_NOKIA_SOLUTIONS_AND_NETWORKS = 28458,
|
IPMI_OEM_NOKIA_SOLUTIONS_AND_NETWORKS = 28458,
|
||||||
IPMI_OEM_VITA = 33196,
|
IPMI_OEM_VITA = 33196,
|
||||||
IPMI_OEM_SUPERMICRO_47488 = 47488
|
IPMI_OEM_SUPERMICRO_47488 = 47488,
|
||||||
|
IPMI_OEM_YADRO = 49769,
|
||||||
} IPMI_OEM;
|
} IPMI_OEM;
|
||||||
|
|
||||||
extern const struct valstr completion_code_vals[];
|
extern const struct valstr completion_code_vals[];
|
||||||
|
|
||||||
#endif /* IPMI_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_CC_H
|
#pragma once
|
||||||
#define IPMI_CC_H
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Thu Jan 11 09:32:41 2007
|
Thu Jan 11 09:32:41 2007
|
||||||
@ -71,6 +70,3 @@
|
|||||||
#define IPMI_CC_NOT_SUPPORTED_PRESENT_STATE 0xd5
|
#define IPMI_CC_NOT_SUPPORTED_PRESENT_STATE 0xd5
|
||||||
#define IPMI_CC_ILLEGAL_COMMAND_DISABLED 0xd6
|
#define IPMI_CC_ILLEGAL_COMMAND_DISABLED 0xd6
|
||||||
#define IPMI_CC_UNSPECIFIED_ERROR 0xff
|
#define IPMI_CC_UNSPECIFIED_ERROR 0xff
|
||||||
|
|
||||||
|
|
||||||
#endif /*IPMI_CC_H*/
|
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#ifndef IPMI_CFGP_H
|
|
||||||
#define IPMI_CFGP_H
|
#pragma once
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -193,5 +193,3 @@ extern int ipmi_cfgp_save(struct ipmi_cfgp_ctx *ctx,
|
|||||||
/* Print parameter data in user-friendly format. */
|
/* Print parameter data in user-friendly format. */
|
||||||
extern int ipmi_cfgp_print(struct ipmi_cfgp_ctx *ctx,
|
extern int ipmi_cfgp_print(struct ipmi_cfgp_ctx *ctx,
|
||||||
const struct ipmi_cfgp_sel *sel, FILE *file);
|
const struct ipmi_cfgp_sel *sel, FILE *file);
|
||||||
|
|
||||||
#endif /* IPMI_CFGP_H */
|
|
||||||
|
@ -30,13 +30,13 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_CHANNEL_H
|
#pragma once
|
||||||
#define IPMI_CHANNEL_H
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
#include <ipmitool/ipmi_intf.h>
|
||||||
|
|
||||||
|
|
||||||
#define IPMI_GET_CHANNEL_AUTH_CAP 0x38
|
#define IPMI_GET_CHANNEL_AUTH_CAP 0x38
|
||||||
@ -56,6 +56,28 @@
|
|||||||
#define IPMI_CHANNEL_SESSION_MULTI 0x80
|
#define IPMI_CHANNEL_SESSION_MULTI 0x80
|
||||||
#define IPMI_CHANNEL_SESSION_BASED 0xC0
|
#define IPMI_CHANNEL_SESSION_BASED 0xC0
|
||||||
|
|
||||||
|
/* Fixed channel numbers as per Table 6-1 */
|
||||||
|
typedef enum {
|
||||||
|
CH_PRIMARY_IPMB,
|
||||||
|
CH_IMP_SPECIFIC_1,
|
||||||
|
CH_IMP_SPECIFIC_2,
|
||||||
|
CH_IMP_SPECIFIC_3,
|
||||||
|
CH_IMP_SPECIFIC_4,
|
||||||
|
CH_IMP_SPECIFIC_5,
|
||||||
|
CH_IMP_SPECIFIC_6,
|
||||||
|
CH_IMP_SPECIFIC_7,
|
||||||
|
CH_IMP_SPECIFIC_8,
|
||||||
|
CH_IMP_SPECIFIC_9,
|
||||||
|
CH_IMP_SPECIFIC_A,
|
||||||
|
CH_IMP_SPECIFIC_B,
|
||||||
|
CH_RSVD1,
|
||||||
|
CH_RSVD2,
|
||||||
|
CH_CURRENT,
|
||||||
|
CH_SYSTEM,
|
||||||
|
CH_TOTAL,
|
||||||
|
CH_UNKNOWN = UINT8_MAX
|
||||||
|
} ipmi_channel_num_t;
|
||||||
|
|
||||||
/* (22.24) Get Channel Info */
|
/* (22.24) Get Channel Info */
|
||||||
struct channel_info_t {
|
struct channel_info_t {
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
@ -67,16 +89,66 @@ struct channel_info_t {
|
|||||||
uint8_t aux_info[2];
|
uint8_t aux_info[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* (22.23) Get Channel Access */
|
|
||||||
|
/* (22.22 / 22.23) Set/Get Channel Access */
|
||||||
|
typedef enum {
|
||||||
|
ALERTING_ENABLED = 0,
|
||||||
|
ALERTING_DISABLED = (1 << 5) /* See Table 22 */
|
||||||
|
} alerting_t;
|
||||||
|
|
||||||
struct channel_access_t {
|
struct channel_access_t {
|
||||||
uint8_t access_mode;
|
uint8_t access_mode;
|
||||||
uint8_t alerting;
|
alerting_t alerting;
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
uint8_t per_message_auth;
|
uint8_t per_message_auth;
|
||||||
uint8_t privilege_limit;
|
uint8_t privilege_limit;
|
||||||
uint8_t user_level_auth;
|
uint8_t user_level_auth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The Cipher Suite Record Format from table 22-18 of the IPMI v2.0 spec
|
||||||
|
*/
|
||||||
|
enum cipher_suite_format_tag {
|
||||||
|
STANDARD_CIPHER_SUITE = 0xc0,
|
||||||
|
OEM_CIPHER_SUITE = 0xc1,
|
||||||
|
};
|
||||||
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
struct std_cipher_suite_record_t {
|
||||||
|
uint8_t start_of_record;
|
||||||
|
uint8_t cipher_suite_id;
|
||||||
|
uint8_t auth_alg;
|
||||||
|
uint8_t integrity_alg;
|
||||||
|
uint8_t crypt_alg;
|
||||||
|
} ATTRIBUTE_PACKING;
|
||||||
|
struct oem_cipher_suite_record_t {
|
||||||
|
uint8_t start_of_record;
|
||||||
|
uint8_t cipher_suite_id;
|
||||||
|
uint8_t iana[3];
|
||||||
|
uint8_t auth_alg;
|
||||||
|
uint8_t integrity_alg;
|
||||||
|
uint8_t crypt_alg;
|
||||||
|
} ATTRIBUTE_PACKING;
|
||||||
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
|
#pragma pack(0)
|
||||||
|
#endif
|
||||||
|
#define CIPHER_ALG_MASK 0x3f
|
||||||
|
#define MAX_CIPHER_SUITE_RECORD_OFFSET 0x40
|
||||||
|
#define MAX_CIPHER_SUITE_DATA_LEN 0x10
|
||||||
|
#define LIST_ALGORITHMS_BY_CIPHER_SUITE 0x80
|
||||||
|
|
||||||
|
/* Below is the theoretical maximum number of cipher suites that could be
|
||||||
|
* reported by a BMC. That is with the Get Channel Cipher Suites Command, at 16
|
||||||
|
* bytes at a time and 0x40 requests, it can report 1024 bytes, which is about
|
||||||
|
* 204 standard records or 128 OEM records. Really, we probably don't need more
|
||||||
|
* than about 20, which is the full set of standard records plus a few OEM
|
||||||
|
* records.
|
||||||
|
*/
|
||||||
|
#define MAX_CIPHER_SUITE_COUNT (MAX_CIPHER_SUITE_RECORD_OFFSET * \
|
||||||
|
MAX_CIPHER_SUITE_DATA_LEN / \
|
||||||
|
sizeof(struct std_cipher_suite_record_t))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The Get Authentication Capabilities response structure
|
* The Get Authentication Capabilities response structure
|
||||||
* From table 22-15 of the IPMI v2.0 spec
|
* From table 22-15 of the IPMI v2.0 spec
|
||||||
@ -131,16 +203,22 @@ struct get_channel_auth_cap_rsp {
|
|||||||
int _ipmi_get_channel_access(struct ipmi_intf *intf,
|
int _ipmi_get_channel_access(struct ipmi_intf *intf,
|
||||||
struct channel_access_t *channel_access,
|
struct channel_access_t *channel_access,
|
||||||
uint8_t get_volatile_settings);
|
uint8_t get_volatile_settings);
|
||||||
|
int ipmi_get_channel_cipher_suites(struct ipmi_intf *intf,
|
||||||
|
const char *payload_type,
|
||||||
|
uint8_t channel,
|
||||||
|
struct cipher_suite_info *suites,
|
||||||
|
size_t *count);
|
||||||
int _ipmi_get_channel_info(struct ipmi_intf *intf,
|
int _ipmi_get_channel_info(struct ipmi_intf *intf,
|
||||||
struct channel_info_t *channel_info);
|
struct channel_info_t *channel_info);
|
||||||
int _ipmi_set_channel_access(struct ipmi_intf *intf,
|
int _ipmi_set_channel_access(struct ipmi_intf *intf,
|
||||||
struct channel_access_t channel_access, uint8_t access_option,
|
struct channel_access_t channel_access,
|
||||||
|
uint8_t access_option,
|
||||||
uint8_t privilege_option);
|
uint8_t privilege_option);
|
||||||
|
|
||||||
uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel);
|
uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel);
|
||||||
uint8_t ipmi_current_channel_medium(struct ipmi_intf * intf);
|
void ipmi_current_channel_info(struct ipmi_intf *intf,
|
||||||
|
struct channel_info_t *chinfo);
|
||||||
int ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, uint8_t channel, uint8_t priv);
|
int ipmi_get_channel_auth_cap(struct ipmi_intf * intf,
|
||||||
|
uint8_t channel, uint8_t priv);
|
||||||
int ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel);
|
int ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel);
|
||||||
|
|
||||||
#endif /*IPMI_CHANNEL_H*/
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_CHASSIS_H
|
#pragma once
|
||||||
#define IPMI_CHASSIS_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -51,5 +50,3 @@ int ipmi_chassis_power_status(struct ipmi_intf * intf);
|
|||||||
int ipmi_chassis_power_control(struct ipmi_intf * intf, uint8_t ctl);
|
int ipmi_chassis_power_control(struct ipmi_intf * intf, uint8_t ctl);
|
||||||
int ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
int ipmi_power_main(struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_power_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
|
|
||||||
#endif /*IPMI_CHASSIS_H*/
|
|
||||||
|
@ -30,9 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_CONSTANTS_H
|
#pragma once
|
||||||
#define IPMI_CONSTANTS_H
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* COMMANDS
|
* COMMANDS
|
||||||
@ -74,6 +72,7 @@
|
|||||||
#define IPMI_SESSION_PRIV_OPERATOR 0x3
|
#define IPMI_SESSION_PRIV_OPERATOR 0x3
|
||||||
#define IPMI_SESSION_PRIV_ADMIN 0x4
|
#define IPMI_SESSION_PRIV_ADMIN 0x4
|
||||||
#define IPMI_SESSION_PRIV_OEM 0x5
|
#define IPMI_SESSION_PRIV_OEM 0x5
|
||||||
|
#define IPMI_SESSION_PRIV_NOACCESS 0xF
|
||||||
|
|
||||||
#define IPMI_SET_IN_PROGRESS_SET_COMPLETE 0x00
|
#define IPMI_SET_IN_PROGRESS_SET_COMPLETE 0x00
|
||||||
#define IPMI_SET_IN_PROGRESS_IN_PROGRESS 0x01
|
#define IPMI_SET_IN_PROGRESS_IN_PROGRESS 0x01
|
||||||
@ -127,10 +126,8 @@
|
|||||||
#define IPMI_INTEGRITY_MD5_128 0x03
|
#define IPMI_INTEGRITY_MD5_128 0x03
|
||||||
#define IPMI_INTEGRITY_HMAC_SHA256_128 0x04
|
#define IPMI_INTEGRITY_HMAC_SHA256_128 0x04
|
||||||
|
|
||||||
/* From table 13-19 of the IPMI v2 specfication */
|
/* From table 13-19 of the IPMI v2 specification */
|
||||||
#define IPMI_CRYPT_NONE 0x00
|
#define IPMI_CRYPT_NONE 0x00
|
||||||
#define IPMI_CRYPT_AES_CBC_128 0x01
|
#define IPMI_CRYPT_AES_CBC_128 0x01
|
||||||
#define IPMI_CRYPT_XRC4_128 0x02
|
#define IPMI_CRYPT_XRC4_128 0x02
|
||||||
#define IPMI_CRYPT_XRC4_40 0x03
|
#define IPMI_CRYPT_XRC4_40 0x03
|
||||||
|
|
||||||
#endif /*IPMI_CONSTANTS_H*/
|
|
||||||
|
@ -16,9 +16,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
#ifndef IPMI_DCMI_H
|
|
||||||
#define IPMI_DCMI_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -129,7 +127,7 @@ struct power_reading {
|
|||||||
uint8_t state;
|
uint8_t state;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
/* make a struct for the return from the capabilites command */
|
/* make a struct for the return from the capabilities command */
|
||||||
struct capabilities {
|
struct capabilities {
|
||||||
uint8_t grp_id; /* first byte: Group Extension ID */
|
uint8_t grp_id; /* first byte: Group Extension ID */
|
||||||
uint16_t conformance;
|
uint16_t conformance;
|
||||||
@ -183,7 +181,7 @@ struct nm_discover {
|
|||||||
uint8_t minor_rev;
|
uint8_t minor_rev;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
/* Node Manager get capabilites command */
|
/* Node Manager get capabilities command */
|
||||||
struct nm_capability {
|
struct nm_capability {
|
||||||
uint8_t intel_id[3];
|
uint8_t intel_id[3];
|
||||||
uint8_t max_settings;
|
uint8_t max_settings;
|
||||||
@ -236,7 +234,7 @@ struct nm_get_policy {
|
|||||||
/* Node Manager set alert destination */
|
/* Node Manager set alert destination */
|
||||||
struct nm_set_alert {
|
struct nm_set_alert {
|
||||||
uint8_t intel_id[3];
|
uint8_t intel_id[3];
|
||||||
uint8_t chan; /* 0:3 BMC chan, 4:6 reserved, bit 7=0 register alert reciever =1 invalidate */
|
uint8_t chan; /* 0:3 BMC chan, 4:6 reserved, bit 7=0 register alert receiver =1 invalidate */
|
||||||
uint8_t dest; /* lan destination */
|
uint8_t dest; /* lan destination */
|
||||||
uint8_t string; /* alert string selector */
|
uint8_t string; /* alert string selector */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
@ -267,4 +265,3 @@ struct nm_suspend {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
int ipmi_nm_main(struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_nm_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
#endif /*IPMI_DCMI_H*/
|
|
||||||
|
@ -26,8 +26,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifndef IPMI_DELLOEM_H
|
|
||||||
#define IPMI_DELLOEM_H
|
#pragma once
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -343,10 +343,6 @@ typedef struct _power_headroom
|
|||||||
uint16_t peakheadroom;
|
uint16_t peakheadroom;
|
||||||
} __attribute__ ((packed)) POWER_HEADROOM;
|
} __attribute__ ((packed)) POWER_HEADROOM;
|
||||||
|
|
||||||
struct vFlashstr {
|
|
||||||
uint8_t val;
|
|
||||||
const char * str;
|
|
||||||
};
|
|
||||||
typedef struct ipmi_vFlash_extended_info
|
typedef struct ipmi_vFlash_extended_info
|
||||||
{
|
{
|
||||||
uint8_t vflashcompcode;
|
uint8_t vflashcompcode;
|
||||||
@ -366,5 +362,3 @@ typedef struct _SensorReadingType
|
|||||||
}SensorReadingType;
|
}SensorReadingType;
|
||||||
uint16_t compareinputwattage(IPMI_POWER_SUPPLY_INFO* powersupplyinfo, uint16_t inputwattage);
|
uint16_t compareinputwattage(IPMI_POWER_SUPPLY_INFO* powersupplyinfo, uint16_t inputwattage);
|
||||||
int ipmi_delloem_main(struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_delloem_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
|
|
||||||
#endif /*IPMI_DELLOEM_H*/
|
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_EKANALYZER_H
|
#pragma once
|
||||||
#define IPMI_EKANALYZER_H
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
@ -64,5 +63,3 @@
|
|||||||
#define FRU_RADIAL_IPMB0_LINK_MAPPING 0x15
|
#define FRU_RADIAL_IPMB0_LINK_MAPPING 0x15
|
||||||
|
|
||||||
int ipmi_ekanalyzer_main(struct ipmi_intf *, int, char **);
|
int ipmi_ekanalyzer_main(struct ipmi_intf *, int, char **);
|
||||||
|
|
||||||
#endif /* IPMI_EKANALYZER_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_ENTITY_H
|
#pragma once
|
||||||
#define IPMI_ENTITY_H
|
|
||||||
|
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
@ -49,5 +48,3 @@ struct entity_id {
|
|||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* IPMI_ENTITY_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_EVENT_H
|
#pragma once
|
||||||
#define IPMI_EVENT_H
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -61,6 +60,31 @@ struct platform_event_msg {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ipmi_event_main(struct ipmi_intf *, int, char **);
|
/* See IPMI 2.0 Specification, Appendix G, Table G-1, "Event Commands" */
|
||||||
|
typedef enum {
|
||||||
|
IPMI_CMD_SET_EVENT_RCVR = 0,
|
||||||
|
IPMI_CMD_GET_EVENT_RCVR,
|
||||||
|
IPMI_CMD_PLATFORM_EVENT
|
||||||
|
} ipmi_event_cmd_t;
|
||||||
|
|
||||||
#endif /*IPMI_EVENT_H*/
|
typedef enum {
|
||||||
|
PLATFORM_EVENT_DATA_LEN_NON_SI = sizeof(struct platform_event_msg),
|
||||||
|
PLATFORM_EVENT_DATA_LEN_SI, /* System interfaces require generator ID */
|
||||||
|
PLATFORM_EVENT_DATA_LEN_MAX = PLATFORM_EVENT_DATA_LEN_SI
|
||||||
|
} ipmi_platform_event_data_len_t;
|
||||||
|
|
||||||
|
/* See Table 5-4 */
|
||||||
|
typedef enum {
|
||||||
|
EVENT_SWID_BIOS_BASE = 0x00, /* BIOS */
|
||||||
|
EVENT_SWID_SMI_BASE = 0x10, /* SMI Handler */
|
||||||
|
EVENT_SWID_SMS_BASE = 0x20, /* System Management Software */
|
||||||
|
EVENT_SWID_OEM_BASE = 0x30, /* OEM */
|
||||||
|
EVENT_SWID_REMOTE_CONSOLE_BASE = 0x40, /* Remote Console SW */
|
||||||
|
EVENT_SWID_TERMINAL_MODE_BASE = 0x47 /* Terminal Mode RC SW */
|
||||||
|
} ipmi_event_swid_t;
|
||||||
|
#define EVENT_SWID(base, index) ((EVENT_SWID_##base##_BASE + index) & 0x7F)
|
||||||
|
|
||||||
|
/* See Figure 29-2, Table 32-1 */
|
||||||
|
#define EVENT_GENERATOR(base, index) (EVENT_SWID(base,index) << 1 | 1)
|
||||||
|
|
||||||
|
int ipmi_event_main(struct ipmi_intf *, int, char **);
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_FIREWALL_H
|
#pragma once
|
||||||
#define IPMI_FIREWALL_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -102,5 +101,3 @@ static inline int bit_test(const unsigned char * bf, int n) {
|
|||||||
static inline void bit_set(unsigned char * bf, int n, int v) {
|
static inline void bit_set(unsigned char * bf, int n, int v) {
|
||||||
bf[n>>3] = (bf[n>>3] & ~(1<<(n%8))) | ((v?1:0)<<(n%8));
|
bf[n>>3] = (bf[n>>3] & ~(1<<(n%8))) | ((v?1:0)<<(n%8));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*IPMI_FIREWALL_H */
|
|
||||||
|
@ -30,17 +30,19 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_FRU_H
|
#pragma once
|
||||||
#define IPMI_FRU_H
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
#include <ipmitool/ipmi_sdr.h>
|
#include <ipmitool/ipmi_sdr.h>
|
||||||
|
#include <ipmitool/ipmi_time.h>
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define FRU_END_OF_FIELDS 0xc1
|
||||||
|
|
||||||
#define GET_FRU_INFO 0x10
|
#define GET_FRU_INFO 0x10
|
||||||
#define GET_FRU_DATA 0x11
|
#define GET_FRU_DATA 0x11
|
||||||
#define SET_FRU_DATA 0x12
|
#define SET_FRU_DATA 0x12
|
||||||
@ -125,6 +127,7 @@ struct fru_area_product {
|
|||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
#endif
|
#endif
|
||||||
|
/* See Table 16-1 of "IPMI FRU Information Storage Specification" */
|
||||||
struct fru_multirec_header {
|
struct fru_multirec_header {
|
||||||
#define FRU_RECORD_TYPE_POWER_SUPPLY_INFORMATION 0x00
|
#define FRU_RECORD_TYPE_POWER_SUPPLY_INFORMATION 0x00
|
||||||
#define FRU_RECORD_TYPE_DC_OUTPUT 0x01
|
#define FRU_RECORD_TYPE_DC_OUTPUT 0x01
|
||||||
@ -134,6 +137,8 @@ struct fru_multirec_header {
|
|||||||
#define FRU_RECORD_TYPE_EXTENDED_COMPATIBILITY 0x05
|
#define FRU_RECORD_TYPE_EXTENDED_COMPATIBILITY 0x05
|
||||||
#define FRU_RECORD_TYPE_OEM_EXTENSION 0xc0
|
#define FRU_RECORD_TYPE_OEM_EXTENSION 0xc0
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
#define FRU_RECORD_FORMAT_EOL_MASK 0x80
|
||||||
|
#define FRU_RECORD_FORMAT_VER_MASK 0x0F
|
||||||
uint8_t format;
|
uint8_t format;
|
||||||
uint8_t len;
|
uint8_t len;
|
||||||
uint8_t record_checksum;
|
uint8_t record_checksum;
|
||||||
@ -193,9 +198,6 @@ struct fru_multirec_powersupply {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char * combined_voltage_desc[] __attribute__((unused)) = {
|
|
||||||
"12 V", "-12 V", "5 V", "3.3 V"};
|
|
||||||
|
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
#endif
|
#endif
|
||||||
@ -242,6 +244,43 @@ struct fru_multirec_dcload {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* In accordance with Table 18-7 of "IPMI Platform Management FRU Information
|
||||||
|
* Storage Definition v1.0"
|
||||||
|
*/
|
||||||
|
struct fru_multirec_mgmt {
|
||||||
|
#define FRU_MULTIREC_MGMT_SUBTYPE_MIN 0x01
|
||||||
|
#define FRU_MULTIREC_MGMT_SUBTYPE_MAX 0x07
|
||||||
|
uint8_t subtype;
|
||||||
|
#define FRU_MULTIREC_MGMT_SYSURL 0x01
|
||||||
|
#define FRU_MULTIREC_MGMT_CMPURL 0x04
|
||||||
|
#define FRU_MULTIREC_MGMT_URL_MINLEN 16
|
||||||
|
#define FRU_MULTIREC_MGMT_URL_MAXLEN 256
|
||||||
|
|
||||||
|
#define FRU_MULTIREC_MGMT_SYSNAME 0x02
|
||||||
|
#define FRU_MULTIREC_MGMT_CMPNAME 0x05
|
||||||
|
#define FRU_MULTIREC_MGMT_NAME_MINLEN 8
|
||||||
|
#define FRU_MULTIREC_MGMT_NAME_MAXLEN 64
|
||||||
|
|
||||||
|
#define FRU_MULTIREC_MGMT_SYSPINGADDR 0x03
|
||||||
|
#define FRU_MULTIREC_MGMT_CMPPINGADDR 0x06
|
||||||
|
#define FRU_MULTIREC_MGMT_PINGADDR_MINLEN 8
|
||||||
|
#define FRU_MULTIREC_MGMT_PINGADDR_MAXLEN 64
|
||||||
|
|
||||||
|
#define FRU_MULTIREC_MGMT_UUID 0x07
|
||||||
|
#define FRU_MULTIREC_MGMT_UUID_LEN 16
|
||||||
|
|
||||||
|
#define FRU_MULTIREC_MGMT_DATA_MAXLEN FRU_MULTIREC_MGMT_URL_MAXLEN
|
||||||
|
uint8_t data[];
|
||||||
|
} ATTRIBUTE_PACKING;
|
||||||
|
|
||||||
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
#endif
|
#endif
|
||||||
@ -590,20 +629,28 @@ struct fru_picmgext_amc_link_desc_record {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* IPMI Return codes for Get FRU Inventory Area and Write FRU Inventory Area */
|
||||||
|
/* PROTECTED_OFFSET Only expected on write command failures. */
|
||||||
|
#define IPMI_CC_FRU_WRITE_PROTECTED_OFFSET 0x80
|
||||||
|
#define IPMI_CC_FRU_DEVICE_BUSY 0x81
|
||||||
|
|
||||||
/* FRU Board manufacturing date */
|
/* FRU Board manufacturing date */
|
||||||
static const uint64_t secs_from_1970_1996 = 820454400;
|
#define FRU_BOARD_DATE_UNSPEC 0 /* IPMI FRU Information Storage Definition
|
||||||
static const char * chassis_type_desc[] __attribute__((unused)) = {
|
v1.0 rev 1.3, Table 11-1 */
|
||||||
"Unspecified", "Other", "Unknown",
|
static inline time_t ipmi_fru2time_t(void *mfg_date) {
|
||||||
"Desktop", "Low Profile Desktop", "Pizza Box",
|
const uint64_t secs_from_1970_1996 = 820454400;
|
||||||
"Mini Tower", "Tower",
|
uint32_t fru_ts = ipmi24toh(mfg_date);
|
||||||
"Portable", "LapTop", "Notebook", "Hand Held",
|
time_t ts;
|
||||||
"Docking Station", "All in One", "Sub Notebook",
|
|
||||||
"Space-saving", "Lunch Box", "Main Server Chassis",
|
if (FRU_BOARD_DATE_UNSPEC == fru_ts) {
|
||||||
"Expansion Chassis", "SubChassis", "Bus Expansion Chassis",
|
ts = IPMI_TIME_UNSPECIFIED;
|
||||||
"Peripheral Chassis", "RAID Chassis", "Rack Mount Chassis",
|
}
|
||||||
"Sealed-case PC", "Multi-system Chassis", "CompactPCI",
|
else {
|
||||||
"AdvancedTCA", "Blade", "Blade Enclosure"
|
ts = fru_ts * 60 + secs_from_1970_1996;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct ipmi_fru_bloc {
|
typedef struct ipmi_fru_bloc {
|
||||||
struct ipmi_fru_bloc * next;
|
struct ipmi_fru_bloc * next;
|
||||||
@ -614,5 +661,4 @@ typedef struct ipmi_fru_bloc {
|
|||||||
|
|
||||||
int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv);
|
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);
|
int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru);
|
||||||
|
char *get_fru_area_str(uint8_t *data, uint32_t *offset);
|
||||||
#endif /* IPMI_FRU_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_KFWUM_H
|
#pragma once
|
||||||
# define IPMI_KFWUM_H
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
@ -239,5 +238,3 @@ struct KfwumFinishFirmwareDownloadReq {
|
|||||||
# ifdef HAVE_PRAGMA_PACK
|
# ifdef HAVE_PRAGMA_PACK
|
||||||
# pragma pack(0)
|
# pragma pack(0)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif /* IPMI_KFWUM_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_GENDEV_H
|
#pragma once
|
||||||
#define IPMI_GENDEV_H
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -44,5 +43,3 @@
|
|||||||
#include <ipmitool/ipmi_entity.h>
|
#include <ipmitool/ipmi_entity.h>
|
||||||
|
|
||||||
int ipmi_gendev_main(struct ipmi_intf *, int, char **);
|
int ipmi_gendev_main(struct ipmi_intf *, int, char **);
|
||||||
|
|
||||||
#endif /* IPMI_GENDEV_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_HPMFWUPG_H
|
#pragma once
|
||||||
#define IPMI_HPMFWUPG_H
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
@ -72,23 +71,6 @@ int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **);
|
|||||||
#define HPMFWUPG_FW_MISMATCH 0x83
|
#define HPMFWUPG_FW_MISMATCH 0x83
|
||||||
#define HPMFWUPG_ROLLBACK_DENIED 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 */
|
/* HPM FIRMWARE UPGRADE GENERAL DEFINITIONS */
|
||||||
#define HPMFWUPG_PICMG_IDENTIFIER 0
|
#define HPMFWUPG_PICMG_IDENTIFIER 0
|
||||||
#define HPMFWUPG_VERSION_SIZE 6
|
#define HPMFWUPG_VERSION_SIZE 6
|
||||||
@ -800,10 +782,6 @@ typedef struct _VERSIONINFO {
|
|||||||
char descString[HPMFWUPG_DESC_STRING_LENGTH + 1];
|
char descString[HPMFWUPG_DESC_STRING_LENGTH + 1];
|
||||||
}VERSIONINFO, *PVERSIONINFO;
|
}VERSIONINFO, *PVERSIONINFO;
|
||||||
|
|
||||||
VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX];
|
|
||||||
|
|
||||||
#define TARGET_VER (0x01)
|
#define TARGET_VER (0x01)
|
||||||
#define ROLLBACK_VER (0x02)
|
#define ROLLBACK_VER (0x02)
|
||||||
#define IMAGE_VER (0x04)
|
#define IMAGE_VER (0x04)
|
||||||
|
|
||||||
#endif /* IPMI_KFWUM_H */
|
|
||||||
|
5
include/ipmitool/ipmi_ime.h
Executable file → Normal file
5
include/ipmitool/ipmi_ime.h
Executable file → Normal file
@ -33,13 +33,10 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_IME_H
|
#pragma once
|
||||||
#define IPMI_IME_H
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
|
|
||||||
int ipmi_ime_main(struct ipmi_intf *, int, char **);
|
int ipmi_ime_main(struct ipmi_intf *, int, char **);
|
||||||
|
|
||||||
#endif /* IPMI_IME_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_INTF_H
|
#pragma once
|
||||||
#define IPMI_INTF_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
#include <ipmitool/ipmi_oem.h>
|
#include <ipmitool/ipmi_oem.h>
|
||||||
@ -62,13 +61,45 @@ enum LANPLUS_SESSION_STATE {
|
|||||||
#define IPMI_SIK_BUFFER_SIZE IPMI_MAX_MD_SIZE
|
#define IPMI_SIK_BUFFER_SIZE IPMI_MAX_MD_SIZE
|
||||||
#define IPMI_KG_BUFFER_SIZE 21 /* key plus null byte */
|
#define IPMI_KG_BUFFER_SIZE 21 /* key plus null byte */
|
||||||
|
|
||||||
|
enum cipher_suite_ids {
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_0 = 0,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_1 = 1,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_2 = 2,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_3 = 3,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_4 = 4,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_5 = 5,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_6 = 6,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_7 = 7,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_8 = 8,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_9 = 9,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_10 = 10,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_11 = 11,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_12 = 12,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_13 = 13,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_14 = 14,
|
||||||
|
#ifdef HAVE_CRYPTO_SHA256
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_15 = 15,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_16 = 16,
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_17 = 17,
|
||||||
|
#endif /* HAVE_CRYPTO_SHA256 */
|
||||||
|
IPMI_LANPLUS_CIPHER_SUITE_RESERVED = 0xff,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cipher_suite_info {
|
||||||
|
enum cipher_suite_ids cipher_suite_id;
|
||||||
|
uint8_t auth_alg;
|
||||||
|
uint8_t integrity_alg;
|
||||||
|
uint8_t crypt_alg;
|
||||||
|
uint32_t iana;
|
||||||
|
};
|
||||||
|
|
||||||
struct ipmi_session_params {
|
struct ipmi_session_params {
|
||||||
char * hostname;
|
char * hostname;
|
||||||
uint8_t username[17];
|
uint8_t username[17];
|
||||||
uint8_t authcode_set[IPMI_AUTHCODE_BUFFER_SIZE + 1];
|
uint8_t authcode_set[IPMI_AUTHCODE_BUFFER_SIZE + 1];
|
||||||
uint8_t authtype_set;
|
uint8_t authtype_set;
|
||||||
uint8_t privlvl;
|
uint8_t privlvl;
|
||||||
uint8_t cipher_suite_id;
|
enum cipher_suite_ids cipher_suite_id;
|
||||||
char sol_escape_char;
|
char sol_escape_char;
|
||||||
int password;
|
int password;
|
||||||
int port;
|
int port;
|
||||||
@ -119,7 +150,7 @@ struct ipmi_session {
|
|||||||
uint32_t bmc_id;
|
uint32_t bmc_id;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Values required for RAKP mesages
|
* Values required for RAKP messages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Random number generated byt the console */
|
/* Random number generated byt the console */
|
||||||
@ -201,7 +232,6 @@ struct ipmi_intf {
|
|||||||
int (*open)(struct ipmi_intf * intf);
|
int (*open)(struct ipmi_intf * intf);
|
||||||
void (*close)(struct ipmi_intf * intf);
|
void (*close)(struct ipmi_intf * intf);
|
||||||
struct ipmi_rs *(*sendrecv)(struct ipmi_intf * intf, struct ipmi_rq * req);
|
struct ipmi_rs *(*sendrecv)(struct ipmi_intf * intf, struct ipmi_rq * req);
|
||||||
int (*sendrsp)(struct ipmi_intf * intf, struct ipmi_rs * rsp);
|
|
||||||
struct ipmi_rs *(*recv_sol)(struct ipmi_intf * intf);
|
struct ipmi_rs *(*recv_sol)(struct ipmi_intf * intf);
|
||||||
struct ipmi_rs *(*send_sol)(struct ipmi_intf * intf, struct ipmi_v2_payload * payload);
|
struct ipmi_rs *(*send_sol)(struct ipmi_intf * intf, struct ipmi_v2_payload * payload);
|
||||||
int (*keepalive)(struct ipmi_intf * intf);
|
int (*keepalive)(struct ipmi_intf * intf);
|
||||||
@ -210,6 +240,10 @@ struct ipmi_intf {
|
|||||||
void (*set_max_response_data_size)(struct ipmi_intf * intf, uint16_t size);
|
void (*set_max_response_data_size)(struct ipmi_intf * intf, uint16_t size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint16_t ipmi_intf_get_max_request_data_size(struct ipmi_intf *intf);
|
||||||
|
uint16_t ipmi_intf_get_max_response_data_size(struct ipmi_intf *intf);
|
||||||
|
uint8_t ipmi_intf_get_bridging_level(const struct ipmi_intf *intf);
|
||||||
|
|
||||||
struct ipmi_intf * ipmi_intf_load(char * name);
|
struct ipmi_intf * ipmi_intf_load(char * name);
|
||||||
void ipmi_intf_print(struct ipmi_intf_support * intflist);
|
void ipmi_intf_print(struct ipmi_intf_support * intflist);
|
||||||
|
|
||||||
@ -218,7 +252,10 @@ void ipmi_intf_session_set_username(struct ipmi_intf * intf, char * username);
|
|||||||
void ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password);
|
void ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password);
|
||||||
void ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, uint8_t privlvl);
|
void ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, uint8_t privlvl);
|
||||||
void ipmi_intf_session_set_lookupbit(struct ipmi_intf * intf, uint8_t lookupbit);
|
void ipmi_intf_session_set_lookupbit(struct ipmi_intf * intf, uint8_t lookupbit);
|
||||||
void ipmi_intf_session_set_cipher_suite_id(struct ipmi_intf * intf, uint8_t cipher_suite_id);
|
#ifdef IPMI_INTF_LANPLUS
|
||||||
|
void ipmi_intf_session_set_cipher_suite_id(struct ipmi_intf * intf,
|
||||||
|
enum cipher_suite_ids cipher_suite_id);
|
||||||
|
#endif /* IPMI_INTF_LANPLUS */
|
||||||
void ipmi_intf_session_set_sol_escape_char(struct ipmi_intf * intf, char sol_escape_char);
|
void ipmi_intf_session_set_sol_escape_char(struct ipmi_intf * intf, char sol_escape_char);
|
||||||
void ipmi_intf_session_set_kgkey(struct ipmi_intf *intf, const uint8_t *kgkey);
|
void ipmi_intf_session_set_kgkey(struct ipmi_intf *intf, const uint8_t *kgkey);
|
||||||
void ipmi_intf_session_set_port(struct ipmi_intf * intf, int port);
|
void ipmi_intf_session_set_port(struct ipmi_intf * intf, int port);
|
||||||
@ -231,4 +268,3 @@ void ipmi_cleanup(struct ipmi_intf * intf);
|
|||||||
#if defined(IPMI_INTF_LAN) || defined (IPMI_INTF_LANPLUS)
|
#if defined(IPMI_INTF_LAN) || defined (IPMI_INTF_LANPLUS)
|
||||||
int ipmi_intf_socket_connect(struct ipmi_intf * intf);
|
int ipmi_intf_socket_connect(struct ipmi_intf * intf);
|
||||||
#endif
|
#endif
|
||||||
#endif /* IPMI_INTF_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_ISOL_H
|
#pragma once
|
||||||
#define IPMI_ISOL_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -53,5 +52,3 @@ struct isol_config_parameters {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int ipmi_isol_main(struct ipmi_intf *, int, char **);
|
int ipmi_isol_main(struct ipmi_intf *, int, char **);
|
||||||
|
|
||||||
#endif /* IPMI_SOL_H */
|
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_KONTRONOEM_H
|
#pragma once
|
||||||
#define IPMI_KONTRONOEM_H
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
@ -42,5 +41,3 @@
|
|||||||
|
|
||||||
int ipmi_kontronoem_main(struct ipmi_intf *, int, char **);
|
int ipmi_kontronoem_main(struct ipmi_intf *, int, char **);
|
||||||
int ipmi_kontronoem_set_large_buffer(struct ipmi_intf *, unsigned char size);
|
int ipmi_kontronoem_set_large_buffer(struct ipmi_intf *, unsigned char size);
|
||||||
|
|
||||||
#endif /* IPMI_KONTRONOEM_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_LANP_H
|
#pragma once
|
||||||
#define IPMI_LANP_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -50,6 +49,13 @@
|
|||||||
#define IPMI_LANP_WRITE_LOCK 1
|
#define IPMI_LANP_WRITE_LOCK 1
|
||||||
#define IPMI_LANP_WRITE_COMMIT 2
|
#define IPMI_LANP_WRITE_COMMIT 2
|
||||||
|
|
||||||
|
#define IPMI_LANP_VLAN_ID_MAX 4094
|
||||||
|
#define IPMI_LANP_VLAN_ID_MIN 1
|
||||||
|
#define IPMI_LANP_VLAN_DISABLE 0 /* ID 0 = VLAN is disabled for the channel */
|
||||||
|
|
||||||
|
#define IPMI_LANP_IS_VLAN_VALID(x) \
|
||||||
|
((x) >= IPMI_LANP_VLAN_ID_MIN && (x) <= IPMI_LANP_VLAN_ID_MAX)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
IPMI_LANP_SET_IN_PROGRESS,
|
IPMI_LANP_SET_IN_PROGRESS,
|
||||||
IPMI_LANP_AUTH_TYPE,
|
IPMI_LANP_AUTH_TYPE,
|
||||||
@ -118,51 +124,6 @@ enum {
|
|||||||
IPMI_LANP_CHAN_ACCESS_MODE=201,
|
IPMI_LANP_CHAN_ACCESS_MODE=201,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct lan_param {
|
|
||||||
int cmd;
|
|
||||||
int size;
|
|
||||||
char desc[24];
|
|
||||||
uint8_t * data;
|
|
||||||
int data_len;
|
|
||||||
} ipmi_lan_params[] __attribute__((unused)) = {
|
|
||||||
{ IPMI_LANP_SET_IN_PROGRESS, 1, "Set in Progress", NULL, 0 },
|
|
||||||
{ IPMI_LANP_AUTH_TYPE, 1, "Auth Type Support", NULL, 0 },
|
|
||||||
{ IPMI_LANP_AUTH_TYPE_ENABLE, 5, "Auth Type Enable", NULL, 0 },
|
|
||||||
{ IPMI_LANP_IP_ADDR, 4, "IP Address", NULL, 0 },
|
|
||||||
{ IPMI_LANP_IP_ADDR_SRC, 1, "IP Address Source", NULL, 0 },
|
|
||||||
{ IPMI_LANP_MAC_ADDR, 6, "MAC Address", NULL, 0 }, /* 5 */
|
|
||||||
{ IPMI_LANP_SUBNET_MASK, 4, "Subnet Mask", NULL, 0 },
|
|
||||||
{ IPMI_LANP_IP_HEADER, 3, "IP Header", NULL, 0 },
|
|
||||||
{ IPMI_LANP_PRI_RMCP_PORT, 2, "Primary RMCP Port", NULL, 0 },
|
|
||||||
{ IPMI_LANP_SEC_RMCP_PORT, 2, "Secondary RMCP Port", NULL, 0 },
|
|
||||||
{ IPMI_LANP_BMC_ARP, 1, "BMC ARP Control", NULL, 0}, /* 10 */
|
|
||||||
{ IPMI_LANP_GRAT_ARP, 1, "Gratituous ARP Intrvl", NULL, 0 },
|
|
||||||
{ IPMI_LANP_DEF_GATEWAY_IP, 4, "Default Gateway IP", NULL, 0 },
|
|
||||||
{ IPMI_LANP_DEF_GATEWAY_MAC, 6, "Default Gateway MAC", NULL, 0 },
|
|
||||||
{ IPMI_LANP_BAK_GATEWAY_IP, 4, "Backup Gateway IP", NULL, 0 },
|
|
||||||
{ IPMI_LANP_BAK_GATEWAY_MAC, 6, "Backup Gateway MAC", NULL, 0 }, /* 15 */
|
|
||||||
{ IPMI_LANP_SNMP_STRING, 18, "SNMP Community String", NULL, 0 },
|
|
||||||
{ IPMI_LANP_NUM_DEST, 1, "Number of Destinations", NULL, 0 },
|
|
||||||
{ IPMI_LANP_DEST_TYPE, 4, "Destination Type", NULL, 0 },
|
|
||||||
{ IPMI_LANP_DEST_ADDR, 13, "Destination Addresses", NULL, 0 },
|
|
||||||
{ IPMI_LANP_VLAN_ID, 2, "802.1q VLAN ID", NULL, 0 }, /* 20 */
|
|
||||||
{ IPMI_LANP_VLAN_PRIORITY, 1, "802.1q VLAN Priority", NULL, 0 },
|
|
||||||
{ IPMI_LANP_RMCP_CIPHER_SUPPORT,1, "RMCP+ Cipher Suite Count", NULL, 0 },
|
|
||||||
{ IPMI_LANP_RMCP_CIPHERS, 16, "RMCP+ Cipher Suites", NULL, 0 },
|
|
||||||
{ IPMI_LANP_RMCP_PRIV_LEVELS, 9, "Cipher Suite Priv Max", NULL, 0 },
|
|
||||||
{ IPMI_LANP_BAD_PASS_THRESH, 6, "Bad Password Threshold", NULL, 0 },
|
|
||||||
{ IPMI_LANP_OEM_ALERT_STRING, 28, "OEM Alert String", NULL, 0 }, /* 25 */
|
|
||||||
{ IPMI_LANP_ALERT_RETRY, 1, "Alert Retry Algorithm", NULL, 0 },
|
|
||||||
{ IPMI_LANP_UTC_OFFSET, 3, "UTC Offset", NULL, 0 },
|
|
||||||
{ IPMI_LANP_DHCP_SERVER_IP, 4, "DHCP Server IP", NULL, 0 },
|
|
||||||
{ IPMI_LANP_DHCP_SERVER_MAC, 6, "DHDP Server MAC", NULL, 0},
|
|
||||||
{ IPMI_LANP_DHCP_ENABLE, 1, "DHCP Enable", NULL, 0 }, /* 30 */
|
|
||||||
{ IPMI_LANP_CHAN_ACCESS_MODE, 2, "Channel Access Mode", NULL, 0 },
|
|
||||||
{ -1, -1, "", NULL, -1 }
|
|
||||||
};
|
|
||||||
|
|
||||||
int ipmi_lanp_main(struct ipmi_intf *, int, char **);
|
int ipmi_lanp_main(struct ipmi_intf *, int, char **);
|
||||||
|
|
||||||
uint8_t find_lan_channel(struct ipmi_intf *intf, uint8_t start);
|
uint8_t find_lan_channel(struct ipmi_intf *intf, uint8_t start);
|
||||||
|
|
||||||
#endif /*IPMI_LANP_H*/
|
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#ifndef IPMI_LANP6_H
|
|
||||||
#define IPMI_LANP6_H
|
#pragma once
|
||||||
|
|
||||||
#include <ipmitool/ipmi_intf.h>
|
#include <ipmitool/ipmi_intf.h>
|
||||||
|
|
||||||
@ -50,5 +50,3 @@ struct ipmi_lanp_priv {
|
|||||||
struct ipmi_intf *intf;
|
struct ipmi_intf *intf;
|
||||||
int channel;
|
int channel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* IPMI_LANP6_H */
|
|
||||||
|
@ -30,13 +30,10 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_MAIN_H
|
#pragma once
|
||||||
#define IPMI_MAIN_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi_intf.h>
|
#include <ipmitool/ipmi_intf.h>
|
||||||
|
|
||||||
int ipmi_main(int argc, char ** argv, struct ipmi_cmd * cmdlist, struct ipmi_intf_support * intflist);
|
int ipmi_main(int argc, char ** argv, struct ipmi_cmd * cmdlist, struct ipmi_intf_support * intflist);
|
||||||
void ipmi_cmd_print(struct ipmi_cmd * cmdlist);
|
void ipmi_cmd_print(struct ipmi_cmd * cmdlist);
|
||||||
int ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv);
|
int ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv);
|
||||||
|
|
||||||
#endif /* IPMI_MAIN_H */
|
|
||||||
|
@ -30,10 +30,19 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_MC_H
|
#pragma once
|
||||||
#define IPMI_MC_H
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
#include <ipmitool/helper.h>
|
||||||
|
#include <ipmitool/ipmi_strings.h>
|
||||||
|
|
||||||
|
#define OEM_MFG_STRING(oem) val2str(IPM_DEV_MANUFACTURER_ID(oem),\
|
||||||
|
ipmi_oem_info)
|
||||||
|
#define OEM_PROD_STRING(oem, p) oemval2str(IPM_DEV_MANUFACTURER_ID(oem),\
|
||||||
|
ipmi16toh(p),\
|
||||||
|
ipmi_oem_product_info)
|
||||||
|
|
||||||
#define BMC_GET_DEVICE_ID 0x01
|
#define BMC_GET_DEVICE_ID 0x01
|
||||||
#define BMC_COLD_RESET 0x02
|
#define BMC_COLD_RESET 0x02
|
||||||
@ -74,7 +83,7 @@ struct ipm_devid_rsp {
|
|||||||
#define IPM_DEV_DEVICE_ID_REV_MASK (0x0F) /* BCD-enoded */
|
#define IPM_DEV_DEVICE_ID_REV_MASK (0x0F) /* BCD-enoded */
|
||||||
|
|
||||||
#define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */
|
#define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */
|
||||||
#define IPM_DEV_FWREV1_MAJOR_MASK (0x3f) /* Major rev, BCD-encoded */
|
#define IPM_DEV_FWREV1_MAJOR_MASK (0x7f) /* Major rev, BCD-encoded */
|
||||||
|
|
||||||
#define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */
|
#define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */
|
||||||
#define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */
|
#define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */
|
||||||
@ -84,29 +93,140 @@ struct ipm_devid_rsp {
|
|||||||
#define IPM_DEV_IPMI_VERSION_MINOR(x) \
|
#define IPM_DEV_IPMI_VERSION_MINOR(x) \
|
||||||
((x & IPM_DEV_IPMI_VER_MINOR_MASK) >> IPM_DEV_IPMI_VER_MINOR_SHIFT)
|
((x & IPM_DEV_IPMI_VER_MINOR_MASK) >> IPM_DEV_IPMI_VER_MINOR_SHIFT)
|
||||||
|
|
||||||
#define IPM_DEV_MANUFACTURER_ID(x) \
|
#define IPM_DEV_MANUFACTURER_ID_RESERVED 0x0FFFFF
|
||||||
((uint32_t) ((x[2] & 0x0F) << 16 | x[1] << 8 | x[0]))
|
#define IPM_DEV_MANUFACTURER_ID(x) ipmi24toh(x)
|
||||||
|
|
||||||
#define IPM_DEV_ADTL_SUPPORT_BITS (8)
|
#define IPM_DEV_ADTL_SUPPORT_BITS (8)
|
||||||
|
|
||||||
/* Structure follow the IPMI V.2 Rev 1.0
|
/* There are lots of BMC implementations that don't follow the IPMI
|
||||||
* See Table 20-10 */
|
* specification for GUID encoding. Some send data encoded as in
|
||||||
|
* RFC4122, some follow SMBIOS specification. We support all users
|
||||||
|
* of those buggy implementations here.
|
||||||
|
*
|
||||||
|
* Most implementations like AMI MegaRAC do it the SMBIOS way.
|
||||||
|
* This is the legacy behavior we don't want to break yet.
|
||||||
|
* That's why the last real mode is GUID_SMBIOS. If automatic
|
||||||
|
* detection finds more than one possible candidate, and
|
||||||
|
* GUID_SMBIOS is one of them, then it will take precedence.
|
||||||
|
*
|
||||||
|
* For the same reason GUID_IPMI is right before GUID_SMBIOS.
|
||||||
|
* If both RFC4122 and IPMI encodings have a valid version
|
||||||
|
* field, then IPMI takes precedence.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
/* Real modes, in reverse precedence order */
|
||||||
|
GUID_RFC4122,
|
||||||
|
GUID_IPMI,
|
||||||
|
GUID_SMBIOS,
|
||||||
|
GUID_REAL_MODES, /* Real mode count*/
|
||||||
|
/* Pseudo modes start here */
|
||||||
|
GUID_AUTO = GUID_REAL_MODES, /* Automatically detect mode */
|
||||||
|
GUID_DUMP, /* Just dump the data */
|
||||||
|
GUID_TOTAL_MODES
|
||||||
|
} ipmi_guid_mode_t;
|
||||||
|
|
||||||
|
#define GUID_NODE_SZ 6
|
||||||
|
|
||||||
|
#define GUID_VER_MASK 0x0F
|
||||||
|
#define GUID_VER_SHIFT 12
|
||||||
|
#define GUID_VERSION(t_hi) (((t_hi) >> GUID_VER_SHIFT) & GUID_VER_MASK)
|
||||||
|
#define GUID_TIME_HI(t_hi) ((t_hi) & ~(GUID_VER_MASK << GUID_VER_SHIFT))
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GUID_VERSION_UNKNOWN = 0, /* Not valid according to any specification */
|
||||||
|
|
||||||
|
/* The following are according to IPMI/SMBIOS/RFC4122 */
|
||||||
|
GUID_VERSION_TIME, /* Time-based, recommended for IPMI */
|
||||||
|
GUID_VERSION_DCE, /* DCE Security with POSIX UIDs, not for IPMI */
|
||||||
|
GUID_VERSION_MD5, /* Name-based, using MD5 */
|
||||||
|
GUID_VERSION_RND, /* Randomly generated */
|
||||||
|
GUID_VERSION_SHA1, /* Name-based, using SHA-1 */
|
||||||
|
|
||||||
|
GUID_VERSION_MAX = GUID_VERSION_SHA1, /* The maximum supported version */
|
||||||
|
GUID_VERSION_COUNT /* The number of supported versions */
|
||||||
|
} guid_version_t;
|
||||||
|
|
||||||
|
static inline bool is_guid_version_valid(guid_version_t ver)
|
||||||
|
{
|
||||||
|
return (ver > GUID_VERSION_UNKNOWN) && (ver <= GUID_VERSION_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The structure follows IPMI v2.0, rev 1.1
|
||||||
|
* See section 20.8 */
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
#endif
|
#endif
|
||||||
struct ipmi_guid_t {
|
typedef struct {
|
||||||
uint32_t time_low; /* timestamp low field */
|
uint8_t node[GUID_NODE_SZ]; /* Byte 0 is LSB */
|
||||||
uint16_t time_mid; /* timestamp middle field */
|
union {
|
||||||
uint16_t time_hi_and_version; /* timestamp high field and version number */
|
struct {
|
||||||
uint8_t clock_seq_hi_variant;/* clock sequence high field and variant */
|
|
||||||
uint8_t clock_seq_low; /* clock sequence low field */
|
uint8_t clock_seq_low; /* clock sequence low field */
|
||||||
uint8_t node[6]; /* node */
|
uint8_t clock_seq_hi_and_rsvd;/* clock sequence high field */
|
||||||
} ATTRIBUTE_PACKING;
|
};
|
||||||
|
uint16_t clock_seq_and_rsvd;
|
||||||
|
};
|
||||||
|
uint16_t time_hi_and_version; /* timestamp high field and version number */
|
||||||
|
uint16_t time_mid; /* timestamp middle field */
|
||||||
|
uint32_t time_low; /* timestamp low field */
|
||||||
|
} ATTRIBUTE_PACKING ipmi_guid_t;
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int _ipmi_mc_get_guid(struct ipmi_intf *, struct ipmi_guid_t *);
|
/* The structure follows RFC4122 (section 4.1.2)
|
||||||
|
* and SMBIOS v3.0.0 (section 7.2.1) */
|
||||||
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
typedef struct {
|
||||||
|
uint32_t time_low; /* timestamp low field */
|
||||||
|
uint16_t time_mid; /* timestamp middle field */
|
||||||
|
uint16_t time_hi_and_version; /* timestamp high field and version number */
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint8_t clock_seq_hi_and_rsvd;/* clock sequence high field */
|
||||||
|
uint8_t clock_seq_low; /* clock sequence low field */
|
||||||
|
};
|
||||||
|
uint16_t clock_seq_and_rsvd;
|
||||||
|
};
|
||||||
|
uint8_t node[GUID_NODE_SZ]; /* Byte 0 is MSB */
|
||||||
|
} ATTRIBUTE_PACKING rfc_guid_t;
|
||||||
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
|
#pragma pack(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Parsed GUID structure */
|
||||||
|
typedef struct {
|
||||||
|
uint8_t node[GUID_NODE_SZ]; /* MSB first */
|
||||||
|
/* These are architecture-specific for easy output with printf() */
|
||||||
|
uint16_t clock_seq_and_rsvd;
|
||||||
|
uint64_t time_hi_and_version;
|
||||||
|
uint64_t time_mid;
|
||||||
|
uint64_t time_low;
|
||||||
|
/* These are the parsed values */
|
||||||
|
time_t time;
|
||||||
|
ipmi_guid_mode_t mode;
|
||||||
|
guid_version_t ver; /* Version from time_hi_and_version, if valid */
|
||||||
|
} parsed_guid_t;
|
||||||
|
|
||||||
|
parsed_guid_t ipmi_parse_guid(void *guid, ipmi_guid_mode_t guid_mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a binary GUID/UUID to a canonical hex string form.
|
||||||
|
* If the version/encoding of the source data is unknown,
|
||||||
|
* dump the source data as a simple hex string.
|
||||||
|
*
|
||||||
|
* @param[out] str The string representation of GUID
|
||||||
|
* @param[in] data The source binary GUID data
|
||||||
|
* @param[in] mode The conversion mode, use GUID_AUTO for automatic detection
|
||||||
|
*
|
||||||
|
* @returns The parsed GUID structure
|
||||||
|
*/
|
||||||
|
parsed_guid_t
|
||||||
|
ipmi_guid2str(char *str, const void *data, ipmi_guid_mode_t mode);
|
||||||
|
#define GUID_STR_MAXLEN 36 /* 8+4+4+4+12 bytes plus the dashes */
|
||||||
|
|
||||||
|
int _ipmi_mc_get_guid(struct ipmi_intf *intf, ipmi_guid_t *guid);
|
||||||
|
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
@ -138,14 +258,24 @@ struct ipm_selftest_rsp {
|
|||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
#endif
|
#endif
|
||||||
struct ipm_get_watchdog_rsp {
|
struct ipm_get_watchdog_rsp {
|
||||||
unsigned char timer_use;
|
unsigned char use;
|
||||||
unsigned char timer_actions;
|
unsigned char intr_action;
|
||||||
unsigned char pre_timeout;
|
unsigned char pre_timeout;
|
||||||
unsigned char timer_use_exp;
|
unsigned char exp_flags;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
unsigned char initial_countdown_lsb;
|
unsigned char initial_countdown_lsb;
|
||||||
unsigned char initial_countdown_msb;
|
unsigned char initial_countdown_msb;
|
||||||
|
};
|
||||||
|
uint16_t init_cnt_le;
|
||||||
|
};
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
unsigned char present_countdown_lsb;
|
unsigned char present_countdown_lsb;
|
||||||
unsigned char present_countdown_msb;
|
unsigned char present_countdown_msb;
|
||||||
|
};
|
||||||
|
uint16_t pres_cnt_le;
|
||||||
|
};
|
||||||
} ATTRIBUTE_PACKING;
|
} ATTRIBUTE_PACKING;
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
@ -170,6 +300,25 @@ struct ipm_get_watchdog_rsp {
|
|||||||
#define IPM_WATCHDOG_CLEAR_BIOS_POST 0x04
|
#define IPM_WATCHDOG_CLEAR_BIOS_POST 0x04
|
||||||
#define IPM_WATCHDOG_CLEAR_BIOS_FRB2 0x02
|
#define IPM_WATCHDOG_CLEAR_BIOS_FRB2 0x02
|
||||||
|
|
||||||
|
/* Use */
|
||||||
|
#define IPMI_WDT_USE_NOLOG_SHIFT 7
|
||||||
|
#define IPMI_WDT_USE_DONTSTOP_SHIFT 6 /* For 'set' */
|
||||||
|
#define IPMI_WDT_USE_RUNNING_SHIFT 6 /* For 'get' */
|
||||||
|
#define IPMI_WDT_USE_SHIFT 0
|
||||||
|
#define IPMI_WDT_USE_MASK 0x07
|
||||||
|
|
||||||
|
/* Pre-timeout interrupt type */
|
||||||
|
#define IPMI_WDT_INTR_SHIFT 4
|
||||||
|
#define IPMI_WDT_INTR_MASK 0x07 /* Apply to the intr value, not to the data byte */
|
||||||
|
|
||||||
|
/* Action */
|
||||||
|
#define IPMI_WDT_ACTION_SHIFT 0
|
||||||
|
#define IPMI_WDT_ACTION_MASK 0x07
|
||||||
|
|
||||||
|
#define IPMI_WDT_GET(b, s) (((b) >> (IPMI_WDT_##s##_SHIFT)) & (IPMI_WDT_##s##_MASK))
|
||||||
|
|
||||||
|
#define IS_WDT_BIT(b, s) IS_SET((b), IPMI_WDT_##s##_SHIFT)
|
||||||
|
|
||||||
/* IPMI 2.0 command for system information*/
|
/* IPMI 2.0 command for system information*/
|
||||||
#define IPMI_SET_SYS_INFO 0x58
|
#define IPMI_SET_SYS_INFO 0x58
|
||||||
#define IPMI_GET_SYS_INFO 0x59
|
#define IPMI_GET_SYS_INFO 0x59
|
||||||
@ -190,5 +339,3 @@ struct ipm_get_watchdog_rsp {
|
|||||||
int ipmi_mc_getsysinfo(struct ipmi_intf * intf, int param, int block, int set,
|
int ipmi_mc_getsysinfo(struct ipmi_intf * intf, int param, int block, int set,
|
||||||
int len, void *buffer);
|
int len, void *buffer);
|
||||||
int ipmi_mc_setsysinfo(struct ipmi_intf * intf, int len, void *buffer);
|
int ipmi_mc_setsysinfo(struct ipmi_intf * intf, int len, void *buffer);
|
||||||
|
|
||||||
#endif /*IPMI_MC_H */
|
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_OEM_H
|
#pragma once
|
||||||
#define IPMI_OEM_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -43,5 +42,3 @@ struct ipmi_oem_handle {
|
|||||||
void ipmi_oem_print(void);
|
void ipmi_oem_print(void);
|
||||||
int ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype);
|
int ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype);
|
||||||
int ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype);
|
int ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype);
|
||||||
|
|
||||||
#endif /*IPMI_OEM_H*/
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF DELL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF DELL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_PEF_H
|
#pragma once
|
||||||
#define IPMI_PEF_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -111,224 +110,6 @@ struct bit_desc_map { /* description text container */
|
|||||||
struct desc_map desc_maps[128];
|
struct desc_map desc_maps[128];
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_actions __attribute__((unused)) = {
|
|
||||||
BIT_DESC_MAP_ALL,
|
|
||||||
{ {"Alert", PEF_ACTION_ALERT},
|
|
||||||
{"Power-off", PEF_ACTION_POWER_DOWN},
|
|
||||||
{"Reset", PEF_ACTION_RESET},
|
|
||||||
{"Power-cycle", PEF_ACTION_POWER_CYCLE},
|
|
||||||
{"OEM-defined", PEF_ACTION_OEM},
|
|
||||||
{"Diagnostic-interrupt", PEF_ACTION_DIAGNOSTIC_INTERRUPT},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_severities __attribute__((unused)) = {
|
|
||||||
BIT_DESC_MAP_ANY,
|
|
||||||
{ {"Non-recoverable", PEF_SEVERITY_NON_RECOVERABLE},
|
|
||||||
{"Critical", PEF_SEVERITY_CRITICAL},
|
|
||||||
{"Warning", PEF_SEVERITY_WARNING},
|
|
||||||
{"OK", PEF_SEVERITY_OK},
|
|
||||||
{"Information", PEF_SEVERITY_INFORMATION},
|
|
||||||
{"Monitor", PEF_SEVERITY_MONITOR},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_sensortypes __attribute__((unused)) = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"Any", 255},
|
|
||||||
{"Temperature", 1},
|
|
||||||
{"Voltage", 2},
|
|
||||||
{"Current", 3},
|
|
||||||
{"Fan", 4},
|
|
||||||
{"Chassis Intrusion", 5},
|
|
||||||
{"Platform security breach", 6},
|
|
||||||
{"Processor", 7},
|
|
||||||
{"Power supply", 8},
|
|
||||||
{"Power Unit", 9},
|
|
||||||
{"Cooling device", 10},
|
|
||||||
{"Other (units-based)", 11},
|
|
||||||
{"Memory", 12},
|
|
||||||
{"Drive Slot", 13},
|
|
||||||
{"POST memory resize", 14},
|
|
||||||
{"POST error", 15},
|
|
||||||
{"Logging disabled", 16},
|
|
||||||
{"Watchdog 1", 17},
|
|
||||||
{"System event", 18},
|
|
||||||
{"Critical Interrupt", 19},
|
|
||||||
{"Button", 20},
|
|
||||||
{"Module/board", 21},
|
|
||||||
{"uController/coprocessor", 22},
|
|
||||||
{"Add-in card", 23},
|
|
||||||
{"Chassis", 24},
|
|
||||||
{"Chipset", 25},
|
|
||||||
{"Other (FRU)", 26},
|
|
||||||
{"Cable/interconnect", 27},
|
|
||||||
{"Terminator", 28},
|
|
||||||
{"System boot", 29},
|
|
||||||
{"Boot error", 30},
|
|
||||||
{"OS boot", 31},
|
|
||||||
{"OS critical stop", 32},
|
|
||||||
{"Slot/connector", 33},
|
|
||||||
{"ACPI power state", 34},
|
|
||||||
{"Watchdog 2", 35},
|
|
||||||
{"Platform alert", 36},
|
|
||||||
{"Entity presence", 37},
|
|
||||||
{"Monitor ASIC/IC", 38},
|
|
||||||
{"LAN", 39},
|
|
||||||
{"Management subsytem health",40},
|
|
||||||
{"Battery", 41},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_1 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"<LNC", 0}, /* '<' : getting worse */
|
|
||||||
{">LNC", 1}, /* '>' : getting better */
|
|
||||||
{"<LC", 2},
|
|
||||||
{">LC", 3},
|
|
||||||
{"<LNR", 4},
|
|
||||||
{">LNR", 5},
|
|
||||||
{">UNC", 6},
|
|
||||||
{"<UNC", 7},
|
|
||||||
{">UC", 8},
|
|
||||||
{"<UC", 9},
|
|
||||||
{">UNR", 10},
|
|
||||||
{"<UNR", 11},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_2 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"transition to idle", 0},
|
|
||||||
{"transition to active", 1},
|
|
||||||
{"transition to busy", 2},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_3 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"state deasserted", 0},
|
|
||||||
{"state asserted", 1},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_4 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"predictive failure deasserted", 0},
|
|
||||||
{"predictive failure asserted", 1},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_5 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"limit not exceeded", 0},
|
|
||||||
{"limit exceeded", 1},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_6 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"performance met", 0},
|
|
||||||
{"performance lags", 1},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_7 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"ok", 0},
|
|
||||||
{"<warn", 1}, /* '<' : getting worse */
|
|
||||||
{"<fail", 2},
|
|
||||||
{"<dead", 3},
|
|
||||||
{">warn", 4}, /* '>' : getting better */
|
|
||||||
{">fail", 5},
|
|
||||||
{"dead", 6},
|
|
||||||
{"monitor", 7},
|
|
||||||
{"informational", 8},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_8 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"device removed/absent", 0},
|
|
||||||
{"device inserted/present", 1},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_9 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"device disabled", 0},
|
|
||||||
{"device enabled", 1},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_10 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"transition to running", 0},
|
|
||||||
{"transition to in test", 1},
|
|
||||||
{"transition to power off", 2},
|
|
||||||
{"transition to online", 3},
|
|
||||||
{"transition to offline", 4},
|
|
||||||
{"transition to off duty", 5},
|
|
||||||
{"transition to degraded", 6},
|
|
||||||
{"transition to power save", 7},
|
|
||||||
{"install error", 8},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_11 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"fully redundant", 0},
|
|
||||||
{"redundancy lost", 1},
|
|
||||||
{"redundancy degraded", 2},
|
|
||||||
{"<non-redundant/sufficient", 3}, /* '<' : getting worse */
|
|
||||||
{">non-redundant/sufficient", 4}, /* '>' : getting better */
|
|
||||||
{"non-redundant/insufficient", 5},
|
|
||||||
{"<redundancy degraded", 6},
|
|
||||||
{">redundancy degraded", 7},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_gentype_12 = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"D0 power state", 0},
|
|
||||||
{"D1 power state", 1},
|
|
||||||
{"D2 power state", 2},
|
|
||||||
{"D3 power state", 3},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map *
|
|
||||||
pef_b2s_generic_ER[] __attribute__((unused)) = {
|
|
||||||
&pef_b2s_gentype_1,
|
|
||||||
&pef_b2s_gentype_2,
|
|
||||||
&pef_b2s_gentype_3,
|
|
||||||
&pef_b2s_gentype_4,
|
|
||||||
&pef_b2s_gentype_5,
|
|
||||||
&pef_b2s_gentype_6,
|
|
||||||
&pef_b2s_gentype_7,
|
|
||||||
&pef_b2s_gentype_8,
|
|
||||||
&pef_b2s_gentype_9,
|
|
||||||
&pef_b2s_gentype_10,
|
|
||||||
&pef_b2s_gentype_11,
|
|
||||||
&pef_b2s_gentype_12,
|
|
||||||
};
|
|
||||||
#define PEF_B2S_GENERIC_ER_ENTRIES \
|
|
||||||
(sizeof(pef_b2s_generic_ER) / sizeof(pef_b2s_generic_ER[0]))
|
|
||||||
|
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
@ -356,46 +137,6 @@ struct pef_policy_entry {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_policies __attribute__((unused)) = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"Match-always", PEF_POLICY_FLAGS_MATCH_ALWAYS},
|
|
||||||
{"Try-next-entry", PEF_POLICY_FLAGS_PREV_OK_SKIP},
|
|
||||||
{"Try-next-set", PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET},
|
|
||||||
{"Try-next-channel", PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET},
|
|
||||||
{"Try-next-destination", PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_ch_medium __attribute__((unused)) = {
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_IPMB 1
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_ICMB_10 2
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_ICMB_09 3
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_LAN 4
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_SERIAL 5
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_XLAN 6
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_PCI_SMBUS 7
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_SMBUS_V1X 8
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_SMBUS_V2X 9
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_USB_V1X 10
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_USB_V2X 11
|
|
||||||
#define PEF_CH_MEDIUM_TYPE_SYSTEM 12
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"IPMB (I2C)", PEF_CH_MEDIUM_TYPE_IPMB},
|
|
||||||
{"ICMB v1.0", PEF_CH_MEDIUM_TYPE_ICMB_10},
|
|
||||||
{"ICMB v0.9", PEF_CH_MEDIUM_TYPE_ICMB_09},
|
|
||||||
{"802.3 LAN", PEF_CH_MEDIUM_TYPE_LAN},
|
|
||||||
{"Serial/Modem (RS-232)", PEF_CH_MEDIUM_TYPE_SERIAL},
|
|
||||||
{"Other LAN", PEF_CH_MEDIUM_TYPE_XLAN},
|
|
||||||
{"PCI SMBus", PEF_CH_MEDIUM_TYPE_PCI_SMBUS},
|
|
||||||
{"SMBus v1.0/1.1", PEF_CH_MEDIUM_TYPE_SMBUS_V1X},
|
|
||||||
{"SMBus v2.0", PEF_CH_MEDIUM_TYPE_SMBUS_V2X},
|
|
||||||
{"USB 1.x", PEF_CH_MEDIUM_TYPE_USB_V1X},
|
|
||||||
{"USB 2.x", PEF_CH_MEDIUM_TYPE_USB_V2X},
|
|
||||||
{"System I/F (KCS,SMIC,BT)", PEF_CH_MEDIUM_TYPE_SYSTEM},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
@ -450,15 +191,6 @@ struct pef_cfgparm_control {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_control __attribute__((unused)) = {
|
|
||||||
BIT_DESC_MAP_ALL,
|
|
||||||
{ {"PEF", PEF_CONTROL_ENABLE},
|
|
||||||
{"PEF event messages", PEF_CONTROL_ENABLE_EVENT_MESSAGES},
|
|
||||||
{"PEF startup delay", PEF_CONTROL_ENABLE_STARTUP_DELAY},
|
|
||||||
{"Alert startup delay", PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
@ -656,15 +388,6 @@ struct pef_lan_cfgparm_dest_type {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_lan_desttype __attribute__((unused)) = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"Acknowledged", PEF_LAN_DEST_TYPE_ACK},
|
|
||||||
{"PET", PEF_LAN_DEST_TYPE_PET},
|
|
||||||
{"OEM 1", PEF_LAN_DEST_TYPE_OEM_1},
|
|
||||||
{"OEM 2", PEF_LAN_DEST_TYPE_OEM_2},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
@ -755,18 +478,6 @@ struct pef_serial_cfgparm_dest_info {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_serial_desttype __attribute__((unused)) = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"Acknowledged", PEF_SERIAL_DEST_TYPE_ACK},
|
|
||||||
{"TAP page", PEF_SERIAL_DEST_TYPE_TAP},
|
|
||||||
{"PPP PET", PEF_SERIAL_DEST_TYPE_PPP},
|
|
||||||
{"Basic callback", PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK},
|
|
||||||
{"PPP callback", PEF_SERIAL_DEST_TYPE_PPP_CALLBACK},
|
|
||||||
{"OEM 1", PEF_SERIAL_DEST_TYPE_OEM_1},
|
|
||||||
{"OEM 2", PEF_SERIAL_DEST_TYPE_OEM_2},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
@ -835,14 +546,6 @@ struct pef_serial_cfgparm_tap_svc_settings {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct bit_desc_map
|
|
||||||
pef_b2s_tap_svc_confirm __attribute__((unused)) = {
|
|
||||||
BIT_DESC_MAP_LIST,
|
|
||||||
{ {"ACK", PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX},
|
|
||||||
{"211+ACK", PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX},
|
|
||||||
{"{211|213}+ACK", PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX},
|
|
||||||
{NULL}
|
|
||||||
} };
|
|
||||||
|
|
||||||
#if 0 /* FYI : config parm groupings */
|
#if 0 /* FYI : config parm groupings */
|
||||||
struct pef_config_parms { /* PEF */
|
struct pef_config_parms { /* PEF */
|
||||||
@ -963,5 +666,3 @@ void ipmi_pef_print_2xd(const char * text, uint8_t u1, uint8_t u2);
|
|||||||
void ipmi_pef_print_str(const char * text, const char * val);
|
void ipmi_pef_print_str(const char * text, const char * val);
|
||||||
|
|
||||||
int ipmi_pef_main(struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_pef_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
|
|
||||||
#endif /* IPMI_PEF_H */
|
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
(C) Kontron
|
(C) Kontron
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _IPMI_PICMG_H_
|
#pragma once
|
||||||
#define _IPMI_PICMG_H_
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -12,6 +11,7 @@
|
|||||||
#define PICMG_CPCI_MAJOR_VERSION 1
|
#define PICMG_CPCI_MAJOR_VERSION 1
|
||||||
#define PICMG_ATCA_MAJOR_VERSION 2
|
#define PICMG_ATCA_MAJOR_VERSION 2
|
||||||
#define PICMG_AMC_MAJOR_VERSION 4
|
#define PICMG_AMC_MAJOR_VERSION 4
|
||||||
|
#define PICMG_UTCA_MAJOR_VERSION 5
|
||||||
|
|
||||||
/* PICMG commands */
|
/* PICMG commands */
|
||||||
#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00
|
#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00
|
||||||
@ -91,95 +91,7 @@ typedef enum picmg_busres_resource_id {
|
|||||||
PICMG_BUSRES_SYNC_CLOCK_GROUP_3
|
PICMG_BUSRES_SYNC_CLOCK_GROUP_3
|
||||||
} t_picmg_busres_resource_id;
|
} t_picmg_busres_resource_id;
|
||||||
|
|
||||||
/* the LED color capabilities */
|
const char *picmg_led_color_str(int color);
|
||||||
static const char* led_color_str[] __attribute__((unused)) = {
|
|
||||||
"reserved",
|
|
||||||
"BLUE",
|
|
||||||
"RED",
|
|
||||||
"GREEN",
|
|
||||||
"AMBER",
|
|
||||||
"ORANGE",
|
|
||||||
"WHITE",
|
|
||||||
"reserved"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const char* amc_link_type_str[] __attribute__((unused)) = {
|
|
||||||
"RESERVED",
|
|
||||||
"RESERVED1",
|
|
||||||
"PCI EXPRESS",
|
|
||||||
"ADVANCED SWITCHING1",
|
|
||||||
"ADVANCED SWITCHING2",
|
|
||||||
"ETHERNET",
|
|
||||||
"RAPIDIO",
|
|
||||||
"STORAGE",
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char* amc_link_type_ext_str[][16] __attribute__((unused)) = {
|
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED */
|
|
||||||
{
|
|
||||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
|
|
||||||
},
|
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 */
|
|
||||||
{
|
|
||||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
|
|
||||||
},
|
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS */
|
|
||||||
{
|
|
||||||
"Gen 1 - NSSC",
|
|
||||||
"Gen 1 - SSC",
|
|
||||||
"Gen 2 - NSSC",
|
|
||||||
"Gen 2 - SSC",
|
|
||||||
"", "", "", "",
|
|
||||||
"", "", "", "",
|
|
||||||
"", "", "", ""
|
|
||||||
},
|
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 */
|
|
||||||
{
|
|
||||||
"Gen 1 - NSSC",
|
|
||||||
"Gen 1 - SSC",
|
|
||||||
"Gen 2 - NSSC",
|
|
||||||
"Gen 2 - SSC",
|
|
||||||
"", "", "", "",
|
|
||||||
"", "", "", "",
|
|
||||||
"", "", "", ""
|
|
||||||
},
|
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 */
|
|
||||||
{
|
|
||||||
"Gen 1 - NSSC",
|
|
||||||
"Gen 1 - SSC",
|
|
||||||
"Gen 2 - NSSC",
|
|
||||||
"Gen 2 - SSC",
|
|
||||||
"", "", "", "",
|
|
||||||
"", "", "", "",
|
|
||||||
"", "", "", ""
|
|
||||||
},
|
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */
|
|
||||||
{
|
|
||||||
"1000BASE-BX (SerDES Gigabit)",
|
|
||||||
"10GBASE-BX410 Gigabit XAUI",
|
|
||||||
"", "",
|
|
||||||
"", "", "", "",
|
|
||||||
"", "", "", "",
|
|
||||||
"", "", "", ""
|
|
||||||
},
|
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */
|
|
||||||
{
|
|
||||||
"1.25 Gbaud transmission rate",
|
|
||||||
"2.5 Gbaud transmission rate",
|
|
||||||
"3.125 Gbaud transmission rate",
|
|
||||||
"", "", "", "", "",
|
|
||||||
"", "", "", "", "", "", "", ""
|
|
||||||
},
|
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */
|
|
||||||
{
|
|
||||||
"Fibre Channel",
|
|
||||||
"Serial ATA",
|
|
||||||
"Serial Attached SCSI",
|
|
||||||
"", "", "", "", "",
|
|
||||||
"", "", "", "", "", "", "", ""
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sAmcPortState {
|
struct sAmcPortState {
|
||||||
#ifndef WORDS_BIGENDIAN
|
#ifndef WORDS_BIGENDIAN
|
||||||
@ -207,5 +119,3 @@ struct sAmcPortState {
|
|||||||
int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
uint8_t picmg_discover(struct ipmi_intf *intf);
|
uint8_t picmg_discover(struct ipmi_intf *intf);
|
||||||
uint8_t ipmi_picmg_ipmb_address(struct ipmi_intf *intf);
|
uint8_t ipmi_picmg_ipmb_address(struct ipmi_intf *intf);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
52
include/ipmitool/ipmi_quantaoem.h
Normal file
52
include/ipmitool/ipmi_quantaoem.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Quanta Computer 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 Quanta Computer 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.
|
||||||
|
* Quanta Computer Inc. 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
|
||||||
|
* Quanta Computer Inc. 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
#include <ipmitool/ipmi.h>
|
||||||
|
#include <ipmitool/ipmi_sdr.h>
|
||||||
|
|
||||||
|
#define OEM_QCT_NETFN 0x36
|
||||||
|
#define OEM_QCT_GET_INFO 0x65
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
OEM_QCT_PLATFORM_UNKNOWN = 0,
|
||||||
|
OEM_QCT_PLATFORM_GRANTLEY,
|
||||||
|
OEM_QCT_PLATFORM_PURLEY
|
||||||
|
} qct_platform_t;
|
||||||
|
|
||||||
|
qct_platform_t oem_qct_get_platform_id(struct ipmi_intf *intf);
|
||||||
|
char *oem_qct_get_evt_desc(struct ipmi_intf *intf, struct sel_event_record *rec);
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_RAW_H
|
#pragma once
|
||||||
#define IPMI_RAW_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -40,5 +39,3 @@ struct ipmi_rs * ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, ui
|
|||||||
uint8_t * wdata, uint8_t wsize, uint8_t rsize);
|
uint8_t * wdata, uint8_t wsize, uint8_t rsize);
|
||||||
int ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
int ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
|
|
||||||
#endif /* IPMI_RAW_H */
|
|
||||||
|
@ -30,13 +30,13 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_SDR_H
|
#pragma once
|
||||||
#define IPMI_SDR_H
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <ipmitool/bswap.h>
|
#include <ipmitool/bswap.h>
|
||||||
@ -381,6 +381,29 @@ struct sdr_record_common_sensor {
|
|||||||
|
|
||||||
struct sdr_record_mask mask;
|
struct sdr_record_mask mask;
|
||||||
|
|
||||||
|
/* IPMI 2.0, Table 43-1, byte 21[7:6] Analog (numeric) Data Format */
|
||||||
|
#define SDR_UNIT_FMT_UNSIGNED 0 /* unsigned */
|
||||||
|
#define SDR_UNIT_FMT_1S_COMPL 1 /* 1's complement (signed) */
|
||||||
|
#define SDR_UNIT_FMT_2S_COMPL 2 /* 2's complement (signed) */
|
||||||
|
#define SDR_UNIT_FMT_NA 3 /* does not return analog (numeric) reading */
|
||||||
|
/* IPMI 2.0, Table 43-1, byte 21[5:3] Rate */
|
||||||
|
#define SDR_UNIT_RATE_NONE 0 /* none */
|
||||||
|
#define SDR_UNIT_RATE_MICROSEC 1 /* per us */
|
||||||
|
#define SDR_UNIT_RATE_MILLISEC 2 /* per ms */
|
||||||
|
#define SDR_UNIT_RATE_SEC 3 /* per s */
|
||||||
|
#define SDR_UNIT_RATE_MIN 4 /* per min */
|
||||||
|
#define SDR_UNIT_RATE_HR 5 /* per hour */
|
||||||
|
#define SDR_UNIT_RATE_DAY 6 /* per day */
|
||||||
|
#define SDR_UNIT_RATE_RSVD 7 /* reserved */
|
||||||
|
/* IPMI 2.0, Table 43-1, byte 21[2:1] Modifier Unit */
|
||||||
|
#define SDR_UNIT_MOD_NONE 0 /* none */
|
||||||
|
#define SDR_UNIT_MOD_DIV 1 /* Basic Unit / Modifier Unit */
|
||||||
|
#define SDR_UNIT_MOD_MUL 2 /* Basic Unit * Mofifier Unit */
|
||||||
|
#define SDR_UNIT_MOD_RSVD 3 /* Reserved */
|
||||||
|
/* IPMI 2.0, Table 43-1, byte 21[0] Percentage */
|
||||||
|
#define SDR_UNIT_PCT_NO 0
|
||||||
|
#define SDR_UNIT_PCT_YES 1
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t analog:2;
|
uint8_t analog:2;
|
||||||
@ -394,8 +417,8 @@ struct sdr_record_common_sensor {
|
|||||||
uint8_t analog:2;
|
uint8_t analog:2;
|
||||||
#endif
|
#endif
|
||||||
struct {
|
struct {
|
||||||
uint8_t base;
|
uint8_t base; /* Base unit type code per IPMI 2.0 Table 43-15 */
|
||||||
uint8_t modifier;
|
uint8_t modifier; /* Modifier unit type code per Table 43-15 */
|
||||||
} ATTRIBUTE_PACKING type;
|
} ATTRIBUTE_PACKING type;
|
||||||
} ATTRIBUTE_PACKING unit;
|
} ATTRIBUTE_PACKING unit;
|
||||||
} ATTRIBUTE_PACKING;
|
} ATTRIBUTE_PACKING;
|
||||||
@ -773,50 +796,7 @@ struct sdr_record_list {
|
|||||||
#pragma pack(0)
|
#pragma pack(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* unit description codes (IPMI v1.5 section 37.16) */
|
|
||||||
#define UNIT_MAX 0x90
|
|
||||||
static const char *unit_desc[] __attribute__ ((unused)) = {
|
|
||||||
"unspecified",
|
|
||||||
"degrees C", "degrees F", "degrees K",
|
|
||||||
"Volts", "Amps", "Watts", "Joules",
|
|
||||||
"Coulombs", "VA", "Nits",
|
|
||||||
"lumen", "lux", "Candela",
|
|
||||||
"kPa", "PSI", "Newton",
|
|
||||||
"CFM", "RPM", "Hz",
|
|
||||||
"microsecond", "millisecond", "second", "minute", "hour",
|
|
||||||
"day", "week", "mil", "inches", "feet", "cu in", "cu feet",
|
|
||||||
"mm", "cm", "m", "cu cm", "cu m", "liters", "fluid ounce",
|
|
||||||
"radians", "steradians", "revolutions", "cycles",
|
|
||||||
"gravities", "ounce", "pound", "ft-lb", "oz-in", "gauss",
|
|
||||||
"gilberts", "henry", "millihenry", "farad", "microfarad",
|
|
||||||
"ohms", "siemens", "mole", "becquerel", "PPM", "reserved",
|
|
||||||
"Decibels", "DbA", "DbC", "gray", "sievert",
|
|
||||||
"color temp deg K", "bit", "kilobit", "megabit", "gigabit",
|
|
||||||
"byte", "kilobyte", "megabyte", "gigabyte", "word", "dword",
|
|
||||||
"qword", "line", "hit", "miss", "retry", "reset",
|
|
||||||
"overflow", "underrun", "collision", "packets", "messages",
|
|
||||||
"characters", "error", "correctable error", "uncorrectable error",};
|
|
||||||
|
|
||||||
/* sensor type codes (IPMI v1.5 table 36.3)
|
|
||||||
/ Updated to v2.0 Table 42-3, Sensor Type Codes */
|
|
||||||
#define SENSOR_TYPE_MAX 0x2C
|
#define SENSOR_TYPE_MAX 0x2C
|
||||||
static const char *sensor_type_desc[] __attribute__ ((unused)) = {
|
|
||||||
"reserved",
|
|
||||||
"Temperature", "Voltage", "Current", "Fan",
|
|
||||||
"Physical Security", "Platform Security", "Processor",
|
|
||||||
"Power Supply", "Power Unit", "Cooling Device", "Other",
|
|
||||||
"Memory", "Drive Slot / Bay", "POST Memory Resize",
|
|
||||||
"System Firmwares", "Event Logging Disabled", "Watchdog1",
|
|
||||||
"System Event", "Critical Interrupt", "Button",
|
|
||||||
"Module / Board", "Microcontroller", "Add-in Card",
|
|
||||||
"Chassis", "Chip Set", "Other FRU", "Cable / Interconnect",
|
|
||||||
"Terminator", "System Boot Initiated", "Boot Error",
|
|
||||||
"OS Boot", "OS Critical Stop", "Slot / Connector",
|
|
||||||
"System ACPI Power State", "Watchdog2", "Platform Alert",
|
|
||||||
"Entity Presence", "Monitor ASIC", "LAN",
|
|
||||||
"Management Subsys Health", "Battery", "Session Audit",
|
|
||||||
"Version Change", "FRU State" };
|
|
||||||
|
|
||||||
struct sensor_reading {
|
struct sensor_reading {
|
||||||
char s_id[17]; /* name of the sensor */
|
char s_id[17]; /* name of the sensor */
|
||||||
@ -864,11 +844,10 @@ struct sdr_get_rs *ipmi_sdr_get_next_header(struct ipmi_intf *intf,
|
|||||||
struct ipmi_sdr_iterator *i);
|
struct ipmi_sdr_iterator *i);
|
||||||
uint8_t *ipmi_sdr_get_record(struct ipmi_intf *intf, struct sdr_get_rs *header,
|
uint8_t *ipmi_sdr_get_record(struct ipmi_intf *intf, struct sdr_get_rs *header,
|
||||||
struct ipmi_sdr_iterator *i);
|
struct ipmi_sdr_iterator *i);
|
||||||
void ipmi_sdr_end(struct ipmi_intf *intf, struct ipmi_sdr_iterator *i);
|
void ipmi_sdr_end(struct ipmi_sdr_iterator *i);
|
||||||
int ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type);
|
int ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type);
|
||||||
|
|
||||||
int ipmi_sdr_print_name_from_rawentry(struct ipmi_intf *intf,uint16_t id,
|
int ipmi_sdr_print_name_from_rawentry(uint16_t id, uint8_t type,uint8_t * raw);
|
||||||
uint8_t type,uint8_t * raw);
|
|
||||||
int ipmi_sdr_print_rawentry(struct ipmi_intf *intf, uint8_t type, uint8_t * raw,
|
int ipmi_sdr_print_rawentry(struct ipmi_intf *intf, uint8_t type, uint8_t * raw,
|
||||||
int len);
|
int len);
|
||||||
int ipmi_sdr_print_listentry(struct ipmi_intf *intf,
|
int ipmi_sdr_print_listentry(struct ipmi_intf *intf,
|
||||||
@ -877,7 +856,7 @@ void ipmi_sdr_print_sensor_hysteresis(struct sdr_record_common_sensor *sensor,
|
|||||||
struct sdr_record_full_sensor *full,
|
struct sdr_record_full_sensor *full,
|
||||||
uint8_t hysteresis_value,
|
uint8_t hysteresis_value,
|
||||||
const char *hdrstr);
|
const char *hdrstr);
|
||||||
const char *ipmi_sdr_get_unit_string(uint8_t pct, uint8_t type,
|
const char *ipmi_sdr_get_unit_string(bool pct, uint8_t type,
|
||||||
uint8_t base, uint8_t modifier);
|
uint8_t base, uint8_t modifier);
|
||||||
struct sensor_reading *
|
struct sensor_reading *
|
||||||
ipmi_sdr_read_sensor_value(struct ipmi_intf *intf,
|
ipmi_sdr_read_sensor_value(struct ipmi_intf *intf,
|
||||||
@ -912,15 +891,9 @@ int ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin,
|
|||||||
|
|
||||||
int ipmi_sdr_print_sensor_eventonly(struct ipmi_intf *intf,
|
int ipmi_sdr_print_sensor_eventonly(struct ipmi_intf *intf,
|
||||||
struct sdr_record_eventonly_sensor *sensor);
|
struct sdr_record_eventonly_sensor *sensor);
|
||||||
int ipmi_sdr_print_sensor_generic_locator(struct ipmi_intf *intf,
|
int ipmi_sdr_print_sensor_generic_locator(struct sdr_record_generic_locator *fru);
|
||||||
struct sdr_record_generic_locator
|
int ipmi_sdr_print_sensor_fru_locator(struct sdr_record_fru_locator *fru);
|
||||||
*fru);
|
int ipmi_sdr_print_sensor_mc_locator(struct sdr_record_mc_locator *mc);
|
||||||
int ipmi_sdr_print_sensor_fru_locator(struct ipmi_intf *intf,
|
|
||||||
struct sdr_record_fru_locator *fru);
|
|
||||||
int ipmi_sdr_print_sensor_mc_locator(struct ipmi_intf *intf,
|
|
||||||
struct sdr_record_mc_locator *mc);
|
|
||||||
int ipmi_sdr_print_sensor_entity_assoc(struct ipmi_intf *intf,
|
|
||||||
struct sdr_record_entity_assoc *assoc);
|
|
||||||
|
|
||||||
struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf,
|
struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf,
|
||||||
struct entity_id *entity);
|
struct entity_id *entity);
|
||||||
@ -933,8 +906,8 @@ struct sdr_record_list *ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf,
|
|||||||
struct sdr_record_list *ipmi_sdr_find_sdr_bytype(struct ipmi_intf *intf,
|
struct sdr_record_list *ipmi_sdr_find_sdr_bytype(struct ipmi_intf *intf,
|
||||||
uint8_t type);
|
uint8_t type);
|
||||||
int ipmi_sdr_list_cache(struct ipmi_intf *intf);
|
int ipmi_sdr_list_cache(struct ipmi_intf *intf);
|
||||||
int ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile);
|
int ipmi_sdr_list_cache_fromfile(const char *ifile);
|
||||||
void ipmi_sdr_list_empty(struct ipmi_intf *intf);
|
void ipmi_sdr_list_empty(void);
|
||||||
int ipmi_sdr_print_info(struct ipmi_intf *intf);
|
int ipmi_sdr_print_info(struct ipmi_intf *intf);
|
||||||
void ipmi_sdr_print_discrete_state(struct ipmi_intf *intf,
|
void ipmi_sdr_print_discrete_state(struct ipmi_intf *intf,
|
||||||
const char *desc, uint8_t sensor_type,
|
const char *desc, uint8_t sensor_type,
|
||||||
@ -952,5 +925,3 @@ int ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
|
|||||||
uint8_t sensor_num, uint8_t sensor_type,
|
uint8_t sensor_num, uint8_t sensor_type,
|
||||||
uint8_t event_type, int numeric_fmt,
|
uint8_t event_type, int numeric_fmt,
|
||||||
uint8_t target, uint8_t lun, uint8_t channel);
|
uint8_t target, uint8_t lun, uint8_t channel);
|
||||||
|
|
||||||
#endif /* IPMI_SDR_H */
|
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_SDRADD_H
|
#pragma once
|
||||||
#define IPMI_SDRADD_H
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Methods to add SDRs to repository from built-in sensors or files
|
* Methods to add SDRs to repository from built-in sensors or files
|
||||||
@ -42,5 +41,3 @@ ipmi_sdr_add_from_file(struct ipmi_intf *intf, const char *ifile);
|
|||||||
|
|
||||||
int
|
int
|
||||||
ipmi_sdr_add_from_list(struct ipmi_intf *intf, const char *rangeList);
|
ipmi_sdr_add_from_list(struct ipmi_intf *intf, const char *rangeList);
|
||||||
|
|
||||||
#endif /* IPMI_SDRADD_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_SEL_H
|
#pragma once
|
||||||
#define IPMI_SEL_H
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
@ -257,7 +256,7 @@ static const struct ipmi_event_sensor_types sensor_specific_event_types[] = {
|
|||||||
{ 0x08, 0x06, 0x03, "Config Error: Power Supply Rating Mismatch" },
|
{ 0x08, 0x06, 0x03, "Config Error: Power Supply Rating Mismatch" },
|
||||||
{ 0x08, 0x06, 0x04, "Config Error: Voltage Rating Mismatch" },
|
{ 0x08, 0x06, 0x04, "Config Error: Voltage Rating Mismatch" },
|
||||||
{ 0x08, 0x06, 0xff, "Config Error" },
|
{ 0x08, 0x06, 0xff, "Config Error" },
|
||||||
{ 0x08, 0x06, 0xff, "Power Supply Inactive" },
|
{ 0x08, 0x07, 0xff, "Power Supply Inactive" },
|
||||||
/* Power Unit */
|
/* Power Unit */
|
||||||
{ 0x09, 0x00, 0xff, "Power off/down" },
|
{ 0x09, 0x00, 0xff, "Power off/down" },
|
||||||
{ 0x09, 0x01, 0xff, "Power cycle" },
|
{ 0x09, 0x01, 0xff, "Power cycle" },
|
||||||
@ -579,8 +578,8 @@ static const struct ipmi_event_sensor_types sensor_specific_event_types[] = {
|
|||||||
{ 0xF1, 0x00, 0xff, "IPMB-A disabled, IPMB-B disabled" },
|
{ 0xF1, 0x00, 0xff, "IPMB-A disabled, IPMB-B disabled" },
|
||||||
{ 0xF1, 0x01, 0xff, "IPMB-A enabled, IPMB-B disabled" },
|
{ 0xF1, 0x01, 0xff, "IPMB-A enabled, IPMB-B disabled" },
|
||||||
{ 0xF1, 0x02, 0xff, "IPMB-A disabled, IPMB-B enabled" },
|
{ 0xF1, 0x02, 0xff, "IPMB-A disabled, IPMB-B enabled" },
|
||||||
{ 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMP-B enabled" },
|
{ 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMB-B enabled" },
|
||||||
/* PICNG Moduke Hot Swap */
|
/* PICMG Module Hot Swap */
|
||||||
{ 0xF2, 0x00, 0xff, "Module Handle Closed" },
|
{ 0xF2, 0x00, 0xff, "Module Handle Closed" },
|
||||||
{ 0xF2, 0x01, 0xff, "Module Handle Opened" },
|
{ 0xF2, 0x01, 0xff, "Module Handle Opened" },
|
||||||
{ 0xF2, 0x02, 0xff, "Quiesced" },
|
{ 0xF2, 0x02, 0xff, "Quiesced" },
|
||||||
@ -599,7 +598,7 @@ static const struct ipmi_event_sensor_types vita_sensor_event_types[] = {
|
|||||||
{ 0xF1, 0x00, 0xFF, "IPMB-A disabled, IPMB-B disabled" },
|
{ 0xF1, 0x00, 0xFF, "IPMB-A disabled, IPMB-B disabled" },
|
||||||
{ 0xF1, 0x01, 0xFF, "IPMB-A enabled, IPMB-B disabled" },
|
{ 0xF1, 0x01, 0xFF, "IPMB-A enabled, IPMB-B disabled" },
|
||||||
{ 0xF1, 0x02, 0xFF, "IPMB-A disabled, IPMB-B enabled" },
|
{ 0xF1, 0x02, 0xFF, "IPMB-A disabled, IPMB-B enabled" },
|
||||||
{ 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMP-B enabled" },
|
{ 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMB-B enabled" },
|
||||||
/* VITA FRU Temperature */
|
/* VITA FRU Temperature */
|
||||||
{ 0xF3, 0x00, 0xff, "At or below Lower Non-critical" },
|
{ 0xF3, 0x00, 0xff, "At or below Lower Non-critical" },
|
||||||
{ 0xF3, 0x01, 0xff, "At or below Lower Critical" },
|
{ 0xF3, 0x01, 0xff, "At or below Lower Critical" },
|
||||||
@ -679,7 +678,7 @@ void ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_e
|
|||||||
void ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char ** desc);
|
void ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char ** desc);
|
||||||
const char * ipmi_get_sensor_type(struct ipmi_intf *intf, uint8_t code);
|
const char * ipmi_get_sensor_type(struct ipmi_intf *intf, uint8_t code);
|
||||||
uint16_t ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id, struct sel_event_record * evt);
|
uint16_t ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id, struct sel_event_record * evt);
|
||||||
char * get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
|
char * get_viking_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
|
||||||
IPMI_OEM ipmi_get_oem(struct ipmi_intf * intf);
|
IPMI_OEM ipmi_get_oem(struct ipmi_intf * intf);
|
||||||
char * ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
|
char * ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
|
||||||
int ipmi_sel_oem_init(const char * filename);
|
int ipmi_sel_oem_init(const char * filename);
|
||||||
@ -687,5 +686,3 @@ const struct ipmi_event_sensor_types *
|
|||||||
ipmi_get_first_event_sensor_type(struct ipmi_intf *intf, uint8_t sensor_type, uint8_t event_type);
|
ipmi_get_first_event_sensor_type(struct ipmi_intf *intf, uint8_t sensor_type, uint8_t event_type);
|
||||||
const struct ipmi_event_sensor_types *
|
const struct ipmi_event_sensor_types *
|
||||||
ipmi_get_next_event_sensor_type(const struct ipmi_event_sensor_types *evt);
|
ipmi_get_next_event_sensor_type(const struct ipmi_event_sensor_types *evt);
|
||||||
|
|
||||||
#endif /* IPMI_SEL_H */
|
|
||||||
|
@ -30,9 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
#ifndef IPMI_SEL_SUPERMICRO_H
|
|
||||||
# define IPMI_SEL_SUPERMICRO_H
|
|
||||||
|
|
||||||
static uint16_t supermicro_x11[] = {
|
static uint16_t supermicro_x11[] = {
|
||||||
0x0958, 0x0955, 0x0953, 0x0952, 0x0941, 0x093A, 0x0939, 0x0938, 0x0937, 0x0930, 0x0927, 0x091D,
|
0x0958, 0x0955, 0x0953, 0x0952, 0x0941, 0x093A, 0x0939, 0x0938, 0x0937, 0x0930, 0x0927, 0x091D,
|
||||||
@ -151,5 +149,3 @@ static uint16_t supermicro_older[] = {
|
|||||||
0x0944, 0x0945, 0x0947, 0x0948, 0x0949, 0x094A, 0x094B, 0x094C, 0x094D, 0x094E, 0x0954, 0x0956,
|
0x0944, 0x0945, 0x0947, 0x0948, 0x0949, 0x094A, 0x094B, 0x094C, 0x094D, 0x094E, 0x0954, 0x0956,
|
||||||
0x0957, 0x0959, 0xFFFF
|
0x0957, 0x0959, 0xFFFF
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* IPMI_SEL_SUPERMICRO_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_SENSOR_H
|
#pragma once
|
||||||
#define IPMI_SENSOR_H
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <ipmitool/bswap.h>
|
#include <ipmitool/bswap.h>
|
||||||
@ -86,4 +85,3 @@ struct sensor_set_thresh_rq {
|
|||||||
int ipmi_sensor_main(struct ipmi_intf *, int, char **);
|
int ipmi_sensor_main(struct ipmi_intf *, int, char **);
|
||||||
int ipmi_sensor_print_fc(struct ipmi_intf *, struct sdr_record_common_sensor *, uint8_t);
|
int ipmi_sensor_print_fc(struct ipmi_intf *, struct sdr_record_common_sensor *, uint8_t);
|
||||||
int ipmi_sensor_get_sensor_reading_factors( struct ipmi_intf * intf, struct sdr_record_full_sensor * sensor, uint8_t reading);
|
int ipmi_sensor_get_sensor_reading_factors( struct ipmi_intf * intf, struct sdr_record_full_sensor * sensor, uint8_t reading);
|
||||||
#endif /* IPMI_SENSOR_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_SESSION_H
|
#pragma once
|
||||||
#define IPMI_SESSION_H
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -127,5 +126,3 @@ struct get_session_info_rsp
|
|||||||
|
|
||||||
|
|
||||||
int ipmi_session_main(struct ipmi_intf *, int, char **);
|
int ipmi_session_main(struct ipmi_intf *, int, char **);
|
||||||
|
|
||||||
#endif /*IPMI_CHANNEL_H*/
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_SOL_H
|
#pragma once
|
||||||
#define IPMI_SOL_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -92,17 +91,13 @@ struct activate_payload_rsp {
|
|||||||
* function will return -1 if value is not valid, or
|
* function will return -1 if value is not valid, or
|
||||||
* will return 0 if valid.
|
* will return 0 if valid.
|
||||||
*/
|
*/
|
||||||
int ipmi_sol_set_param_isvalid_uint8_t( const char *strval,
|
int ipmi_sol_set_param_isvalid_uint8_t(const char *strval,
|
||||||
const char *name,
|
const char *name,
|
||||||
int base,
|
|
||||||
uint8_t minval,
|
uint8_t minval,
|
||||||
uint8_t maxval,
|
uint8_t maxval,
|
||||||
uint8_t *out_value);
|
uint8_t *out_value);
|
||||||
|
|
||||||
int ipmi_sol_main(struct ipmi_intf *, int, char **);
|
int ipmi_sol_main(struct ipmi_intf *, int, char **);
|
||||||
int ipmi_get_sol_info(struct ipmi_intf * intf,
|
int ipmi_get_sol_info(struct ipmi_intf *intf,
|
||||||
uint8_t channel,
|
uint8_t channel,
|
||||||
struct sol_config_parameters * params);
|
struct sol_config_parameters *params);
|
||||||
|
|
||||||
|
|
||||||
#endif /* IPMI_SOL_H */
|
|
||||||
|
@ -30,11 +30,12 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_STRINGS_H
|
#pragma once
|
||||||
#define IPMI_STRINGS_H
|
|
||||||
|
|
||||||
#include <ipmitool/helper.h>
|
#include <ipmitool/helper.h>
|
||||||
|
|
||||||
|
#define CC_STRING(cc) val2str(cc, completion_code_vals)
|
||||||
|
|
||||||
extern const struct valstr completion_code_vals[];
|
extern const struct valstr completion_code_vals[];
|
||||||
extern const struct valstr entity_id_vals[];
|
extern const struct valstr entity_id_vals[];
|
||||||
extern const struct valstr entity_device_type_vals[];
|
extern const struct valstr entity_device_type_vals[];
|
||||||
@ -48,11 +49,14 @@ extern const struct valstr ipmi_authtype_vals[];
|
|||||||
extern const struct valstr ipmi_channel_protocol_vals[];
|
extern const struct valstr ipmi_channel_protocol_vals[];
|
||||||
extern const struct valstr ipmi_channel_medium_vals[];
|
extern const struct valstr ipmi_channel_medium_vals[];
|
||||||
extern const struct valstr ipmi_chassis_power_control_vals[];
|
extern const struct valstr ipmi_chassis_power_control_vals[];
|
||||||
|
extern const struct valstr ipmi_chassis_restart_cause_vals[];
|
||||||
extern const struct valstr ipmi_auth_algorithms[];
|
extern const struct valstr ipmi_auth_algorithms[];
|
||||||
extern const struct valstr ipmi_integrity_algorithms[];
|
extern const struct valstr ipmi_integrity_algorithms[];
|
||||||
extern const struct valstr ipmi_encryption_algorithms[];
|
extern const struct valstr ipmi_encryption_algorithms[];
|
||||||
extern const struct valstr ipmi_oem_info[];
|
|
||||||
extern const struct valstr ipmi_user_enable_status_vals[];
|
extern const struct valstr ipmi_user_enable_status_vals[];
|
||||||
|
extern const struct valstr *ipmi_oem_info;
|
||||||
|
void ipmi_oem_info_init();
|
||||||
|
void ipmi_oem_info_free();
|
||||||
|
|
||||||
extern const struct valstr picmg_frucontrol_vals[];
|
extern const struct valstr picmg_frucontrol_vals[];
|
||||||
extern const struct valstr picmg_clk_family_vals[];
|
extern const struct valstr picmg_clk_family_vals[];
|
||||||
@ -71,5 +75,3 @@ extern const struct oemvalstr picmg_busres_shmc_status_vals[];
|
|||||||
extern const struct oemvalstr ipmi_oem_product_info[];
|
extern const struct oemvalstr ipmi_oem_product_info[];
|
||||||
extern const char *ipmi_generic_sensor_type_vals[];
|
extern const char *ipmi_generic_sensor_type_vals[];
|
||||||
extern const struct oemvalstr ipmi_oem_sensor_type_vals[];
|
extern const struct oemvalstr ipmi_oem_sensor_type_vals[];
|
||||||
|
|
||||||
#endif /*IPMI_STRINGS_H*/
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_SUNOEM_H
|
#pragma once
|
||||||
#define IPMI_SUNOEM_H
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -68,6 +67,3 @@ typedef enum {
|
|||||||
} sunoem_ec_t;
|
} sunoem_ec_t;
|
||||||
|
|
||||||
int ipmi_sunoem_main(struct ipmi_intf *, int, char **);
|
int ipmi_sunoem_main(struct ipmi_intf *, int, char **);
|
||||||
|
|
||||||
#endif /*IPMI_SUNOEM_H*/
|
|
||||||
|
|
||||||
|
90
include/ipmitool/ipmi_time.h
Normal file
90
include/ipmitool/ipmi_time.h
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Alexander Amelkin. 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 the copyright holder, 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.
|
||||||
|
* THE COPYRIGHT HOLDER 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
|
||||||
|
* THE COPYRIGHT HOLDER 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 THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGES.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
extern bool time_in_utc;
|
||||||
|
|
||||||
|
/* Special values according to IPMI v2.0, rev. 1.1, section 37.1 */
|
||||||
|
#define IPMI_TIME_UNSPECIFIED 0xFFFFFFFFu
|
||||||
|
#define IPMI_TIME_INIT_DONE 0x20000000u
|
||||||
|
|
||||||
|
#define SECONDS_A_DAY (24 * 60 * 60)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether the timestamp is in seconds since Epoch or since
|
||||||
|
* the system startup.
|
||||||
|
*/
|
||||||
|
static inline bool ipmi_timestamp_is_special(time_t ts)
|
||||||
|
{
|
||||||
|
return (ts < IPMI_TIME_INIT_DONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether the timestamp is valid at all
|
||||||
|
*/
|
||||||
|
static inline bool ipmi_timestamp_is_valid(time_t ts)
|
||||||
|
{
|
||||||
|
return (ts != IPMI_TIME_UNSPECIFIED);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Just 26 characters are required for asctime_r(), plus timezone info.
|
||||||
|
* However just to be safe locale-wise and assuming that in no locale
|
||||||
|
* the date/time string exceeds the 'standard' legacy terminal width,
|
||||||
|
* the buffer size is set here to 80.
|
||||||
|
*/
|
||||||
|
#define IPMI_ASCTIME_SZ 80
|
||||||
|
typedef char ipmi_datebuf_t[IPMI_ASCTIME_SZ];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These are ipmitool-specific versions that take
|
||||||
|
* in account the command line options
|
||||||
|
*/
|
||||||
|
char *ipmi_asctime_r(time_t stamp, ipmi_datebuf_t outbuf);
|
||||||
|
size_t ipmi_strftime(char *s, size_t max, const char *format, time_t stamp)
|
||||||
|
__attribute__((format(strftime, 3, 0)));
|
||||||
|
|
||||||
|
/* These return pointers to static arrays and aren't thread safe */
|
||||||
|
char *ipmi_timestamp_fmt(uint32_t stamp, const char *fmt)
|
||||||
|
__attribute__((format(strftime, 2, 0)));
|
||||||
|
char *ipmi_timestamp_string(uint32_t stamp); /* Day Mon DD HH:MM:SS YYYY ZZZ */
|
||||||
|
char *ipmi_timestamp_numeric(uint32_t stamp); /* MM/DD/YYYY HH:MM:SS ZZZ */
|
||||||
|
char *ipmi_timestamp_date(uint32_t stamp); /* MM/DD/YYYY ZZZ */
|
||||||
|
char *ipmi_timestamp_time(uint32_t stamp); /* HH:MM:SS ZZZ */
|
||||||
|
|
||||||
|
/* Subtract the UTC offset from local time_t */
|
||||||
|
time_t ipmi_localtime2utc(time_t local);
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_TSOL_H
|
#pragma once
|
||||||
#define IPMI_TSOL_H
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
@ -42,5 +41,3 @@
|
|||||||
#define IPMI_TSOL_DEF_PORT 6230
|
#define IPMI_TSOL_DEF_PORT 6230
|
||||||
|
|
||||||
int ipmi_tsol_main(struct ipmi_intf *, int, char **);
|
int ipmi_tsol_main(struct ipmi_intf *, int, char **);
|
||||||
|
|
||||||
#endif /* IPMI_TSOL_H */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMI_USER_H
|
#pragma once
|
||||||
#define IPMI_USER_H
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -48,6 +47,9 @@
|
|||||||
#define IPMI_USER_ENABLE_DISABLED 0x80
|
#define IPMI_USER_ENABLE_DISABLED 0x80
|
||||||
#define IPMI_USER_ENABLE_RESERVED 0xC0
|
#define IPMI_USER_ENABLE_RESERVED 0xC0
|
||||||
|
|
||||||
|
#define IPMI_UID_MASK 0x3F /* The user_id is 6-bit and is usually in bits [5:0] */
|
||||||
|
#define IPMI_UID(id) ((id) & IPMI_UID_MASK)
|
||||||
|
|
||||||
/* (22.27) Get and (22.26) Set User Access */
|
/* (22.27) Get and (22.26) Set User Access */
|
||||||
struct user_access_t {
|
struct user_access_t {
|
||||||
uint8_t callin_callback;
|
uint8_t callin_callback;
|
||||||
@ -79,5 +81,3 @@ int _ipmi_set_user_access(struct ipmi_intf *intf,
|
|||||||
int _ipmi_set_user_password(struct ipmi_intf *intf,
|
int _ipmi_set_user_password(struct ipmi_intf *intf,
|
||||||
uint8_t user_id, uint8_t operation,
|
uint8_t user_id, uint8_t operation,
|
||||||
const char *password, uint8_t is_twenty_byte);
|
const char *password, uint8_t is_twenty_byte);
|
||||||
|
|
||||||
#endif /* IPMI_USER_H */
|
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
* Copyright (c) Pigeon Point Systems. All right reserved
|
* Copyright (c) Pigeon Point Systems. All right reserved
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _IPMI_VITA_H_
|
#pragma once
|
||||||
#define _IPMI_VITA_H_
|
|
||||||
|
|
||||||
/* VITA 46.11 commands */
|
/* VITA 46.11 commands */
|
||||||
#define VITA_GET_VSO_CAPABILITIES_CMD 0x00
|
#define VITA_GET_VSO_CAPABILITIES_CMD 0x00
|
||||||
@ -45,5 +44,3 @@ ipmi_vita_ipmb_address(struct ipmi_intf *intf);
|
|||||||
|
|
||||||
extern int
|
extern int
|
||||||
ipmi_vita_main(struct ipmi_intf * intf, int argc, char ** argv);
|
ipmi_vita_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
|
|
||||||
#endif /* _IPMI_VITA_H_ */
|
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPMITOOL_LOG_H
|
#pragma once
|
||||||
#define IPMITOOL_LOG_H
|
|
||||||
|
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
@ -54,10 +53,6 @@
|
|||||||
|
|
||||||
void log_init(const char * name, int isdaemon, int verbose);
|
void log_init(const char * name, int isdaemon, int verbose);
|
||||||
void log_halt(void);
|
void log_halt(void);
|
||||||
void log_level_set(int level);
|
void log_level_set(int verbose);
|
||||||
int log_level_get(void);
|
|
||||||
void lprintf(int level, const char * format, ...);
|
void lprintf(int level, const char * format, ...);
|
||||||
void lperror(int level, const char * format, ...);
|
void lperror(int level, const char * format, ...);
|
||||||
|
|
||||||
#endif /*IPMITOOL_LOG_H*/
|
|
||||||
|
|
||||||
|
@ -41,8 +41,7 @@ libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_pef.c \
|
|||||||
ipmi_main.c ipmi_tsol.c ipmi_firewall.c ipmi_kontronoem.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_hpmfwupg.c ipmi_sdradd.c ipmi_ekanalyzer.c ipmi_gendev.c \
|
||||||
ipmi_ime.c ipmi_delloem.c ipmi_dcmi.c hpm2.c ipmi_vita.c \
|
ipmi_ime.c ipmi_delloem.c ipmi_dcmi.c hpm2.c ipmi_vita.c \
|
||||||
ipmi_lanp6.c ipmi_cfgp.c \
|
ipmi_lanp6.c ipmi_cfgp.c ipmi_quantaoem.c ipmi_time.c
|
||||||
../src/plugins/lan/md5.c ../src/plugins/lan/md5.h
|
|
||||||
|
|
||||||
libipmitool_la_LDFLAGS = -export-dynamic
|
libipmitool_la_LDFLAGS = -export-dynamic
|
||||||
libipmitool_la_LIBADD = -lm
|
libipmitool_la_LIBADD = -lm
|
||||||
|
@ -1620,8 +1620,10 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
|
|||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
struct fru_info fru;
|
struct fru_info fru;
|
||||||
uint8_t *spd_data, msg_data[4];
|
uint8_t *spd_data = NULL;
|
||||||
int len, offset;
|
uint8_t msg_data[4];
|
||||||
|
uint32_t len, offset;
|
||||||
|
int rc = -1;
|
||||||
|
|
||||||
msg_data[0] = id;
|
msg_data[0] = id;
|
||||||
|
|
||||||
@ -1632,14 +1634,14 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
|
|||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf(" Device not present (No Response)\n");
|
printf(" Device not present (No Response)\n");
|
||||||
return -1;
|
goto end;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
printf(" Device not present (%s)\n",
|
printf(" Device not present (%s)\n",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
fru.size = (rsp->data[1] << 8) | rsp->data[0];
|
fru.size = (rsp->data[1] << 8) | rsp->data[0];
|
||||||
@ -1651,15 +1653,15 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
|
|||||||
|
|
||||||
if (fru.size < 1) {
|
if (fru.size < 1) {
|
||||||
lprintf(LOG_ERR, " Invalid FRU size %d", fru.size);
|
lprintf(LOG_ERR, " Invalid FRU size %d", fru.size);
|
||||||
return -1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
spd_data = malloc(fru.size);
|
spd_data = malloc(fru.size);
|
||||||
|
|
||||||
if (spd_data == NULL) {
|
if (!spd_data) {
|
||||||
printf(" Unable to malloc memory for spd array of size=%d\n",
|
printf(" Unable to malloc memory for spd array of size=%d\n",
|
||||||
fru.size);
|
fru.size);
|
||||||
return -1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
@ -1677,34 +1679,39 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
|
|||||||
msg_data[3] = FRU_DATA_RQST_SIZE;
|
msg_data[3] = FRU_DATA_RQST_SIZE;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf(" Device not present (No Response)\n");
|
printf(" Device not present (No Response)\n");
|
||||||
free(spd_data);
|
goto end;
|
||||||
spd_data = NULL;
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
printf(" Device not present (%s)\n",
|
printf(" Device not present (%s)\n",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
|
|
||||||
free(spd_data);
|
|
||||||
spd_data = NULL;
|
|
||||||
/* Timeouts are acceptable. No DIMM in the socket */
|
/* Timeouts are acceptable. No DIMM in the socket */
|
||||||
if (rsp->ccode == 0xc3)
|
if (rsp->ccode == 0xc3)
|
||||||
return 1;
|
rc = 1;
|
||||||
|
|
||||||
return -1;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = rsp->data[0];
|
len = rsp->data[0];
|
||||||
|
if(rsp->data_len < 1
|
||||||
|
|| len > rsp->data_len - 1
|
||||||
|
|| len > fru.size - offset)
|
||||||
|
{
|
||||||
|
printf(" Not enough buffer size");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
memcpy(&spd_data[offset], rsp->data + 1, len);
|
memcpy(&spd_data[offset], rsp->data + 1, len);
|
||||||
offset += len;
|
offset += len;
|
||||||
} while (offset < fru.size);
|
} while (offset < fru.size);
|
||||||
|
|
||||||
/* now print spd info */
|
/* now print spd info */
|
||||||
ipmi_spd_print(spd_data, offset);
|
ipmi_spd_print(spd_data, offset);
|
||||||
free(spd_data);
|
rc = 0;
|
||||||
spd_data = NULL;
|
|
||||||
|
|
||||||
return 0;
|
end:
|
||||||
|
free_n(&spd_data);
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
221
lib/helper.c
221
lib/helper.c
@ -29,12 +29,6 @@
|
|||||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
* 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.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
#define _POSIX_SOURCE
|
|
||||||
#define /* glibc 2.19 and earlier */ _BSD_SOURCE || \
|
|
||||||
/* Since glibc 2.20 */_DEFAULT_SOURCE || \
|
|
||||||
_XOPEN_SOURCE >= 500 || \
|
|
||||||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || \
|
|
||||||
/* Since glibc 2.10: */ _POSIX_C_SOURCE >= 200112L \
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -60,7 +54,7 @@
|
|||||||
#ifdef HAVE_PATHS_H
|
#ifdef HAVE_PATHS_H
|
||||||
# include <paths.h>
|
# include <paths.h>
|
||||||
#else
|
#else
|
||||||
# define _PATH_VARRUN "/var/run/"
|
# define _PATH_RUN "/run/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
@ -100,7 +94,7 @@ buf2str_extended(const uint8_t *buf, int len, const char *sep)
|
|||||||
int left;
|
int left;
|
||||||
int sep_len;
|
int sep_len;
|
||||||
|
|
||||||
if (buf == NULL) {
|
if (!buf) {
|
||||||
snprintf(str, sizeof(str), "<NULL>");
|
snprintf(str, sizeof(str), "<NULL>");
|
||||||
return (const char *)str;
|
return (const char *)str;
|
||||||
}
|
}
|
||||||
@ -180,7 +174,7 @@ ipmi_parse_hex(const char *str, uint8_t *out, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
len /= 2; /* out bytes */
|
len /= 2; /* out bytes */
|
||||||
if (out == NULL) {
|
if (!out) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +228,50 @@ void printbuf(const uint8_t * buf, int len, const char * desc)
|
|||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Unconditionally reverse the order of arbitrarily long strings of bytes
|
||||||
|
*/
|
||||||
|
uint8_t *array_byteswap(uint8_t *buffer, size_t length)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
uint8_t temp;
|
||||||
|
size_t max = length - 1;
|
||||||
|
|
||||||
|
for (i = 0; i < length / 2; ++i) {
|
||||||
|
temp = buffer[i];
|
||||||
|
buffer[i] = buffer[max - i];
|
||||||
|
buffer[max - i] = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert data array from network (big-endian) to host byte order */
|
||||||
|
uint8_t *array_ntoh(uint8_t *buffer, size_t length)
|
||||||
|
{
|
||||||
|
#if WORDS_BIGENDIAN
|
||||||
|
/* Big-endian host doesn't need conversion from big-endian network */
|
||||||
|
(void)length; /* Silence the compiler */
|
||||||
|
return buffer;
|
||||||
|
#else
|
||||||
|
/* Little-endian host needs conversion from big-endian network */
|
||||||
|
return array_byteswap(buffer, length);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert data array from little-endian to host byte order */
|
||||||
|
uint8_t *array_letoh(uint8_t *buffer, size_t length)
|
||||||
|
{
|
||||||
|
#if WORDS_BIGENDIAN
|
||||||
|
/* Big-endian host needs conversion from little-endian IPMI */
|
||||||
|
return array_byteswap(buffer, length);
|
||||||
|
#else
|
||||||
|
/* Little-endian host doesn't need conversion from little-endian IPMI */
|
||||||
|
(void)length; /* Silence the compiler */
|
||||||
|
return buffer;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* str2mac - parse-out MAC address from given string and store it
|
/* str2mac - parse-out MAC address from given string and store it
|
||||||
* into buffer.
|
* into buffer.
|
||||||
*
|
*
|
||||||
@ -281,29 +319,77 @@ mac2str(const uint8_t *buf)
|
|||||||
return buf2str_extended(buf, 6, ":");
|
return buf2str_extended(buf, 6, ":");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * val2str(uint16_t val, const struct valstr *vs)
|
/**
|
||||||
|
* Find the index of value in a valstr array
|
||||||
|
*
|
||||||
|
* @param[in] val The value to search for
|
||||||
|
* @param[in] vs The valstr array to search in
|
||||||
|
* @return >=0 The index into \p vs
|
||||||
|
* @return -1 Error: value \p val was not found in \p vs
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
inline
|
||||||
|
off_t find_val_idx(uint32_t val, const struct valstr *vs)
|
||||||
{
|
{
|
||||||
static char un_str[32];
|
if (vs) {
|
||||||
int i;
|
for (off_t i = 0; vs[i].str; ++i) {
|
||||||
|
if (vs[i].val == val) {
|
||||||
for (i = 0; vs[i].str != NULL; i++) {
|
return i;
|
||||||
if (vs[i].val == val)
|
}
|
||||||
return vs[i].str;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a statically allocated 'Unknown' string for the provided value.
|
||||||
|
* The function is not thread-safe (as most of ipmitool).
|
||||||
|
*
|
||||||
|
* @param[in] val The value to put into the string
|
||||||
|
* @returns A pointer to a statically allocated string
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
inline
|
||||||
|
const char *unknown_val_str(uint32_t val)
|
||||||
|
{
|
||||||
|
static char un_str[32];
|
||||||
memset(un_str, 0, 32);
|
memset(un_str, 0, 32);
|
||||||
snprintf(un_str, 32, "Unknown (0x%02X)", val);
|
snprintf(un_str, 32, "Unknown (0x%02X)", val);
|
||||||
|
|
||||||
return un_str;
|
return un_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * oemval2str(uint32_t oem, uint16_t val,
|
const char *
|
||||||
const struct oemvalstr *vs)
|
specific_val2str(uint32_t val,
|
||||||
|
const struct valstr *specific,
|
||||||
|
const struct valstr *generic)
|
||||||
{
|
{
|
||||||
static char un_str[32];
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; vs[i].oem != 0xffffff && vs[i].str != NULL; i++) {
|
if (0 <= (i = find_val_idx(val, specific))) {
|
||||||
|
return specific[i].str;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 <= (i = find_val_idx(val, generic))) {
|
||||||
|
return generic[i].str;
|
||||||
|
}
|
||||||
|
|
||||||
|
return unknown_val_str(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *val2str(uint32_t val, const struct valstr *vs)
|
||||||
|
{
|
||||||
|
return specific_val2str(val, NULL, vs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *oemval2str(uint32_t oem, uint32_t val,
|
||||||
|
const struct oemvalstr *vs)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; vs[i].oem != 0xffffff && vs[i].str; i++) {
|
||||||
/* FIXME: for now on we assume PICMG capability on all IANAs */
|
/* FIXME: for now on we assume PICMG capability on all IANAs */
|
||||||
if ( (vs[i].oem == oem || vs[i].oem == IPMI_OEM_PICMG) &&
|
if ( (vs[i].oem == oem || vs[i].oem == IPMI_OEM_PICMG) &&
|
||||||
vs[i].val == val ) {
|
vs[i].val == val ) {
|
||||||
@ -311,10 +397,7 @@ const char * oemval2str(uint32_t oem, uint16_t val,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(un_str, 0, 32);
|
return unknown_val_str(val);
|
||||||
snprintf(un_str, 32, "Unknown (0x%X)", val);
|
|
||||||
|
|
||||||
return un_str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* str2double - safely convert string to double
|
/* str2double - safely convert string to double
|
||||||
@ -559,12 +642,12 @@ int str2uchar(const char * str, uint8_t * uchr_ptr)
|
|||||||
return 0;
|
return 0;
|
||||||
} /* str2uchar(...) */
|
} /* str2uchar(...) */
|
||||||
|
|
||||||
uint16_t str2val(const char *str, const struct valstr *vs)
|
uint32_t str2val32(const char *str, const struct valstr *vs)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; vs[i].str != NULL; i++) {
|
for (i = 0; vs[i].str; i++) {
|
||||||
if (strncasecmp(vs[i].str, str, __maxlen(str, vs[i].str)) == 0)
|
if (strcasecmp(vs[i].str, str) == 0)
|
||||||
return vs[i].val;
|
return vs[i].val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,10 +665,10 @@ print_valstr(const struct valstr * vs, const char * title, int loglevel)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (vs == NULL)
|
if (!vs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (title != NULL) {
|
if (title) {
|
||||||
if (loglevel < 0)
|
if (loglevel < 0)
|
||||||
printf("\n%s:\n\n", title);
|
printf("\n%s:\n\n", title);
|
||||||
else
|
else
|
||||||
@ -600,7 +683,7 @@ print_valstr(const struct valstr * vs, const char * title, int loglevel)
|
|||||||
lprintf(loglevel, "==============================================");
|
lprintf(loglevel, "==============================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; vs[i].str != NULL; i++) {
|
for (i = 0; vs[i].str; i++) {
|
||||||
if (loglevel < 0) {
|
if (loglevel < 0) {
|
||||||
if (vs[i].val < 256)
|
if (vs[i].val < 256)
|
||||||
printf(" %d\t0x%02x\t%s\n", vs[i].val, vs[i].val, vs[i].str);
|
printf(" %d\t0x%02x\t%s\n", vs[i].val, vs[i].val, vs[i].str);
|
||||||
@ -631,18 +714,18 @@ print_valstr_2col(const struct valstr * vs, const char * title, int loglevel)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (vs == NULL)
|
if (!vs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (title != NULL) {
|
if (title) {
|
||||||
if (loglevel < 0)
|
if (loglevel < 0)
|
||||||
printf("\n%s:\n\n", title);
|
printf("\n%s:\n\n", title);
|
||||||
else
|
else
|
||||||
lprintf(loglevel, "\n%s:\n", title);
|
lprintf(loglevel, "\n%s:\n", title);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; vs[i].str != NULL; i++) {
|
for (i = 0; vs[i].str; i++) {
|
||||||
if (vs[i+1].str == NULL) {
|
if (!vs[i+1].str) {
|
||||||
/* last one */
|
/* last one */
|
||||||
if (loglevel < 0) {
|
if (loglevel < 0) {
|
||||||
printf(" %4d %-32s\n", vs[i].val, vs[i].str);
|
printf(" %4d %-32s\n", vs[i].val, vs[i].str);
|
||||||
@ -696,12 +779,12 @@ ipmi_open_file(const char * file, int rw)
|
|||||||
struct stat st1, st2;
|
struct stat st1, st2;
|
||||||
FILE * fp;
|
FILE * fp;
|
||||||
|
|
||||||
/* verify existance */
|
/* verify existence */
|
||||||
if (lstat(file, &st1) < 0) {
|
if (lstat(file, &st1) < 0) {
|
||||||
if (rw) {
|
if (rw) {
|
||||||
/* does not exist, ok to create */
|
/* does not exist, ok to create */
|
||||||
fp = fopen(file, "w");
|
fp = fopen(file, "w");
|
||||||
if (fp == NULL) {
|
if (!fp) {
|
||||||
lperror(LOG_ERR, "Unable to open file %s "
|
lperror(LOG_ERR, "Unable to open file %s "
|
||||||
"for write", file);
|
"for write", file);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -718,7 +801,7 @@ ipmi_open_file(const char * file, int rw)
|
|||||||
if (!rw) {
|
if (!rw) {
|
||||||
/* on read skip the extra checks */
|
/* on read skip the extra checks */
|
||||||
fp = fopen(file, "r");
|
fp = fopen(file, "r");
|
||||||
if (fp == NULL) {
|
if (!fp) {
|
||||||
lperror(LOG_ERR, "Unable to open file %s", file);
|
lperror(LOG_ERR, "Unable to open file %s", file);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -741,7 +824,7 @@ ipmi_open_file(const char * file, int rw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fp = fopen(file, rw ? "w+" : "r");
|
fp = fopen(file, rw ? "w+" : "r");
|
||||||
if (fp == NULL) {
|
if (!fp) {
|
||||||
lperror(LOG_ERR, "Unable to open file %s", file);
|
lperror(LOG_ERR, "Unable to open file %s", file);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -785,6 +868,7 @@ ipmi_start_daemon(struct ipmi_intf *intf)
|
|||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int fd;
|
int fd;
|
||||||
|
int ret;
|
||||||
#ifdef SIGHUP
|
#ifdef SIGHUP
|
||||||
sigset_t sighup;
|
sigset_t sighup;
|
||||||
#endif
|
#endif
|
||||||
@ -828,7 +912,11 @@ ipmi_start_daemon(struct ipmi_intf *intf)
|
|||||||
exit(0);
|
exit(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chdir("/");
|
ret = chdir("/");
|
||||||
|
if (ret) {
|
||||||
|
lprintf(LOG_ERR, "chdir failed: %s (%d)", strerror(errno), errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
umask(0);
|
umask(0);
|
||||||
|
|
||||||
for (fd=0; fd<64; fd++) {
|
for (fd=0; fd<64; fd++) {
|
||||||
@ -837,9 +925,20 @@ ipmi_start_daemon(struct ipmi_intf *intf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fd = open("/dev/null", O_RDWR);
|
fd = open("/dev/null", O_RDWR);
|
||||||
assert(0 == fd);
|
if (fd != STDIN_FILENO) {
|
||||||
dup(fd);
|
lprintf(LOG_ERR, "failed to reset stdin: %s (%d)", strerror(errno), errno);
|
||||||
dup(fd);
|
exit(1);
|
||||||
|
}
|
||||||
|
ret = dup(fd);
|
||||||
|
if (ret != STDOUT_FILENO) {
|
||||||
|
lprintf(LOG_ERR, "failed to reset stdout: %s (%d)", strerror(errno), errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
ret = dup(fd);
|
||||||
|
if (ret != STDERR_FILENO) {
|
||||||
|
lprintf(LOG_ERR, "failed to reset stderr: %s (%d)", strerror(errno), errno);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eval_ccode - evaluate return value of _ipmi_* functions and print error error
|
/* eval_ccode - evaluate return value of _ipmi_* functions and print error error
|
||||||
@ -852,7 +951,7 @@ ipmi_start_daemon(struct ipmi_intf *intf)
|
|||||||
int
|
int
|
||||||
eval_ccode(const int ccode)
|
eval_ccode(const int ccode)
|
||||||
{
|
{
|
||||||
if (ccode == 0) {
|
if (!ccode) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (ccode < 0) {
|
} else if (ccode < 0) {
|
||||||
switch (ccode) {
|
switch (ccode) {
|
||||||
@ -1012,11 +1111,11 @@ ipmi_get_oem_id(struct ipmi_intf *intf)
|
|||||||
req.msg.data_len = 0;
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Board ID command failed");
|
lprintf(LOG_ERR, "Get Board ID command failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Board ID command failed: %#x %s",
|
lprintf(LOG_ERR, "Get Board ID command failed: %#x %s",
|
||||||
rsp->ccode, val2str(rsp->ccode, completion_code_vals));
|
rsp->ccode, val2str(rsp->ccode, completion_code_vals));
|
||||||
return 0;
|
return 0;
|
||||||
@ -1026,3 +1125,35 @@ ipmi_get_oem_id(struct ipmi_intf *intf)
|
|||||||
|
|
||||||
return oem_id;
|
return oem_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Parse command line arguments as numeric byte values (dec or hex)
|
||||||
|
* and store them in a \p len sized buffer \p out.
|
||||||
|
*
|
||||||
|
* @param[in] argc Number of arguments
|
||||||
|
* @param[in] argv Array of arguments
|
||||||
|
* @param[out] out The output buffer
|
||||||
|
* @param[in] len Length of the output buffer in bytes (no null-termination
|
||||||
|
* is assumed, the input data is treated as raw byte values,
|
||||||
|
* not as a string.
|
||||||
|
*
|
||||||
|
* @returns A success status indicator
|
||||||
|
* @return false Error
|
||||||
|
* @return true Success
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
args2buf(int argc, char *argv[], uint8_t *out, size_t len)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < len && i < (size_t)argc; ++i) {
|
||||||
|
uint8_t byte;
|
||||||
|
|
||||||
|
if (str2uchar(argv[i], &byte)) {
|
||||||
|
lprintf(LOG_ERR, "Bad byte value: %s", argv[i]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
out[i] = byte;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -30,7 +30,11 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
#ifdef HAVE_MALLOC_H
|
||||||
|
# include <malloc.h>
|
||||||
|
#else
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <ipmitool/helper.h>
|
#include <ipmitool/helper.h>
|
||||||
@ -49,7 +53,7 @@ ipmi_cfgp_init(struct ipmi_cfgp_ctx *ctx, const struct ipmi_cfgp *set,
|
|||||||
unsigned int count, const char *cmdname,
|
unsigned int count, const char *cmdname,
|
||||||
ipmi_cfgp_handler_t handler, void *priv)
|
ipmi_cfgp_handler_t handler, void *priv)
|
||||||
{
|
{
|
||||||
if (ctx == NULL || set == NULL || handler == NULL || !cmdname) {
|
if (!ctx || !set || !handler || !cmdname) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +78,7 @@ ipmi_cfgp_uninit(struct ipmi_cfgp_ctx *ctx)
|
|||||||
{
|
{
|
||||||
struct ipmi_cfgp_data *d;
|
struct ipmi_cfgp_data *d;
|
||||||
|
|
||||||
if (ctx == NULL) {
|
if (!ctx) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +127,7 @@ ipmi_cfgp_parse_sel(struct ipmi_cfgp_ctx *ctx,
|
|||||||
{
|
{
|
||||||
const struct ipmi_cfgp *p;
|
const struct ipmi_cfgp *p;
|
||||||
|
|
||||||
if (ctx == NULL || argv == NULL || sel == NULL) {
|
if (!ctx || !argv || !sel) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +141,7 @@ ipmi_cfgp_parse_sel(struct ipmi_cfgp_ctx *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = lookup_cfgp(ctx, argv[0]);
|
p = lookup_cfgp(ctx, argv[0]);
|
||||||
if (p == NULL) {
|
if (!p) {
|
||||||
lprintf(LOG_ERR, "invalid parameter");
|
lprintf(LOG_ERR, "invalid parameter");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -201,11 +205,11 @@ cfgp_add_data(struct ipmi_cfgp_ctx *ctx, struct ipmi_cfgp_data *data)
|
|||||||
static void
|
static void
|
||||||
cfgp_usage(const struct ipmi_cfgp *p, int write)
|
cfgp_usage(const struct ipmi_cfgp *p, int write)
|
||||||
{
|
{
|
||||||
if (p->name == NULL) {
|
if (!p->name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write && p->format == NULL) {
|
if (write && !p->format) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +231,7 @@ ipmi_cfgp_usage(const struct ipmi_cfgp *set, int count, int write)
|
|||||||
const struct ipmi_cfgp *p;
|
const struct ipmi_cfgp *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (set == NULL) {
|
if (!set) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +267,7 @@ ipmi_cfgp_parse_data(struct ipmi_cfgp_ctx *ctx,
|
|||||||
struct ipmi_cfgp_data *data;
|
struct ipmi_cfgp_data *data;
|
||||||
struct ipmi_cfgp_action action;
|
struct ipmi_cfgp_action action;
|
||||||
|
|
||||||
if (ctx == NULL || sel == NULL || argv == NULL) {
|
if (!ctx || !sel || !argv) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +294,7 @@ ipmi_cfgp_parse_data(struct ipmi_cfgp_ctx *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = malloc(sizeof(struct ipmi_cfgp_data) + p->size);
|
data = malloc(sizeof(struct ipmi_cfgp_data) + p->size);
|
||||||
if (data == NULL) {
|
if (!data) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +374,7 @@ cfgp_get_param(struct ipmi_cfgp_ctx *ctx, const struct ipmi_cfgp *p,
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
data = malloc(sizeof(struct ipmi_cfgp_data) + p->size);
|
data = malloc(sizeof(struct ipmi_cfgp_data) + p->size);
|
||||||
if (data == NULL) {
|
if (!data) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +426,7 @@ ipmi_cfgp_get(struct ipmi_cfgp_ctx *ctx, const struct ipmi_cfgp_sel *sel)
|
|||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (ctx == NULL || sel == NULL) {
|
if (!ctx || !sel) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +465,7 @@ cfgp_do_action(struct ipmi_cfgp_ctx *ctx, int action_type,
|
|||||||
struct ipmi_cfgp_action action;
|
struct ipmi_cfgp_action action;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (ctx == NULL || sel == NULL) {
|
if (!ctx || !sel) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +474,7 @@ cfgp_do_action(struct ipmi_cfgp_ctx *ctx, int action_type,
|
|||||||
action.argv = NULL;
|
action.argv = NULL;
|
||||||
action.file = file;
|
action.file = file;
|
||||||
|
|
||||||
for (data = ctx->v; data != NULL; data = data->next) {
|
for (data = ctx->v; data; data = data->next) {
|
||||||
if (sel->param != -1 && sel->param != data->sel.param) {
|
if (sel->param != -1 && sel->param != data->sel.param) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -523,7 +527,7 @@ int
|
|||||||
ipmi_cfgp_save(struct ipmi_cfgp_ctx *ctx,
|
ipmi_cfgp_save(struct ipmi_cfgp_ctx *ctx,
|
||||||
const struct ipmi_cfgp_sel *sel, FILE *file)
|
const struct ipmi_cfgp_sel *sel, FILE *file)
|
||||||
{
|
{
|
||||||
if (file == NULL) {
|
if (!file) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +538,7 @@ int
|
|||||||
ipmi_cfgp_print(struct ipmi_cfgp_ctx *ctx,
|
ipmi_cfgp_print(struct ipmi_cfgp_ctx *ctx,
|
||||||
const struct ipmi_cfgp_sel *sel, FILE *file)
|
const struct ipmi_cfgp_sel *sel, FILE *file)
|
||||||
{
|
{
|
||||||
if (file == NULL) {
|
if (!file) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ _ipmi_get_channel_access(struct ipmi_intf *intf,
|
|||||||
struct ipmi_rq req = {0};
|
struct ipmi_rq req = {0};
|
||||||
uint8_t data[2];
|
uint8_t data[2];
|
||||||
|
|
||||||
if (channel_access == NULL) {
|
if (!channel_access) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
data[0] = channel_access->channel & 0x0F;
|
data[0] = channel_access->channel & 0x0F;
|
||||||
@ -87,9 +87,9 @@ _ipmi_get_channel_access(struct ipmi_intf *intf,
|
|||||||
req.msg.data_len = 2;
|
req.msg.data_len = 2;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
} else if (rsp->data_len != 2) {
|
} else if (rsp->data_len != 2) {
|
||||||
return (-2);
|
return (-2);
|
||||||
@ -118,7 +118,7 @@ _ipmi_get_channel_info(struct ipmi_intf *intf,
|
|||||||
struct ipmi_rq req = {0};
|
struct ipmi_rq req = {0};
|
||||||
uint8_t data[1];
|
uint8_t data[1];
|
||||||
|
|
||||||
if (channel_info == NULL) {
|
if (!channel_info) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
data[0] = channel_info->channel & 0x0F;
|
data[0] = channel_info->channel & 0x0F;
|
||||||
@ -128,9 +128,9 @@ _ipmi_get_channel_info(struct ipmi_intf *intf,
|
|||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
} else if (rsp->data_len != 9) {
|
} else if (rsp->data_len != 9) {
|
||||||
return (-2);
|
return (-2);
|
||||||
@ -202,7 +202,7 @@ _ipmi_set_channel_access(struct ipmi_intf *intf,
|
|||||||
req.msg.data_len = 3;
|
req.msg.data_len = 3;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
@ -225,7 +225,7 @@ iana_string(uint32_t iana)
|
|||||||
* ipmi_1_5_authtypes
|
* ipmi_1_5_authtypes
|
||||||
*
|
*
|
||||||
* Create a string describing the supported authentication types as
|
* Create a string describing the supported authentication types as
|
||||||
* specificed by the parameter n
|
* specified by the parameter n
|
||||||
*/
|
*/
|
||||||
static const char *
|
static const char *
|
||||||
ipmi_1_5_authtypes(uint8_t n)
|
ipmi_1_5_authtypes(uint8_t n)
|
||||||
@ -244,10 +244,28 @@ ipmi_1_5_authtypes(uint8_t n)
|
|||||||
return supportedTypes;
|
return supportedTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t
|
void
|
||||||
ipmi_current_channel_medium(struct ipmi_intf *intf)
|
ipmi_current_channel_info(struct ipmi_intf *intf,
|
||||||
|
struct channel_info_t *chinfo)
|
||||||
{
|
{
|
||||||
return ipmi_get_channel_medium(intf, 0xE);
|
int ccode = 0;
|
||||||
|
|
||||||
|
chinfo->channel = CH_CURRENT;
|
||||||
|
ccode = _ipmi_get_channel_info(intf, chinfo);
|
||||||
|
if (ccode) {
|
||||||
|
if (ccode != IPMI_CC_INV_DATA_FIELD_IN_REQ) {
|
||||||
|
if (ccode > 0) {
|
||||||
|
lprintf(LOG_ERR, "Get Channel Info command failed: %s",
|
||||||
|
val2str(ccode, completion_code_vals));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
eval_ccode(ccode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chinfo->channel = CH_UNKNOWN;
|
||||||
|
chinfo->medium = IPMI_CHANNEL_MEDIUM_RESERVED;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -276,7 +294,7 @@ ipmi_get_channel_auth_cap(struct ipmi_intf *intf, uint8_t channel, uint8_t priv)
|
|||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
|
||||||
if ((rsp == NULL) || (rsp->ccode > 0)) {
|
if (!rsp || rsp->ccode) {
|
||||||
/*
|
/*
|
||||||
* It's very possible that this failed because we asked for IPMI v2 data
|
* It's very possible that this failed because we asked for IPMI v2 data
|
||||||
* Ask again, without requesting IPMI v2 data
|
* Ask again, without requesting IPMI v2 data
|
||||||
@ -284,11 +302,11 @@ ipmi_get_channel_auth_cap(struct ipmi_intf *intf, uint8_t channel, uint8_t priv)
|
|||||||
msg_data[0] &= 0x7F;
|
msg_data[0] &= 0x7F;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Unable to Get Channel Authentication Capabilities");
|
lprintf(LOG_ERR, "Unable to Get Channel Authentication Capabilities");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Channel Authentication Capabilities failed: %s",
|
lprintf(LOG_ERR, "Get Channel Authentication Capabilities failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -342,58 +360,152 @@ ipmi_get_channel_auth_cap(struct ipmi_intf *intf, uint8_t channel, uint8_t priv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static inline size_t parse_cipher_suite(uint8_t *cipher_suite_data,
|
||||||
ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, const char *payload_type,
|
size_t data_len,
|
||||||
uint8_t channel)
|
uint32_t *iana,
|
||||||
|
uint8_t *auth_alg,
|
||||||
|
uint8_t *integrity_alg,
|
||||||
|
uint8_t *crypt_alg,
|
||||||
|
enum cipher_suite_ids *cipher_suite_id)
|
||||||
|
{
|
||||||
|
size_t size = 0;
|
||||||
|
const char *incomplete = "Incomplete data record in cipher suite data";
|
||||||
|
|
||||||
|
if (*cipher_suite_data == STANDARD_CIPHER_SUITE) {
|
||||||
|
struct std_cipher_suite_record_t *record =
|
||||||
|
(struct std_cipher_suite_record_t*)cipher_suite_data;
|
||||||
|
|
||||||
|
/* Verify that we have at least a full record left; id + 3 algs */
|
||||||
|
if (data_len < sizeof(*record)) {
|
||||||
|
lprintf(LOG_INFO, "%s", incomplete);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IANA code remains default (0) */
|
||||||
|
*cipher_suite_id = record->cipher_suite_id;
|
||||||
|
*auth_alg = CIPHER_ALG_MASK & record->auth_alg;
|
||||||
|
*integrity_alg = CIPHER_ALG_MASK & record->integrity_alg;
|
||||||
|
*crypt_alg = CIPHER_ALG_MASK & record->crypt_alg;
|
||||||
|
size = sizeof(*record);
|
||||||
|
} else if (*cipher_suite_data == OEM_CIPHER_SUITE) {
|
||||||
|
/* OEM record type */
|
||||||
|
struct oem_cipher_suite_record_t *record =
|
||||||
|
(struct oem_cipher_suite_record_t*)cipher_suite_data;
|
||||||
|
/* Verify that we have at least a full record left
|
||||||
|
* id + iana + 3 algs
|
||||||
|
*/
|
||||||
|
if (data_len < sizeof(*record)) {
|
||||||
|
lprintf(LOG_INFO, "%s", incomplete);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Grab the IANA */
|
||||||
|
*iana = ipmi24toh(record->iana);
|
||||||
|
*cipher_suite_id = record->cipher_suite_id;
|
||||||
|
*auth_alg = CIPHER_ALG_MASK & record->auth_alg;
|
||||||
|
*integrity_alg = CIPHER_ALG_MASK & record->integrity_alg;
|
||||||
|
*crypt_alg = CIPHER_ALG_MASK & record->crypt_alg;
|
||||||
|
size = sizeof(*record);
|
||||||
|
} else {
|
||||||
|
lprintf(LOG_INFO, "Bad start of record byte in cipher suite data "
|
||||||
|
"(value %x)", *cipher_suite_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
parse_channel_cipher_suite_data(uint8_t *cipher_suite_data, size_t data_len,
|
||||||
|
struct cipher_suite_info* suites,
|
||||||
|
size_t nr_suites)
|
||||||
|
{
|
||||||
|
size_t count = 0;
|
||||||
|
size_t offset = 0;
|
||||||
|
|
||||||
|
/* Default everything to zeroes */
|
||||||
|
memset(suites, 0, sizeof(*suites) * nr_suites);
|
||||||
|
|
||||||
|
while (offset < data_len && count < nr_suites) {
|
||||||
|
size_t suite_size;
|
||||||
|
|
||||||
|
/* Set non-zero defaults */
|
||||||
|
suites[count].auth_alg = IPMI_AUTH_RAKP_NONE;
|
||||||
|
suites[count].integrity_alg = IPMI_INTEGRITY_NONE;
|
||||||
|
suites[count].crypt_alg = IPMI_CRYPT_NONE;
|
||||||
|
|
||||||
|
/* Update fields from cipher suite data */
|
||||||
|
suite_size = parse_cipher_suite(cipher_suite_data + offset,
|
||||||
|
data_len - offset,
|
||||||
|
&suites[count].iana,
|
||||||
|
&suites[count].auth_alg,
|
||||||
|
&suites[count].integrity_alg,
|
||||||
|
&suites[count].crypt_alg,
|
||||||
|
&suites[count].cipher_suite_id);
|
||||||
|
|
||||||
|
if (!suite_size) {
|
||||||
|
lprintf(LOG_INFO,
|
||||||
|
"Failed to parse cipher suite data at offset %d",
|
||||||
|
offset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset += suite_size;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ipmi_get_channel_cipher_suites(struct ipmi_intf *intf,
|
||||||
|
const char *payload_type,
|
||||||
|
uint8_t channel,
|
||||||
|
struct cipher_suite_info *suites,
|
||||||
|
size_t *count)
|
||||||
{
|
{
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
|
|
||||||
uint8_t rqdata[3];
|
uint8_t rqdata[3];
|
||||||
uint32_t iana;
|
|
||||||
uint8_t auth_alg, integrity_alg, crypt_alg;
|
|
||||||
uint8_t cipher_suite_id;
|
|
||||||
uint8_t list_index = 0;
|
uint8_t list_index = 0;
|
||||||
/* 0x40 sets * 16 bytes per set */
|
/* 0x40 sets * 16 bytes per set */
|
||||||
uint8_t cipher_suite_data[1024];
|
uint8_t cipher_suite_data[MAX_CIPHER_SUITE_RECORD_OFFSET *
|
||||||
uint16_t offset = 0;
|
MAX_CIPHER_SUITE_DATA_LEN];
|
||||||
/* how much was returned, total */
|
size_t offset = 0;
|
||||||
uint16_t cipher_suite_data_length = 0;
|
size_t nr_suites = 0;
|
||||||
|
|
||||||
|
if (!suites || !count || !*count)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
nr_suites = *count;
|
||||||
|
*count = 0;
|
||||||
memset(cipher_suite_data, 0, sizeof(cipher_suite_data));
|
memset(cipher_suite_data, 0, sizeof(cipher_suite_data));
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.msg.netfn = IPMI_NETFN_APP;
|
req.msg.netfn = IPMI_NETFN_APP;
|
||||||
req.msg.cmd = IPMI_GET_CHANNEL_CIPHER_SUITES;
|
req.msg.cmd = IPMI_GET_CHANNEL_CIPHER_SUITES;
|
||||||
req.msg.data = rqdata;
|
req.msg.data = rqdata;
|
||||||
req.msg.data_len = 3;
|
req.msg.data_len = sizeof(rqdata);
|
||||||
|
|
||||||
rqdata[0] = channel;
|
rqdata[0] = channel;
|
||||||
rqdata[1] = ((strncmp(payload_type, "ipmi", 4) == 0)? 0: 1);
|
rqdata[1] = strcmp(payload_type, "ipmi") ? 1 : 0;
|
||||||
/* Always ask for cipher suite format */
|
|
||||||
rqdata[2] = 0x80;
|
|
||||||
|
|
||||||
|
do {
|
||||||
|
/* Always ask for cipher suite format */
|
||||||
|
rqdata[2] = LIST_ALGORITHMS_BY_CIPHER_SUITE | list_index;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites");
|
lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode
|
||||||
|
|| rsp->data_len < 1
|
||||||
|
|| rsp->data_len > sizeof(uint8_t) + MAX_CIPHER_SUITE_DATA_LEN)
|
||||||
|
{
|
||||||
lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s",
|
lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Grab the returned channel number once. We assume it's the same
|
|
||||||
* in future calls.
|
|
||||||
*/
|
|
||||||
if (rsp->data_len >= 1) {
|
|
||||||
channel = rsp->data[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((rsp->data_len > 1) && (rsp->data_len == 17) && (list_index < 0x3F)) {
|
|
||||||
/*
|
/*
|
||||||
* We got back cipher suite data -- store it.
|
* We got back cipher suite data -- store it.
|
||||||
* printf("copying data to offset %d\n", offset);
|
* printf("copying data to offset %d\n", offset);
|
||||||
@ -406,111 +518,44 @@ ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, const char *payload_type,
|
|||||||
* Increment our list for the next call
|
* Increment our list for the next call
|
||||||
*/
|
*/
|
||||||
++list_index;
|
++list_index;
|
||||||
rqdata[2] = (rqdata[2] & 0x80) + list_index;
|
} while ((rsp->data_len == (sizeof(uint8_t) + MAX_CIPHER_SUITE_DATA_LEN))
|
||||||
|
&& (list_index < MAX_CIPHER_SUITE_RECORD_OFFSET));
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
*count = parse_channel_cipher_suite_data(cipher_suite_data, offset, suites,
|
||||||
if (rsp == NULL) {
|
nr_suites);
|
||||||
lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites");
|
return 0;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
if (rsp->ccode > 0) {
|
|
||||||
lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s",
|
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy last chunk */
|
static int
|
||||||
if(rsp->data_len > 1) {
|
ipmi_print_channel_cipher_suites(struct ipmi_intf *intf,
|
||||||
/*
|
const char *payload_type,
|
||||||
* We got back cipher suite data -- store it.
|
uint8_t channel)
|
||||||
* printf("copying data to offset %d\n", offset);
|
{
|
||||||
* printbuf(rsp->data + 1, rsp->data_len - 1, "this is the data");
|
int rc;
|
||||||
*/
|
size_t i = 0;
|
||||||
memcpy(cipher_suite_data + offset, rsp->data + 1, rsp->data_len - 1);
|
struct cipher_suite_info suites[MAX_CIPHER_SUITE_COUNT];
|
||||||
offset += rsp->data_len - 1;
|
size_t nr_suites = sizeof(*suites);
|
||||||
}
|
const char *header_str =
|
||||||
|
"ID IANA Auth Alg Integrity Alg Confidentiality Alg";
|
||||||
|
|
||||||
/* We can chomp on all our data now. */
|
rc = ipmi_get_channel_cipher_suites(intf, payload_type, channel,
|
||||||
cipher_suite_data_length = offset;
|
suites, &nr_suites);
|
||||||
offset = 0;
|
|
||||||
|
|
||||||
if (! csv_output) {
|
if (rc < 0)
|
||||||
printf("ID IANA Auth Alg Integrity Alg Confidentiality Alg\n");
|
return rc;
|
||||||
}
|
|
||||||
while (offset < cipher_suite_data_length) {
|
|
||||||
if (cipher_suite_data[offset++] == 0xC0) {
|
|
||||||
/* standard type */
|
|
||||||
iana = 0;
|
|
||||||
|
|
||||||
/* Verify that we have at least a full record left; id + 3 algs */
|
if (!csv_output) {
|
||||||
if ((cipher_suite_data_length - offset) < 4) {
|
printf("%s\n", header_str);
|
||||||
lprintf(LOG_ERR, "Incomplete data record in cipher suite data");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
cipher_suite_id = cipher_suite_data[offset++];
|
|
||||||
} else if (cipher_suite_data[offset++] == 0xC1) {
|
|
||||||
/* OEM record type */
|
|
||||||
/* Verify that we have at least a full record left
|
|
||||||
* id + iana + 3 algs
|
|
||||||
*/
|
|
||||||
if ((cipher_suite_data_length - offset) < 4) {
|
|
||||||
lprintf(LOG_ERR, "Incomplete data record in cipher suite data");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cipher_suite_id = cipher_suite_data[offset++];
|
|
||||||
|
|
||||||
/* Grab the IANA */
|
|
||||||
iana =
|
|
||||||
cipher_suite_data[offset] |
|
|
||||||
(cipher_suite_data[offset + 1] << 8) |
|
|
||||||
(cipher_suite_data[offset + 2] << 16);
|
|
||||||
offset += 3;
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Bad start of record byte in cipher suite data");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Grab the algorithms for this cipher suite. I guess we can't be
|
|
||||||
* sure of what order they'll come in. Also, I suppose we default
|
|
||||||
* to the NONE algorithm if one were absent. This part of the spec is
|
|
||||||
* poorly written -- I have read the errata document. For now, I'm only
|
|
||||||
* allowing one algorithm per type (auth, integrity, crypt) because I
|
|
||||||
* don't I understand how it could be otherwise.
|
|
||||||
*/
|
|
||||||
auth_alg = IPMI_AUTH_RAKP_NONE;
|
|
||||||
integrity_alg = IPMI_INTEGRITY_NONE;
|
|
||||||
crypt_alg = IPMI_CRYPT_NONE;
|
|
||||||
|
|
||||||
while (((cipher_suite_data[offset] & 0xC0) != 0xC0) &&
|
|
||||||
((cipher_suite_data_length - offset) > 0))
|
|
||||||
{
|
|
||||||
switch (cipher_suite_data[offset] & 0xC0)
|
|
||||||
{
|
|
||||||
case 0x00:
|
|
||||||
/* Authentication algorithm specifier */
|
|
||||||
auth_alg = cipher_suite_data[offset++] & 0x3F;
|
|
||||||
break;
|
|
||||||
case 0x40:
|
|
||||||
/* Interity algorithm specifier */
|
|
||||||
integrity_alg = cipher_suite_data[offset++] & 0x3F;
|
|
||||||
break;
|
|
||||||
case 0x80:
|
|
||||||
/* Confidentiality algorithm specifier */
|
|
||||||
crypt_alg = cipher_suite_data[offset++] & 0x3F;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (i = 0; i < nr_suites; i++) {
|
||||||
/* We have everything we need to spit out a cipher suite record */
|
/* We have everything we need to spit out a cipher suite record */
|
||||||
printf((csv_output? "%d,%s,%s,%s,%s\n" :
|
printf(csv_output ? "%d,%s,%s,%s,%s\n"
|
||||||
"%-4d %-7s %-15s %-15s %-15s\n"),
|
: "%-4d %-7s %-15s %-15s %-15s\n",
|
||||||
cipher_suite_id,
|
suites[i].cipher_suite_id,
|
||||||
iana_string(iana),
|
iana_string(suites[i].iana),
|
||||||
val2str(auth_alg, ipmi_auth_algorithms),
|
val2str(suites[i].auth_alg, ipmi_auth_algorithms),
|
||||||
val2str(integrity_alg, ipmi_integrity_algorithms),
|
val2str(suites[i].integrity_alg, ipmi_integrity_algorithms),
|
||||||
val2str(crypt_alg, ipmi_encryption_algorithms));
|
val2str(suites[i].crypt_alg, ipmi_encryption_algorithms));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -648,8 +693,9 @@ ipmi_get_channel_info(struct ipmi_intf *intf, uint8_t channel)
|
|||||||
*
|
*
|
||||||
* @channel - IPMI Channel
|
* @channel - IPMI Channel
|
||||||
*
|
*
|
||||||
* returns - IPMI Channel Medium, IPMI_CHANNEL_MEDIUM_RESERVED if ccode > 0,
|
* @returns IPMI Channel Medium
|
||||||
* 0 on error.
|
* @retval IPMI_CHANNEL_MEDIUM_RESERVED if ccode was not IPMI_CC_OK
|
||||||
|
* @retval 0 on error
|
||||||
*/
|
*/
|
||||||
uint8_t
|
uint8_t
|
||||||
ipmi_get_channel_medium(struct ipmi_intf *intf, uint8_t channel)
|
ipmi_get_channel_medium(struct ipmi_intf *intf, uint8_t channel)
|
||||||
@ -659,13 +705,16 @@ ipmi_get_channel_medium(struct ipmi_intf *intf, uint8_t channel)
|
|||||||
|
|
||||||
channel_info.channel = channel;
|
channel_info.channel = channel;
|
||||||
ccode = _ipmi_get_channel_info(intf, &channel_info);
|
ccode = _ipmi_get_channel_info(intf, &channel_info);
|
||||||
if (ccode == 0xCC) {
|
if (ccode) {
|
||||||
return IPMI_CHANNEL_MEDIUM_RESERVED;
|
if (ccode != IPMI_CC_INV_DATA_FIELD_IN_REQ) {
|
||||||
} else if (ccode < 0 && eval_ccode(ccode) != 0) {
|
if (ccode > 0) {
|
||||||
return 0;
|
|
||||||
} else if (ccode > 0) {
|
|
||||||
lprintf(LOG_ERR, "Get Channel Info command failed: %s",
|
lprintf(LOG_ERR, "Get Channel Info command failed: %s",
|
||||||
val2str(ccode, completion_code_vals));
|
val2str(ccode, completion_code_vals));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
eval_ccode(ccode);
|
||||||
|
}
|
||||||
|
}
|
||||||
return IPMI_CHANNEL_MEDIUM_RESERVED;
|
return IPMI_CHANNEL_MEDIUM_RESERVED;
|
||||||
}
|
}
|
||||||
lprintf(LOG_DEBUG, "Channel type: %s",
|
lprintf(LOG_DEBUG, "Channel type: %s",
|
||||||
@ -754,9 +803,27 @@ ipmi_set_user_access(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
int ccode = 0;
|
int ccode = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
uint8_t channel = 0;
|
uint8_t channel = 0;
|
||||||
uint8_t priv = 0;
|
|
||||||
uint8_t user_id = 0;
|
uint8_t user_id = 0;
|
||||||
if (argc > 0 && strncmp(argv[0], "help", 4) == 0) {
|
struct {
|
||||||
|
const char *option;
|
||||||
|
enum {
|
||||||
|
UA_INTEGER, /* direct integer value */
|
||||||
|
UA_BOOLEAN, /* off/disable = false, on/enable = true */
|
||||||
|
UA_BOOLEAN_INVERSE /* off/disable = true, on/enable = false */
|
||||||
|
} type;
|
||||||
|
uint8_t *val;
|
||||||
|
uint8_t min; /* minimum value for UA_INTEGER options */
|
||||||
|
uint8_t max; /* maximum value for UA_INTEGER options */
|
||||||
|
} options[] = {
|
||||||
|
{ "callin=", UA_BOOLEAN_INVERSE, &user_access.callin_callback, 0, 0},
|
||||||
|
{ "link=", UA_BOOLEAN, &user_access.link_auth, 0, 0},
|
||||||
|
{ "ipmi=", UA_BOOLEAN, &user_access.ipmi_messaging, 0, 0},
|
||||||
|
{ "privilege=", UA_INTEGER, &user_access.privilege_limit
|
||||||
|
, IPMI_SESSION_PRIV_CALLBACK
|
||||||
|
, IPMI_SESSION_PRIV_NOACCESS },
|
||||||
|
};
|
||||||
|
|
||||||
|
if (argc > 0 && !strcmp(argv[0], "help")) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (argc < 3) {
|
} else if (argc < 3) {
|
||||||
@ -778,33 +845,46 @@ ipmi_set_user_access(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
for (i = 2; i < argc; i ++) {
|
for (i = 2; i < argc; i ++) {
|
||||||
if (strncmp(argv[i], "callin=", 7) == 0) {
|
size_t j;
|
||||||
if (strncmp(argv[i] + 7, "off", 3) == 0) {
|
for (j = 0; j < ARRAY_SIZE(options); ++j) {
|
||||||
user_access.callin_callback = 1;
|
const char *opt = argv[i];
|
||||||
} else {
|
const int optlen = strlen(options[j].option);
|
||||||
user_access.callin_callback = 0;
|
if (!strncmp(opt, options[j].option, optlen)) {
|
||||||
|
const char *optval = opt + optlen;
|
||||||
|
uint16_t val;
|
||||||
|
|
||||||
|
if (UA_INTEGER != options[j].type) {
|
||||||
|
bool boolval = (UA_BOOLEAN_INVERSE == options[j].type)
|
||||||
|
? false
|
||||||
|
: true;
|
||||||
|
*options[j].val = boolval;
|
||||||
|
if (!strcmp(optval, "off")
|
||||||
|
|| !strcmp(optval, "disable")
|
||||||
|
|| !strcmp(optval, "no"))
|
||||||
|
{
|
||||||
|
boolval = !boolval;
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[i], "link=", 5) == 0) {
|
} else if (UINT8_MAX
|
||||||
if (strncmp(argv[i] + 5, "off", 3) == 0) {
|
!= (val = str2val(optval, ipmi_privlvl_vals)))
|
||||||
user_access.link_auth = 0;
|
{
|
||||||
} else {
|
*options[j].val = (uint8_t)val;
|
||||||
user_access.link_auth = 1;
|
} else if (str2uchar(optval, options[j].val)) {
|
||||||
}
|
lprintf(LOG_ERR
|
||||||
} else if (strncmp(argv[i], "ipmi=", 5) == 0) {
|
, "Numeric [%hhu-%hhu] value expected, "
|
||||||
if (strncmp(argv[i] + 5, "off", 3) == 0) {
|
"but '%s' given."
|
||||||
user_access.ipmi_messaging = 0;
|
, options[j].min
|
||||||
} else {
|
, options[j].max
|
||||||
user_access.ipmi_messaging = 1;
|
, optval);
|
||||||
}
|
|
||||||
} else if (strncmp(argv[i], "privilege=", 10) == 0) {
|
|
||||||
if (str2uchar(argv[i] + 10, &priv) != 0) {
|
|
||||||
lprintf(LOG_ERR,
|
|
||||||
"Numeric value expected, but '%s' given.",
|
|
||||||
argv[i] + 10);
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
user_access.privilege_limit = priv;
|
lprintf(LOG_DEBUG
|
||||||
} else {
|
, "Option %s=%hhu"
|
||||||
|
, options[j].option
|
||||||
|
, *options[j].val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ARRAY_SIZE(options) == j) {
|
||||||
lprintf(LOG_ERR, "Invalid option: %s\n", argv[i]);
|
lprintf(LOG_ERR, "Invalid option: %s\n", argv[i]);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -831,10 +911,10 @@ ipmi_channel_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (strncmp(argv[0], "help", 4) == 0) {
|
} else if (!strcmp(argv[0], "help")) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strncmp(argv[0], "authcap", 7) == 0) {
|
} else if (!strcmp(argv[0], "authcap")) {
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -844,7 +924,7 @@ ipmi_channel_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
retval = ipmi_get_channel_auth_cap(intf, channel, priv);
|
retval = ipmi_get_channel_auth_cap(intf, channel, priv);
|
||||||
} else if (strncmp(argv[0], "getaccess", 10) == 0) {
|
} else if (!strcmp(argv[0], "getaccess")) {
|
||||||
uint8_t user_id = 0;
|
uint8_t user_id = 0;
|
||||||
if ((argc < 2) || (argc > 3)) {
|
if ((argc < 2) || (argc > 3)) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
@ -860,9 +940,9 @@ ipmi_channel_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval = ipmi_get_user_access(intf, channel, user_id);
|
retval = ipmi_get_user_access(intf, channel, user_id);
|
||||||
} else if (strncmp(argv[0], "setaccess", 9) == 0) {
|
} else if (!strcmp(argv[0], "setaccess")) {
|
||||||
return ipmi_set_user_access(intf, (argc - 1), &(argv[1]));
|
return ipmi_set_user_access(intf, (argc - 1), &(argv[1]));
|
||||||
} else if (strncmp(argv[0], "info", 4) == 0) {
|
} else if (!strcmp(argv[0], "info")) {
|
||||||
channel = 0xE;
|
channel = 0xE;
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
@ -874,11 +954,11 @@ ipmi_channel_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval = ipmi_get_channel_info(intf, channel);
|
retval = ipmi_get_channel_info(intf, channel);
|
||||||
} else if (strncmp(argv[0], "getciphers", 10) == 0) {
|
} else if (!strcmp(argv[0], "getciphers")) {
|
||||||
/* channel getciphers <ipmi|sol> [channel] */
|
/* channel getciphers <ipmi|sol> [channel] */
|
||||||
channel = 0xE;
|
channel = 0xE;
|
||||||
if ((argc < 2) || (argc > 3) ||
|
if ((argc < 2) || (argc > 3) ||
|
||||||
(strncmp(argv[1], "ipmi", 4) && strncmp(argv[1], "sol", 3))) {
|
(strcmp(argv[1], "ipmi") && strcmp(argv[1], "sol"))) {
|
||||||
printf_channel_usage();
|
printf_channel_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -887,7 +967,7 @@ ipmi_channel_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval = ipmi_get_channel_cipher_suites(intf,
|
retval = ipmi_print_channel_cipher_suites(intf,
|
||||||
argv[1], /* ipmi | sol */
|
argv[1], /* ipmi | sol */
|
||||||
channel);
|
channel);
|
||||||
} else {
|
} else {
|
||||||
|
1577
lib/ipmi_chassis.c
1577
lib/ipmi_chassis.c
File diff suppressed because it is too large
Load Diff
735
lib/ipmi_dcmi.c
Executable file → Normal file
735
lib/ipmi_dcmi.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -37,10 +37,14 @@
|
|||||||
#include <ipmitool/log.h>
|
#include <ipmitool/log.h>
|
||||||
#include <ipmitool/helper.h>
|
#include <ipmitool/helper.h>
|
||||||
#include <ipmitool/ipmi_strings.h>
|
#include <ipmitool/ipmi_strings.h>
|
||||||
|
#include <ipmitool/ipmi_fru.h>
|
||||||
|
#include <ipmitool/ipmi_time.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define NO_MORE_INFO_FIELD 0xc1
|
#define NO_MORE_INFO_FIELD 0xc1
|
||||||
#define TYPE_CODE 0xc0 /*Language code*/
|
#define TYPE_CODE 0xc0 /*Language code*/
|
||||||
@ -193,7 +197,7 @@ struct ipmi_ek_amc_p2p_connectivity_record{
|
|||||||
struct fru_picmgext_amc_channel_desc_record * ch_desc;
|
struct fru_picmgext_amc_channel_desc_record * ch_desc;
|
||||||
unsigned char link_desc_count;
|
unsigned char link_desc_count;
|
||||||
struct fru_picmgext_amc_link_desc_record * link_desc;
|
struct fru_picmgext_amc_link_desc_record * link_desc;
|
||||||
int * matching_result; /*For link descriptor comparision*/
|
int * matching_result; /*For link descriptor comparison*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -216,8 +220,7 @@ static void ipmi_ek_add_record2list( struct ipmi_ek_multi_header ** record,
|
|||||||
struct ipmi_ek_multi_header ** list_last );
|
struct ipmi_ek_multi_header ** list_last );
|
||||||
|
|
||||||
static void ipmi_ek_display_record( struct ipmi_ek_multi_header * record,
|
static void ipmi_ek_display_record( struct ipmi_ek_multi_header * record,
|
||||||
struct ipmi_ek_multi_header * list_head,
|
struct ipmi_ek_multi_header * list_head);
|
||||||
struct ipmi_ek_multi_header * list_last );
|
|
||||||
|
|
||||||
static void ipmi_ek_remove_record_from_list(
|
static void ipmi_ek_remove_record_from_list(
|
||||||
struct ipmi_ek_multi_header * record,
|
struct ipmi_ek_multi_header * record,
|
||||||
@ -234,7 +237,7 @@ static int ipmi_ekanalyzer_fru_file2structure( char * filename,
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static int ipmi_ek_matching_process( int * file_type, int index1, int index2,
|
static int ipmi_ek_matching_process( int * file_type, int index1, int index2,
|
||||||
struct ipmi_ek_multi_header ** list_head,
|
struct ipmi_ek_multi_header ** list_head,
|
||||||
struct ipmi_ek_multi_header ** list_last, char * opt,
|
char * opt,
|
||||||
struct ipmi_ek_multi_header * pphysical );
|
struct ipmi_ek_multi_header * pphysical );
|
||||||
|
|
||||||
static int ipmi_ek_get_resource_descriptor( int port_count, int index,
|
static int ipmi_ek_get_resource_descriptor( int port_count, int index,
|
||||||
@ -450,11 +453,11 @@ ipmi_ek_get_file_type(char *argument)
|
|||||||
*
|
*
|
||||||
* Global: None
|
* Global: None
|
||||||
*
|
*
|
||||||
* Return: OK_STATUS as succes or ERROR_STATUS as error
|
* Return: OK_STATUS as success or ERROR_STATUS as error
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int
|
int
|
||||||
ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
ipmi_ekanalyzer_main(struct ipmi_intf *__UNUSED__(intf), int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc = ERROR_STATUS;
|
int rc = ERROR_STATUS;
|
||||||
int file_type[MAX_FILE_NUMBER];
|
int file_type[MAX_FILE_NUMBER];
|
||||||
@ -475,11 +478,12 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[argument_offset], "help") == 0) {
|
if (!strcmp(argv[argument_offset], "help")) {
|
||||||
ipmi_ekanalyzer_usage();
|
ipmi_ekanalyzer_usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((strcmp(argv[argument_offset], "frushow") == 0)
|
} else if (!strcmp(argv[argument_offset], "frushow")
|
||||||
&& (argc > (MIN_ARGUMENT-1))) {
|
&& (argc > (MIN_ARGUMENT-1)))
|
||||||
|
{
|
||||||
for (type_offset = 0; type_offset < (argc-1); type_offset++ ) {
|
for (type_offset = 0; type_offset < (argc-1); type_offset++ ) {
|
||||||
argument_offset++;
|
argument_offset++;
|
||||||
file_type[type_offset] = ipmi_ek_get_file_type(argv[argument_offset]);
|
file_type[type_offset] = ipmi_ek_get_file_type(argv[argument_offset]);
|
||||||
@ -495,7 +499,7 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
filename[type_offset] = malloc(strlen(argv[argument_offset])
|
filename[type_offset] = malloc(strlen(argv[argument_offset])
|
||||||
+ 1 - SIZE_OF_FILE_TYPE);
|
+ 1 - SIZE_OF_FILE_TYPE);
|
||||||
if (filename[type_offset] == NULL) {
|
if (!filename[type_offset]) {
|
||||||
lprintf(LOG_ERR, "malloc failure");
|
lprintf(LOG_ERR, "malloc failure");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -511,9 +515,9 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
/* Convert from binary data into multi record structure */
|
/* Convert from binary data into multi record structure */
|
||||||
rc = ipmi_ekanalyzer_fru_file2structure (filename[type_offset],
|
rc = ipmi_ekanalyzer_fru_file2structure (filename[type_offset],
|
||||||
&list_head, &list_record, &list_last );
|
&list_head, &list_record, &list_last );
|
||||||
ipmi_ek_display_record(list_record, list_head, list_last);
|
ipmi_ek_display_record(list_record, list_head);
|
||||||
/* Remove record of list */
|
/* Remove record of list */
|
||||||
while (list_head != NULL) {
|
while (list_head) {
|
||||||
ipmi_ek_remove_record_from_list(list_head,
|
ipmi_ek_remove_record_from_list(list_head,
|
||||||
&list_head,&list_last );
|
&list_head,&list_last );
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
@ -524,8 +528,9 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
free(filename[type_offset]);
|
free(filename[type_offset]);
|
||||||
filename[type_offset] = NULL;
|
filename[type_offset] = NULL;
|
||||||
}
|
}
|
||||||
} else if ((strcmp(argv[argument_offset], "print") == 0)
|
} else if (!strcmp(argv[argument_offset], "print")
|
||||||
|| (strcmp(argv[argument_offset], "summary") == 0)) {
|
|| !strcmp(argv[argument_offset], "summary"))
|
||||||
|
{
|
||||||
/* Display help text for corresponding command
|
/* Display help text for corresponding command
|
||||||
* if not enough parameters were given.
|
* if not enough parameters were given.
|
||||||
*/
|
*/
|
||||||
@ -537,7 +542,7 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
int filename_size=0;
|
int filename_size=0;
|
||||||
if (argc < MIN_ARGUMENT) {
|
if (argc < MIN_ARGUMENT) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
if (strcmp(argv[argument_offset], "print") == 0) {
|
if (!strcmp(argv[argument_offset], "print")) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
" ekanalyzer print [carrier/power/all]"
|
" ekanalyzer print [carrier/power/all]"
|
||||||
" <xx=frufile> <xx=frufile> [xx=frufile]");
|
" <xx=frufile> <xx=frufile> [xx=frufile]");
|
||||||
@ -549,18 +554,20 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return ERROR_STATUS;
|
return ERROR_STATUS;
|
||||||
}
|
}
|
||||||
argument_offset++;
|
argument_offset++;
|
||||||
if ((strcmp(argv[argument_offset], "carrier") == 0)
|
if (!strcmp(argv[argument_offset], "carrier")
|
||||||
|| (strcmp(argv[argument_offset], "power") == 0)
|
|| !strcmp(argv[argument_offset], "power")
|
||||||
|| (strcmp(argv[argument_offset], "all") == 0)) {
|
|| !strcmp(argv[argument_offset], "all"))
|
||||||
|
{
|
||||||
option = argv[argument_offset];
|
option = argv[argument_offset];
|
||||||
index ++;
|
index ++;
|
||||||
argc--;
|
argc--;
|
||||||
} else if ((strcmp(argv[argument_offset], "match") == 0)
|
} else if (!strcmp(argv[argument_offset], "match")
|
||||||
|| ( strcmp(argv[argument_offset], "unmatch") == 0)) {
|
|| !strcmp(argv[argument_offset], "unmatch"))
|
||||||
|
{
|
||||||
option = argv[argument_offset];
|
option = argv[argument_offset];
|
||||||
index ++;
|
index ++;
|
||||||
argc--;
|
argc--;
|
||||||
} else if ( strncmp(&argv[argument_offset][2], "=", 1) == 0) {
|
} else if ('=' == argv[argument_offset][2]) {
|
||||||
/* since the command line must receive xx=filename,
|
/* since the command line must receive xx=filename,
|
||||||
* so the position of "=" sign is 2
|
* so the position of "=" sign is 2
|
||||||
*/
|
*/
|
||||||
@ -573,7 +580,7 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
option = "invalid";
|
option = "invalid";
|
||||||
printf("Invalid option '%s'\n", argv[argument_offset]);
|
printf("Invalid option '%s'\n", argv[argument_offset]);
|
||||||
argument_offset--;
|
argument_offset--;
|
||||||
if (strcmp(argv[0], "print") == 0) {
|
if (!strcmp(argv[0], "print")) {
|
||||||
lprintf (LOG_ERR,
|
lprintf (LOG_ERR,
|
||||||
" ekanalyzer print [carrier/power/all]"
|
" ekanalyzer print [carrier/power/all]"
|
||||||
" <xx=frufile> <xx=frufile> [xx=frufile]");
|
" <xx=frufile> <xx=frufile> [xx=frufile]");
|
||||||
@ -584,12 +591,12 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
rc = ERROR_STATUS;
|
rc = ERROR_STATUS;
|
||||||
}
|
}
|
||||||
if (strcmp(option, "invalid") != 0) {
|
if (strcmp(option, "invalid")) {
|
||||||
int i=0;
|
int i=0;
|
||||||
for (i = 0; i < (argc-1); i++) {
|
for (i = 0; i < (argc-1); i++) {
|
||||||
file_type[i] = ipmi_ek_get_file_type (argv[index]);
|
file_type[i] = ipmi_ek_get_file_type (argv[index]);
|
||||||
if (file_type[i] == ERROR_STATUS) {
|
if (file_type[i] == ERROR_STATUS) {
|
||||||
/* display the first 2 charactors (file type) of argument */
|
/* display the first 2 characters (file type) of argument */
|
||||||
lprintf(LOG_ERR, "Invalid file type: %c%c\n",
|
lprintf(LOG_ERR, "Invalid file type: %c%c\n",
|
||||||
argv[index][0],
|
argv[index][0],
|
||||||
argv[index][1]);
|
argv[index][1]);
|
||||||
@ -603,7 +610,7 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
filename_size = strlen(argv[index]) - SIZE_OF_FILE_TYPE + 1;
|
filename_size = strlen(argv[index]) - SIZE_OF_FILE_TYPE + 1;
|
||||||
if (filename_size > 0) {
|
if (filename_size > 0) {
|
||||||
filename[i] = malloc( filename_size );
|
filename[i] = malloc( filename_size );
|
||||||
if (filename[i] != NULL) {
|
if (filename[i]) {
|
||||||
strcpy(filename[i], &argv[index][SIZE_OF_FILE_TYPE]);
|
strcpy(filename[i], &argv[index][SIZE_OF_FILE_TYPE]);
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
@ -623,7 +630,7 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
printf("file name: %s\n", filename[i]);
|
printf("file name: %s\n", filename[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strcmp(argv[0], "print") == 0) {
|
if (!strcmp(argv[0], "print")) {
|
||||||
rc = ipmi_ekanalyzer_print((argc-1),
|
rc = ipmi_ekanalyzer_print((argc-1),
|
||||||
option, filename, file_type);
|
option, filename, file_type);
|
||||||
} else {
|
} else {
|
||||||
@ -631,7 +638,7 @@ ipmi_ekanalyzer_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
option, filename, file_type);
|
option, filename, file_type);
|
||||||
}
|
}
|
||||||
for (i = 0; i < (argc-1); i++) {
|
for (i = 0; i < (argc-1); i++) {
|
||||||
if (filename[i] != NULL) {
|
if (filename[i]) {
|
||||||
free(filename[i]);
|
free(filename[i]);
|
||||||
filename[i] = NULL;
|
filename[i] = NULL;
|
||||||
}
|
}
|
||||||
@ -674,7 +681,7 @@ ipmi_ekanalyzer_print(int argc, char *opt, char **filename, int *file_type)
|
|||||||
{
|
{
|
||||||
int return_value = OK_STATUS;
|
int return_value = OK_STATUS;
|
||||||
/* Display carrier topology */
|
/* Display carrier topology */
|
||||||
if ((strcmp(opt, "carrier") == 0) || (strcmp(opt, "default") == 0)) {
|
if (!strcmp(opt, "carrier") || !strcmp(opt, "default")) {
|
||||||
tboolean found_flag = FALSE;
|
tboolean found_flag = FALSE;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int index_name[argc];
|
int index_name[argc];
|
||||||
@ -714,8 +721,9 @@ ipmi_ekanalyzer_print(int argc, char *opt, char **filename, int *file_type)
|
|||||||
*/
|
*/
|
||||||
tboolean first_data = TRUE;
|
tboolean first_data = TRUE;
|
||||||
for (list_record[i] = list_head[i];
|
for (list_record[i] = list_head[i];
|
||||||
list_record[i] != NULL;
|
list_record[i];
|
||||||
list_record[i] = list_record[i]->next) {
|
list_record[i] = list_record[i]->next)
|
||||||
|
{
|
||||||
if (list_record[i]->data[PICMG_ID_OFFSET] == FRU_AMC_CARRIER_P2P) {
|
if (list_record[i]->data[PICMG_ID_OFFSET] == FRU_AMC_CARRIER_P2P) {
|
||||||
if (first_data) {
|
if (first_data) {
|
||||||
printf("%s\n", STAR_LINE_LIMITER);
|
printf("%s\n", STAR_LINE_LIMITER);
|
||||||
@ -724,7 +732,7 @@ ipmi_ekanalyzer_print(int argc, char *opt, char **filename, int *file_type)
|
|||||||
}
|
}
|
||||||
return_value = ipmi_ek_display_carrier_connectivity(list_record[i]);
|
return_value = ipmi_ek_display_carrier_connectivity(list_record[i]);
|
||||||
} else if (list_record[i]->data[PICMG_ID_OFFSET] == FRU_AMC_CARRIER_INFO) {
|
} else if (list_record[i]->data[PICMG_ID_OFFSET] == FRU_AMC_CARRIER_INFO) {
|
||||||
/*See AMC.0 specification Table3-3 for mor detail*/
|
/*See AMC.0 specification Table3-3 for more detail*/
|
||||||
#define COUNT_OFFSET 6
|
#define COUNT_OFFSET 6
|
||||||
if (first_data) {
|
if (first_data) {
|
||||||
printf("From Carrier file: %s\n", filename[index_name[i]]);
|
printf("From Carrier file: %s\n", filename[index_name[i]]);
|
||||||
@ -737,7 +745,7 @@ ipmi_ekanalyzer_print(int argc, char *opt, char **filename, int *file_type)
|
|||||||
}
|
}
|
||||||
/*Destroy the list of record*/
|
/*Destroy the list of record*/
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
while (list_head[i] != NULL) {
|
while (list_head[i]) {
|
||||||
ipmi_ek_remove_record_from_list(list_head[i],
|
ipmi_ek_remove_record_from_list(list_head[i],
|
||||||
&list_head[i], &list_last[i]);
|
&list_head[i], &list_last[i]);
|
||||||
}
|
}
|
||||||
@ -749,10 +757,10 @@ ipmi_ekanalyzer_print(int argc, char *opt, char **filename, int *file_type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strcmp(opt, "power") == 0) {
|
} else if (!strcmp(opt, "power")) {
|
||||||
printf("Print power information\n");
|
printf("Print power information\n");
|
||||||
return_value = ipmi_ek_display_power(argc, opt, filename, file_type);
|
return_value = ipmi_ek_display_power(argc, opt, filename, file_type);
|
||||||
} else if (strcmp(opt, "all") == 0) {
|
} else if (!strcmp(opt, "all")) {
|
||||||
printf("Print all information\n");
|
printf("Print all information\n");
|
||||||
return_value = ipmi_ek_display_power(argc, opt, filename, file_type);
|
return_value = ipmi_ek_display_power(argc, opt, filename, file_type);
|
||||||
} else {
|
} else {
|
||||||
@ -787,7 +795,7 @@ ipmi_ek_display_carrier_connectivity(struct ipmi_ek_multi_header *record)
|
|||||||
int offset = START_DATA_OFFSET;
|
int offset = START_DATA_OFFSET;
|
||||||
struct fru_picmgext_carrier_p2p_record rsc_desc;
|
struct fru_picmgext_carrier_p2p_record rsc_desc;
|
||||||
struct fru_picmgext_carrier_p2p_descriptor *port_desc;
|
struct fru_picmgext_carrier_p2p_descriptor *port_desc;
|
||||||
if (record == NULL) {
|
if (!record) {
|
||||||
lprintf(LOG_ERR, "P2P connectivity record is invalid\n");
|
lprintf(LOG_ERR, "P2P connectivity record is invalid\n");
|
||||||
return ERROR_STATUS;
|
return ERROR_STATUS;
|
||||||
}
|
}
|
||||||
@ -915,14 +923,14 @@ ipmi_ek_display_power( int argc, char * opt, char ** filename, int * file_type )
|
|||||||
return_value = ipmi_ekanalyzer_fru_file2structure( filename[num_file],
|
return_value = ipmi_ekanalyzer_fru_file2structure( filename[num_file],
|
||||||
&list_head[num_file], &list_record[num_file], &list_last[num_file]);
|
&list_head[num_file], &list_record[num_file], &list_last[num_file]);
|
||||||
|
|
||||||
if ( list_head[num_file] != NULL ){
|
if (list_head[num_file]){
|
||||||
for ( list_record[num_file] = list_head[num_file];
|
for ( list_record[num_file] = list_head[num_file];
|
||||||
list_record[num_file] != NULL;
|
list_record[num_file];
|
||||||
list_record[num_file] = list_record[num_file]->next
|
list_record[num_file] = list_record[num_file]->next)
|
||||||
){
|
{
|
||||||
if ( ( strcmp(opt, "all") == 0 )
|
if (!strcmp(opt, "all")
|
||||||
&& ( file_type[num_file] == ON_CARRIER_FRU_FILE )
|
&& file_type[num_file] == ON_CARRIER_FRU_FILE)
|
||||||
){
|
{
|
||||||
if ( list_record[num_file]->data[PICMG_ID_OFFSET]
|
if ( list_record[num_file]->data[PICMG_ID_OFFSET]
|
||||||
==
|
==
|
||||||
FRU_AMC_CARRIER_P2P
|
FRU_AMC_CARRIER_P2P
|
||||||
@ -989,7 +997,7 @@ ipmi_ek_display_power( int argc, char * opt, char ** filename, int * file_type )
|
|||||||
return_value = OK_STATUS;
|
return_value = OK_STATUS;
|
||||||
/*Destroy the list of record*/
|
/*Destroy the list of record*/
|
||||||
for ( index = 0; index < argc; index++ ){
|
for ( index = 0; index < argc; index++ ){
|
||||||
while ( list_head[index] != NULL ){
|
while (list_head[index]) {
|
||||||
ipmi_ek_remove_record_from_list ( list_head[index],
|
ipmi_ek_remove_record_from_list ( list_head[index],
|
||||||
&list_head[index],&list_last[index] );
|
&list_head[index],&list_last[index] );
|
||||||
}
|
}
|
||||||
@ -1081,7 +1089,7 @@ ipmi_ekanalyzer_ekeying_match( int argc, char * opt,
|
|||||||
{
|
{
|
||||||
tboolean return_value = FALSE;
|
tboolean return_value = FALSE;
|
||||||
|
|
||||||
if ( (strcmp(opt, "carrier") == 0 ) || (strcmp(opt, "power") == 0) ){
|
if (!strcmp(opt, "carrier") || !strcmp(opt, "power")) {
|
||||||
lprintf(LOG_ERR, " ekanalyzer summary [match/ unmatch/ all]"\
|
lprintf(LOG_ERR, " ekanalyzer summary [match/ unmatch/ all]"\
|
||||||
" <xx=frufile> <xx=frufile> [xx=frufile]");
|
" <xx=frufile> <xx=frufile> [xx=frufile]");
|
||||||
return_value = ERROR_STATUS;
|
return_value = ERROR_STATUS;
|
||||||
@ -1152,13 +1160,13 @@ ipmi_ekanalyzer_ekeying_match( int argc, char * opt,
|
|||||||
/*Get Carrier p2p connectivity record for physical check*/
|
/*Get Carrier p2p connectivity record for physical check*/
|
||||||
for (num_file=0; num_file < argc; num_file++){
|
for (num_file=0; num_file < argc; num_file++){
|
||||||
if (file_type[num_file] == ON_CARRIER_FRU_FILE ){
|
if (file_type[num_file] == ON_CARRIER_FRU_FILE ){
|
||||||
for ( pcarrier_p2p=list_head[num_file];
|
for (pcarrier_p2p = list_head[num_file];
|
||||||
pcarrier_p2p != NULL ;
|
pcarrier_p2p;
|
||||||
pcarrier_p2p = pcarrier_p2p->next
|
pcarrier_p2p = pcarrier_p2p->next)
|
||||||
){
|
{
|
||||||
if ( pcarrier_p2p->data[PICMG_ID_OFFSET]
|
if (FRU_AMC_CARRIER_P2P ==
|
||||||
== FRU_AMC_CARRIER_P2P
|
pcarrier_p2p->data[PICMG_ID_OFFSET])
|
||||||
){
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1185,14 +1193,14 @@ ipmi_ekanalyzer_ekeying_match( int argc, char * opt,
|
|||||||
}
|
}
|
||||||
return_value = ipmi_ek_matching_process( file_type,
|
return_value = ipmi_ek_matching_process( file_type,
|
||||||
match_pair, num_file, list_head,
|
match_pair, num_file, list_head,
|
||||||
list_last, opt, pcarrier_p2p);
|
opt, pcarrier_p2p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match_pair ++;
|
match_pair ++;
|
||||||
}
|
}
|
||||||
for( num_file=0; num_file < argc; num_file++ ){
|
for( num_file=0; num_file < argc; num_file++ ){
|
||||||
if (list_head[num_file] != NULL ){
|
if (list_head[num_file]) {
|
||||||
ipmi_ek_remove_record_from_list( list_head[num_file],
|
ipmi_ek_remove_record_from_list( list_head[num_file],
|
||||||
&list_record[num_file], &list_last[num_file]);
|
&list_record[num_file], &list_last[num_file]);
|
||||||
}
|
}
|
||||||
@ -1221,8 +1229,6 @@ ipmi_ekanalyzer_ekeying_match( int argc, char * opt,
|
|||||||
* index2: position of the second record in the list of the record
|
* index2: position of the second record in the list of the record
|
||||||
* ipmi_ek_multi_header ** list_head: pointer to the header of a
|
* ipmi_ek_multi_header ** list_head: pointer to the header of a
|
||||||
* linked list that contain FRU multi record
|
* linked list that contain FRU multi record
|
||||||
* ipmi_ek_multi_header ** list_last: pointer to the tale of a
|
|
||||||
* linked list that contain FRU multi record
|
|
||||||
* opt: string that contain display option such as "match", "unmatch", or
|
* opt: string that contain display option such as "match", "unmatch", or
|
||||||
* "all".
|
* "all".
|
||||||
* pphysical: a pointer that contain a carrier p2p connectivity record
|
* pphysical: a pointer that contain a carrier p2p connectivity record
|
||||||
@ -1238,7 +1244,7 @@ ipmi_ekanalyzer_ekeying_match( int argc, char * opt,
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static int ipmi_ek_matching_process( int * file_type, int index1, int index2,
|
static int ipmi_ek_matching_process( int * file_type, int index1, int index2,
|
||||||
struct ipmi_ek_multi_header ** list_head,
|
struct ipmi_ek_multi_header ** list_head,
|
||||||
struct ipmi_ek_multi_header ** list_last, char * opt,
|
char * opt,
|
||||||
struct ipmi_ek_multi_header * pphysical )
|
struct ipmi_ek_multi_header * pphysical )
|
||||||
{
|
{
|
||||||
int result = ERROR_STATUS;
|
int result = ERROR_STATUS;
|
||||||
@ -1254,13 +1260,13 @@ static int ipmi_ek_matching_process( int * file_type, int index1, int index2,
|
|||||||
index2 = index_temp; /*index2 indcate an AMC*/
|
index2 = index_temp; /*index2 indcate an AMC*/
|
||||||
}
|
}
|
||||||
/*Calculate record size for Carrier file*/
|
/*Calculate record size for Carrier file*/
|
||||||
for ( record=list_head[index1]; record != NULL;record = record->next ){
|
for (record = list_head[index1]; record; record = record->next ){
|
||||||
if ( record->data[PICMG_ID_OFFSET] == FRU_AMC_P2P ){
|
if ( record->data[PICMG_ID_OFFSET] == FRU_AMC_P2P ){
|
||||||
num_amc_record2++;
|
num_amc_record2++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*Calculate record size for amc file*/
|
/*Calculate record size for amc file*/
|
||||||
for ( record=list_head[index2]; record != NULL;record = record->next){
|
for (record = list_head[index2]; record; record = record->next){
|
||||||
if ( record->data[PICMG_ID_OFFSET] == FRU_AMC_P2P ){
|
if ( record->data[PICMG_ID_OFFSET] == FRU_AMC_P2P ){
|
||||||
num_amc_record1++;
|
num_amc_record1++;
|
||||||
}
|
}
|
||||||
@ -1278,17 +1284,17 @@ static int ipmi_ek_matching_process( int * file_type, int index1, int index2,
|
|||||||
amc_record2 = malloc ( num_amc_record2 * \
|
amc_record2 = malloc ( num_amc_record2 * \
|
||||||
sizeof(struct ipmi_ek_amc_p2p_connectivity_record));
|
sizeof(struct ipmi_ek_amc_p2p_connectivity_record));
|
||||||
|
|
||||||
for (record=list_head[index2]; record != NULL;record = record->next){
|
for (record = list_head[index2]; record; record = record->next) {
|
||||||
if ( record->data[PICMG_ID_OFFSET] == FRU_AMC_P2P ){
|
if ( record->data[PICMG_ID_OFFSET] == FRU_AMC_P2P ){
|
||||||
result = ipmi_ek_create_amc_p2p_record( record,
|
result = ipmi_ek_create_amc_p2p_record( record,
|
||||||
&amc_record1[index_record1] );
|
&amc_record1[index_record1] );
|
||||||
if (result != ERROR_STATUS){
|
if (result != ERROR_STATUS){
|
||||||
struct ipmi_ek_multi_header * current_record = NULL;
|
struct ipmi_ek_multi_header * current_record = NULL;
|
||||||
|
|
||||||
for ( current_record=list_head[index1];
|
for (current_record=list_head[index1];
|
||||||
current_record != NULL ;
|
current_record;
|
||||||
current_record = current_record->next
|
current_record = current_record->next)
|
||||||
){
|
{
|
||||||
if ( current_record->data[PICMG_ID_OFFSET] == FRU_AMC_P2P ){
|
if ( current_record->data[PICMG_ID_OFFSET] == FRU_AMC_P2P ){
|
||||||
result = ipmi_ek_create_amc_p2p_record( current_record,
|
result = ipmi_ek_create_amc_p2p_record( current_record,
|
||||||
&amc_record2[index_record2] );
|
&amc_record2[index_record2] );
|
||||||
@ -1358,7 +1364,7 @@ ipmi_ek_check_physical_connectivity(
|
|||||||
{
|
{
|
||||||
int return_status = OK_STATUS;
|
int return_status = OK_STATUS;
|
||||||
|
|
||||||
if ( record == NULL ){
|
if (!record){
|
||||||
printf("NO Carrier p2p connectivity !\n");
|
printf("NO Carrier p2p connectivity !\n");
|
||||||
return_status = ERROR_STATUS;
|
return_status = ERROR_STATUS;
|
||||||
}
|
}
|
||||||
@ -1423,7 +1429,7 @@ ipmi_ek_check_physical_connectivity(
|
|||||||
rsc_desc.p2p_count );
|
rsc_desc.p2p_count );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (port_desc != NULL) && (return_status != ERROR_STATUS) ){
|
if (port_desc && return_status != ERROR_STATUS) {
|
||||||
int j=0;
|
int j=0;
|
||||||
|
|
||||||
for ( j = 0; j < rsc_desc.p2p_count; j++ ){
|
for ( j = 0; j < rsc_desc.p2p_count; j++ ){
|
||||||
@ -1450,7 +1456,7 @@ ipmi_ek_check_physical_connectivity(
|
|||||||
(filetype1 ==(port_desc[j].remote_resource_id &0x0f))
|
(filetype1 ==(port_desc[j].remote_resource_id &0x0f))
|
||||||
)
|
)
|
||||||
){
|
){
|
||||||
if ( ! (strcmp(option, "unmatch") == 0) ){
|
if (strcmp(option, "unmatch")){
|
||||||
printf("%s port %d ==> %s port %d\n",
|
printf("%s port %d ==> %s port %d\n",
|
||||||
val2str(filetype2, ipmi_ekanalyzer_module_type),
|
val2str(filetype2, ipmi_ekanalyzer_module_type),
|
||||||
record1.ch_desc[index1].lane0port,
|
record1.ch_desc[index1].lane0port,
|
||||||
@ -1473,7 +1479,7 @@ ipmi_ek_check_physical_connectivity(
|
|||||||
&&
|
&&
|
||||||
(filetype2 == (port_desc[j].remote_resource_id & 0x0f))
|
(filetype2 == (port_desc[j].remote_resource_id & 0x0f))
|
||||||
){
|
){
|
||||||
if ( ! (strcmp(option, "unmatch") == 0) ){
|
if (strcmp(option, "unmatch")){
|
||||||
printf("%s port %d ==> %s port %d\n",
|
printf("%s port %d ==> %s port %d\n",
|
||||||
val2str(filetype2, ipmi_ekanalyzer_module_type),
|
val2str(filetype2, ipmi_ekanalyzer_module_type),
|
||||||
record1.ch_desc[index1].lane0port,
|
record1.ch_desc[index1].lane0port,
|
||||||
@ -1487,7 +1493,7 @@ ipmi_ek_check_physical_connectivity(
|
|||||||
&&
|
&&
|
||||||
(record2.rsc_id == (port_desc[j].remote_resource_id))
|
(record2.rsc_id == (port_desc[j].remote_resource_id))
|
||||||
){
|
){
|
||||||
if ( ! (strcmp(option, "unmatch") == 0) ){
|
if (strcmp(option, "unmatch")){
|
||||||
printf("%s port %d ==> %s %x port %d\n",
|
printf("%s port %d ==> %s %x port %d\n",
|
||||||
val2str(filetype2, ipmi_ekanalyzer_module_type),
|
val2str(filetype2, ipmi_ekanalyzer_module_type),
|
||||||
record1.ch_desc[index1].lane0port,
|
record1.ch_desc[index1].lane0port,
|
||||||
@ -1523,7 +1529,7 @@ ipmi_ek_check_physical_connectivity(
|
|||||||
}
|
}
|
||||||
return_status = ERROR_STATUS;
|
return_status = ERROR_STATUS;
|
||||||
}
|
}
|
||||||
if (port_desc != NULL){
|
if (port_desc) {
|
||||||
free(port_desc);
|
free(port_desc);
|
||||||
port_desc = NULL;
|
port_desc = NULL;
|
||||||
}
|
}
|
||||||
@ -1603,10 +1609,10 @@ ipmi_ek_compare_link( struct ipmi_ek_multi_header * physic_record,
|
|||||||
physic_record, file_type1, file_type2, opt );
|
physic_record, file_type1, file_type2, opt );
|
||||||
if ( result == OK_STATUS ){
|
if ( result == OK_STATUS ){
|
||||||
/*Display the result if option = match or all*/
|
/*Display the result if option = match or all*/
|
||||||
if ( (strcmp( opt, "match" ) == 0)
|
if (!strcmp(opt, "match")
|
||||||
|| (strcmp( opt, "all" ) == 0)
|
|| !strcmp(opt, "all")
|
||||||
|| (strcmp( opt, "default" ) == 0)
|
|| !strcmp(opt, "default"))
|
||||||
){
|
{
|
||||||
tboolean isOEMtype = FALSE;
|
tboolean isOEMtype = FALSE;
|
||||||
printf(" Matching Result\n");
|
printf(" Matching Result\n");
|
||||||
isOEMtype = ipmi_ek_display_link_descriptor( file_type1,
|
isOEMtype = ipmi_ek_display_link_descriptor( file_type1,
|
||||||
@ -1663,10 +1669,10 @@ ipmi_ek_compare_link( struct ipmi_ek_multi_header * physic_record,
|
|||||||
record1, index_ch_desc1, record2, index_ch_desc2,
|
record1, index_ch_desc1, record2, index_ch_desc2,
|
||||||
physic_record, file_type1, file_type2, opt );
|
physic_record, file_type1, file_type2, opt );
|
||||||
if ( result == OK_STATUS ){
|
if ( result == OK_STATUS ){
|
||||||
if ( (strcmp( opt, "match" ) == 0)
|
if (!strcmp( opt, "match" )
|
||||||
|| (strcmp( opt, "all" ) == 0)
|
|| !strcmp(opt, "all")
|
||||||
|| (strcmp( opt, "default" ) == 0)
|
|| !strcmp(opt, "default"))
|
||||||
){
|
{
|
||||||
tboolean isOEMtype = FALSE;
|
tboolean isOEMtype = FALSE;
|
||||||
printf(" Matching Result\n");
|
printf(" Matching Result\n");
|
||||||
isOEMtype = ipmi_ek_display_link_descriptor( file_type1,
|
isOEMtype = ipmi_ek_display_link_descriptor( file_type1,
|
||||||
@ -1694,7 +1700,7 @@ ipmi_ek_compare_link( struct ipmi_ek_multi_header * physic_record,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (strcmp(opt, "unmatch") == 0) || (strcmp(opt, "all") == 0) ){
|
if (!strcmp(opt, "unmatch") || !strcmp(opt, "all")) {
|
||||||
int isOEMtype = FALSE;
|
int isOEMtype = FALSE;
|
||||||
printf(" Unmatching result\n");
|
printf(" Unmatching result\n");
|
||||||
for (index1 = 0; index1 < record1.link_desc_count; index1++){
|
for (index1 = 0; index1 < record1.link_desc_count; index1++){
|
||||||
@ -1939,12 +1945,12 @@ ipmi_ek_compare_link_descriptor(
|
|||||||
*
|
*
|
||||||
* Function name: ipmi_ek_compare_asym
|
* Function name: ipmi_ek_compare_asym
|
||||||
*
|
*
|
||||||
* Description: This function compares 2 asymetric match of 2
|
* Description: This function compares 2 asymmetric match of 2
|
||||||
* amc link descriptors
|
* amc link descriptors
|
||||||
*
|
*
|
||||||
* Restriction: None
|
* Restriction: None
|
||||||
*
|
*
|
||||||
* Input: asym[COMPARE_CANDIDATE]: Contain 2 asymetric match for comparison
|
* Input: asym[COMPARE_CANDIDATE]: Contain 2 asymmetric match for comparison
|
||||||
*
|
*
|
||||||
* Output: None
|
* Output: None
|
||||||
*
|
*
|
||||||
@ -2055,7 +2061,7 @@ ipmi_ek_compare_number_of_enable_port(
|
|||||||
* destination (its value = "To"). ( it is set to "" if it is not
|
* destination (its value = "To"). ( it is set to "" if it is not
|
||||||
* a source nor destination
|
* a source nor destination
|
||||||
* link_desc: AMC link descriptor
|
* link_desc: AMC link descriptor
|
||||||
* asym: asymetric match
|
* asym: asymmetric match
|
||||||
*
|
*
|
||||||
* Output: None
|
* Output: None
|
||||||
*
|
*
|
||||||
@ -2208,7 +2214,7 @@ ipmi_ek_create_amc_p2p_record(struct ipmi_ek_multi_header *record,
|
|||||||
int index_oem = 0;
|
int index_oem = 0;
|
||||||
amc_record->oem_guid = malloc(amc_record->guid_count * \
|
amc_record->oem_guid = malloc(amc_record->guid_count * \
|
||||||
sizeof(struct fru_picmgext_guid));
|
sizeof(struct fru_picmgext_guid));
|
||||||
if (amc_record->oem_guid == NULL) {
|
if (!amc_record->oem_guid) {
|
||||||
return ERROR_STATUS;
|
return ERROR_STATUS;
|
||||||
}
|
}
|
||||||
for (index_oem = 0; index_oem < amc_record->guid_count;
|
for (index_oem = 0; index_oem < amc_record->guid_count;
|
||||||
@ -2238,7 +2244,7 @@ ipmi_ek_create_amc_p2p_record(struct ipmi_ek_multi_header *record,
|
|||||||
int ch_index = 0;
|
int ch_index = 0;
|
||||||
amc_record->ch_desc = malloc((amc_record->ch_count) * \
|
amc_record->ch_desc = malloc((amc_record->ch_count) * \
|
||||||
sizeof(struct fru_picmgext_amc_channel_desc_record));
|
sizeof(struct fru_picmgext_amc_channel_desc_record));
|
||||||
if (amc_record->ch_desc == NULL) {
|
if (!amc_record->ch_desc) {
|
||||||
return ERROR_STATUS;
|
return ERROR_STATUS;
|
||||||
}
|
}
|
||||||
for (ch_index = 0; ch_index < amc_record->ch_count;
|
for (ch_index = 0; ch_index < amc_record->ch_count;
|
||||||
@ -2264,7 +2270,7 @@ ipmi_ek_create_amc_p2p_record(struct ipmi_ek_multi_header *record,
|
|||||||
int i=0;
|
int i=0;
|
||||||
amc_record->link_desc = malloc(amc_record->link_desc_count * \
|
amc_record->link_desc = malloc(amc_record->link_desc_count * \
|
||||||
sizeof(struct fru_picmgext_amc_link_desc_record));
|
sizeof(struct fru_picmgext_amc_link_desc_record));
|
||||||
if (amc_record->link_desc == NULL) {
|
if (!amc_record->link_desc) {
|
||||||
return ERROR_STATUS;
|
return ERROR_STATUS;
|
||||||
}
|
}
|
||||||
for (i = 0; i< amc_record->link_desc_count; i++) {
|
for (i = 0; i< amc_record->link_desc_count; i++) {
|
||||||
@ -2347,7 +2353,7 @@ ipmi_ek_get_resource_descriptor(int port_count, int index,
|
|||||||
*
|
*
|
||||||
* Global: None
|
* Global: None
|
||||||
*
|
*
|
||||||
* Return: Return OK_STATUS on sucess, ERROR_STATUS on error
|
* Return: Return OK_STATUS on success, ERROR_STATUS on error
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static int
|
static int
|
||||||
@ -2358,7 +2364,7 @@ ipmi_ek_display_fru_header(char *filename)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
input_file = fopen(filename, "r");
|
input_file = fopen(filename, "r");
|
||||||
if (input_file == NULL) {
|
if (!input_file) {
|
||||||
lprintf(LOG_ERR, "File '%s' not found.", filename);
|
lprintf(LOG_ERR, "File '%s' not found.", filename);
|
||||||
return (ERROR_STATUS);
|
return (ERROR_STATUS);
|
||||||
}
|
}
|
||||||
@ -2413,7 +2419,7 @@ ipmi_ek_display_fru_header_detail(char *filename)
|
|||||||
FILE *input_file;
|
FILE *input_file;
|
||||||
size_t file_offset = 0;
|
size_t file_offset = 0;
|
||||||
struct fru_header header;
|
struct fru_header header;
|
||||||
time_t tval;
|
time_t ts;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
unsigned char data = 0;
|
unsigned char data = 0;
|
||||||
unsigned char lan_code = 0;
|
unsigned char lan_code = 0;
|
||||||
@ -2421,7 +2427,7 @@ ipmi_ek_display_fru_header_detail(char *filename)
|
|||||||
unsigned int board_length = 0;
|
unsigned int board_length = 0;
|
||||||
|
|
||||||
input_file = fopen(filename, "r");
|
input_file = fopen(filename, "r");
|
||||||
if (input_file == NULL) {
|
if (!input_file) {
|
||||||
lprintf(LOG_ERR, "File '%s' not found.", filename);
|
lprintf(LOG_ERR, "File '%s' not found.", filename);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -2439,6 +2445,8 @@ ipmi_ek_display_fru_header_detail(char *filename)
|
|||||||
if (header.offset.internal != 0) {
|
if (header.offset.internal != 0) {
|
||||||
unsigned char format_version;
|
unsigned char format_version;
|
||||||
unsigned long len = 0;
|
unsigned long len = 0;
|
||||||
|
uint8_t *area_offset;
|
||||||
|
uint8_t next_offset = UINT8_MAX;
|
||||||
|
|
||||||
printf("%s\n", EQUAL_LINE_LIMITER);
|
printf("%s\n", EQUAL_LINE_LIMITER);
|
||||||
printf("FRU Internal Use Info\n");
|
printf("FRU Internal Use Info\n");
|
||||||
@ -2452,12 +2460,46 @@ ipmi_ek_display_fru_header_detail(char *filename)
|
|||||||
}
|
}
|
||||||
printf("Format Version: %d\n", (format_version & 0x0f));
|
printf("Format Version: %d\n", (format_version & 0x0f));
|
||||||
|
|
||||||
if (header.offset.chassis > 0) {
|
/* Internal use area doesn't contain the size byte.
|
||||||
len = (header.offset.chassis * FACTOR_OFFSET)
|
* We need to calculate its size by finding the area
|
||||||
- (header.offset.internal * FACTOR_OFFSET);
|
* that is next. Areas may not follow the same order
|
||||||
} else {
|
* as their offsets listed in the header, so we need
|
||||||
len = (header.offset.board * FACTOR_OFFSET)
|
* to find the area that is physically next to the
|
||||||
- (header.offset.internal * FACTOR_OFFSET);
|
* internal use area.
|
||||||
|
*/
|
||||||
|
for (area_offset = &header.offset.internal + 1;
|
||||||
|
area_offset <= &header.offset.multi;
|
||||||
|
++area_offset)
|
||||||
|
{
|
||||||
|
/* If the area is closer to us than the previously
|
||||||
|
* checked one, make it our best candidate
|
||||||
|
*/
|
||||||
|
if (*area_offset < next_offset
|
||||||
|
&& *area_offset > header.offset.internal)
|
||||||
|
{
|
||||||
|
next_offset = *area_offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If there was at least one area after internal use one,
|
||||||
|
* then we must have found it and can use it to calculate
|
||||||
|
* length. Otherwise, everything till the end of file is
|
||||||
|
* internal use area expect for the last (checksum) byte.
|
||||||
|
*/
|
||||||
|
if (next_offset < UINT8_MAX) {
|
||||||
|
len = (next_offset - header.offset.internal) * FACTOR_OFFSET;
|
||||||
|
--len; /* First byte of internal use area is version and we've
|
||||||
|
already read it */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
struct stat fs;
|
||||||
|
long curpos = ftell(input_file);
|
||||||
|
if (curpos < 0 || 0 > fstat(fileno(input_file), &fs)) {
|
||||||
|
lprintf(LOG_ERR, "Failed to determine FRU file size");
|
||||||
|
fclose(input_file);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
len = fs.st_size - curpos - 1; /* Last byte is checksum */
|
||||||
}
|
}
|
||||||
printf("Length: %ld\n", len);
|
printf("Length: %ld\n", len);
|
||||||
printf("Data dump:\n");
|
printf("Data dump:\n");
|
||||||
@ -2541,33 +2583,40 @@ ipmi_ek_display_fru_header_detail(char *filename)
|
|||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
tval = ((mfg_date[2] << 16) + (mfg_date[1] << 8)
|
|
||||||
+ (mfg_date[0]));
|
ts = ipmi_fru2time_t(mfg_date);
|
||||||
tval = tval * 60;
|
printf("Board Mfg Date: %ld, %s\n",
|
||||||
tval = tval + secs_from_1970_1996;
|
(IPMI_TIME_UNSPECIFIED == ts)
|
||||||
printf("Board Mfg Date: %ld, %s", tval,
|
? FRU_BOARD_DATE_UNSPEC
|
||||||
asctime(localtime(&tval)));
|
: ts,
|
||||||
|
ipmi_timestamp_numeric(ts));
|
||||||
board_length -= SIZE_MFG_DATE;
|
board_length -= SIZE_MFG_DATE;
|
||||||
|
|
||||||
/* Board Mfg */
|
/* Board Mfg */
|
||||||
file_offset = ipmi_ek_display_board_info_area(
|
file_offset = ipmi_ek_display_board_info_area(
|
||||||
input_file, "Board Manufacture Data", &board_length);
|
input_file, "Board Manufacture Data", &board_length);
|
||||||
ret = fseek(input_file, file_offset, SEEK_SET);
|
ret = fseek(input_file, file_offset, SEEK_SET);
|
||||||
|
|
||||||
/* Board Product */
|
/* Board Product */
|
||||||
file_offset = ipmi_ek_display_board_info_area(
|
file_offset = ipmi_ek_display_board_info_area(
|
||||||
input_file, "Board Product Name", &board_length);
|
input_file, "Board Product Name", &board_length);
|
||||||
ret = fseek(input_file, file_offset, SEEK_SET);
|
ret = fseek(input_file, file_offset, SEEK_SET);
|
||||||
|
|
||||||
/* Board Serial */
|
/* Board Serial */
|
||||||
file_offset = ipmi_ek_display_board_info_area(
|
file_offset = ipmi_ek_display_board_info_area(
|
||||||
input_file, "Board Serial Number", &board_length);
|
input_file, "Board Serial Number", &board_length);
|
||||||
ret = fseek(input_file, file_offset, SEEK_SET);
|
ret = fseek(input_file, file_offset, SEEK_SET);
|
||||||
|
|
||||||
/* Board Part */
|
/* Board Part */
|
||||||
file_offset = ipmi_ek_display_board_info_area(
|
file_offset = ipmi_ek_display_board_info_area(
|
||||||
input_file, "Board Part Number", &board_length);
|
input_file, "Board Part Number", &board_length);
|
||||||
ret = fseek(input_file, file_offset, SEEK_SET);
|
ret = fseek(input_file, file_offset, SEEK_SET);
|
||||||
|
|
||||||
/* FRU file ID */
|
/* FRU file ID */
|
||||||
file_offset = ipmi_ek_display_board_info_area(
|
file_offset = ipmi_ek_display_board_info_area(
|
||||||
input_file, "FRU File ID", &board_length);
|
input_file, "FRU File ID", &board_length);
|
||||||
ret = fseek(input_file, file_offset, SEEK_SET);
|
ret = fseek(input_file, file_offset, SEEK_SET);
|
||||||
|
|
||||||
/* Additional Custom Mfg. */
|
/* Additional Custom Mfg. */
|
||||||
file_offset = ipmi_ek_display_board_info_area(
|
file_offset = ipmi_ek_display_board_info_area(
|
||||||
input_file, "Custom", &board_length);
|
input_file, "Custom", &board_length);
|
||||||
@ -2614,7 +2663,7 @@ ipmi_ek_display_chassis_info_area(FILE *input_file, long offset)
|
|||||||
unsigned char ch_type = 0;
|
unsigned char ch_type = 0;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
|
||||||
if (input_file == NULL) {
|
if (!input_file) {
|
||||||
lprintf(LOG_ERR, "No file stream to read.");
|
lprintf(LOG_ERR, "No file stream to read.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -2696,12 +2745,18 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
unsigned char len = 0;
|
unsigned char len = 0;
|
||||||
unsigned int size_board = 0;
|
unsigned int size_board = 0;
|
||||||
if (input_file == NULL || board_type == NULL
|
int custom_fields = 0;
|
||||||
|| board_length == NULL) {
|
if (!input_file || !board_type || !board_length) {
|
||||||
return (size_t)(-1);
|
return (size_t)(-1);
|
||||||
}
|
}
|
||||||
file_offset = ftell(input_file);
|
file_offset = ftell(input_file);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: This whole file's code is extremely dirty and wicked.
|
||||||
|
* Must eventually switch to using ipmi_fru.c code or some
|
||||||
|
* specialized FRU library.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Board length*/
|
/* Board length*/
|
||||||
ret = fread(&len, 1, 1, input_file);
|
ret = fread(&len, 1, 1, input_file);
|
||||||
if ((ret != 1) || ferror(input_file)) {
|
if ((ret != 1) || ferror(input_file)) {
|
||||||
@ -2710,21 +2765,22 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|||||||
}
|
}
|
||||||
(*board_length)--;
|
(*board_length)--;
|
||||||
|
|
||||||
/* Bit 5:0 of Board Mfg type represent legnth */
|
/* Bit 5:0 of Board Mfg type represent length */
|
||||||
size_board = (len & 0x3f);
|
size_board = (len & 0x3f);
|
||||||
if (size_board == 0) {
|
if (size_board == 0) {
|
||||||
printf("%s: None\n", board_type);
|
printf("%s: None\n", board_type);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (strncmp(board_type, "Custom", 6 ) != 0) {
|
if (strcmp(board_type, "Custom")) {
|
||||||
unsigned char *data;
|
unsigned char *data, *str;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
data = malloc(size_board);
|
data = malloc(size_board + 1); /* Make room for type/length field */
|
||||||
if (data == NULL) {
|
if (!data) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
return (size_t)(-1);
|
return (size_t)(-1);
|
||||||
}
|
}
|
||||||
ret = fread(data, size_board, 1, input_file);
|
data[0] = len; /* Save the type/length byte in 'data' */
|
||||||
|
ret = fread(data + 1, size_board, 1, input_file);
|
||||||
if ((ret != 1) || ferror(input_file)) {
|
if ((ret != 1) || ferror(input_file)) {
|
||||||
lprintf(LOG_ERR, "Invalid board type size!");
|
lprintf(LOG_ERR, "Invalid board type size!");
|
||||||
free(data);
|
free(data);
|
||||||
@ -2733,17 +2789,11 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|||||||
}
|
}
|
||||||
printf("%s type: 0x%02x\n", board_type, len);
|
printf("%s type: 0x%02x\n", board_type, len);
|
||||||
printf("%s: ", board_type);
|
printf("%s: ", board_type);
|
||||||
for (i = 0; i < size_board; i++) {
|
i = 0;
|
||||||
if ((len & TYPE_CODE) == TYPE_CODE) {
|
str = (unsigned char *)get_fru_area_str(data, &i);
|
||||||
printf("%c", data[i]);
|
printf("%s\n", str);
|
||||||
} else {
|
free(str);
|
||||||
/* other than language code (binary, BCD,
|
str = NULL;
|
||||||
* ASCII 6 bit...) is not supported
|
|
||||||
*/
|
|
||||||
printf("%02x", data[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
free(data);
|
free(data);
|
||||||
data = NULL;
|
data = NULL;
|
||||||
(*board_length) -= size_board;
|
(*board_length) -= size_board;
|
||||||
@ -2756,7 +2806,12 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|||||||
/* take the rest of data in the area minus 1 byte of
|
/* take the rest of data in the area minus 1 byte of
|
||||||
* checksum
|
* checksum
|
||||||
*/
|
*/
|
||||||
printf("Additional Custom Mfg. length: 0x%02x\n", len);
|
if (custom_fields) {
|
||||||
|
printf("End of Custom Mfg. fields (0x%02x)\n", len);
|
||||||
|
} else {
|
||||||
|
printf("No Additional Custom Mfg. fields (0x%02x)\n", len);
|
||||||
|
}
|
||||||
|
|
||||||
padding = (*board_length) - 1;
|
padding = (*board_length) - 1;
|
||||||
if ((padding > 0) && (!feof(input_file))) {
|
if ((padding > 0) && (!feof(input_file))) {
|
||||||
printf("Unused space: %d (bytes)\n", padding);
|
printf("Unused space: %d (bytes)\n", padding);
|
||||||
@ -2770,36 +2825,47 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|||||||
printf("Checksum: 0x%02x\n", checksum);
|
printf("Checksum: 0x%02x\n", checksum);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
custom_fields++;
|
||||||
printf("Additional Custom Mfg. length: 0x%02x\n", len);
|
printf("Additional Custom Mfg. length: 0x%02x\n", len);
|
||||||
if ((size_board > 0) && (size_board < (*board_length))) {
|
if ((size_board > 0) && (size_board < (*board_length))) {
|
||||||
unsigned char * additional_data = NULL;
|
unsigned char *additional_data, *str;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
additional_data = malloc(size_board);
|
additional_data = malloc(size_board + 1); /* Make room for type/length field */
|
||||||
if (additional_data == NULL) {
|
if (!additional_data) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
return (size_t)(-1);
|
return (size_t)(-1);
|
||||||
}
|
}
|
||||||
ret = fread(additional_data, size_board, 1, input_file);
|
additional_data[0] = len;
|
||||||
|
ret = fread(additional_data + 1, size_board, 1, input_file);
|
||||||
if ((ret != 1) || ferror(input_file)) {
|
if ((ret != 1) || ferror(input_file)) {
|
||||||
lprintf(LOG_ERR, "Invalid Additional Data!");
|
lprintf(LOG_ERR, "Invalid Additional Data!");
|
||||||
if (additional_data != NULL) {
|
if (additional_data) {
|
||||||
free(additional_data);
|
free(additional_data);
|
||||||
additional_data = NULL;
|
additional_data = NULL;
|
||||||
}
|
}
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
printf("Additional Custom Mfg. Data: %02x",
|
printf("Additional Custom Mfg. Data: ");
|
||||||
additional_data[0]);
|
i = 0;
|
||||||
for (i = 1; i < size_board; i++) {
|
str = (unsigned char *)get_fru_area_str(additional_data, &i);
|
||||||
printf("-%02x", additional_data[i]);
|
printf("%s\n", str);
|
||||||
}
|
free(str);
|
||||||
printf("\n");
|
str = NULL;
|
||||||
free(additional_data);
|
free(additional_data);
|
||||||
additional_data = NULL;
|
additional_data = NULL;
|
||||||
|
|
||||||
(*board_length) -= size_board;
|
(*board_length) -= size_board;
|
||||||
|
ret = fread(&len, 1, 1, input_file);
|
||||||
|
if ((ret != 1) || ferror(input_file)) {
|
||||||
|
lprintf(LOG_ERR, "Invalid Length!");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
(*board_length)--;
|
||||||
|
size_board = (len & 0x3f);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("No Additional Custom Mfg. %d\n", *board_length);
|
printf("ERROR: File has insufficient data (%d bytes) for the "
|
||||||
|
"Additional Custom Mfg. field\n", *board_length);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2838,7 +2904,7 @@ ipmi_ek_display_product_info_area(FILE *input_file, long offset)
|
|||||||
unsigned char data = 0;
|
unsigned char data = 0;
|
||||||
unsigned int len = 0;
|
unsigned int len = 0;
|
||||||
|
|
||||||
if (input_file == NULL) {
|
if (!input_file) {
|
||||||
lprintf(LOG_ERR, "No file stream to read.");
|
lprintf(LOG_ERR, "No file stream to read.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -2924,7 +2990,6 @@ ipmi_ek_display_product_info_area(FILE *input_file, long offset)
|
|||||||
*
|
*
|
||||||
* Input: record: a pointer to current record
|
* Input: record: a pointer to current record
|
||||||
* list_head: a pointer to header of the list
|
* list_head: a pointer to header of the list
|
||||||
* list_last: a pointer to tale of the list
|
|
||||||
*
|
*
|
||||||
* Output: None
|
* Output: None
|
||||||
*
|
*
|
||||||
@ -2935,17 +3000,16 @@ ipmi_ek_display_product_info_area(FILE *input_file, long offset)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static void
|
static void
|
||||||
ipmi_ek_display_record(struct ipmi_ek_multi_header *record,
|
ipmi_ek_display_record(struct ipmi_ek_multi_header *record,
|
||||||
struct ipmi_ek_multi_header *list_head,
|
struct ipmi_ek_multi_header *list_head)
|
||||||
struct ipmi_ek_multi_header *list_last)
|
|
||||||
{
|
{
|
||||||
if (list_head == NULL) {
|
if (!list_head) {
|
||||||
printf("***empty list***\n");
|
printf("***empty list***\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("%s\n", EQUAL_LINE_LIMITER);
|
printf("%s\n", EQUAL_LINE_LIMITER);
|
||||||
printf("FRU Multi Info area\n");
|
printf("FRU Multi Info area\n");
|
||||||
printf("%s\n", EQUAL_LINE_LIMITER);
|
printf("%s\n", EQUAL_LINE_LIMITER);
|
||||||
for (record = list_head; record != NULL; record = record->next) {
|
for (record = list_head; record; record = record->next) {
|
||||||
printf("Record Type ID: 0x%02x\n", record->header.type);
|
printf("Record Type ID: 0x%02x\n", record->header.type);
|
||||||
printf("Record Format version: 0x%02x\n",
|
printf("Record Format version: 0x%02x\n",
|
||||||
record->header.format);
|
record->header.format);
|
||||||
@ -3398,7 +3462,7 @@ ipmi_ek_display_board_p2p_record(struct ipmi_ek_multi_header *record)
|
|||||||
printf("ShMC Cross-connect (two-pair)\n");
|
printf("ShMC Cross-connect (two-pair)\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unknwon\n");
|
printf("Unknown\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (d->type == FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET) {
|
} else if (d->type == FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET) {
|
||||||
@ -3413,17 +3477,17 @@ ipmi_ek_display_board_p2p_record(struct ipmi_ek_multi_header *record)
|
|||||||
printf("FC-PI\n");
|
printf("FC-PI\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unknwon\n");
|
printf("Unknown\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (d->type == FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND) {
|
} else if (d->type == FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND) {
|
||||||
printf("Unknwon\n");
|
printf("Unknown\n");
|
||||||
} else if (d->type == FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR) {
|
} else if (d->type == FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR) {
|
||||||
printf("Unknwon\n");
|
printf("Unknown\n");
|
||||||
} else if (d->type == FRU_PICMGEXT_LINK_TYPE_PCIE) {
|
} else if (d->type == FRU_PICMGEXT_LINK_TYPE_PCIE) {
|
||||||
printf("Unknwon\n");
|
printf("Unknown\n");
|
||||||
} else {
|
} else {
|
||||||
printf("Unknwon\n");
|
printf("Unknown\n");
|
||||||
}
|
}
|
||||||
printf("\tLink Type:\t\t0x%02x - ", d->type);
|
printf("\tLink Type:\t\t0x%02x - ", d->type);
|
||||||
if (d->type == 0 || d->type == 0xff) {
|
if (d->type == 0 || d->type == 0xff) {
|
||||||
@ -4007,7 +4071,7 @@ ipmi_ek_display_clock_config_record(struct ipmi_ek_multi_header *record)
|
|||||||
*
|
*
|
||||||
* Restriction: None
|
* Restriction: None
|
||||||
*
|
*
|
||||||
* Input/Ouput: filename1: name of the file that contain FRU binary data
|
* Input/Output: filename1: name of the file that contain FRU binary data
|
||||||
* record: a pointer to current record
|
* record: a pointer to current record
|
||||||
* list_head: a pointer to header of the list
|
* list_head: a pointer to header of the list
|
||||||
* list_last: a pointer to tale of the list
|
* list_last: a pointer to tale of the list
|
||||||
@ -4031,7 +4095,7 @@ ipmi_ekanalyzer_fru_file2structure(char *filename,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
input_file = fopen(filename, "r");
|
input_file = fopen(filename, "r");
|
||||||
if (input_file == NULL) {
|
if (!input_file) {
|
||||||
lprintf(LOG_ERR, "File: '%s' is not found", filename);
|
lprintf(LOG_ERR, "File: '%s' is not found", filename);
|
||||||
return ERROR_STATUS;
|
return ERROR_STATUS;
|
||||||
}
|
}
|
||||||
@ -4058,7 +4122,7 @@ ipmi_ekanalyzer_fru_file2structure(char *filename,
|
|||||||
fseek(input_file, multi_offset, SEEK_SET);
|
fseek(input_file, multi_offset, SEEK_SET);
|
||||||
while (!feof(input_file)) {
|
while (!feof(input_file)) {
|
||||||
*list_record = malloc(sizeof(struct ipmi_ek_multi_header));
|
*list_record = malloc(sizeof(struct ipmi_ek_multi_header));
|
||||||
if (*list_record == NULL) {
|
if (!(*list_record)) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
return ERROR_STATUS;
|
return ERROR_STATUS;
|
||||||
}
|
}
|
||||||
@ -4076,7 +4140,7 @@ ipmi_ekanalyzer_fru_file2structure(char *filename,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
(*list_record)->data = malloc((*list_record)->header.len);
|
(*list_record)->data = malloc((*list_record)->header.len);
|
||||||
if ((*list_record)->data == NULL) {
|
if (!(*list_record)->data) {
|
||||||
lprintf(LOG_ERR, "Failed to allocation memory size %d\n",
|
lprintf(LOG_ERR, "Failed to allocation memory size %d\n",
|
||||||
(*list_record)->header.len);
|
(*list_record)->header.len);
|
||||||
record_count++;
|
record_count++;
|
||||||
@ -4121,7 +4185,7 @@ ipmi_ekanalyzer_fru_file2structure(char *filename,
|
|||||||
*
|
*
|
||||||
* Function name: ipmi_ek_add_record2list
|
* Function name: ipmi_ek_add_record2list
|
||||||
*
|
*
|
||||||
* Description: this function adds a sigle FRU multi record to a linked list of
|
* Description: this function adds a single FRU multi record to a linked list of
|
||||||
* FRU multi record.
|
* FRU multi record.
|
||||||
*
|
*
|
||||||
* Restriction: None
|
* Restriction: None
|
||||||
@ -4140,18 +4204,18 @@ ipmi_ek_add_record2list(struct ipmi_ek_multi_header **record,
|
|||||||
struct ipmi_ek_multi_header **list_head,
|
struct ipmi_ek_multi_header **list_head,
|
||||||
struct ipmi_ek_multi_header **list_last)
|
struct ipmi_ek_multi_header **list_last)
|
||||||
{
|
{
|
||||||
if (*list_head == NULL) {
|
if (*list_head) {
|
||||||
*list_head = *record;
|
|
||||||
(*record)->prev = NULL;
|
|
||||||
if (verbose > 2) {
|
|
||||||
printf("Adding first record to list\n");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
(*list_last)->next = *record;
|
(*list_last)->next = *record;
|
||||||
(*record)->prev = *list_last;
|
(*record)->prev = *list_last;
|
||||||
if (verbose > 2) {
|
if (verbose > 2) {
|
||||||
printf("Add 1 record to list\n");
|
printf("Add 1 record to list\n");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
*list_head = *record;
|
||||||
|
(*record)->prev = NULL;
|
||||||
|
if (verbose > 2) {
|
||||||
|
printf("Adding first record to list\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*list_last = *record;
|
*list_last = *record;
|
||||||
(*record)->next = NULL;
|
(*record)->next = NULL;
|
||||||
@ -4161,7 +4225,7 @@ ipmi_ek_add_record2list(struct ipmi_ek_multi_header **record,
|
|||||||
*
|
*
|
||||||
* Function name: ipmi_ek_remove_record_from_list
|
* Function name: ipmi_ek_remove_record_from_list
|
||||||
*
|
*
|
||||||
* Description: this function removes a sigle FRU multi record from a linked
|
* Description: this function removes a single FRU multi record from a linked
|
||||||
* list of FRU multi record.
|
* list of FRU multi record.
|
||||||
*
|
*
|
||||||
* Restriction: None
|
* Restriction: None
|
||||||
@ -4180,12 +4244,12 @@ ipmi_ek_remove_record_from_list(struct ipmi_ek_multi_header *record,
|
|||||||
struct ipmi_ek_multi_header **list_head,
|
struct ipmi_ek_multi_header **list_head,
|
||||||
struct ipmi_ek_multi_header **list_last)
|
struct ipmi_ek_multi_header **list_last)
|
||||||
{
|
{
|
||||||
if (record->prev == NULL) {
|
if (!record->prev) {
|
||||||
*list_head = record->next;
|
*list_head = record->next;
|
||||||
} else {
|
} else {
|
||||||
record->prev->next = record->next;
|
record->prev->next = record->next;
|
||||||
}
|
}
|
||||||
if (record->next == NULL) {
|
if (!record->next) {
|
||||||
(*list_last) = record->prev;
|
(*list_last) = record->prev;
|
||||||
} else {
|
} else {
|
||||||
record->next->prev = record->prev;
|
record->next->prev = record->prev;
|
||||||
|
186
lib/ipmi_event.c
186
lib/ipmi_event.c
@ -29,7 +29,6 @@
|
|||||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
* 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.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
#define _BSD_SOURCE
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -53,6 +52,14 @@
|
|||||||
#include <ipmitool/ipmi_event.h>
|
#include <ipmitool/ipmi_event.h>
|
||||||
#include <ipmitool/ipmi_sdr.h>
|
#include <ipmitool/ipmi_sdr.h>
|
||||||
|
|
||||||
|
static
|
||||||
|
inline
|
||||||
|
bool
|
||||||
|
is_system(const struct channel_info_t *chinfo)
|
||||||
|
{
|
||||||
|
return (IPMI_CHANNEL_MEDIUM_SYSTEM == chinfo->medium
|
||||||
|
|| CH_SYSTEM == chinfo->channel);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ipmi_event_msg_print(struct ipmi_intf * intf, struct platform_event_msg * pmsg)
|
ipmi_event_msg_print(struct ipmi_intf * intf, struct platform_event_msg * pmsg)
|
||||||
@ -62,7 +69,8 @@ ipmi_event_msg_print(struct ipmi_intf * intf, struct platform_event_msg * pmsg)
|
|||||||
memset(&sel_event, 0, sizeof(struct sel_event_record));
|
memset(&sel_event, 0, sizeof(struct sel_event_record));
|
||||||
|
|
||||||
sel_event.record_id = 0;
|
sel_event.record_id = 0;
|
||||||
sel_event.sel_type.standard_type.gen_id = 2;
|
htoipmi16(EVENT_GENERATOR(SMS, 0),
|
||||||
|
(void *)&sel_event.sel_type.standard_type.gen_id);
|
||||||
|
|
||||||
sel_event.sel_type.standard_type.evm_rev = pmsg->evm_rev;
|
sel_event.sel_type.standard_type.evm_rev = pmsg->evm_rev;
|
||||||
sel_event.sel_type.standard_type.sensor_type = pmsg->sensor_type;
|
sel_event.sel_type.standard_type.sensor_type = pmsg->sensor_type;
|
||||||
@ -84,36 +92,42 @@ ipmi_send_platform_event(struct ipmi_intf * intf, struct platform_event_msg * em
|
|||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
uint8_t rqdata[8];
|
uint8_t rqdata[PLATFORM_EVENT_DATA_LEN_MAX];
|
||||||
uint8_t chmed;
|
uint8_t *rqdata_start = rqdata;
|
||||||
|
struct channel_info_t chinfo;
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
memset(rqdata, 0, 8);
|
memset(rqdata, 0, sizeof(rqdata));
|
||||||
|
|
||||||
req.msg.netfn = IPMI_NETFN_SE;
|
req.msg.netfn = IPMI_NETFN_SE;
|
||||||
req.msg.cmd = 0x02;
|
req.msg.cmd = IPMI_CMD_PLATFORM_EVENT;
|
||||||
req.msg.data = rqdata;
|
req.msg.data = rqdata;
|
||||||
|
req.msg.data_len = PLATFORM_EVENT_DATA_LEN_NON_SI;
|
||||||
|
|
||||||
chmed = ipmi_current_channel_medium(intf);
|
ipmi_current_channel_info(intf, &chinfo);
|
||||||
if (chmed == IPMI_CHANNEL_MEDIUM_SYSTEM) {
|
if (chinfo.channel == CH_UNKNOWN) {
|
||||||
/* system interface, need extra generator ID */
|
lprintf(LOG_ERR, "Failed to send the platform event "
|
||||||
req.msg.data_len = 8;
|
"via an unknown channel");
|
||||||
rqdata[0] = 0x41; // As per Fig. 29-2 and Table 5-4
|
return -3;
|
||||||
memcpy(rqdata+1, emsg, sizeof(struct platform_event_msg));
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
req.msg.data_len = 7;
|
if (is_system(&chinfo)) {
|
||||||
memcpy(rqdata, emsg, sizeof(struct platform_event_msg));
|
/* system interface, need extra generator ID, see Fig. 29-2 */
|
||||||
|
req.msg.data_len = PLATFORM_EVENT_DATA_LEN_SI;
|
||||||
|
rqdata[0] = EVENT_GENERATOR(SMS, 0);
|
||||||
|
rqdata_start++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(rqdata_start, emsg, sizeof(struct platform_event_msg));
|
||||||
|
|
||||||
ipmi_event_msg_print(intf, emsg);
|
ipmi_event_msg_print(intf, emsg);
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Platform Event Message command failed");
|
lprintf(LOG_ERR, "Platform Event Message command failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (rsp->ccode > 0) {
|
else if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Platform Event Message command failed: %s",
|
lprintf(LOG_ERR, "Platform Event Message command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -211,14 +225,14 @@ ipmi_event_find_offset(struct ipmi_intf *intf, uint8_t sensor_type, uint8_t even
|
|||||||
{
|
{
|
||||||
const struct ipmi_event_sensor_types *evt;
|
const struct ipmi_event_sensor_types *evt;
|
||||||
|
|
||||||
if (desc == NULL || sensor_type == 0 || event_type == 0) {
|
if (!desc || sensor_type == 0 || event_type == 0) {
|
||||||
return 0x00;
|
return 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (evt = ipmi_get_first_event_sensor_type(intf, sensor_type, event_type);
|
for (evt = ipmi_get_first_event_sensor_type(intf, sensor_type, event_type);
|
||||||
evt != NULL; evt = ipmi_get_next_event_sensor_type(evt)) {
|
evt; evt = ipmi_get_next_event_sensor_type(evt)) {
|
||||||
if (evt->desc != NULL &&
|
if (evt->desc &&
|
||||||
strncasecmp(desc, evt->desc, __maxlen(desc, evt->desc)) == 0) {
|
strcasecmp(desc, evt->desc) == 0) {
|
||||||
return evt->offset;
|
return evt->offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,7 +260,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
int off;
|
int off;
|
||||||
uint8_t target, lun, channel;
|
uint8_t target, lun, channel;
|
||||||
|
|
||||||
if (id == NULL) {
|
if (!id) {
|
||||||
lprintf(LOG_ERR, "No sensor ID supplied");
|
lprintf(LOG_ERR, "No sensor ID supplied");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -254,11 +268,11 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
memset(&emsg, 0, sizeof(struct platform_event_msg));
|
memset(&emsg, 0, sizeof(struct platform_event_msg));
|
||||||
emsg.evm_rev = 0x04;
|
emsg.evm_rev = 0x04;
|
||||||
|
|
||||||
if (evdir == NULL)
|
if (!evdir)
|
||||||
emsg.event_dir = EVENT_DIR_ASSERT;
|
emsg.event_dir = EVENT_DIR_ASSERT;
|
||||||
else if (strncasecmp(evdir, "assert", 6) == 0)
|
else if (!strcmp(evdir, "assert"))
|
||||||
emsg.event_dir = EVENT_DIR_ASSERT;
|
emsg.event_dir = EVENT_DIR_ASSERT;
|
||||||
else if (strncasecmp(evdir, "deassert", 8) == 0)
|
else if (!strcmp(evdir, "deassert"))
|
||||||
emsg.event_dir = EVENT_DIR_DEASSERT;
|
emsg.event_dir = EVENT_DIR_DEASSERT;
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR, "Invalid event direction %s. Must be 'assert' or 'deassert'", evdir);
|
lprintf(LOG_ERR, "Invalid event direction %s. Must be 'assert' or 'deassert'", evdir);
|
||||||
@ -267,7 +281,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
|
|
||||||
printf("Finding sensor %s... ", id);
|
printf("Finding sensor %s... ", id);
|
||||||
sdr = ipmi_sdr_find_sdr_byid(intf, id);
|
sdr = ipmi_sdr_find_sdr_byid(intf, id);
|
||||||
if (sdr == NULL) {
|
if (!sdr) {
|
||||||
printf("not found!\n");
|
printf("not found!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -304,7 +318,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
int hilo = 0;
|
int hilo = 0;
|
||||||
off = 1;
|
off = 1;
|
||||||
|
|
||||||
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
if (!state || !strcmp(state, "list")) {
|
||||||
printf("Sensor States:\n");
|
printf("Sensor States:\n");
|
||||||
printf(" lnr : Lower Non-Recoverable \n");
|
printf(" lnr : Lower Non-Recoverable \n");
|
||||||
printf(" lcr : Lower Critical\n");
|
printf(" lcr : Lower Critical\n");
|
||||||
@ -315,12 +329,12 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != strncasecmp(state, "lnr", 3) &&
|
if (0 != strcmp(state, "lnr") &&
|
||||||
0 != strncasecmp(state, "lcr", 3) &&
|
0 != strcmp(state, "lcr") &&
|
||||||
0 != strncasecmp(state, "lnc", 3) &&
|
0 != strcmp(state, "lnc") &&
|
||||||
0 != strncasecmp(state, "unc", 3) &&
|
0 != strcmp(state, "unc") &&
|
||||||
0 != strncasecmp(state, "ucr", 3) &&
|
0 != strcmp(state, "ucr") &&
|
||||||
0 != strncasecmp(state, "unr", 3))
|
0 != strcmp(state, "unr"))
|
||||||
{
|
{
|
||||||
lprintf(LOG_ERR, "Invalid threshold identifier %s", state);
|
lprintf(LOG_ERR, "Invalid threshold identifier %s", state);
|
||||||
return -1;
|
return -1;
|
||||||
@ -349,11 +363,11 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
|
|
||||||
rsp = ipmi_sdr_get_sensor_thresholds(intf, emsg.sensor_num,
|
rsp = ipmi_sdr_get_sensor_thresholds(intf, emsg.sensor_num,
|
||||||
target, lun, channel);
|
target, lun, channel);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Command Get Sensor Thresholds failed: invalid response.");
|
"Command Get Sensor Thresholds failed: invalid response.");
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Command Get Sensor Thresholds failed: %s",
|
lprintf(LOG_ERR, "Command Get Sensor Thresholds failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -364,7 +378,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
|
|
||||||
rsp = ipmi_sdr_get_sensor_hysteresis(intf, emsg.sensor_num,
|
rsp = ipmi_sdr_get_sensor_hysteresis(intf, emsg.sensor_num,
|
||||||
target, lun, channel);
|
target, lun, channel);
|
||||||
if (rsp != NULL && rsp->ccode == 0)
|
if (rsp && !rsp->ccode)
|
||||||
off = dir ? rsp->data[0] : rsp->data[1];
|
off = dir ? rsp->data[0] : rsp->data[1];
|
||||||
if (off <= 0)
|
if (off <= 0)
|
||||||
off = 1;
|
off = 1;
|
||||||
@ -401,7 +415,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
/*
|
/*
|
||||||
* print list of available states for this sensor
|
* print list of available states for this sensor
|
||||||
*/
|
*/
|
||||||
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
if (!state || strcasecmp(state, "list") == 0) {
|
||||||
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
||||||
printf("Sensor State Shortcuts:\n");
|
printf("Sensor State Shortcuts:\n");
|
||||||
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
||||||
@ -412,12 +426,12 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
|
|
||||||
off = 0;
|
off = 0;
|
||||||
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
||||||
if (strncasecmp(state, digi_on[x], strlen(digi_on[x])) == 0) {
|
if (strcasecmp(state, digi_on[x]) == 0) {
|
||||||
emsg.event_data[0] = 1;
|
emsg.event_data[0] = 1;
|
||||||
off = 1;
|
off = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(state, digi_off[x], strlen(digi_off[x])) == 0) {
|
else if (strcasecmp(state, digi_off[x]) == 0) {
|
||||||
emsg.event_data[0] = 0;
|
emsg.event_data[0] = 0;
|
||||||
off = 1;
|
off = 1;
|
||||||
break;
|
break;
|
||||||
@ -441,7 +455,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
/*
|
/*
|
||||||
* print list of available states for this sensor
|
* print list of available states for this sensor
|
||||||
*/
|
*/
|
||||||
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
if (!state || strcasecmp(state, "list") == 0) {
|
||||||
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -461,7 +475,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
/*
|
/*
|
||||||
* print list of available states for this sensor
|
* print list of available states for this sensor
|
||||||
*/
|
*/
|
||||||
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
if (!state || strcasecmp(state, "list") == 0) {
|
||||||
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -485,43 +499,30 @@ static int
|
|||||||
ipmi_event_fromfile(struct ipmi_intf * intf, char * file)
|
ipmi_event_fromfile(struct ipmi_intf * intf, char * file)
|
||||||
{
|
{
|
||||||
FILE * fp;
|
FILE * fp;
|
||||||
struct ipmi_rs * rsp;
|
/* For ease of filling in from file data */
|
||||||
struct ipmi_rq req;
|
union {
|
||||||
struct sel_event_record sel_event;
|
struct platform_event_msg emsg;
|
||||||
uint8_t rqdata[8];
|
uint8_t bytes[sizeof(struct platform_event_msg)];
|
||||||
|
} __attribute__ ((packed)) rqdata;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char * ptr, * tok;
|
char * ptr, * tok;
|
||||||
int i, j;
|
|
||||||
uint8_t chmed;
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (file == NULL)
|
if (!file)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(rqdata, 0, 8);
|
|
||||||
|
|
||||||
/* setup Platform Event Message command */
|
|
||||||
memset(&req, 0, sizeof(req));
|
|
||||||
req.msg.netfn = IPMI_NETFN_SE;
|
|
||||||
req.msg.cmd = 0x02;
|
|
||||||
req.msg.data = rqdata;
|
|
||||||
req.msg.data_len = 7;
|
|
||||||
|
|
||||||
chmed = ipmi_current_channel_medium(intf);
|
|
||||||
if (chmed == IPMI_CHANNEL_MEDIUM_SYSTEM) {
|
|
||||||
/* system interface, need extra generator ID */
|
|
||||||
rqdata[0] = 0x41; // As per Fig. 29-2 and Table 5-4
|
|
||||||
req.msg.data_len = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
fp = ipmi_open_file_read(file);
|
fp = ipmi_open_file_read(file);
|
||||||
if (fp == NULL)
|
if (!fp)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
while (feof(fp) == 0) {
|
while (feof(fp) == 0) {
|
||||||
if (fgets(buf, 1024, fp) == NULL)
|
size_t count = 0;
|
||||||
|
if (!fgets(buf, 1024, fp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* Each line is a new event */
|
||||||
|
memset(&rqdata, 0, sizeof(rqdata));
|
||||||
|
|
||||||
/* clip off optional comment tail indicated by # */
|
/* clip off optional comment tail indicated by # */
|
||||||
ptr = strchr(buf, '#');
|
ptr = strchr(buf, '#');
|
||||||
if (ptr)
|
if (ptr)
|
||||||
@ -541,49 +542,28 @@ ipmi_event_fromfile(struct ipmi_intf * intf, char * file)
|
|||||||
|
|
||||||
/* parse the event, 7 bytes with optional comment */
|
/* parse the event, 7 bytes with optional comment */
|
||||||
/* 0x00 0x00 0x00 0x00 0x00 0x00 0x00 # event */
|
/* 0x00 0x00 0x00 0x00 0x00 0x00 0x00 # event */
|
||||||
i = 0;
|
|
||||||
tok = strtok(ptr, " ");
|
tok = strtok(ptr, " ");
|
||||||
while (tok) {
|
while (tok) {
|
||||||
if (i == 7)
|
if (count == sizeof(struct platform_event_msg))
|
||||||
|
break;
|
||||||
|
if (0 > str2uchar(tok, &rqdata.bytes[count])) {
|
||||||
|
lprintf(LOG_ERR, "Invalid token in file: [%s]", tok);
|
||||||
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
j = i++;
|
|
||||||
if (chmed == IPMI_CHANNEL_MEDIUM_SYSTEM)
|
|
||||||
j++;
|
|
||||||
rqdata[j] = (uint8_t)strtol(tok, NULL, 0);
|
|
||||||
tok = strtok(NULL, " ");
|
|
||||||
}
|
}
|
||||||
if (i < 7) {
|
tok = strtok(NULL, " ");
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
if (count < sizeof(struct platform_event_msg)) {
|
||||||
lprintf(LOG_ERR, "Invalid Event: %s",
|
lprintf(LOG_ERR, "Invalid Event: %s",
|
||||||
buf2str(rqdata, sizeof(rqdata)));
|
buf2str(rqdata.bytes, sizeof(rqdata.bytes)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&sel_event, 0, sizeof(struct sel_event_record));
|
/* Now actually send it, failures will be logged by the sender */
|
||||||
sel_event.record_id = 0;
|
rc = ipmi_send_platform_event(intf, &rqdata.emsg);
|
||||||
sel_event.sel_type.standard_type.gen_id = 2;
|
if (IPMI_CC_OK != rc)
|
||||||
|
break;
|
||||||
j = (chmed == IPMI_CHANNEL_MEDIUM_SYSTEM) ? 1 : 0;
|
|
||||||
sel_event.sel_type.standard_type.evm_rev = rqdata[j++];
|
|
||||||
sel_event.sel_type.standard_type.sensor_type = rqdata[j++];
|
|
||||||
sel_event.sel_type.standard_type.sensor_num = rqdata[j++];
|
|
||||||
sel_event.sel_type.standard_type.event_type = rqdata[j] & 0x7f;
|
|
||||||
sel_event.sel_type.standard_type.event_dir = (rqdata[j++] & 0x80) >> 7;
|
|
||||||
sel_event.sel_type.standard_type.event_data[0] = rqdata[j++];
|
|
||||||
sel_event.sel_type.standard_type.event_data[1] = rqdata[j++];
|
|
||||||
sel_event.sel_type.standard_type.event_data[2] = rqdata[j++];
|
|
||||||
|
|
||||||
ipmi_sel_print_std_entry(intf, &sel_event);
|
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
|
||||||
if (rsp == NULL) {
|
|
||||||
lprintf(LOG_ERR, "Platform Event Message command failed");
|
|
||||||
rc = -1;
|
|
||||||
}
|
|
||||||
else if (rsp->ccode > 0) {
|
|
||||||
lprintf(LOG_ERR, "Platform Event Message command failed: %s",
|
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
|
||||||
rc = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -616,11 +596,11 @@ ipmi_event_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (argc == 0 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc == 0 || !strcmp(argv[0], "help")) {
|
||||||
ipmi_event_usage();
|
ipmi_event_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[0], "file", 4) == 0) {
|
if (!strcmp(argv[0], "file")) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
ipmi_event_usage();
|
ipmi_event_usage();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -128,7 +128,7 @@ ipmi_firewall_parse_args(int argc, char ** argv, struct ipmi_function_params * p
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
if (strncmp(argv[i], "channel", 7) == 0 && (++i < argc)) {
|
if (!strcmp(argv[i], "channel") && (++i < argc)) {
|
||||||
uint8_t channel_tmp = 0;
|
uint8_t channel_tmp = 0;
|
||||||
if (is_ipmi_channel_num(argv[i], &channel_tmp) != 0) {
|
if (is_ipmi_channel_num(argv[i], &channel_tmp) != 0) {
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
@ -137,31 +137,31 @@ ipmi_firewall_parse_args(int argc, char ** argv, struct ipmi_function_params * p
|
|||||||
p->channel = channel_tmp;
|
p->channel = channel_tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "lun", 3) == 0 && (++i < argc)) {
|
else if (!strcmp(argv[i], "lun") && (++i < argc)) {
|
||||||
if (str2int(argv[i], &(p->lun)) != 0) {
|
if (str2int(argv[i], &(p->lun)) != 0) {
|
||||||
lprintf(LOG_ERR, "Given lun '%s' is invalid.", argv[i]);
|
lprintf(LOG_ERR, "Given lun '%s' is invalid.", argv[i]);
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "force", 5) == 0) {
|
else if (!strcmp(argv[i], "force")) {
|
||||||
p->force = 1;
|
p->force = 1;
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "netfn", 5) == 0 && (++i < argc)) {
|
else if (!strcmp(argv[i], "netfn") && (++i < argc)) {
|
||||||
if (str2int(argv[i], &(p->netfn)) != 0) {
|
if (str2int(argv[i], &(p->netfn)) != 0) {
|
||||||
lprintf(LOG_ERR, "Given netfn '%s' is invalid.", argv[i]);
|
lprintf(LOG_ERR, "Given netfn '%s' is invalid.", argv[i]);
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "command", 7) == 0 && (++i < argc)) {
|
else if (!strcmp(argv[i], "command") && (++i < argc)) {
|
||||||
if (str2int(argv[i], &(p->command)) != 0) {
|
if (str2int(argv[i], &(p->command)) != 0) {
|
||||||
lprintf(LOG_ERR, "Given command '%s' is invalid.", argv[i]);
|
lprintf(LOG_ERR, "Given command '%s' is invalid.", argv[i]);
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[i], "subfn", 5) == 0 && (++i < argc)) {
|
else if (!strcmp(argv[i], "subfn") && (++i < argc)) {
|
||||||
if (str2int(argv[i], &(p->subfn)) != 0) {
|
if (str2int(argv[i], &(p->subfn)) != 0) {
|
||||||
lprintf(LOG_ERR, "Given subfn '%s' is invalid.", argv[i]);
|
lprintf(LOG_ERR, "Given subfn '%s' is invalid.", argv[i]);
|
||||||
conv_err = 1;
|
conv_err = 1;
|
||||||
@ -235,11 +235,11 @@ _get_netfn_support(struct ipmi_intf * intf, int channel, unsigned char * lun, un
|
|||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get NetFn Support command failed");
|
lprintf(LOG_ERR, "Get NetFn Support command failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get NetFn Support command failed: %s",
|
lprintf(LOG_ERR, "Get NetFn Support command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -289,11 +289,11 @@ _get_command_support(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 3;
|
req.msg.data_len = 3;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
|
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=0) command failed: %s",
|
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=0) command failed: %s",
|
||||||
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -316,11 +316,11 @@ _get_command_support(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 3;
|
req.msg.data_len = 3;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
|
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed: %s",
|
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed: %s",
|
||||||
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -368,11 +368,11 @@ _get_command_configurable(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 3;
|
req.msg.data_len = 3;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
|
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=0) command failed: %s",
|
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=0) command failed: %s",
|
||||||
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -395,11 +395,11 @@ _get_command_configurable(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 3;
|
req.msg.data_len = 3;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
|
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed: %s",
|
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed: %s",
|
||||||
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -447,11 +447,11 @@ _get_command_enables(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 3;
|
req.msg.data_len = 3;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
|
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=0) command failed: %s",
|
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=0) command failed: %s",
|
||||||
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -474,11 +474,11 @@ _get_command_enables(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 3;
|
req.msg.data_len = 3;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
|
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s",
|
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s",
|
||||||
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -558,11 +558,11 @@ _set_command_enables(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 19;
|
req.msg.data_len = 19;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
|
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=0) command failed: %s",
|
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=0) command failed: %s",
|
||||||
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -579,11 +579,11 @@ _set_command_enables(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 19;
|
req.msg.data_len = 19;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
|
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s",
|
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s",
|
||||||
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -625,11 +625,11 @@ _get_subfn_support(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 4;
|
req.msg.data_len = 4;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Command Sub-function Support (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
|
lprintf(LOG_ERR, "Get Command Sub-function Support (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Command Sub-function Support (LUN=%d, NetFn=%d, command=%d) command failed: %s",
|
lprintf(LOG_ERR, "Get Command Sub-function Support (LUN=%d, NetFn=%d, command=%d) command failed: %s",
|
||||||
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -672,11 +672,11 @@ _get_subfn_configurable(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 4;
|
req.msg.data_len = 4;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Configurable Command Sub-function (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
|
lprintf(LOG_ERR, "Get Configurable Command Sub-function (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Configurable Command Sub-function (LUN=%d, NetFn=%d, command=%d) command failed: %s",
|
lprintf(LOG_ERR, "Get Configurable Command Sub-function (LUN=%d, NetFn=%d, command=%d) command failed: %s",
|
||||||
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -719,11 +719,11 @@ _get_subfn_enables(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 4;
|
req.msg.data_len = 4;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
|
lprintf(LOG_ERR, "Get Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed: %s",
|
lprintf(LOG_ERR, "Get Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed: %s",
|
||||||
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -787,11 +787,11 @@ _set_subfn_enables(struct ipmi_intf * intf,
|
|||||||
req.msg.data_len = 8;
|
req.msg.data_len = 8;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Set Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
|
lprintf(LOG_ERR, "Set Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Set Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed: %s",
|
lprintf(LOG_ERR, "Set Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed: %s",
|
||||||
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
|
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -888,7 +888,7 @@ static int _gather_info(struct ipmi_intf * intf, struct ipmi_function_params * p
|
|||||||
|
|
||||||
/* ipmi_firewall_info - print out info for firewall functions
|
/* ipmi_firewall_info - print out info for firewall functions
|
||||||
*
|
*
|
||||||
* @intf: ipmi inteface
|
* @intf: ipmi interface
|
||||||
* @argc: argument count
|
* @argc: argument count
|
||||||
* @argv: argument list
|
* @argv: argument list
|
||||||
*
|
*
|
||||||
@ -903,7 +903,7 @@ ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
struct bmc_fn_support * bmc_fn_support;
|
struct bmc_fn_support * bmc_fn_support;
|
||||||
unsigned int l, n, c;
|
unsigned int l, n, c;
|
||||||
|
|
||||||
if ((argc > 0 && strncmp(argv[0], "help", 4) == 0) || ipmi_firewall_parse_args(argc, argv, &p) < 0)
|
if ((argc > 0 && !strcmp(argv[0], "help")) || ipmi_firewall_parse_args(argc, argv, &p) < 0)
|
||||||
{
|
{
|
||||||
printf_firewall_info_usage();
|
printf_firewall_info_usage();
|
||||||
return 0;
|
return 0;
|
||||||
@ -1001,7 +1001,7 @@ ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
/* ipmi_firewall_enable_disable - enable/disable BMC functions
|
/* ipmi_firewall_enable_disable - enable/disable BMC functions
|
||||||
*
|
*
|
||||||
* @intf: ipmi inteface
|
* @intf: ipmi interface
|
||||||
* @enable: whether to enable or disable
|
* @enable: whether to enable or disable
|
||||||
* @argc: argument count
|
* @argc: argument count
|
||||||
* @argv: argument list
|
* @argv: argument list
|
||||||
@ -1018,7 +1018,7 @@ ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char
|
|||||||
unsigned int l, n, c;
|
unsigned int l, n, c;
|
||||||
unsigned char enables[MAX_COMMAND_BYTES];
|
unsigned char enables[MAX_COMMAND_BYTES];
|
||||||
|
|
||||||
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 1 || !strcmp(argv[0], "help")) {
|
||||||
char * s1 = enable?"en":"dis";
|
char * s1 = enable?"en":"dis";
|
||||||
char * s2 = enable?"":" [force]";
|
char * s2 = enable?"":" [force]";
|
||||||
printf("%sable [channel H] lun L netfn N%s\n", s1, s2);
|
printf("%sable [channel H] lun L netfn N%s\n", s1, s2);
|
||||||
@ -1055,7 +1055,7 @@ ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char
|
|||||||
c = p.command;
|
c = p.command;
|
||||||
if (p.subfn >= 0) {
|
if (p.subfn >= 0) {
|
||||||
// firewall (en|dis)able [channel c] lun l netfn n command m subfn s
|
// firewall (en|dis)able [channel c] lun l netfn n command m subfn s
|
||||||
// (en|dis)able this sub-function for this commnad on this lun/netfn pair
|
// (en|dis)able this sub-function for this command on this lun/netfn pair
|
||||||
memcpy(enables,
|
memcpy(enables,
|
||||||
bmc_fn_support->lun[l].netfn[n].command[c].subfn_enable,
|
bmc_fn_support->lun[l].netfn[n].command[c].subfn_enable,
|
||||||
MAX_SUBFN_BYTES);
|
MAX_SUBFN_BYTES);
|
||||||
@ -1065,7 +1065,7 @@ ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char
|
|||||||
|
|
||||||
} else if (p.command >= 0) {
|
} else if (p.command >= 0) {
|
||||||
// firewall (en|dis)able [channel c] lun l netfn n command m
|
// firewall (en|dis)able [channel c] lun l netfn n command m
|
||||||
// (en|dis)able all subfn and command for this commnad on this lun/netfn pair
|
// (en|dis)able all subfn and command for this command on this lun/netfn pair
|
||||||
memset(enables, enable?0xff:0, MAX_SUBFN_BYTES);
|
memset(enables, enable?0xff:0, MAX_SUBFN_BYTES);
|
||||||
ret = _set_subfn_enables(intf, &p,
|
ret = _set_subfn_enables(intf, &p,
|
||||||
&bmc_fn_support->lun[l].netfn[n].command[c], enables);
|
&bmc_fn_support->lun[l].netfn[n].command[c], enables);
|
||||||
@ -1076,14 +1076,14 @@ ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char
|
|||||||
&bmc_fn_support->lun[l].netfn[n], enables, p.force);
|
&bmc_fn_support->lun[l].netfn[n], enables, p.force);
|
||||||
} else if (p.netfn >= 0) {
|
} else if (p.netfn >= 0) {
|
||||||
// firewall (en|dis)able [channel c] lun l netfn n
|
// firewall (en|dis)able [channel c] lun l netfn n
|
||||||
// (en|dis)able all commnads on this lun/netfn pair
|
// (en|dis)able all command on this lun/netfn pair
|
||||||
memset(enables, enable?0xff:0, sizeof(enables));
|
memset(enables, enable?0xff:0, sizeof(enables));
|
||||||
ret = _set_command_enables(intf, &p,
|
ret = _set_command_enables(intf, &p,
|
||||||
&bmc_fn_support->lun[l].netfn[n], enables, p.force);
|
&bmc_fn_support->lun[l].netfn[n], enables, p.force);
|
||||||
/*
|
/*
|
||||||
} else if (p.lun >= 0) {
|
} else if (p.lun >= 0) {
|
||||||
// firewall (en|dis)able [channel c] lun l
|
// firewall (en|dis)able [channel c] lun l
|
||||||
// (en|dis)able all commnads on all netfn pairs for this lun
|
// (en|dis)able all command on all netfn pairs for this lun
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
free(bmc_fn_support);
|
free(bmc_fn_support);
|
||||||
@ -1093,7 +1093,7 @@ ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char
|
|||||||
|
|
||||||
/* ipmi_firewall_reset - reset firmware firewall to enable everything
|
/* ipmi_firewall_reset - reset firmware firewall to enable everything
|
||||||
*
|
*
|
||||||
* @intf: ipmi inteface
|
* @intf: ipmi interface
|
||||||
* @argc: argument count
|
* @argc: argument count
|
||||||
* @argv: argument list
|
* @argv: argument list
|
||||||
*
|
*
|
||||||
@ -1113,7 +1113,7 @@ ipmi_firewall_reset(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
printf_firewall_usage();
|
printf_firewall_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (argc > 0 && strncmp(argv[0], "help", 4) == 0) {
|
} else if (argc > 0 && !strcmp(argv[0], "help")) {
|
||||||
printf_firewall_usage();
|
printf_firewall_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1171,19 +1171,19 @@ ipmi_firewall_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 1 || !strcmp(argv[0], "help")) {
|
||||||
printf_firewall_usage();
|
printf_firewall_usage();
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "info", 4) == 0) {
|
else if (!strcmp(argv[0], "info")) {
|
||||||
rc = ipmi_firewall_info(intf, argc-1, &(argv[1]));
|
rc = ipmi_firewall_info(intf, argc-1, &(argv[1]));
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "enable", 6) == 0) {
|
else if (!strcmp(argv[0], "enable")) {
|
||||||
rc = ipmi_firewall_enable_disable(intf, 1, argc-1, &(argv[1]));
|
rc = ipmi_firewall_enable_disable(intf, 1, argc-1, &(argv[1]));
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "disable", 7) == 0) {
|
else if (!strcmp(argv[0], "disable")) {
|
||||||
rc = ipmi_firewall_enable_disable(intf, 0, argc-1, &(argv[1]));
|
rc = ipmi_firewall_enable_disable(intf, 0, argc-1, &(argv[1]));
|
||||||
}
|
}
|
||||||
else if (strncmp(argv[0], "reset", 5) == 0) {
|
else if (!strcmp(argv[0], "reset")) {
|
||||||
rc = ipmi_firewall_reset(intf, argc-1, &(argv[1]));
|
rc = ipmi_firewall_reset(intf, argc-1, &(argv[1]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
1012
lib/ipmi_fru.c
1012
lib/ipmi_fru.c
File diff suppressed because it is too large
Load Diff
@ -151,16 +151,16 @@ ipmi_fwum_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
printf_kfwum_help();
|
printf_kfwum_help();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (strncmp(argv[0], "help", 4) == 0) {
|
if (!strcmp(argv[0], "help")) {
|
||||||
printf_kfwum_help();
|
printf_kfwum_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (strncmp(argv[0], "info", 4) == 0) {
|
} else if (!strcmp(argv[0], "info")) {
|
||||||
rc = ipmi_fwum_info(intf);
|
rc = ipmi_fwum_info(intf);
|
||||||
} else if (strncmp(argv[0], "status", 6) == 0) {
|
} else if (!strcmp(argv[0], "status")) {
|
||||||
rc = ipmi_fwum_status(intf);
|
rc = ipmi_fwum_status(intf);
|
||||||
} else if (strncmp(argv[0], "rollback", 8) == 0) {
|
} else if (!strcmp(argv[0], "rollback")) {
|
||||||
rc = KfwumManualRollback(intf);
|
rc = KfwumManualRollback(intf);
|
||||||
} else if (strncmp(argv[0], "download", 8) == 0) {
|
} else if (!strcmp(argv[0], "download")) {
|
||||||
if ((argc < 2) || (strlen(argv[1]) < 1)) {
|
if ((argc < 2) || (strlen(argv[1]) < 1)) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Path and file name must be specified.");
|
"Path and file name must be specified.");
|
||||||
@ -168,14 +168,14 @@ ipmi_fwum_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
printf("Firmware File Name : %s\n", argv[1]);
|
printf("Firmware File Name : %s\n", argv[1]);
|
||||||
rc = ipmi_fwum_fwupgrade(intf, argv[1], 0);
|
rc = ipmi_fwum_fwupgrade(intf, argv[1], 0);
|
||||||
} else if (strncmp(argv[0], "upgrade", 7) == 0) {
|
} else if (!strcmp(argv[0], "upgrade")) {
|
||||||
if ((argc >= 2) && (strlen(argv[1]) > 0)) {
|
if ((argc >= 2) && (strlen(argv[1]) > 0)) {
|
||||||
printf("Upgrading using file name %s\n", argv[1]);
|
printf("Upgrading using file name %s\n", argv[1]);
|
||||||
rc = ipmi_fwum_fwupgrade(intf, argv[1], 1);
|
rc = ipmi_fwum_fwupgrade(intf, argv[1], 1);
|
||||||
} else {
|
} else {
|
||||||
rc = KfwumStartFirmwareUpgrade(intf);
|
rc = KfwumStartFirmwareUpgrade(intf);
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[0], "tracelog", 8) == 0) {
|
} else if (!strcmp(argv[0], "tracelog")) {
|
||||||
rc = KfwumGetTraceLog(intf);
|
rc = KfwumGetTraceLog(intf);
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid KFWUM command: %s", argv[0]);
|
lprintf(LOG_ERR, "Invalid KFWUM command: %s", argv[0]);
|
||||||
@ -258,7 +258,7 @@ ipmi_fwum_fwupgrade(struct ipmi_intf *intf, char *file, int action)
|
|||||||
unsigned short padding;
|
unsigned short padding;
|
||||||
unsigned long fsize = 0;
|
unsigned long fsize = 0;
|
||||||
unsigned char not_used;
|
unsigned char not_used;
|
||||||
if (file == NULL) {
|
if (!file) {
|
||||||
lprintf(LOG_ERR, "No file given.");
|
lprintf(LOG_ERR, "No file given.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ KfwumGetFileSize(const char *pFileName, unsigned long *pFileSize)
|
|||||||
{
|
{
|
||||||
FILE *pFileHandle = NULL;
|
FILE *pFileHandle = NULL;
|
||||||
pFileHandle = fopen(pFileName, "rb");
|
pFileHandle = fopen(pFileName, "rb");
|
||||||
if (pFileHandle == NULL) {
|
if (!pFileHandle) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (fseek(pFileHandle, 0L , SEEK_END) == 0) {
|
if (fseek(pFileHandle, 0L , SEEK_END) == 0) {
|
||||||
@ -342,7 +342,7 @@ KfwumSetupBuffersFromFile(const char *pFileName, unsigned long fileSize)
|
|||||||
int qty = 0;
|
int qty = 0;
|
||||||
|
|
||||||
pFileHandle = fopen(pFileName, "rb");
|
pFileHandle = fopen(pFileName, "rb");
|
||||||
if (pFileHandle == NULL) {
|
if (!pFileHandle) {
|
||||||
lprintf(LOG_ERR, "Failed to open '%s' for reading.",
|
lprintf(LOG_ERR, "Failed to open '%s' for reading.",
|
||||||
pFileName);
|
pFileName);
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -454,7 +454,7 @@ KfwumGetInfo(struct ipmi_intf *intf, unsigned char output,
|
|||||||
if (!rsp) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error in FWUM Firmware Get Info Command.");
|
lprintf(LOG_ERR, "Error in FWUM Firmware Get Info Command.");
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "FWUM Firmware Get Info returned %x",
|
lprintf(LOG_ERR, "FWUM Firmware Get Info returned %x",
|
||||||
rsp->ccode);
|
rsp->ccode);
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -479,7 +479,7 @@ KfwumGetInfo(struct ipmi_intf *intf, unsigned char output,
|
|||||||
printf("Number Of Memory Bank : %u\n", pGetInfo->numBank);
|
printf("Number Of Memory Bank : %u\n", pGetInfo->numBank);
|
||||||
}
|
}
|
||||||
*pNumBank = pGetInfo->numBank;
|
*pNumBank = pGetInfo->numBank;
|
||||||
/* Determine wich type of download to use: */
|
/* Determine which type of download to use: */
|
||||||
/* Old FWUM or Old IPMC fw (data_len < 7)
|
/* Old FWUM or Old IPMC fw (data_len < 7)
|
||||||
* --> Address with small buffer size
|
* --> Address with small buffer size
|
||||||
*/
|
*/
|
||||||
@ -501,14 +501,14 @@ KfwumGetInfo(struct ipmi_intf *intf, unsigned char output,
|
|||||||
printf("Protocol Revision :");
|
printf("Protocol Revision :");
|
||||||
printf(" > 5 optimizing buffers\n");
|
printf(" > 5 optimizing buffers\n");
|
||||||
}
|
}
|
||||||
if (strstr(intf->name,"lan") != NULL) {
|
if (strstr(intf->name,"lan")) {
|
||||||
/* also covers lanplus */
|
/* also covers lanplus */
|
||||||
save_fw_nfo.bufferSize = KFWUM_SMALL_BUFFER;
|
save_fw_nfo.bufferSize = KFWUM_SMALL_BUFFER;
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf("IOL payload size : %d\n",
|
printf("IOL payload size : %d\n",
|
||||||
save_fw_nfo.bufferSize);
|
save_fw_nfo.bufferSize);
|
||||||
}
|
}
|
||||||
} else if ((strstr(intf->name,"open")!= NULL)
|
} else if (strstr(intf->name,"open")
|
||||||
&& intf->target_addr != IPMI_BMC_SLAVE_ADDR
|
&& intf->target_addr != IPMI_BMC_SLAVE_ADDR
|
||||||
&& (intf->target_addr != intf->my_addr)) {
|
&& (intf->target_addr != intf->my_addr)) {
|
||||||
save_fw_nfo.bufferSize = KFWUM_SMALL_BUFFER;
|
save_fw_nfo.bufferSize = KFWUM_SMALL_BUFFER;
|
||||||
@ -549,10 +549,10 @@ KfwumGetDeviceInfo(struct ipmi_intf *intf, unsigned char output,
|
|||||||
req.msg.data_len = 0;
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error in Get Device Id Command");
|
lprintf(LOG_ERR, "Error in Get Device Id Command");
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Device Id returned %x",
|
lprintf(LOG_ERR, "Get Device Id returned %x",
|
||||||
rsp->ccode);
|
rsp->ccode);
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -598,19 +598,19 @@ KfwumGetStatus(struct ipmi_intf * intf)
|
|||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf(" Getting Status!\n");
|
printf(" Getting Status!\n");
|
||||||
}
|
}
|
||||||
/* Retreive the number of bank */
|
/* Retrieve the number of bank */
|
||||||
rc = KfwumGetInfo(intf, 0, &numBank);
|
rc = KfwumGetInfo(intf, 0, &numBank);
|
||||||
for(counter = 0;
|
for(counter = 0;
|
||||||
(counter < numBank) && (rc == 0);
|
(counter < numBank) && (rc == 0);
|
||||||
counter ++) {
|
counter ++) {
|
||||||
/* Retreive the status of each bank */
|
/* Retrieve the status of each bank */
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.msg.netfn = IPMI_NETFN_FIRMWARE;
|
req.msg.netfn = IPMI_NETFN_FIRMWARE;
|
||||||
req.msg.cmd = KFWUM_CMD_ID_GET_FIRMWARE_STATUS;
|
req.msg.cmd = KFWUM_CMD_ID_GET_FIRMWARE_STATUS;
|
||||||
req.msg.data = &counter;
|
req.msg.data = &counter;
|
||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Error in FWUM Firmware Get Status Command.");
|
"Error in FWUM Firmware Get Status Command.");
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
@ -668,10 +668,10 @@ KfwumManualRollback(struct ipmi_intf *intf)
|
|||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error in FWUM Manual Rollback Command.");
|
lprintf(LOG_ERR, "Error in FWUM Manual Rollback Command.");
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Error in FWUM Manual Rollback Command returned %x",
|
"Error in FWUM Manual Rollback Command returned %x",
|
||||||
rsp->ccode);
|
rsp->ccode);
|
||||||
@ -707,7 +707,7 @@ KfwumStartFirmwareImage(struct ipmi_intf *intf, unsigned long length,
|
|||||||
req.msg.data_len = 6;
|
req.msg.data_len = 6;
|
||||||
}
|
}
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Error in FWUM Firmware Start Firmware Image Download Command.");
|
"Error in FWUM Firmware Start Firmware Image Download Command.");
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -755,13 +755,13 @@ KfwumSaveFirmwareImage(struct ipmi_intf *intf, unsigned char sequenceNumber,
|
|||||||
/* + 1 => sequenceNumber*/
|
/* + 1 => sequenceNumber*/
|
||||||
}
|
}
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Error in FWUM Firmware Save Firmware Image Download Command.");
|
"Error in FWUM Firmware Save Firmware Image Download Command.");
|
||||||
/* We don't receive "C7" on errors with IOL,
|
/* We don't receive "C7" on errors with IOL,
|
||||||
* instead we receive nothing
|
* instead we receive nothing
|
||||||
*/
|
*/
|
||||||
if (strstr(intf->name, "lan") != NULL) {
|
if (strstr(intf->name, "lan")) {
|
||||||
no_rsp++;
|
no_rsp++;
|
||||||
if (no_rsp < FWUM_SAVE_FIRMWARE_NO_RESPONSE_LIMIT) {
|
if (no_rsp < FWUM_SAVE_FIRMWARE_NO_RESPONSE_LIMIT) {
|
||||||
*pInBufLength -= 1;
|
*pInBufLength -= 1;
|
||||||
@ -772,7 +772,7 @@ KfwumSaveFirmwareImage(struct ipmi_intf *intf, unsigned char sequenceNumber,
|
|||||||
*pInBufLength = 0;
|
*pInBufLength = 0;
|
||||||
break;
|
break;
|
||||||
} /* For other interface keep trying */
|
} /* For other interface keep trying */
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
if (rsp->ccode == 0xc0) {
|
if (rsp->ccode == 0xc0) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
} else if ((rsp->ccode == 0xc7)
|
} else if ((rsp->ccode == 0xc7)
|
||||||
@ -836,9 +836,9 @@ KfwumFinishFirmwareImage(struct ipmi_intf *intf, tKFWUM_InFirmwareInfo firmInfo)
|
|||||||
/* Infinite loop if BMC doesn't reply or replies 0xc0 every time. */
|
/* Infinite loop if BMC doesn't reply or replies 0xc0 every time. */
|
||||||
do {
|
do {
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
} while (rsp == NULL || rsp->ccode == 0xc0);
|
} while (!rsp || rsp->ccode == 0xc0);
|
||||||
|
|
||||||
if (rsp->ccode != 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"FWUM Firmware Finish Firmware Image Download returned %x",
|
"FWUM Firmware Finish Firmware Image Download returned %x",
|
||||||
rsp->ccode);
|
rsp->ccode);
|
||||||
@ -917,7 +917,7 @@ KfwumStartFirmwareUpgrade(struct ipmi_intf *intf)
|
|||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Error in FWUM Firmware Start Firmware Upgrade Command");
|
"Error in FWUM Firmware Start Firmware Upgrade Command");
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
@ -950,7 +950,7 @@ KfwumGetTraceLog(struct ipmi_intf *intf)
|
|||||||
(chunkIdx < TRACE_LOG_CHUNK_COUNT)
|
(chunkIdx < TRACE_LOG_CHUNK_COUNT)
|
||||||
&& (rc == 0);
|
&& (rc == 0);
|
||||||
chunkIdx++) {
|
chunkIdx++) {
|
||||||
/* Retreive each log chunk and print it */
|
/* Retrieve each log chunk and print it */
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.msg.netfn = IPMI_NETFN_FIRMWARE;
|
req.msg.netfn = IPMI_NETFN_FIRMWARE;
|
||||||
req.msg.cmd = KFWUM_CMD_ID_GET_TRACE_LOG;
|
req.msg.cmd = KFWUM_CMD_ID_GET_TRACE_LOG;
|
||||||
@ -958,7 +958,7 @@ KfwumGetTraceLog(struct ipmi_intf *intf)
|
|||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Error in FWUM Firmware Get Trace Log Command");
|
"Error in FWUM Firmware Get Trace Log Command");
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
@ -971,7 +971,7 @@ KfwumGetTraceLog(struct ipmi_intf *intf)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (cmdIdx=0; cmdIdx < TRACE_LOG_CHUNK_SIZE; cmdIdx++) {
|
for (cmdIdx=0; cmdIdx < TRACE_LOG_CHUNK_SIZE; cmdIdx++) {
|
||||||
/* Don't diplay commands with an invalid state */
|
/* Don't display commands with an invalid state */
|
||||||
if ((rsp->data[TRACE_LOG_ATT_COUNT * cmdIdx + 1] != 0)
|
if ((rsp->data[TRACE_LOG_ATT_COUNT * cmdIdx + 1] != 0)
|
||||||
&& (rsp->data[TRACE_LOG_ATT_COUNT * cmdIdx] < KFWUM_CMD_ID_STD_MAX_CMD)) {
|
&& (rsp->data[TRACE_LOG_ATT_COUNT * cmdIdx] < KFWUM_CMD_ID_STD_MAX_CMD)) {
|
||||||
printf(" Cmd ID: %17s -- CmdState: %10s -- CompCode: %2x\n",
|
printf(" Cmd ID: %17s -- CmdState: %10s -- CompCode: %2x\n",
|
||||||
@ -1001,7 +1001,7 @@ KfwumGetInfoFromFirmware(unsigned char *pBuf, unsigned long bufSize,
|
|||||||
}
|
}
|
||||||
offset = IN_FIRMWARE_INFO_OFFSET_LOCATION;
|
offset = IN_FIRMWARE_INFO_OFFSET_LOCATION;
|
||||||
|
|
||||||
/* Now, fill the structure with read informations */
|
/* Now, fill the structure with read information */
|
||||||
pInfo->checksum = (unsigned short)KWUM_GET_BYTE_AT_OFFSET(pBuf,
|
pInfo->checksum = (unsigned short)KWUM_GET_BYTE_AT_OFFSET(pBuf,
|
||||||
offset + 0 + IN_FIRMWARE_INFO_OFFSET_CHECKSUM ) << 8;
|
offset + 0 + IN_FIRMWARE_INFO_OFFSET_CHECKSUM ) << 8;
|
||||||
|
|
||||||
|
@ -71,7 +71,6 @@ typedef struct gendev_eeprom_info
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_gendev_get_eeprom_size(
|
ipmi_gendev_get_eeprom_size(
|
||||||
struct ipmi_intf *intf,
|
|
||||||
struct sdr_record_generic_locator *dev,
|
struct sdr_record_generic_locator *dev,
|
||||||
t_gendev_eeprom_info *info
|
t_gendev_eeprom_info *info
|
||||||
)
|
)
|
||||||
@ -88,8 +87,7 @@ ipmi_gendev_get_eeprom_size(
|
|||||||
lprintf(LOG_ERR, "DevType : %x", dev->dev_type);
|
lprintf(LOG_ERR, "DevType : %x", dev->dev_type);
|
||||||
lprintf(LOG_ERR, "DevType Mod: %x", dev->dev_type_modifier);
|
lprintf(LOG_ERR, "DevType Mod: %x", dev->dev_type_modifier);
|
||||||
*/
|
*/
|
||||||
if( info != NULL)
|
if (info) {
|
||||||
{
|
|
||||||
switch(dev->dev_type)
|
switch(dev->dev_type)
|
||||||
{
|
{
|
||||||
case 0x08: // 24C01
|
case 0x08: // 24C01
|
||||||
@ -192,7 +190,7 @@ ipmi_gendev_read_file(
|
|||||||
int eeprom_size;
|
int eeprom_size;
|
||||||
t_gendev_eeprom_info eeprom_info;
|
t_gendev_eeprom_info eeprom_info;
|
||||||
|
|
||||||
eeprom_size = ipmi_gendev_get_eeprom_size(intf, dev, &eeprom_info);
|
eeprom_size = ipmi_gendev_get_eeprom_size(dev, &eeprom_info);
|
||||||
|
|
||||||
if(eeprom_size > 0)
|
if(eeprom_size > 0)
|
||||||
{
|
{
|
||||||
@ -280,8 +278,7 @@ ipmi_gendev_read_file(
|
|||||||
msize
|
msize
|
||||||
);
|
);
|
||||||
|
|
||||||
if (rsp != NULL)
|
if (rsp) {
|
||||||
{
|
|
||||||
retryCounter = GENDEV_RETRY_COUNT;
|
retryCounter = GENDEV_RETRY_COUNT;
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
@ -364,7 +361,7 @@ ipmi_gendev_write_file(
|
|||||||
int eeprom_size;
|
int eeprom_size;
|
||||||
t_gendev_eeprom_info eeprom_info;
|
t_gendev_eeprom_info eeprom_info;
|
||||||
|
|
||||||
eeprom_size = ipmi_gendev_get_eeprom_size(intf, dev, &eeprom_info);
|
eeprom_size = ipmi_gendev_get_eeprom_size(dev, &eeprom_info);
|
||||||
|
|
||||||
if(eeprom_size > 0)
|
if(eeprom_size > 0)
|
||||||
{
|
{
|
||||||
@ -376,7 +373,7 @@ ipmi_gendev_write_file(
|
|||||||
|
|
||||||
if(fp)
|
if(fp)
|
||||||
{
|
{
|
||||||
/* Retreive file length, check if it's fits the Eeprom Size */
|
/* Retrieve file length, check if it's fits the Eeprom Size */
|
||||||
fseek(fp, 0 ,SEEK_END);
|
fseek(fp, 0 ,SEEK_END);
|
||||||
fileLength = ftell(fp);
|
fileLength = ftell(fp);
|
||||||
|
|
||||||
@ -457,8 +454,6 @@ ipmi_gendev_write_file(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for(
|
for(
|
||||||
retryCounter = 0;
|
retryCounter = 0;
|
||||||
retryCounter<GENDEV_RETRY_COUNT;
|
retryCounter<GENDEV_RETRY_COUNT;
|
||||||
@ -476,8 +471,7 @@ ipmi_gendev_write_file(
|
|||||||
i2caddr+= (((eeprom_info.size) % address_span_size) * 2);
|
i2caddr+= (((eeprom_info.size) % address_span_size) * 2);
|
||||||
|
|
||||||
rsp = ipmi_master_write_read(intf, i2cbus, i2caddr, (uint8_t *) wrByte, eeprom_info.address_length+msize, 0);
|
rsp = ipmi_master_write_read(intf, i2cbus, i2caddr, (uint8_t *) wrByte, eeprom_info.address_length+msize, 0);
|
||||||
if (rsp != NULL)
|
if (rsp) {
|
||||||
{
|
|
||||||
retryCounter = GENDEV_RETRY_COUNT;
|
retryCounter = GENDEV_RETRY_COUNT;
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
@ -495,8 +489,7 @@ ipmi_gendev_write_file(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( rc == 0 )
|
if (!rc) {
|
||||||
{
|
|
||||||
static uint8_t previousCompleted = 101;
|
static uint8_t previousCompleted = 101;
|
||||||
percentCompleted = ((counter * 100) / eeprom_info.size );
|
percentCompleted = ((counter * 100) / eeprom_info.size );
|
||||||
|
|
||||||
@ -548,11 +541,7 @@ ipmi_gendev_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
lprintf(LOG_ERR, "Rx gendev command: %s", argv[0]);
|
lprintf(LOG_ERR, "Rx gendev command: %s", argv[0]);
|
||||||
|
|
||||||
if (
|
if (!argc || !strcmp(argv[0], "help"))
|
||||||
(argc == 0)
|
|
||||||
||
|
|
||||||
(strncmp(argv[0], "help", 4) == 0)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"SDR Commands: list read write");
|
"SDR Commands: list read write");
|
||||||
@ -562,18 +551,12 @@ ipmi_gendev_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
" read <sdr name> <file> Read to file eeprom specify by Generic Device Locators");
|
" read <sdr name> <file> Read to file eeprom specify by Generic Device Locators");
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
" write <sdr name> <file> Write from file eeprom specify by Generic Device Locators");
|
" write <sdr name> <file> Write from file eeprom specify by Generic Device Locators");
|
||||||
}
|
} else if (!strcmp(argv[0], "list")) {
|
||||||
else if ( strncmp(argv[0], "list", 4) == 0)
|
rc = ipmi_sdr_print_sdr(intf, SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
||||||
{
|
} else if (!strcmp(argv[0], "read")) {
|
||||||
rc = ipmi_sdr_print_sdr(intf,
|
|
||||||
SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR);
|
|
||||||
}
|
|
||||||
else if (strncmp(argv[0], "read", 4) == 0)
|
|
||||||
{
|
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
lprintf(LOG_ERR, "usage: gendev read <gendev> <filename>");
|
lprintf(LOG_ERR, "usage: gendev read <gendev> <filename>");
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
struct sdr_record_list *sdr;
|
struct sdr_record_list *sdr;
|
||||||
|
|
||||||
lprintf(LOG_ERR, "Gendev read sdr name : %s", argv[1]);
|
lprintf(LOG_ERR, "Gendev read sdr name : %s", argv[1]);
|
||||||
@ -582,14 +565,12 @@ ipmi_gendev_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
/* lookup by sensor name */
|
/* lookup by sensor name */
|
||||||
sdr = ipmi_sdr_find_sdr_byid(intf, argv[1]);
|
sdr = ipmi_sdr_find_sdr_byid(intf, argv[1]);
|
||||||
if (sdr == NULL)
|
if (!sdr) {
|
||||||
{
|
|
||||||
lprintf(LOG_ERR, "Sensor data record not found!");
|
lprintf(LOG_ERR, "Sensor data record not found!");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
|
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR) {
|
||||||
{
|
|
||||||
lprintf(LOG_ERR, "Target SDR is not a generic device locator");
|
lprintf(LOG_ERR, "Target SDR is not a generic device locator");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -598,13 +579,10 @@ ipmi_gendev_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
ipmi_gendev_read_file(intf, sdr->record.genloc, argv[2]);
|
ipmi_gendev_read_file(intf, sdr->record.genloc, argv[2]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} else if (!strcmp(argv[0], "write")) {
|
||||||
else if (strncmp(argv[0], "write", 5) == 0)
|
|
||||||
{
|
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
lprintf(LOG_ERR, "usage: gendev write <gendev> <filename>");
|
lprintf(LOG_ERR, "usage: gendev write <gendev> <filename>");
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
struct sdr_record_list *sdr;
|
struct sdr_record_list *sdr;
|
||||||
|
|
||||||
lprintf(LOG_ERR, "Gendev write sdr name : %s", argv[1]);
|
lprintf(LOG_ERR, "Gendev write sdr name : %s", argv[1]);
|
||||||
@ -613,25 +591,20 @@ ipmi_gendev_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
/* lookup by sensor name */
|
/* lookup by sensor name */
|
||||||
sdr = ipmi_sdr_find_sdr_byid(intf, argv[1]);
|
sdr = ipmi_sdr_find_sdr_byid(intf, argv[1]);
|
||||||
if (sdr == NULL)
|
if (!sdr) {
|
||||||
{
|
|
||||||
lprintf(LOG_ERR, "Sensor data record not found!");
|
lprintf(LOG_ERR, "Sensor data record not found!");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR)
|
if (sdr->type != SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR) {
|
||||||
{
|
|
||||||
lprintf(LOG_ERR, "Target SDR is not a generic device locator");
|
lprintf(LOG_ERR, "Target SDR is not a generic device locator");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
lprintf(LOG_ERR, "Gendev write file name: %s", argv[2]);
|
lprintf(LOG_ERR, "Gendev write file name: %s", argv[2]);
|
||||||
ipmi_gendev_write_file(intf, sdr->record.genloc, argv[2]);
|
ipmi_gendev_write_file(intf, sdr->record.genloc, argv[2]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
lprintf(LOG_ERR, "Invalid gendev command: %s", argv[0]);
|
lprintf(LOG_ERR, "Invalid gendev command: %s", argv[0]);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006 Kontron Canada, Inc. All Rights Reserved.
|
* Copyright (c) 2006 Kontron Canada, Inc. All Rights Reserved.
|
||||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
* Copyright 2020 Joyent, Inc.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -30,10 +31,6 @@
|
|||||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
* 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.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
#define _BSD_SOURCE || \
|
|
||||||
(_XOPEN_SOURCE >= 500 || \
|
|
||||||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) && \
|
|
||||||
!(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
|
|
||||||
|
|
||||||
#include <ipmitool/ipmi_intf.h>
|
#include <ipmitool/ipmi_intf.h>
|
||||||
#include <ipmitool/ipmi_mc.h>
|
#include <ipmitool/ipmi_mc.h>
|
||||||
@ -52,12 +49,27 @@
|
|||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* From src/plugins/ipmi_intf.c: */
|
/*
|
||||||
uint16_t
|
* This error code is used as a temporary PATCH to
|
||||||
ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf);
|
* 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
|
||||||
|
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
|
|
||||||
|
VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX];
|
||||||
|
|
||||||
int HpmfwupgUpgrade(struct ipmi_intf *intf, char *imageFilename,
|
int HpmfwupgUpgrade(struct ipmi_intf *intf, char *imageFilename,
|
||||||
int activate, int, int);
|
int activate, int, int);
|
||||||
int HpmfwupgValidateImageIntegrity(struct HpmfwupgUpgradeCtx *pFwupgCtx);
|
int HpmfwupgValidateImageIntegrity(struct HpmfwupgUpgradeCtx *pFwupgCtx);
|
||||||
@ -117,7 +129,7 @@ int HpmFwupgActionUploadFirmware(struct HpmfwupgComponentBitMask components,
|
|||||||
int option,
|
int option,
|
||||||
int *pFlagColdReset);
|
int *pFlagColdReset);
|
||||||
int
|
int
|
||||||
HpmfwupgPreUpgradeCheck(struct ipmi_intf *intf,
|
HpmfwupgPreUpgradeCheck(
|
||||||
struct HpmfwupgUpgradeCtx *pFwupgCtx,
|
struct HpmfwupgUpgradeCtx *pFwupgCtx,
|
||||||
int componentMask, int option);
|
int componentMask, int option);
|
||||||
|
|
||||||
@ -507,10 +519,9 @@ HpmfwupgUpgrade(struct ipmi_intf *intf, char *imageFilename, int activate,
|
|||||||
lprintf(LOG_NOTICE, "\nPerforming upgrade stage:");
|
lprintf(LOG_NOTICE, "\nPerforming upgrade stage:");
|
||||||
}
|
}
|
||||||
if (option & VIEW_MODE) {
|
if (option & VIEW_MODE) {
|
||||||
rc = HpmfwupgPreUpgradeCheck(intf,
|
rc = HpmfwupgPreUpgradeCheck(&fwupgCtx,componentMask, VIEW_MODE);
|
||||||
&fwupgCtx,componentMask, VIEW_MODE);
|
|
||||||
} else {
|
} else {
|
||||||
rc = HpmfwupgPreUpgradeCheck(intf, &fwupgCtx,
|
rc = HpmfwupgPreUpgradeCheck(&fwupgCtx,
|
||||||
componentMask, option);
|
componentMask, option);
|
||||||
if (rc == HPMFWUPG_SUCCESS) {
|
if (rc == HPMFWUPG_SUCCESS) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
@ -534,7 +545,7 @@ HpmfwupgUpgrade(struct ipmi_intf *intf, char *imageFilename, int activate,
|
|||||||
}
|
}
|
||||||
if (rc == HPMFWUPG_SUCCESS) {
|
if (rc == HPMFWUPG_SUCCESS) {
|
||||||
if (option & VIEW_MODE) {
|
if (option & VIEW_MODE) {
|
||||||
/* Dont display anything here in case we are just viewing it */
|
/* Don't display anything here in case we are just viewing it */
|
||||||
lprintf(LOG_NOTICE," ");
|
lprintf(LOG_NOTICE," ");
|
||||||
} else if (option & COMPARE_MODE) {
|
} else if (option & COMPARE_MODE) {
|
||||||
lprintf(LOG_NOTICE,
|
lprintf(LOG_NOTICE,
|
||||||
@ -544,7 +555,7 @@ HpmfwupgUpgrade(struct ipmi_intf *intf, char *imageFilename, int activate,
|
|||||||
"\nFirmware upgrade procedure successful\n");
|
"\nFirmware upgrade procedure successful\n");
|
||||||
}
|
}
|
||||||
} else if (option & VIEW_MODE) {
|
} else if (option & VIEW_MODE) {
|
||||||
/* Dont display anything here in case we are just viewing it */
|
/* Don't display anything here in case we are just viewing it */
|
||||||
lprintf(LOG_NOTICE," ");
|
lprintf(LOG_NOTICE," ");
|
||||||
} else if (option & COMPARE_MODE) {
|
} else if (option & COMPARE_MODE) {
|
||||||
lprintf(LOG_NOTICE,
|
lprintf(LOG_NOTICE,
|
||||||
@ -653,7 +664,7 @@ HpmfwupgPreparationStage(struct ipmi_intf *intf,
|
|||||||
if (rc != HPMFWUPG_SUCCESS) {
|
if (rc != HPMFWUPG_SUCCESS) {
|
||||||
/* Giving one more chance to user to check whether its OK to continue even if the
|
/* Giving one more chance to user to check whether its OK to continue even if the
|
||||||
* product ID does not match. This is helpful as sometimes we just want to update
|
* product ID does not match. This is helpful as sometimes we just want to update
|
||||||
* and dont care whether we have a different product Id. If the user says NO then
|
* and don't care whether we have a different product Id. If the user says NO then
|
||||||
* we need to just bail out from here
|
* we need to just bail out from here
|
||||||
*/
|
*/
|
||||||
if (!((option & FORCE_MODE) || (option & VIEW_MODE))) {
|
if (!((option & FORCE_MODE) || (option & VIEW_MODE))) {
|
||||||
@ -725,7 +736,7 @@ HpmfwupgPreparationStage(struct ipmi_intf *intf,
|
|||||||
"\n Some components present in the image file are not supported by the IPMC");
|
"\n Some components present in the image file are not supported by the IPMC");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
/* Make sure the upgrade is desirable rigth now */
|
/* Make sure the upgrade is desirable right now */
|
||||||
if (pFwupgCtx->targetCap.GlobalCapabilities.bitField.fwUpgUndesirable == 1) {
|
if (pFwupgCtx->targetCap.GlobalCapabilities.bitField.fwUpgUndesirable == 1) {
|
||||||
lprintf(LOG_NOTICE, "\n Upgrade undesirable at this moment");
|
lprintf(LOG_NOTICE, "\n Upgrade undesirable at this moment");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
@ -834,7 +845,7 @@ HpmfwupgValidateActionRecordChecksum(struct HpmfwupgActionRecord *pActionRecord)
|
|||||||
* is same as target version.
|
* is same as target version.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
HpmfwupgPreUpgradeCheck(struct ipmi_intf *intf,
|
HpmfwupgPreUpgradeCheck(
|
||||||
struct HpmfwupgUpgradeCtx *pFwupgCtx,
|
struct HpmfwupgUpgradeCtx *pFwupgCtx,
|
||||||
int componentMask, int option)
|
int componentMask, int option)
|
||||||
{
|
{
|
||||||
@ -1213,7 +1224,7 @@ HpmFwupgActionUploadFirmware(struct HpmfwupgComponentBitMask components,
|
|||||||
if (rc == HPMFWUPG_UPLOAD_BLOCK_LENGTH && !bufLengthIsSet) {
|
if (rc == HPMFWUPG_UPLOAD_BLOCK_LENGTH && !bufLengthIsSet) {
|
||||||
rc = HPMFWUPG_SUCCESS;
|
rc = HPMFWUPG_SUCCESS;
|
||||||
/* Retry with a smaller buffer length */
|
/* Retry with a smaller buffer length */
|
||||||
if (strstr(intf->name,"lan") != NULL && bufLength > 8) {
|
if (strstr(intf->name,"lan") && bufLength > 8) {
|
||||||
bufLength-= 8;
|
bufLength-= 8;
|
||||||
lprintf(LOG_INFO,
|
lprintf(LOG_INFO,
|
||||||
"Trying reduced buffer length: %d",
|
"Trying reduced buffer length: %d",
|
||||||
@ -1304,7 +1315,7 @@ HpmFwupgActionUploadFirmware(struct HpmfwupgComponentBitMask components,
|
|||||||
HpmDisplayUpgrade(1,0,0,0);
|
HpmDisplayUpgrade(1,0,0,0);
|
||||||
if ((option & COMPARE_MODE)
|
if ((option & COMPARE_MODE)
|
||||||
&& !pFwupgCtx->genCompProp[pFwupgCtx->componentId].GeneralCompProperties.bitfield.comparisonSupport) {
|
&& !pFwupgCtx->genCompProp[pFwupgCtx->componentId].GeneralCompProperties.bitfield.comparisonSupport) {
|
||||||
printf("| |Comparison isn't supported for given compenent. |\n");
|
printf("| |Comparison isn't supported for given component. |\n");
|
||||||
}
|
}
|
||||||
*pImagePtr = pDataInitial + firmwareLength;
|
*pImagePtr = pDataInitial + firmwareLength;
|
||||||
}
|
}
|
||||||
@ -1390,27 +1401,26 @@ int
|
|||||||
HpmfwupgGetBufferFromFile(char *imageFilename,
|
HpmfwupgGetBufferFromFile(char *imageFilename,
|
||||||
struct HpmfwupgUpgradeCtx *pFwupgCtx)
|
struct HpmfwupgUpgradeCtx *pFwupgCtx)
|
||||||
{
|
{
|
||||||
int rc = HPMFWUPG_SUCCESS;
|
int rc = HPMFWUPG_ERROR;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
FILE *pImageFile = fopen(imageFilename, "rb");
|
FILE *pImageFile = fopen(imageFilename, "rb");
|
||||||
if (pImageFile == NULL) {
|
if (!pImageFile) {
|
||||||
lprintf(LOG_ERR, "Cannot open image file '%s'",
|
lprintf(LOG_ERR, "Cannot open image file '%s'",
|
||||||
imageFilename);
|
imageFilename);
|
||||||
return HPMFWUPG_ERROR;
|
goto ret_no_close;
|
||||||
}
|
}
|
||||||
/* Get the raw data in file */
|
/* Get the raw data in file */
|
||||||
ret = fseek(pImageFile, 0, SEEK_END);
|
ret = fseek(pImageFile, 0, SEEK_END);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
lprintf(LOG_ERR, "Failed to seek in the image file '%s'",
|
lprintf(LOG_ERR, "Failed to seek in the image file '%s'",
|
||||||
imageFilename);
|
imageFilename);
|
||||||
return HPMFWUPG_ERROR;
|
goto ret_close;
|
||||||
}
|
}
|
||||||
pFwupgCtx->imageSize = ftell(pImageFile);
|
pFwupgCtx->imageSize = ftell(pImageFile);
|
||||||
pFwupgCtx->pImageData = malloc(sizeof(unsigned char)*pFwupgCtx->imageSize);
|
pFwupgCtx->pImageData = malloc(sizeof(unsigned char)*pFwupgCtx->imageSize);
|
||||||
if (pFwupgCtx->pImageData == NULL) {
|
if (!pFwupgCtx->pImageData) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
fclose(pImageFile);
|
goto ret_close;
|
||||||
return HPMFWUPG_ERROR;
|
|
||||||
}
|
}
|
||||||
rewind(pImageFile);
|
rewind(pImageFile);
|
||||||
ret = fread(pFwupgCtx->pImageData,
|
ret = fread(pFwupgCtx->pImageData,
|
||||||
@ -1422,9 +1432,14 @@ HpmfwupgGetBufferFromFile(char *imageFilename,
|
|||||||
"Failed to read file %s size %d",
|
"Failed to read file %s size %d",
|
||||||
imageFilename,
|
imageFilename,
|
||||||
pFwupgCtx->imageSize);
|
pFwupgCtx->imageSize);
|
||||||
rc = HPMFWUPG_ERROR;
|
goto ret_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = HPMFWUPG_SUCCESS;
|
||||||
|
|
||||||
|
ret_close:
|
||||||
fclose(pImageFile);
|
fclose(pImageFile);
|
||||||
|
ret_no_close:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1438,11 +1453,11 @@ HpmfwupgGetDeviceId(struct ipmi_intf *intf, struct ipm_devid_rsp *pGetDevId)
|
|||||||
req.msg.cmd = BMC_GET_DEVICE_ID;
|
req.msg.cmd = BMC_GET_DEVICE_ID;
|
||||||
req.msg.data_len = 0;
|
req.msg.data_len = 0;
|
||||||
rsp = HpmfwupgSendCmd(intf, req, NULL);
|
rsp = HpmfwupgSendCmd(intf, req, NULL);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error getting device ID.");
|
lprintf(LOG_ERR, "Error getting device ID.");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode != 0x00) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Error getting device ID.");
|
lprintf(LOG_ERR, "Error getting device ID.");
|
||||||
lprintf(LOG_ERR, "compcode=0x%x: %s",
|
lprintf(LOG_ERR, "compcode=0x%x: %s",
|
||||||
rsp->ccode,
|
rsp->ccode,
|
||||||
@ -1466,12 +1481,12 @@ HpmfwupgGetTargetUpgCapabilities(struct ipmi_intf *intf,
|
|||||||
req.msg.data = (unsigned char*)&pCtx->req;
|
req.msg.data = (unsigned char*)&pCtx->req;
|
||||||
req.msg.data_len = sizeof(struct HpmfwupgGetTargetUpgCapabilitiesReq);
|
req.msg.data_len = sizeof(struct HpmfwupgGetTargetUpgCapabilitiesReq);
|
||||||
rsp = HpmfwupgSendCmd(intf, req, NULL);
|
rsp = HpmfwupgSendCmd(intf, req, NULL);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Error getting target upgrade capabilities.");
|
"Error getting target upgrade capabilities.");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode != 0x00) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"Error getting target upgrade capabilities, ccode: 0x%x: %s",
|
"Error getting target upgrade capabilities, ccode: 0x%x: %s",
|
||||||
rsp->ccode,
|
rsp->ccode,
|
||||||
@ -1507,7 +1522,7 @@ HpmfwupgGetTargetUpgCapabilities(struct ipmi_intf *intf,
|
|||||||
pCtx->resp.GlobalCapabilities.bitField.autRollbackOverride ? 'y' : 'n');
|
pCtx->resp.GlobalCapabilities.bitField.autRollbackOverride ? 'y' : 'n');
|
||||||
lprintf(LOG_NOTICE, "IPMC degraded...........[%c] ",
|
lprintf(LOG_NOTICE, "IPMC degraded...........[%c] ",
|
||||||
pCtx->resp.GlobalCapabilities.bitField.ipmcDegradedDurinUpg ? 'y' : 'n');
|
pCtx->resp.GlobalCapabilities.bitField.ipmcDegradedDurinUpg ? 'y' : 'n');
|
||||||
lprintf(LOG_NOTICE, "Defered activation......[%c] ",
|
lprintf(LOG_NOTICE, "Deferred activation.....[%c] ",
|
||||||
pCtx->resp.GlobalCapabilities.bitField.deferActivation ? 'y' : 'n');
|
pCtx->resp.GlobalCapabilities.bitField.deferActivation ? 'y' : 'n');
|
||||||
lprintf(LOG_NOTICE, "Service affected........[%c] ",
|
lprintf(LOG_NOTICE, "Service affected........[%c] ",
|
||||||
pCtx->resp.GlobalCapabilities.bitField.servAffectDuringUpg ? 'y' : 'n');
|
pCtx->resp.GlobalCapabilities.bitField.servAffectDuringUpg ? 'y' : 'n');
|
||||||
@ -1543,12 +1558,12 @@ HpmfwupgGetComponentProperties(struct ipmi_intf *intf,
|
|||||||
req.msg.data = (unsigned char*)&pCtx->req;
|
req.msg.data = (unsigned char*)&pCtx->req;
|
||||||
req.msg.data_len = sizeof(struct HpmfwupgGetComponentPropertiesReq);
|
req.msg.data_len = sizeof(struct HpmfwupgGetComponentPropertiesReq);
|
||||||
rsp = HpmfwupgSendCmd(intf, req, NULL);
|
rsp = HpmfwupgSendCmd(intf, req, NULL);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_NOTICE,
|
lprintf(LOG_NOTICE,
|
||||||
"Error getting component properties\n");
|
"Error getting component properties\n");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode != 0x00) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_NOTICE,
|
lprintf(LOG_NOTICE,
|
||||||
"Error getting component properties");
|
"Error getting component properties");
|
||||||
lprintf(LOG_NOTICE,
|
lprintf(LOG_NOTICE,
|
||||||
@ -1669,11 +1684,11 @@ HpmfwupgAbortUpgrade(struct ipmi_intf *intf,
|
|||||||
req.msg.data = (unsigned char*)&pCtx->req;
|
req.msg.data = (unsigned char*)&pCtx->req;
|
||||||
req.msg.data_len = sizeof(struct HpmfwupgAbortUpgradeReq);
|
req.msg.data_len = sizeof(struct HpmfwupgAbortUpgradeReq);
|
||||||
rsp = HpmfwupgSendCmd(intf, req, NULL);
|
rsp = HpmfwupgSendCmd(intf, req, NULL);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error - aborting upgrade.");
|
lprintf(LOG_ERR, "Error - aborting upgrade.");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode != 0x00) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Error aborting upgrade");
|
lprintf(LOG_ERR, "Error aborting upgrade");
|
||||||
lprintf(LOG_ERR, "compcode=0x%x: %s",
|
lprintf(LOG_ERR, "compcode=0x%x: %s",
|
||||||
rsp->ccode,
|
rsp->ccode,
|
||||||
@ -1698,14 +1713,14 @@ HpmfwupgInitiateUpgradeAction(struct ipmi_intf *intf,
|
|||||||
req.msg.data = (unsigned char*)&pCtx->req;
|
req.msg.data = (unsigned char*)&pCtx->req;
|
||||||
req.msg.data_len = sizeof(struct HpmfwupgInitiateUpgradeActionReq);
|
req.msg.data_len = sizeof(struct HpmfwupgInitiateUpgradeActionReq);
|
||||||
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error initiating upgrade action.");
|
lprintf(LOG_ERR, "Error initiating upgrade action.");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
/* Long duration command handling */
|
/* Long duration command handling */
|
||||||
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
|
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
|
||||||
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
|
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
|
||||||
} else if (rsp->ccode != 0x00) {
|
} else if (rsp->ccode) {
|
||||||
lprintf(LOG_NOTICE,"Error initiating upgrade action");
|
lprintf(LOG_NOTICE,"Error initiating upgrade action");
|
||||||
lprintf(LOG_NOTICE, "compcode=0x%x: %s",
|
lprintf(LOG_NOTICE, "compcode=0x%x: %s",
|
||||||
rsp->ccode,
|
rsp->ccode,
|
||||||
@ -1732,7 +1747,7 @@ HpmfwupgUploadFirmwareBlock(struct ipmi_intf *intf,
|
|||||||
/* 2 is the size of the upload struct - data */
|
/* 2 is the size of the upload struct - data */
|
||||||
req.msg.data_len = 2 + count;
|
req.msg.data_len = 2 + count;
|
||||||
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_NOTICE, "Error uploading firmware block.");
|
lprintf(LOG_NOTICE, "Error uploading firmware block.");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
@ -1768,7 +1783,7 @@ HpmfwupgUploadFirmwareBlock(struct ipmi_intf *intf,
|
|||||||
/* Long duration command handling */
|
/* Long duration command handling */
|
||||||
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
|
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
|
||||||
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
|
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
|
||||||
} else if (rsp->ccode != 0x00) {
|
} else if (rsp->ccode) {
|
||||||
/* PATCH --> This validation is to handle retryables errors codes on IPMB bus.
|
/* PATCH --> This validation is to handle retryables errors codes on IPMB bus.
|
||||||
* This will be fixed in the next release of open ipmi and this
|
* This will be fixed in the next release of open ipmi and this
|
||||||
* check will have to be removed. (Buggy version = 39)
|
* check will have to be removed. (Buggy version = 39)
|
||||||
@ -1809,7 +1824,7 @@ HpmfwupgFinishFirmwareUpload(struct ipmi_intf *intf,
|
|||||||
req.msg.data = (unsigned char*)&pCtx->req;
|
req.msg.data = (unsigned char*)&pCtx->req;
|
||||||
req.msg.data_len = sizeof(struct HpmfwupgFinishFirmwareUploadReq);
|
req.msg.data_len = sizeof(struct HpmfwupgFinishFirmwareUploadReq);
|
||||||
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error fininshing firmware upload.");
|
lprintf(LOG_ERR, "Error fininshing firmware upload.");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
@ -1846,7 +1861,7 @@ HpmfwupgActivateFirmware(struct ipmi_intf *intf,
|
|||||||
req.msg.data_len = sizeof(struct HpmfwupgActivateFirmwareReq)
|
req.msg.data_len = sizeof(struct HpmfwupgActivateFirmwareReq)
|
||||||
- (!pCtx->req.rollback_override ? 1 : 0);
|
- (!pCtx->req.rollback_override ? 1 : 0);
|
||||||
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error activating firmware.");
|
lprintf(LOG_ERR, "Error activating firmware.");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
@ -1947,7 +1962,7 @@ HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf,
|
|||||||
req.msg.data = (unsigned char*)&pCtx->req;
|
req.msg.data = (unsigned char*)&pCtx->req;
|
||||||
req.msg.data_len = sizeof(struct HpmfwupgManualFirmwareRollbackReq);
|
req.msg.data_len = sizeof(struct HpmfwupgManualFirmwareRollbackReq);
|
||||||
rsp = HpmfwupgSendCmd(intf, req, &fwupgCtx);
|
rsp = HpmfwupgSendCmd(intf, req, &fwupgCtx);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error sending manual rollback.");
|
lprintf(LOG_ERR, "Error sending manual rollback.");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
@ -1958,7 +1973,7 @@ HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf,
|
|||||||
printf("Waiting firmware rollback...");
|
printf("Waiting firmware rollback...");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
rc = HpmfwupgQueryRollbackStatus(intf, &resCmd, &fwupgCtx);
|
rc = HpmfwupgQueryRollbackStatus(intf, &resCmd, &fwupgCtx);
|
||||||
} else if ( rsp->ccode != 0x00 ) {
|
} else if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Error sending manual rollback");
|
lprintf(LOG_ERR, "Error sending manual rollback");
|
||||||
lprintf(LOG_ERR, "compcode=0x%x: %s",
|
lprintf(LOG_ERR, "compcode=0x%x: %s",
|
||||||
rsp->ccode,
|
rsp->ccode,
|
||||||
@ -1985,7 +2000,7 @@ HpmfwupgQueryRollbackStatus(struct ipmi_intf *intf,
|
|||||||
req.msg.data = (unsigned char*)&pCtx->req;
|
req.msg.data = (unsigned char*)&pCtx->req;
|
||||||
req.msg.data_len = sizeof(struct HpmfwupgQueryRollbackStatusReq);
|
req.msg.data_len = sizeof(struct HpmfwupgQueryRollbackStatusReq);
|
||||||
/* If we are not in upgrade context, we use default timeout values */
|
/* If we are not in upgrade context, we use default timeout values */
|
||||||
if (pFwupgCtx != NULL) {
|
if (pFwupgCtx) {
|
||||||
struct HpmfwupgImageHeader *pImageHeader;
|
struct HpmfwupgImageHeader *pImageHeader;
|
||||||
if (pFwupgCtx->pImageData) {
|
if (pFwupgCtx->pImageData) {
|
||||||
pImageHeader = (struct HpmfwupgImageHeader*)pFwupgCtx->pImageData;
|
pImageHeader = (struct HpmfwupgImageHeader*)pFwupgCtx->pImageData;
|
||||||
@ -1994,7 +2009,7 @@ HpmfwupgQueryRollbackStatus(struct ipmi_intf *intf,
|
|||||||
rollbackTimeout = 0;
|
rollbackTimeout = 0;
|
||||||
}
|
}
|
||||||
/* Use the greater of the two timeouts (header and target caps) */
|
/* Use the greater of the two timeouts (header and target caps) */
|
||||||
rollbackTimeout = MAX(rollbackTimeout,
|
rollbackTimeout = __max(rollbackTimeout,
|
||||||
pFwupgCtx->targetCap.rollbackTimeout) * 5;
|
pFwupgCtx->targetCap.rollbackTimeout) * 5;
|
||||||
} else {
|
} else {
|
||||||
rollbackTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
rollbackTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
||||||
@ -2021,7 +2036,7 @@ HpmfwupgQueryRollbackStatus(struct ipmi_intf *intf,
|
|||||||
&& ((rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS)
|
&& ((rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS)
|
||||||
|| (rsp->ccode == IPMI_CC_TIMEOUT))
|
|| (rsp->ccode == IPMI_CC_TIMEOUT))
|
||||||
&& (timeoutSec2 - timeoutSec1 < rollbackTimeout));
|
&& (timeoutSec2 - timeoutSec1 < rollbackTimeout));
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error getting upgrade status.");
|
lprintf(LOG_ERR, "Error getting upgrade status.");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
@ -2065,11 +2080,11 @@ HpmfwupgQuerySelftestResult(struct ipmi_intf *intf, struct HpmfwupgQuerySelftest
|
|||||||
unsigned int timeoutSec1, timeoutSec2;
|
unsigned int timeoutSec1, timeoutSec2;
|
||||||
pCtx->req.picmgId = HPMFWUPG_PICMG_IDENTIFIER;
|
pCtx->req.picmgId = HPMFWUPG_PICMG_IDENTIFIER;
|
||||||
/* If we are not in upgrade context, we use default timeout values */
|
/* If we are not in upgrade context, we use default timeout values */
|
||||||
if (pFwupgCtx != NULL) {
|
if (pFwupgCtx) {
|
||||||
/* Getting selftest timeout from new image */
|
/* Getting selftest timeout from new image */
|
||||||
struct HpmfwupgImageHeader *pImageHeader = (struct HpmfwupgImageHeader*)
|
struct HpmfwupgImageHeader *pImageHeader = (struct HpmfwupgImageHeader*)
|
||||||
pFwupgCtx->pImageData;
|
pFwupgCtx->pImageData;
|
||||||
selfTestTimeout = MAX(pImageHeader->selfTestTimeout,
|
selfTestTimeout = __max(pImageHeader->selfTestTimeout,
|
||||||
pFwupgCtx->targetCap.selftestTimeout) * 5;
|
pFwupgCtx->targetCap.selftestTimeout) * 5;
|
||||||
} else {
|
} else {
|
||||||
selfTestTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
selfTestTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
||||||
@ -2101,7 +2116,7 @@ HpmfwupgQuerySelftestResult(struct ipmi_intf *intf, struct HpmfwupgQuerySelftest
|
|||||||
} while (rsp
|
} while (rsp
|
||||||
&& (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS)
|
&& (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS)
|
||||||
&& (timeoutSec2 - timeoutSec1 < selfTestTimeout));
|
&& (timeoutSec2 - timeoutSec1 < selfTestTimeout));
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_NOTICE, "Error getting upgrade status\n");
|
lprintf(LOG_NOTICE, "Error getting upgrade status\n");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
@ -2135,14 +2150,14 @@ HpmfwupgSendCmd(struct ipmi_intf *intf, struct ipmi_rq req,
|
|||||||
unsigned int timeoutSec1, timeoutSec2;
|
unsigned int timeoutSec1, timeoutSec2;
|
||||||
unsigned char retry = 0;
|
unsigned char retry = 0;
|
||||||
/* If we are not in upgrade context, we use default timeout values */
|
/* If we are not in upgrade context, we use default timeout values */
|
||||||
if (pFwupgCtx != NULL) {
|
if (pFwupgCtx) {
|
||||||
inaccessTimeout = pFwupgCtx->targetCap.inaccessTimeout*5;
|
inaccessTimeout = pFwupgCtx->targetCap.inaccessTimeout*5;
|
||||||
upgradeTimeout = pFwupgCtx->targetCap.upgradeTimeout*5;
|
upgradeTimeout = pFwupgCtx->targetCap.upgradeTimeout*5;
|
||||||
} else {
|
} else {
|
||||||
/* keeping the inaccessTimeout to 60 seconds results in almost 2900 retries
|
/* keeping the inaccessTimeout to 60 seconds results in almost 2900 retries
|
||||||
* So if the target is not available it will be retrying the command for 2900
|
* So if the target is not available it will be retrying the command for 2900
|
||||||
* times which is not effecient -So reducing the Timout to 5 seconds which is
|
* times which is not efficient -So reducing the Timeout to 5 seconds which is
|
||||||
* almost 200 retries if it continuously recieves 0xC3 as completion code.
|
* almost 200 retries if it continuously receives 0xC3 as completion code.
|
||||||
*/
|
*/
|
||||||
inaccessTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
inaccessTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
||||||
upgradeTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
upgradeTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
||||||
@ -2151,10 +2166,10 @@ HpmfwupgSendCmd(struct ipmi_intf *intf, struct ipmi_rq req,
|
|||||||
do {
|
do {
|
||||||
static unsigned char isValidSize = FALSE;
|
static unsigned char isValidSize = FALSE;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
#define HPM_LAN_PACKET_RESIZE_LIMIT 6
|
#define HPM_LAN_PACKET_RESIZE_LIMIT 6
|
||||||
/* also covers lanplus */
|
/* also covers lanplus */
|
||||||
if (strstr(intf->name, "lan") != NULL) {
|
if (strstr(intf->name, "lan")) {
|
||||||
static int errorCount=0;
|
static int errorCount=0;
|
||||||
static struct ipmi_rs fakeRsp;
|
static struct ipmi_rs fakeRsp;
|
||||||
lprintf(LOG_DEBUG,
|
lprintf(LOG_DEBUG,
|
||||||
@ -2219,7 +2234,7 @@ HpmfwupgSendCmd(struct ipmi_intf *intf, struct ipmi_rq req,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Handle inaccessibility timeout (rsp = NULL if IOL) */
|
/* Handle inaccessibility timeout (rsp = NULL if IOL) */
|
||||||
if (rsp == NULL || rsp->ccode == 0xff || rsp->ccode == 0xc3 || rsp->ccode == 0xd3) {
|
if (!rsp || rsp->ccode == 0xff || rsp->ccode == 0xc3 || rsp->ccode == 0xd3) {
|
||||||
if (inaccessTimeoutCounter < inaccessTimeout) {
|
if (inaccessTimeoutCounter < inaccessTimeout) {
|
||||||
timeoutSec2 = time(NULL);
|
timeoutSec2 = time(NULL);
|
||||||
if (timeoutSec2 > timeoutSec1) {
|
if (timeoutSec2 > timeoutSec1) {
|
||||||
@ -2272,14 +2287,14 @@ HpmfwupgWaitLongDurationCmd(struct ipmi_intf *intf,
|
|||||||
unsigned int timeoutSec1, timeoutSec2;
|
unsigned int timeoutSec1, timeoutSec2;
|
||||||
struct HpmfwupgGetUpgradeStatusCtx upgStatusCmd;
|
struct HpmfwupgGetUpgradeStatusCtx upgStatusCmd;
|
||||||
/* If we are not in upgrade context, we use default timeout values */
|
/* If we are not in upgrade context, we use default timeout values */
|
||||||
if (pFwupgCtx != NULL) {
|
if (pFwupgCtx) {
|
||||||
upgradeTimeout = (unsigned int)(pFwupgCtx->targetCap.upgradeTimeout*5);
|
upgradeTimeout = (unsigned int)(pFwupgCtx->targetCap.upgradeTimeout*5);
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf("Use File Upgrade Capabilities: %i seconds\n",
|
printf("Use File Upgrade Capabilities: %i seconds\n",
|
||||||
upgradeTimeout);
|
upgradeTimeout);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Try to retreive from Caps */
|
/* Try to retrieve from Caps */
|
||||||
struct HpmfwupgGetTargetUpgCapabilitiesCtx targetCapCmd;
|
struct HpmfwupgGetTargetUpgCapabilitiesCtx targetCapCmd;
|
||||||
if(HpmfwupgGetTargetUpgCapabilities(intf, &targetCapCmd) != HPMFWUPG_SUCCESS) {
|
if(HpmfwupgGetTargetUpgCapabilities(intf, &targetCapCmd) != HPMFWUPG_SUCCESS) {
|
||||||
upgradeTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
upgradeTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT;
|
||||||
@ -2295,13 +2310,9 @@ HpmfwupgWaitLongDurationCmd(struct ipmi_intf *intf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc == HPMFWUPG_SUCCESS) {
|
|
||||||
/* Poll upgrade status until completion or timeout*/
|
/* Poll upgrade status until completion or timeout*/
|
||||||
timeoutSec1 = time(NULL);
|
timeoutSec2 = timeoutSec1 = time(NULL);
|
||||||
timeoutSec2 = time(NULL);
|
rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx, 1);
|
||||||
rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd,
|
|
||||||
pFwupgCtx, 1);
|
|
||||||
}
|
|
||||||
while (
|
while (
|
||||||
/* With KCS: Cover the case where we sometime
|
/* With KCS: Cover the case where we sometime
|
||||||
* receive d5 (on the first get status) from
|
* receive d5 (on the first get status) from
|
||||||
@ -2464,12 +2475,12 @@ ipmi_hpmfwupg_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
HpmfwupgPrintUsage();
|
HpmfwupgPrintUsage();
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
if (strcmp(argv[0], "help") == 0) {
|
if (!strcmp(argv[0], "help")) {
|
||||||
HpmfwupgPrintUsage();
|
HpmfwupgPrintUsage();
|
||||||
return HPMFWUPG_SUCCESS;
|
return HPMFWUPG_SUCCESS;
|
||||||
} else if ((strcmp(argv[0], "check") == 0)) {
|
} else if (!strcmp(argv[0], "check")) {
|
||||||
/* hpm check */
|
/* hpm check */
|
||||||
if (argv[1] == NULL) {
|
if (!argv[1]) {
|
||||||
rc = HpmfwupgTargetCheck(intf,VIEW_MODE);
|
rc = HpmfwupgTargetCheck(intf,VIEW_MODE);
|
||||||
} else {
|
} else {
|
||||||
/* hpm check <filename> */
|
/* hpm check <filename> */
|
||||||
@ -2479,18 +2490,18 @@ ipmi_hpmfwupg_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
0, VIEW_MODE);
|
0, VIEW_MODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[0], "upgrade") == 0) {
|
} else if (!strcmp(argv[0], "upgrade")) {
|
||||||
int i =0;
|
int i =0;
|
||||||
for (i=1; i< argc ; i++) {
|
for (i=1; i< argc ; i++) {
|
||||||
if (strcmp(argv[i],"activate") == 0) {
|
if (!strcmp(argv[i],"activate")) {
|
||||||
activateFlag = 1;
|
activateFlag = 1;
|
||||||
}
|
}
|
||||||
/* hpm upgrade <filename> force */
|
/* hpm upgrade <filename> force */
|
||||||
if (strcmp(argv[i],"force") == 0) {
|
if (!strcmp(argv[i],"force")) {
|
||||||
option |= FORCE_MODE;
|
option |= FORCE_MODE;
|
||||||
}
|
}
|
||||||
/* hpm upgrade <filename> component <comp Id> */
|
/* hpm upgrade <filename> component <comp Id> */
|
||||||
if (strcmp(argv[i],"component") == 0) {
|
if (!strcmp(argv[i],"component")) {
|
||||||
if (i+1 < argc) {
|
if (i+1 < argc) {
|
||||||
/* Error Checking */
|
/* Error Checking */
|
||||||
if (str2int(argv[i+1], &componentId) != 0
|
if (str2int(argv[i+1], &componentId) != 0
|
||||||
@ -2519,7 +2530,7 @@ ipmi_hpmfwupg_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strcmp(argv[i],"debug") == 0) {
|
if (!strcmp(argv[i],"debug")) {
|
||||||
option |= DEBUG_MODE;
|
option |= DEBUG_MODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2529,11 +2540,11 @@ ipmi_hpmfwupg_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
rc = HpmfwupgUpgrade(intf, argv[1], activateFlag,
|
rc = HpmfwupgUpgrade(intf, argv[1], activateFlag,
|
||||||
componentMask, option);
|
componentMask, option);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[0], "compare") == 0) {
|
} else if (!strcmp(argv[0], "compare")) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i=1; i< argc; i++) {
|
for (i=1; i< argc; i++) {
|
||||||
/* hpm compare <file> [component x...] */
|
/* hpm compare <file> [component x...] */
|
||||||
if (strcmp(argv[i],"component") == 0) {
|
if (!strcmp(argv[i],"component")) {
|
||||||
if (i+1 < argc) {
|
if (i+1 < argc) {
|
||||||
/* Error Checking */
|
/* Error Checking */
|
||||||
if (str2int(argv[i+1], &componentId) != 0
|
if (str2int(argv[i+1], &componentId) != 0
|
||||||
@ -2562,7 +2573,7 @@ ipmi_hpmfwupg_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
"No component Id provided\n");
|
"No component Id provided\n");
|
||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i],"debug") == 0) {
|
} else if (!strcmp(argv[i],"debug")) {
|
||||||
option|= DEBUG_MODE;
|
option|= DEBUG_MODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2572,19 +2583,19 @@ ipmi_hpmfwupg_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
rc = HpmfwupgUpgrade(intf, argv[1], 0,
|
rc = HpmfwupgUpgrade(intf, argv[1], 0,
|
||||||
componentMask, option);
|
componentMask, option);
|
||||||
}
|
}
|
||||||
} else if ((argc >= 1) && (strcmp(argv[0], "activate") == 0)) {
|
} else if (argc >= 1 && !strcmp(argv[0], "activate")) {
|
||||||
struct HpmfwupgActivateFirmwareCtx cmdCtx;
|
struct HpmfwupgActivateFirmwareCtx cmdCtx;
|
||||||
if ((argc == 2) && (strcmp(argv[1], "norollback") == 0)) {
|
if (argc == 2 && !strcmp(argv[1], "norollback")) {
|
||||||
cmdCtx.req.rollback_override = 1;
|
cmdCtx.req.rollback_override = 1;
|
||||||
} else {
|
} else {
|
||||||
cmdCtx.req.rollback_override = 0;
|
cmdCtx.req.rollback_override = 0;
|
||||||
}
|
}
|
||||||
rc = HpmfwupgActivateFirmware(intf, &cmdCtx, NULL);
|
rc = HpmfwupgActivateFirmware(intf, &cmdCtx, NULL);
|
||||||
} else if ((argc == 1) && (strcmp(argv[0], "targetcap") == 0)) {
|
} else if (argc == 1 && !strcmp(argv[0], "targetcap")) {
|
||||||
struct HpmfwupgGetTargetUpgCapabilitiesCtx cmdCtx;
|
struct HpmfwupgGetTargetUpgCapabilitiesCtx cmdCtx;
|
||||||
verbose++;
|
verbose++;
|
||||||
rc = HpmfwupgGetTargetUpgCapabilities(intf, &cmdCtx);
|
rc = HpmfwupgGetTargetUpgCapabilities(intf, &cmdCtx);
|
||||||
} else if ((argc == 3) && (strcmp(argv[0], "compprop") == 0)) {
|
} else if (argc == 3 && !strcmp(argv[0], "compprop")) {
|
||||||
struct HpmfwupgGetComponentPropertiesCtx cmdCtx;
|
struct HpmfwupgGetComponentPropertiesCtx cmdCtx;
|
||||||
if (str2uchar(argv[1], &(cmdCtx.req.componentId)) != 0
|
if (str2uchar(argv[1], &(cmdCtx.req.componentId)) != 0
|
||||||
|| cmdCtx.req.componentId > 7) {
|
|| cmdCtx.req.componentId > 7) {
|
||||||
@ -2606,23 +2617,23 @@ ipmi_hpmfwupg_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
verbose++;
|
verbose++;
|
||||||
rc = HpmfwupgGetComponentProperties(intf, &cmdCtx);
|
rc = HpmfwupgGetComponentProperties(intf, &cmdCtx);
|
||||||
} else if ((argc == 1) && (strcmp(argv[0], "abort") == 0)) {
|
} else if (argc == 1 && !strcmp(argv[0], "abort")) {
|
||||||
struct HpmfwupgAbortUpgradeCtx cmdCtx;
|
struct HpmfwupgAbortUpgradeCtx cmdCtx;
|
||||||
verbose++;
|
verbose++;
|
||||||
rc = HpmfwupgAbortUpgrade(intf, &cmdCtx);
|
rc = HpmfwupgAbortUpgrade(intf, &cmdCtx);
|
||||||
} else if ((argc == 1) && (strcmp(argv[0], "upgstatus") == 0)) {
|
} else if (argc == 1 && !strcmp(argv[0], "upgstatus")) {
|
||||||
struct HpmfwupgGetUpgradeStatusCtx cmdCtx;
|
struct HpmfwupgGetUpgradeStatusCtx cmdCtx;
|
||||||
verbose++;
|
verbose++;
|
||||||
rc = HpmfwupgGetUpgradeStatus(intf, &cmdCtx, NULL, 0);
|
rc = HpmfwupgGetUpgradeStatus(intf, &cmdCtx, NULL, 0);
|
||||||
} else if ((argc == 1) && (strcmp(argv[0], "rollback") == 0)) {
|
} else if (argc == 1 && !strcmp(argv[0], "rollback")) {
|
||||||
struct HpmfwupgManualFirmwareRollbackCtx cmdCtx;
|
struct HpmfwupgManualFirmwareRollbackCtx cmdCtx;
|
||||||
verbose++;
|
verbose++;
|
||||||
rc = HpmfwupgManualFirmwareRollback(intf, &cmdCtx);
|
rc = HpmfwupgManualFirmwareRollback(intf, &cmdCtx);
|
||||||
} else if ((argc == 1) && (strcmp(argv[0], "rollbackstatus") == 0)) {
|
} else if (argc == 1 && !strcmp(argv[0], "rollbackstatus")) {
|
||||||
struct HpmfwupgQueryRollbackStatusCtx cmdCtx;
|
struct HpmfwupgQueryRollbackStatusCtx cmdCtx;
|
||||||
verbose++;
|
verbose++;
|
||||||
rc = HpmfwupgQueryRollbackStatus(intf, &cmdCtx, NULL);
|
rc = HpmfwupgQueryRollbackStatus(intf, &cmdCtx, NULL);
|
||||||
} else if ((argc == 1) && (strcmp(argv[0], "selftestresult") == 0)) {
|
} else if (argc == 1 && !strcmp(argv[0], "selftestresult")) {
|
||||||
struct HpmfwupgQuerySelftestResultCtx cmdCtx;
|
struct HpmfwupgQuerySelftestResultCtx cmdCtx;
|
||||||
verbose++;
|
verbose++;
|
||||||
rc = HpmfwupgQuerySelftestResult(intf, &cmdCtx, NULL);
|
rc = HpmfwupgQuerySelftestResult(intf, &cmdCtx, NULL);
|
||||||
|
78
lib/ipmi_ime.c
Executable file → Normal file
78
lib/ipmi_ime.c
Executable file → Normal file
@ -202,11 +202,11 @@ static int ImeGetInfo(struct ipmi_intf *intf)
|
|||||||
req.msg.data_len = 0;
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Get Device ID command failed");
|
lprintf(LOG_ERR, "Get Device ID command failed");
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Get Device ID command failed: %s",
|
lprintf(LOG_ERR, "Get Device ID command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
@ -240,8 +240,7 @@ static int ImeGetInfo(struct ipmi_intf *intf)
|
|||||||
{
|
{
|
||||||
rc = IME_SUCCESS;
|
rc = IME_SUCCESS;
|
||||||
printf("Manufacturer Name : %s\n",
|
printf("Manufacturer Name : %s\n",
|
||||||
val2str( (long)IPM_DEV_MANUFACTURER_ID(devid->manufacturer_id),
|
OEM_MFG_STRING(devid->manufacturer_id));
|
||||||
ipmi_oem_info) );
|
|
||||||
|
|
||||||
printf("Product ID : %u (0x%02x%02x)\n",
|
printf("Product ID : %u (0x%02x%02x)\n",
|
||||||
buf2short((uint8_t *)(devid->product_id)),
|
buf2short((uint8_t *)(devid->product_id)),
|
||||||
@ -251,7 +250,7 @@ static int ImeGetInfo(struct ipmi_intf *intf)
|
|||||||
(devid->product_id[1]<<8)+devid->product_id[0],
|
(devid->product_id[1]<<8)+devid->product_id[0],
|
||||||
ipmi_oem_product_info);
|
ipmi_oem_product_info);
|
||||||
|
|
||||||
if (product!=NULL)
|
if (product)
|
||||||
{
|
{
|
||||||
printf("Product Name : %s\n", product);
|
printf("Product Name : %s\n", product);
|
||||||
}
|
}
|
||||||
@ -357,12 +356,7 @@ static int ImeUpgrade(struct ipmi_intf *intf, char* imageFilename)
|
|||||||
|
|
||||||
rc = ImeImageCtxFromFile(imageFilename, &imgCtx);
|
rc = ImeImageCtxFromFile(imageFilename, &imgCtx);
|
||||||
|
|
||||||
if(
|
if (rc == IME_ERROR || !imgCtx.pData || !imgCtx.size) {
|
||||||
(rc == IME_ERROR) ||
|
|
||||||
(imgCtx.pData == NULL) ||
|
|
||||||
(imgCtx.size == 0)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,11 +504,11 @@ static int ImeUpdatePrepare(struct ipmi_intf *intf)
|
|||||||
req.msg.data_len = 0;
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "UpdatePrepare command failed");
|
lprintf(LOG_ERR, "UpdatePrepare command failed");
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
|
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
@ -545,11 +539,11 @@ static int ImeUpdateOpenArea(struct ipmi_intf *intf)
|
|||||||
req.msg.data_len = 2;
|
req.msg.data_len = 2;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "UpdateOpenArea command failed");
|
lprintf(LOG_ERR, "UpdateOpenArea command failed");
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "UpdateOpenArea command failed: %s",
|
lprintf(LOG_ERR, "UpdateOpenArea command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
@ -585,11 +579,11 @@ static int ImeUpdateWriteArea(
|
|||||||
req.msg.data_len = length + 1;
|
req.msg.data_len = length + 1;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "UpdateWriteArea command failed");
|
lprintf(LOG_ERR, "UpdateWriteArea command failed");
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "UpdateWriteArea command failed: %s",
|
lprintf(LOG_ERR, "UpdateWriteArea command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
if( rsp->ccode == 0x80) // restart operation
|
if( rsp->ccode == 0x80) // restart operation
|
||||||
@ -632,11 +626,11 @@ static int ImeUpdateCloseArea(
|
|||||||
req.msg.data_len = length;
|
req.msg.data_len = length;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "UpdateCloseArea command failed");
|
lprintf(LOG_ERR, "UpdateCloseArea command failed");
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "UpdateCloseArea command failed: %s",
|
lprintf(LOG_ERR, "UpdateCloseArea command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
@ -666,11 +660,11 @@ static int ImeUpdateGetStatus(struct ipmi_intf *intf, tImeStatus *pStatus )
|
|||||||
req.msg.data_len = 0;
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "UpdatePrepare command failed");
|
lprintf(LOG_ERR, "UpdatePrepare command failed");
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
|
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
@ -739,11 +733,11 @@ static int ImeUpdateGetCapabilities(struct ipmi_intf *intf, tImeCaps *pCaps )
|
|||||||
req.msg.data_len = 0;
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "UpdatePrepare command failed");
|
lprintf(LOG_ERR, "UpdatePrepare command failed");
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
|
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
@ -779,11 +773,11 @@ static int ImeUpdateRegisterUpdate(struct ipmi_intf *intf, tImeUpdateType type)
|
|||||||
req.msg.data_len = 2;
|
req.msg.data_len = 2;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed");
|
lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed");
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed: %s",
|
lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
@ -810,11 +804,11 @@ static int ImeUpdateShowStatus(struct ipmi_intf *intf)
|
|||||||
req.msg.data_len = 0;
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "UpdatePrepare command failed");
|
lprintf(LOG_ERR, "UpdatePrepare command failed");
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
|
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return IME_ERROR;
|
return IME_ERROR;
|
||||||
@ -880,14 +874,12 @@ static int ImeImageCtxFromFile(
|
|||||||
int rc = IME_SUCCESS;
|
int rc = IME_SUCCESS;
|
||||||
FILE* pImageFile = fopen(imageFilename, "rb");
|
FILE* pImageFile = fopen(imageFilename, "rb");
|
||||||
|
|
||||||
if ( pImageFile == NULL )
|
if (!pImageFile) {
|
||||||
{
|
|
||||||
lprintf(LOG_NOTICE,"Cannot open image file %s", imageFilename);
|
lprintf(LOG_NOTICE,"Cannot open image file %s", imageFilename);
|
||||||
rc = IME_ERROR;
|
rc = IME_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rc == IME_SUCCESS )
|
if (rc == IME_SUCCESS) {
|
||||||
{
|
|
||||||
/* Get the raw data in file */
|
/* Get the raw data in file */
|
||||||
fseek(pImageFile, 0, SEEK_END);
|
fseek(pImageFile, 0, SEEK_END);
|
||||||
pImageCtx->size = ftell(pImageFile);
|
pImageCtx->size = ftell(pImageFile);
|
||||||
@ -901,13 +893,9 @@ static int ImeImageCtxFromFile(
|
|||||||
pImageCtx->pData = malloc(sizeof(unsigned char)*pImageCtx->size);
|
pImageCtx->pData = malloc(sizeof(unsigned char)*pImageCtx->size);
|
||||||
rewind(pImageFile);
|
rewind(pImageFile);
|
||||||
|
|
||||||
if ( pImageCtx->pData != NULL )
|
if (!pImageCtx->pData
|
||||||
{
|
|| pImageCtx->size < fread(pImageCtx->pData, sizeof(unsigned char),
|
||||||
if (pImageCtx->size < fread(pImageCtx->pData, sizeof(unsigned char),
|
|
||||||
pImageCtx->size, pImageFile))
|
pImageCtx->size, pImageFile))
|
||||||
rc = IME_ERROR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
rc = IME_ERROR;
|
rc = IME_ERROR;
|
||||||
}
|
}
|
||||||
@ -919,9 +907,7 @@ static int ImeImageCtxFromFile(
|
|||||||
pImageCtx->crc8 = ImeCrc8(pImageCtx->size, pImageCtx->pData);
|
pImageCtx->crc8 = ImeCrc8(pImageCtx->size, pImageCtx->pData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pImageFile) {
|
||||||
if( pImageFile != NULL)
|
|
||||||
{
|
|
||||||
fclose(pImageFile);
|
fclose(pImageFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1002,16 +988,13 @@ int ipmi_ime_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_DEBUG,"ipmi_ime_main()");
|
lprintf(LOG_DEBUG,"ipmi_ime_main()");
|
||||||
|
|
||||||
|
|
||||||
if ( (argc == 0) || (strcmp(argv[0], "help") == 0) )
|
if (!argc || !strcmp(argv[0], "help")) {
|
||||||
{
|
|
||||||
ImePrintUsage();
|
ImePrintUsage();
|
||||||
}
|
}
|
||||||
else if ( (argc == 0) || (strcmp(argv[0], "info") == 0) )
|
else if (!strcmp(argv[0], "info")) {
|
||||||
{
|
|
||||||
rc = ImeGetInfo(intf);
|
rc = ImeGetInfo(intf);
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[0], "update") == 0)
|
else if (!strcmp(argv[0], "update")) {
|
||||||
{
|
|
||||||
if(argc == 2)
|
if(argc == 2)
|
||||||
{
|
{
|
||||||
lprintf(LOG_NOTICE,"Update using file: %s", argv[1]);
|
lprintf(LOG_NOTICE,"Update using file: %s", argv[1]);
|
||||||
@ -1023,8 +1006,7 @@ int ipmi_ime_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
rc = IME_ERROR;
|
rc = IME_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( (argc == 0) || (strcmp(argv[0], "rollback") == 0) )
|
else if (!strcmp(argv[0], "rollback")) {
|
||||||
{
|
|
||||||
rc = ImeManualRollback(intf);
|
rc = ImeManualRollback(intf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
* 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.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
#define _XOPEN_SOURCE
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -84,7 +83,7 @@ static int ipmi_get_isol_info(struct ipmi_intf * intf,
|
|||||||
data[3] = 0x00; /* selector */
|
data[3] = 0x00; /* selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error in Get ISOL Config Command");
|
lprintf(LOG_ERR, "Error in Get ISOL Config Command");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -92,7 +91,7 @@ static int ipmi_get_isol_info(struct ipmi_intf * intf,
|
|||||||
lprintf(LOG_ERR, "IPMI v1.5 Serial Over Lan (ISOL) not supported!");
|
lprintf(LOG_ERR, "IPMI v1.5 Serial Over Lan (ISOL) not supported!");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
|
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -108,11 +107,11 @@ static int ipmi_get_isol_info(struct ipmi_intf * intf,
|
|||||||
data[3] = 0x00; /* selector */
|
data[3] = 0x00; /* selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error in Get ISOL Config Command");
|
lprintf(LOG_ERR, "Error in Get ISOL Config Command");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
|
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -128,11 +127,11 @@ static int ipmi_get_isol_info(struct ipmi_intf * intf,
|
|||||||
data[3] = 0x00; /* selector */
|
data[3] = 0x00; /* selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error in Get ISOL Config Command");
|
lprintf(LOG_ERR, "Error in Get ISOL Config Command");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
|
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -193,12 +192,12 @@ static int ipmi_isol_set_param(struct ipmi_intf * intf,
|
|||||||
/*
|
/*
|
||||||
* enabled
|
* enabled
|
||||||
*/
|
*/
|
||||||
if (strcmp(param, "enabled") == 0)
|
if (!strcmp(param, "enabled"))
|
||||||
{
|
{
|
||||||
data[1] = ISOL_ENABLE_PARAM;
|
data[1] = ISOL_ENABLE_PARAM;
|
||||||
if (strcmp(value, "true") == 0)
|
if (!strcmp(value, "true"))
|
||||||
data[2] = 0x01;
|
data[2] = 0x01;
|
||||||
else if (strcmp(value, "false") == 0)
|
else if (!strcmp(value, "false"))
|
||||||
data[2] = 0x00;
|
data[2] = 0x00;
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR, "Invalid value %s for parameter %s",
|
lprintf(LOG_ERR, "Invalid value %s for parameter %s",
|
||||||
@ -211,7 +210,7 @@ static int ipmi_isol_set_param(struct ipmi_intf * intf,
|
|||||||
/*
|
/*
|
||||||
* privilege-level
|
* privilege-level
|
||||||
*/
|
*/
|
||||||
else if (strcmp(param, "privilege-level") == 0)
|
else if (!strcmp(param, "privilege-level"))
|
||||||
{
|
{
|
||||||
data[1] = ISOL_AUTHENTICATION_PARAM;
|
data[1] = ISOL_AUTHENTICATION_PARAM;
|
||||||
if (! strcmp(value, "user"))
|
if (! strcmp(value, "user"))
|
||||||
@ -236,22 +235,22 @@ static int ipmi_isol_set_param(struct ipmi_intf * intf,
|
|||||||
/*
|
/*
|
||||||
* bit-rate
|
* bit-rate
|
||||||
*/
|
*/
|
||||||
else if (strcmp(param, "bit-rate") == 0)
|
else if (!strcmp(param, "bit-rate"))
|
||||||
{
|
{
|
||||||
data[1] = ISOL_BAUD_RATE_PARAM;
|
data[1] = ISOL_BAUD_RATE_PARAM;
|
||||||
if (strncmp(value, "9.6", 3) == 0) {
|
if (!strcmp(value, "9.6")) {
|
||||||
data[2] = 0x06;
|
data[2] = 0x06;
|
||||||
}
|
}
|
||||||
else if (strncmp(value, "19.2", 4) == 0) {
|
else if (!strcmp(value, "19.2")) {
|
||||||
data[2] = 0x07;
|
data[2] = 0x07;
|
||||||
}
|
}
|
||||||
else if (strncmp(value, "38.4", 4) == 0) {
|
else if (!strcmp(value, "38.4")) {
|
||||||
data[2] = 0x08;
|
data[2] = 0x08;
|
||||||
}
|
}
|
||||||
else if (strncmp(value, "57.6", 4) == 0) {
|
else if (!strcmp(value, "57.6")) {
|
||||||
data[2] = 0x09;
|
data[2] = 0x09;
|
||||||
}
|
}
|
||||||
else if (strncmp(value, "115.2", 5) == 0) {
|
else if (!strcmp(value, "115.2")) {
|
||||||
data[2] = 0x0A;
|
data[2] = 0x0A;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -272,11 +271,11 @@ static int ipmi_isol_set_param(struct ipmi_intf * intf,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error setting ISOL parameter '%s'", param);
|
lprintf(LOG_ERR, "Error setting ISOL parameter '%s'", param);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Error setting ISOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error setting ISOL parameter '%s': %s",
|
||||||
param, val2str(rsp->ccode, completion_code_vals));
|
param, val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -429,11 +428,11 @@ ipmi_isol_deactivate(struct ipmi_intf * intf)
|
|||||||
data[5] = 0x00;
|
data[5] = 0x00;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error deactivating ISOL");
|
lprintf(LOG_ERR, "Error deactivating ISOL");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Error deactivating ISOL: %s",
|
lprintf(LOG_ERR, "Error deactivating ISOL: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -573,7 +572,7 @@ ipmi_isol_red_pill(struct ipmi_intf * intf)
|
|||||||
int timedout = 0;
|
int timedout = 0;
|
||||||
|
|
||||||
buffer = (char*)malloc(buffer_size);
|
buffer = (char*)malloc(buffer_size);
|
||||||
if (buffer == NULL) {
|
if (!buffer) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -791,20 +790,20 @@ int ipmi_isol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
/*
|
/*
|
||||||
* Help
|
* Help
|
||||||
*/
|
*/
|
||||||
if (!argc || !strncmp(argv[0], "help", 4))
|
if (!argc || !strcmp(argv[0], "help"))
|
||||||
print_isol_usage();
|
print_isol_usage();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Info
|
* Info
|
||||||
*/
|
*/
|
||||||
else if (!strncmp(argv[0], "info", 4)) {
|
else if (!strcmp(argv[0], "info")) {
|
||||||
ret = ipmi_print_isol_info(intf);
|
ret = ipmi_print_isol_info(intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set a parameter value
|
* Set a parameter value
|
||||||
*/
|
*/
|
||||||
else if (!strncmp(argv[0], "set", 3)) {
|
else if (!strcmp(argv[0], "set")) {
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
print_isol_set_usage();
|
print_isol_set_usage();
|
||||||
return -1;
|
return -1;
|
||||||
@ -815,7 +814,7 @@ int ipmi_isol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
/*
|
/*
|
||||||
* Activate
|
* Activate
|
||||||
*/
|
*/
|
||||||
else if (!strncmp(argv[0], "activate", 8)) {
|
else if (!strcmp(argv[0], "activate")) {
|
||||||
ret = ipmi_isol_activate(intf);
|
ret = ipmi_isol_activate(intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +60,7 @@ static void ipmi_kontron_help(void);
|
|||||||
static int ipmi_kontron_set_serial_number(struct ipmi_intf *intf);
|
static int ipmi_kontron_set_serial_number(struct ipmi_intf *intf);
|
||||||
static int ipmi_kontron_set_mfg_date (struct ipmi_intf *intf);
|
static int ipmi_kontron_set_mfg_date (struct ipmi_intf *intf);
|
||||||
static void ipmi_kontron_nextboot_help(void);
|
static void ipmi_kontron_nextboot_help(void);
|
||||||
static int ipmi_kontron_nextboot_set(struct ipmi_intf *intf, int argc,
|
static int ipmi_kontron_nextboot_set(struct ipmi_intf *intf, char **argv);
|
||||||
char **argv);
|
|
||||||
static int ipmi_kontronoem_send_set_large_buffer(struct ipmi_intf *intf,
|
static int ipmi_kontronoem_send_set_large_buffer(struct ipmi_intf *intf,
|
||||||
unsigned char channel, unsigned char size);
|
unsigned char channel, unsigned char size);
|
||||||
|
|
||||||
@ -76,38 +75,38 @@ ipmi_kontronoem_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
ipmi_kontron_help();
|
ipmi_kontron_help();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (strncmp(argv[0], "help", 4) == 0) {
|
if (!strcmp(argv[0], "help")) {
|
||||||
ipmi_kontron_help();
|
ipmi_kontron_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (!strncmp(argv[0], "setsn", 5)) {
|
} else if (!strcmp(argv[0], "setsn")) {
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
printf("fru setsn\n");
|
printf("fru setsn\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (ipmi_kontron_set_serial_number(intf) > 0) {
|
if (ipmi_kontron_set_serial_number(intf) > 0) {
|
||||||
printf("FRU serial number setted successfully\n");
|
printf("FRU serial number set successfully\n");
|
||||||
} else {
|
} else {
|
||||||
printf("FRU serial number set failed\n");
|
printf("FRU serial number set failed\n");
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
}
|
}
|
||||||
} else if (!strncmp(argv[0], "setmfgdate", 10)) {
|
} else if (!strcmp(argv[0], "setmfgdate")) {
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
printf("fru setmfgdate\n");
|
printf("fru setmfgdate\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (ipmi_kontron_set_mfg_date(intf) > 0) {
|
if (ipmi_kontron_set_mfg_date(intf) > 0) {
|
||||||
printf("FRU manufacturing date setted successfully\n");
|
printf("FRU manufacturing date set successfully\n");
|
||||||
} else {
|
} else {
|
||||||
printf("FRU manufacturing date set failed\n");
|
printf("FRU manufacturing date set failed\n");
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
}
|
}
|
||||||
} else if (!strncmp(argv[0], "nextboot", 8)) {
|
} else if (!strcmp(argv[0], "nextboot")) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
ipmi_kontron_nextboot_help();
|
ipmi_kontron_nextboot_help();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
rc = ipmi_kontron_nextboot_set(intf, (argc - 1), (argv + 1));
|
rc = ipmi_kontron_nextboot_set(intf, (argv + 1));
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
printf("Nextboot set successfully\n");
|
printf("Nextboot set successfully\n");
|
||||||
} else {
|
} else {
|
||||||
@ -188,10 +187,10 @@ ipmi_kontronoem_send_set_large_buffer(struct ipmi_intf *intf,
|
|||||||
req.msg.data_len = 2;
|
req.msg.data_len = 2;
|
||||||
req.msg.lun = 0x00;
|
req.msg.lun = 0x00;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf("Cannot send large buffer command\n");
|
printf("Cannot send large buffer command\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
} else if (rsp->ccode > 0) {
|
} else if (rsp->ccode) {
|
||||||
printf("Invalid length for the selected interface (%s) %d\n",
|
printf("Invalid length for the selected interface (%s) %d\n",
|
||||||
val2str(rsp->ccode, completion_code_vals), rsp->ccode);
|
val2str(rsp->ccode, completion_code_vals), rsp->ccode);
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -243,16 +242,16 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
|
|||||||
/* Set Lun, necessary for this oem command */
|
/* Set Lun, necessary for this oem command */
|
||||||
req.msg.lun = 0x03;
|
req.msg.lun = 0x03;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf(" Device not present (No Response)\n");
|
printf(" Device not present (No Response)\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode > 0) {
|
} else if (rsp->ccode) {
|
||||||
printf(" This option is not implemented for this board\n");
|
printf(" This option is not implemented for this board\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
sn_size = rsp->data_len;
|
sn_size = rsp->data_len;
|
||||||
sn = malloc(sn_size + 1);
|
sn = malloc(sn_size + 1);
|
||||||
if (sn == NULL) {
|
if (!sn) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -269,12 +268,12 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
|
|||||||
req.msg.data = msg_data;
|
req.msg.data = msg_data;
|
||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf(" Device not present (No Response)\n");
|
printf(" Device not present (No Response)\n");
|
||||||
free(sn);
|
free(sn);
|
||||||
sn = NULL;
|
sn = NULL;
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode > 0) {
|
} else if (rsp->ccode) {
|
||||||
printf(" Device not present (%s)\n",
|
printf(" Device not present (%s)\n",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
free(sn);
|
free(sn);
|
||||||
@ -302,12 +301,12 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
|
|||||||
req.msg.data = msg_data;
|
req.msg.data = msg_data;
|
||||||
req.msg.data_len = 4;
|
req.msg.data_len = 4;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf(" Device not present (No Response)\n");
|
printf(" Device not present (No Response)\n");
|
||||||
free(sn);
|
free(sn);
|
||||||
sn = NULL;
|
sn = NULL;
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode > 0) {
|
} else if (rsp->ccode) {
|
||||||
printf(" Device not present (%s)\n",
|
printf(" Device not present (%s)\n",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
free(sn);
|
free(sn);
|
||||||
@ -328,7 +327,7 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
|
|||||||
/* Set the Board Section */
|
/* Set the Board Section */
|
||||||
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
|
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
|
||||||
fru_data = malloc(fru.size);
|
fru_data = malloc(fru.size);
|
||||||
if (fru_data == NULL) {
|
if (!fru_data) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
free(sn);
|
free(sn);
|
||||||
sn = NULL;
|
sn = NULL;
|
||||||
@ -346,20 +345,20 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
|
|||||||
/* Position at Board Manufacturer */
|
/* Position at Board Manufacturer */
|
||||||
fru_data_offset = (header.offset.board * 8) + 6;
|
fru_data_offset = (header.offset.board * 8) + 6;
|
||||||
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
||||||
if (fru_area != NULL) {
|
if (fru_area) {
|
||||||
free(fru_area);
|
free(fru_area);
|
||||||
fru_area = NULL;
|
fru_area = NULL;
|
||||||
}
|
}
|
||||||
/* Position at Board Product Name */
|
/* Position at Board Product Name */
|
||||||
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
||||||
if (fru_area != NULL) {
|
if (fru_area) {
|
||||||
free(fru_area);
|
free(fru_area);
|
||||||
fru_area = NULL;
|
fru_area = NULL;
|
||||||
}
|
}
|
||||||
fru_data_offset_tmp = fru_data_offset;
|
fru_data_offset_tmp = fru_data_offset;
|
||||||
/* Position at Serial Number */
|
/* Position at Serial Number */
|
||||||
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
|
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
|
||||||
if (fru_area == NULL) {
|
if (!fru_area) {
|
||||||
lprintf(LOG_ERR, "Failed to read FRU Area string.");
|
lprintf(LOG_ERR, "Failed to read FRU Area string.");
|
||||||
free(fru_data);
|
free(fru_data);
|
||||||
fru_data = NULL;
|
fru_data = NULL;
|
||||||
@ -420,32 +419,32 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
|
|||||||
/* Position at Product Manufacturer */
|
/* Position at Product Manufacturer */
|
||||||
fru_data_offset = (header.offset.product * 8) + 3;
|
fru_data_offset = (header.offset.product * 8) + 3;
|
||||||
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
||||||
if (fru_area != NULL) {
|
if (fru_area) {
|
||||||
free(fru_area);
|
free(fru_area);
|
||||||
fru_area = NULL;
|
fru_area = NULL;
|
||||||
}
|
}
|
||||||
/* Position at Product Name */
|
/* Position at Product Name */
|
||||||
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
||||||
if (fru_area != NULL) {
|
if (fru_area) {
|
||||||
free(fru_area);
|
free(fru_area);
|
||||||
fru_area = NULL;
|
fru_area = NULL;
|
||||||
}
|
}
|
||||||
/* Position at Product Part */
|
/* Position at Product Part */
|
||||||
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
||||||
if (fru_area != NULL) {
|
if (fru_area) {
|
||||||
free(fru_area);
|
free(fru_area);
|
||||||
fru_area = NULL;
|
fru_area = NULL;
|
||||||
}
|
}
|
||||||
/* Position at Product Version */
|
/* Position at Product Version */
|
||||||
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
fru_area = get_fru_area_str(fru_data, &fru_data_offset);
|
||||||
if (fru_area != NULL) {
|
if (fru_area) {
|
||||||
free(fru_area);
|
free(fru_area);
|
||||||
fru_area = NULL;
|
fru_area = NULL;
|
||||||
}
|
}
|
||||||
fru_data_offset_tmp = fru_data_offset;
|
fru_data_offset_tmp = fru_data_offset;
|
||||||
/* Position at Serial Number */
|
/* Position at Serial Number */
|
||||||
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
|
fru_area = get_fru_area_str(fru_data, &fru_data_offset_tmp);
|
||||||
if (fru_area == NULL) {
|
if (!fru_area) {
|
||||||
lprintf(LOG_ERR, "Failed to read FRU Area string.");
|
lprintf(LOG_ERR, "Failed to read FRU Area string.");
|
||||||
free(sn);
|
free(sn);
|
||||||
sn = NULL;
|
sn = NULL;
|
||||||
@ -532,10 +531,10 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
|
|||||||
/* Set Lun temporary, necessary for this oem command */
|
/* Set Lun temporary, necessary for this oem command */
|
||||||
req.msg.lun = 0x03;
|
req.msg.lun = 0x03;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf("Device not present (No Response)\n");
|
printf("Device not present (No Response)\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
} else if (rsp->ccode > 0) {
|
} else if (rsp->ccode) {
|
||||||
printf("This option is not implemented for this board\n");
|
printf("This option is not implemented for this board\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@ -554,10 +553,10 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
|
|||||||
req.msg.data = msg_data;
|
req.msg.data = msg_data;
|
||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf(" Device not present (No Response)\n");
|
printf(" Device not present (No Response)\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
} else if (rsp->ccode > 0) {
|
} else if (rsp->ccode) {
|
||||||
printf(" Device not present (%s)\n",
|
printf(" Device not present (%s)\n",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -582,10 +581,10 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
|
|||||||
req.msg.data = msg_data;
|
req.msg.data = msg_data;
|
||||||
req.msg.data_len = 4;
|
req.msg.data_len = 4;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf(" Device not present (No Response)\n");
|
printf(" Device not present (No Response)\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode > 0) {
|
} else if (rsp->ccode) {
|
||||||
printf(" Device not present (%s)\n",
|
printf(" Device not present (%s)\n",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -601,7 +600,7 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
|
|||||||
}
|
}
|
||||||
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
|
board_sec_len = (header.offset.product * 8) - (header.offset.board * 8);
|
||||||
fru_data = malloc(fru.size);
|
fru_data = malloc(fru.size);
|
||||||
if(fru_data == NULL) {
|
if (!fru_data) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@ -656,7 +655,7 @@ ipmi_kontron_nextboot_help(void)
|
|||||||
* returns 1 if successful
|
* returns 1 if successful
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ipmi_kontron_nextboot_set(struct ipmi_intf *intf, int argc, char **argv)
|
ipmi_kontron_nextboot_set(struct ipmi_intf *intf, char **argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -672,7 +671,7 @@ ipmi_kontron_nextboot_set(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
msg_data[5] = 0xFF;
|
msg_data[5] = 0xFF;
|
||||||
msg_data[6] = 0xFF; /* any */
|
msg_data[6] = 0xFF; /* any */
|
||||||
for (i = 0; bootdev[i] != 0; i++) {
|
for (i = 0; bootdev[i] != 0; i++) {
|
||||||
if (strcmp(argv[0], bootdev[i]) == 0) {
|
if (!strcmp(argv[0], bootdev[i])) {
|
||||||
msg_data[5] = i;
|
msg_data[5] = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -690,10 +689,10 @@ ipmi_kontron_nextboot_set(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
/* Set Lun temporary, necessary for this oem command */
|
/* Set Lun temporary, necessary for this oem command */
|
||||||
req.msg.lun = 0x03;
|
req.msg.lun = 0x03;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
printf("Device not present (No Response)\n");
|
printf("Device not present (No Response)\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
} else if (rsp->ccode > 0) {
|
} else if (rsp->ccode) {
|
||||||
printf("Device not present (%s)\n",
|
printf("Device not present (%s)\n",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return (-1);
|
return (-1);
|
||||||
|
602
lib/ipmi_lanp.c
602
lib/ipmi_lanp.c
File diff suppressed because it is too large
Load Diff
@ -333,7 +333,7 @@ ipmi_lanp_err(const struct ipmi_rs *rsp, const struct ipmi_lanp *p,
|
|||||||
int log_level = LOG_ERR;
|
int log_level = LOG_ERR;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
reason = "No response";
|
reason = "No response";
|
||||||
err = -1;
|
err = -1;
|
||||||
} else {
|
} else {
|
||||||
@ -354,7 +354,7 @@ ipmi_lanp_err(const struct ipmi_rs *rsp, const struct ipmi_lanp *p,
|
|||||||
reason = val2str(rsp->ccode, lanp_cc_vals);
|
reason = val2str(rsp->ccode, lanp_cc_vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reason == NULL) {
|
if (!reason) {
|
||||||
/* print completion code value */
|
/* print completion code value */
|
||||||
snprintf(cc_msg, sizeof(cc_msg), "CC=%02x", rsp->ccode);
|
snprintf(cc_msg, sizeof(cc_msg), "CC=%02x", rsp->ccode);
|
||||||
reason = cc_msg;
|
reason = cc_msg;
|
||||||
@ -403,7 +403,7 @@ ipmi_get_dynamic_oem_lanp(void *priv, const struct ipmi_lanp *param,
|
|||||||
param->name, set_selector, block_selector);
|
param->name, set_selector, block_selector);
|
||||||
|
|
||||||
rsp = lp->intf->sendrecv(lp->intf, &req);
|
rsp = lp->intf->sendrecv(lp->intf, &req);
|
||||||
if (rsp == NULL || rsp->ccode) {
|
if (!rsp || rsp->ccode) {
|
||||||
return ipmi_lanp_err(rsp, param, "get", quiet);
|
return ipmi_lanp_err(rsp, param, "get", quiet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,7 +467,7 @@ ipmi_set_dynamic_oem_lanp(void *priv, const struct ipmi_lanp *param,
|
|||||||
lprintf(LOG_INFO, "Setting parameter '%s'", param->name);
|
lprintf(LOG_INFO, "Setting parameter '%s'", param->name);
|
||||||
|
|
||||||
rsp = lp->intf->sendrecv(lp->intf, &req);
|
rsp = lp->intf->sendrecv(lp->intf, &req);
|
||||||
if (rsp == NULL || rsp->ccode) {
|
if (!rsp || rsp->ccode) {
|
||||||
return ipmi_lanp_err(rsp, param, "set", 0);
|
return ipmi_lanp_err(rsp, param, "set", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,9 +1027,7 @@ static void lanp_print_usage(int cmd)
|
|||||||
printf("\n available parameters:\n");
|
printf("\n available parameters:\n");
|
||||||
/* 'save' shall use 'write' filter, since it outputs a block
|
/* 'save' shall use 'write' filter, since it outputs a block
|
||||||
* of 'set's */
|
* of 'set's */
|
||||||
ipmi_cfgp_usage(lan_cfgp,
|
ipmi_cfgp_usage(lan_cfgp, ARRAY_SIZE(lan_cfgp), cmd != LANP_CMD_PRINT);
|
||||||
sizeof(lan_cfgp)/sizeof(lan_cfgp[0]),
|
|
||||||
cmd != LANP_CMD_PRINT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,7 +1159,7 @@ ipmi_lan6_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ipmi_cfgp_init(&ctx, lan_cfgp,
|
ipmi_cfgp_init(&ctx, lan_cfgp,
|
||||||
sizeof(lan_cfgp)/sizeof(lan_cfgp[0]), "lan6 set nolock",
|
ARRAY_SIZE(lan_cfgp), "lan6 set nolock",
|
||||||
lanp_ip6_cfgp, &lp);
|
lanp_ip6_cfgp, &lp);
|
||||||
|
|
||||||
ret = ipmi_cfgp_parse_sel(&ctx, argc, (const char **)argv, &sel);
|
ret = ipmi_cfgp_parse_sel(&ctx, argc, (const char **)argv, &sel);
|
||||||
|
197
lib/ipmi_main.c
197
lib/ipmi_main.c
@ -29,11 +29,6 @@
|
|||||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
* 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.
|
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
#define _XOPEN_SOURCE 700
|
|
||||||
#define _BSD_SOURCE || \
|
|
||||||
(_XOPEN_SOURCE >= 500 || \
|
|
||||||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) && \
|
|
||||||
!(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -47,6 +42,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#include <ipmitool/helper.h>
|
#include <ipmitool/helper.h>
|
||||||
#include <ipmitool/log.h>
|
#include <ipmitool/log.h>
|
||||||
@ -70,18 +66,20 @@
|
|||||||
#include <ipmitool/ipmi_user.h>
|
#include <ipmitool/ipmi_user.h>
|
||||||
#include <ipmitool/ipmi_raw.h>
|
#include <ipmitool/ipmi_raw.h>
|
||||||
#include <ipmitool/ipmi_pef.h>
|
#include <ipmitool/ipmi_pef.h>
|
||||||
|
#include <ipmitool/ipmi_time.h>
|
||||||
#include <ipmitool/ipmi_oem.h>
|
#include <ipmitool/ipmi_oem.h>
|
||||||
#include <ipmitool/ipmi_ekanalyzer.h>
|
#include <ipmitool/ipmi_ekanalyzer.h>
|
||||||
#include <ipmitool/ipmi_picmg.h>
|
#include <ipmitool/ipmi_picmg.h>
|
||||||
#include <ipmitool/ipmi_kontronoem.h>
|
#include <ipmitool/ipmi_kontronoem.h>
|
||||||
#include <ipmitool/ipmi_vita.h>
|
#include <ipmitool/ipmi_vita.h>
|
||||||
|
#include <ipmitool/ipmi_quantaoem.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_ALL_OPTIONS
|
#ifdef ENABLE_ALL_OPTIONS
|
||||||
# define OPTION_STRING "I:46hVvcgsEKYao:H:d:P:f:U:p:C:L:A:t:T:m:z:S:l:b:B:e:k:y:O:R:N:D:"
|
# define OPTION_STRING "I:46hVvcgsEKYao:H:d:P:f:U:p:C:L:A:t:T:m:z:S:l:b:B:e:k:y:O:R:N:D:Z"
|
||||||
#else
|
#else
|
||||||
# define OPTION_STRING "I:46hVvcH:f:U:p:d:S:D:"
|
# define OPTION_STRING "I:46hVvcH:f:U:p:d:S:D:"
|
||||||
#endif
|
#endif
|
||||||
@ -90,8 +88,6 @@
|
|||||||
void
|
void
|
||||||
ipmi_intf_set_max_request_data_size(struct ipmi_intf * intf, uint16_t size);
|
ipmi_intf_set_max_request_data_size(struct ipmi_intf * intf, uint16_t size);
|
||||||
|
|
||||||
extern int verbose;
|
|
||||||
extern int csv_output;
|
|
||||||
extern const struct valstr ipmi_privlvl_vals[];
|
extern const struct valstr ipmi_privlvl_vals[];
|
||||||
extern const struct valstr ipmi_authtype_session_vals[];
|
extern const struct valstr ipmi_authtype_session_vals[];
|
||||||
|
|
||||||
@ -113,14 +109,14 @@ ipmi_password_file_read(char * filename)
|
|||||||
int l;
|
int l;
|
||||||
|
|
||||||
pass = malloc(21);
|
pass = malloc(21);
|
||||||
if (pass == NULL) {
|
if (!pass) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(pass, 0, 21);
|
memset(pass, 0, 21);
|
||||||
fp = ipmi_open_file_read((const char *)filename);
|
fp = ipmi_open_file_read((const char *)filename);
|
||||||
if (fp == NULL) {
|
if (!fp) {
|
||||||
lprintf(LOG_ERR, "Unable to open password file %s",
|
lprintf(LOG_ERR, "Unable to open password file %s",
|
||||||
filename);
|
filename);
|
||||||
free(pass);
|
free(pass);
|
||||||
@ -128,7 +124,7 @@ ipmi_password_file_read(char * filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* read in id */
|
/* read in id */
|
||||||
if (fgets(pass, 21, fp) == NULL) {
|
if (!fgets(pass, 21, fp)) {
|
||||||
lprintf(LOG_ERR, "Unable to read password from file %s",
|
lprintf(LOG_ERR, "Unable to read password from file %s",
|
||||||
filename);
|
filename);
|
||||||
free(pass);
|
free(pass);
|
||||||
@ -157,10 +153,10 @@ ipmi_cmd_print(struct ipmi_cmd * cmdlist)
|
|||||||
struct ipmi_cmd * cmd;
|
struct ipmi_cmd * cmd;
|
||||||
int hdr = 0;
|
int hdr = 0;
|
||||||
|
|
||||||
if (cmdlist == NULL)
|
if (!cmdlist)
|
||||||
return;
|
return;
|
||||||
for (cmd=cmdlist; cmd->func != NULL; cmd++) {
|
for (cmd=cmdlist; cmd->func; cmd++) {
|
||||||
if (cmd->desc == NULL)
|
if (!cmd->desc)
|
||||||
continue;
|
continue;
|
||||||
if (hdr == 0) {
|
if (hdr == 0) {
|
||||||
lprintf(LOG_NOTICE, "Commands:");
|
lprintf(LOG_NOTICE, "Commands:");
|
||||||
@ -182,7 +178,7 @@ ipmi_cmd_print(struct ipmi_cmd * cmdlist)
|
|||||||
* @argc: command argument count
|
* @argc: command argument count
|
||||||
* @argv: command argument list
|
* @argv: command argument list
|
||||||
*
|
*
|
||||||
* returns value from func() of that commnad if found
|
* returns value from func() of that command if found
|
||||||
* returns -1 if command is not found
|
* returns -1 if command is not found
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
@ -191,25 +187,25 @@ ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv)
|
|||||||
struct ipmi_cmd * cmd = intf->cmdlist;
|
struct ipmi_cmd * cmd = intf->cmdlist;
|
||||||
|
|
||||||
/* hook to run a default command if nothing specified */
|
/* hook to run a default command if nothing specified */
|
||||||
if (name == NULL) {
|
if (!name) {
|
||||||
if (cmd->func == NULL || cmd->name == NULL)
|
if (!cmd->func || !cmd->name)
|
||||||
return -1;
|
return -1;
|
||||||
else if (strncmp(cmd->name, "default", 7) == 0)
|
|
||||||
|
if (!strcmp(cmd->name, "default"))
|
||||||
return cmd->func(intf, 0, NULL);
|
return cmd->func(intf, 0, NULL);
|
||||||
else {
|
|
||||||
lprintf(LOG_ERR, "No command provided!");
|
lprintf(LOG_ERR, "No command provided!");
|
||||||
ipmi_cmd_print(intf->cmdlist);
|
ipmi_cmd_print(intf->cmdlist);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (cmd=intf->cmdlist; cmd->func != NULL; cmd++) {
|
for (cmd=intf->cmdlist; cmd->func; cmd++) {
|
||||||
if (strncmp(name, cmd->name, __maxlen(cmd->name, name)) == 0)
|
if (!strcmp(name, cmd->name))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cmd->func == NULL) {
|
if (!cmd->func) {
|
||||||
cmd = intf->cmdlist;
|
cmd = intf->cmdlist;
|
||||||
if (strncmp(cmd->name, "default", 7) == 0)
|
if (!strcmp(cmd->name, "default"))
|
||||||
return cmd->func(intf, argc+1, argv-1);
|
return cmd->func(intf, argc+1, argv-1);
|
||||||
|
|
||||||
lprintf(LOG_ERR, "Invalid command: %s", name);
|
lprintf(LOG_ERR, "Invalid command: %s", name);
|
||||||
@ -263,12 +259,13 @@ ipmi_option_usage(const char * progname, struct ipmi_cmd * cmdlist, struct ipmi_
|
|||||||
lprintf(LOG_NOTICE, " -O seloem Use file for OEM SEL event descriptions");
|
lprintf(LOG_NOTICE, " -O seloem Use file for OEM SEL event descriptions");
|
||||||
lprintf(LOG_NOTICE, " -N seconds Specify timeout for lan [default=2] / lanplus [default=1] interface");
|
lprintf(LOG_NOTICE, " -N seconds Specify timeout for lan [default=2] / lanplus [default=1] interface");
|
||||||
lprintf(LOG_NOTICE, " -R retry Set the number of retries for lan/lanplus interface [default=4]");
|
lprintf(LOG_NOTICE, " -R retry Set the number of retries for lan/lanplus interface [default=4]");
|
||||||
|
lprintf(LOG_NOTICE, " -Z Display all dates in UTC");
|
||||||
#endif
|
#endif
|
||||||
lprintf(LOG_NOTICE, "");
|
lprintf(LOG_NOTICE, "");
|
||||||
|
|
||||||
ipmi_intf_print(intflist);
|
ipmi_intf_print(intflist);
|
||||||
|
|
||||||
if (cmdlist != NULL)
|
if (cmdlist)
|
||||||
ipmi_cmd_print(cmdlist);
|
ipmi_cmd_print(cmdlist);
|
||||||
}
|
}
|
||||||
/* ipmi_catch_sigint - Handle the interrupt signal (Ctrl-C), close the
|
/* ipmi_catch_sigint - Handle the interrupt signal (Ctrl-C), close the
|
||||||
@ -281,7 +278,7 @@ ipmi_option_usage(const char * progname, struct ipmi_cmd * cmdlist, struct ipmi_
|
|||||||
*/
|
*/
|
||||||
void ipmi_catch_sigint()
|
void ipmi_catch_sigint()
|
||||||
{
|
{
|
||||||
if (ipmi_main_intf != NULL) {
|
if (ipmi_main_intf) {
|
||||||
printf("\nSIGN INT: Close Interface %s\n",ipmi_main_intf->desc);
|
printf("\nSIGN INT: Close Interface %s\n",ipmi_main_intf->desc);
|
||||||
/* reduce retry count to a single retry */
|
/* reduce retry count to a single retry */
|
||||||
ipmi_main_intf->ssn_params.retry = 1;
|
ipmi_main_intf->ssn_params.retry = 1;
|
||||||
@ -323,6 +320,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
uint8_t target_addr = 0;
|
uint8_t target_addr = 0;
|
||||||
uint8_t target_channel = 0;
|
uint8_t target_channel = 0;
|
||||||
|
|
||||||
|
uint8_t u8tmp = 0;
|
||||||
uint8_t transit_addr = 0;
|
uint8_t transit_addr = 0;
|
||||||
uint8_t transit_channel = 0;
|
uint8_t transit_channel = 0;
|
||||||
uint8_t target_lun = 0;
|
uint8_t target_lun = 0;
|
||||||
@ -347,19 +345,29 @@ ipmi_main(int argc, char ** argv,
|
|||||||
char * seloem = NULL;
|
char * seloem = NULL;
|
||||||
int port = 0;
|
int port = 0;
|
||||||
int devnum = 0;
|
int devnum = 0;
|
||||||
int cipher_suite_id = 3; /* See table 22-19 of the IPMIv2 spec */
|
#ifdef IPMI_INTF_LANPLUS
|
||||||
|
/* lookup best cipher suite available */
|
||||||
|
enum cipher_suite_ids cipher_suite_id = IPMI_LANPLUS_CIPHER_SUITE_RESERVED;
|
||||||
|
#endif /* IPMI_INTF_LANPLUS */
|
||||||
int argflag, i, found;
|
int argflag, i, found;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
int ai_family = AF_UNSPEC;
|
int ai_family = AF_UNSPEC;
|
||||||
char sol_escape_char = SOL_ESCAPE_CHARACTER_DEFAULT;
|
char sol_escape_char = SOL_ESCAPE_CHARACTER_DEFAULT;
|
||||||
char * devfile = NULL;
|
char * devfile = NULL;
|
||||||
|
|
||||||
|
/* Set program locale according to system settings */
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
|
||||||
/* save program name */
|
/* save program name */
|
||||||
progname = strrchr(argv[0], '/');
|
progname = strrchr(argv[0], '/');
|
||||||
progname = ((progname == NULL) ? argv[0] : progname+1);
|
progname = ((!progname) ? argv[0] : progname+1);
|
||||||
signal(SIGINT, ipmi_catch_sigint);
|
signal(SIGINT, ipmi_catch_sigint);
|
||||||
memset(kgkey, 0, sizeof(kgkey));
|
memset(kgkey, 0, sizeof(kgkey));
|
||||||
|
|
||||||
|
/* setup log */
|
||||||
|
log_init(progname, 0, 0);
|
||||||
|
|
||||||
while ((argflag = getopt(argc, (char **)argv, OPTION_STRING)) != -1)
|
while ((argflag = getopt(argc, (char **)argv, OPTION_STRING)) != -1)
|
||||||
{
|
{
|
||||||
switch (argflag) {
|
switch (argflag) {
|
||||||
@ -369,18 +377,19 @@ ipmi_main(int argc, char ** argv,
|
|||||||
intfname = NULL;
|
intfname = NULL;
|
||||||
}
|
}
|
||||||
intfname = strdup(optarg);
|
intfname = strdup(optarg);
|
||||||
if (intfname == NULL) {
|
if (!intfname) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (intflist != NULL) {
|
if (intflist) {
|
||||||
found = 0;
|
found = 0;
|
||||||
for (sup=intflist; sup->name != NULL; sup++) {
|
for (sup=intflist; sup->name; sup++) {
|
||||||
if (strncmp(sup->name, intfname, strlen(intfname)) == 0 &&
|
if (!strcmp(sup->name, intfname)
|
||||||
strncmp(sup->name, intfname, strlen(sup->name)) == 0 &&
|
&& sup->supported)
|
||||||
sup->supported == 1)
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
lprintf(LOG_ERR, "Interface %s not supported", intfname);
|
lprintf(LOG_ERR, "Interface %s not supported", intfname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
@ -425,21 +434,24 @@ ipmi_main(int argc, char ** argv,
|
|||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef IPMI_INTF_LANPLUS
|
||||||
case 'C':
|
case 'C':
|
||||||
if (str2int(optarg, &cipher_suite_id) != 0) {
|
/* Cipher Suite ID is a byte as per IPMI specification */
|
||||||
lprintf(LOG_ERR, "Invalid parameter given or out of range for '-C'.");
|
if (str2uchar(optarg, &u8tmp) != 0) {
|
||||||
rc = -1;
|
lprintf(LOG_ERR, "Invalid parameter given or out of "
|
||||||
goto out_free;
|
"range [0-255] for '-C'.");
|
||||||
}
|
|
||||||
/* add check Cipher is -gt 0 */
|
|
||||||
if (cipher_suite_id < 0) {
|
|
||||||
lprintf(LOG_ERR, "Cipher suite ID %i is invalid.", cipher_suite_id);
|
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
cipher_suite_id = u8tmp;
|
||||||
break;
|
break;
|
||||||
|
#endif /* IPMI_INTF_LANPLUS */
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose++;
|
log_level_set(++verbose);
|
||||||
|
if (verbose == 2) {
|
||||||
|
/* add version info to debug output */
|
||||||
|
lprintf(LOG_DEBUG, "%s version %s\n", progname, VERSION);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
csv_output = 1;
|
csv_output = 1;
|
||||||
@ -450,7 +462,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
hostname = NULL;
|
hostname = NULL;
|
||||||
}
|
}
|
||||||
hostname = strdup(optarg);
|
hostname = strdup(optarg);
|
||||||
if (hostname == NULL) {
|
if (!hostname) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -461,7 +473,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
password = NULL;
|
password = NULL;
|
||||||
}
|
}
|
||||||
password = ipmi_password_file_read(optarg);
|
password = ipmi_password_file_read(optarg);
|
||||||
if (password == NULL)
|
if (!password)
|
||||||
lprintf(LOG_ERR, "Unable to read password "
|
lprintf(LOG_ERR, "Unable to read password "
|
||||||
"from file %s", optarg);
|
"from file %s", optarg);
|
||||||
break;
|
break;
|
||||||
@ -471,14 +483,14 @@ ipmi_main(int argc, char ** argv,
|
|||||||
#else
|
#else
|
||||||
tmp_pass = getpass("Password: ");
|
tmp_pass = getpass("Password: ");
|
||||||
#endif
|
#endif
|
||||||
if (tmp_pass != NULL) {
|
if (tmp_pass) {
|
||||||
if (password) {
|
if (password) {
|
||||||
free(password);
|
free(password);
|
||||||
password = NULL;
|
password = NULL;
|
||||||
}
|
}
|
||||||
password = strdup(tmp_pass);
|
password = strdup(tmp_pass);
|
||||||
tmp_pass = NULL;
|
tmp_pass = NULL;
|
||||||
if (password == NULL) {
|
if (!password) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -518,7 +530,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
#else
|
#else
|
||||||
tmp_pass = getpass("Key: ");
|
tmp_pass = getpass("Key: ");
|
||||||
#endif
|
#endif
|
||||||
if (tmp_pass != NULL) {
|
if (tmp_pass) {
|
||||||
memset(kgkey, 0, sizeof(kgkey));
|
memset(kgkey, 0, sizeof(kgkey));
|
||||||
strncpy((char *)kgkey, tmp_pass,
|
strncpy((char *)kgkey, tmp_pass,
|
||||||
sizeof(kgkey) - 1);
|
sizeof(kgkey) - 1);
|
||||||
@ -535,7 +547,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
username = strdup(optarg);
|
username = strdup(optarg);
|
||||||
if (username == NULL) {
|
if (!username) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -546,7 +558,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
sdrcache = NULL;
|
sdrcache = NULL;
|
||||||
}
|
}
|
||||||
sdrcache = strdup(optarg);
|
sdrcache = strdup(optarg);
|
||||||
if (sdrcache == NULL) {
|
if (!sdrcache) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -558,7 +570,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
free(devfile);
|
free(devfile);
|
||||||
}
|
}
|
||||||
devfile = strdup(optarg);
|
devfile = strdup(optarg);
|
||||||
if (devfile == NULL) {
|
if (!devfile) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -602,12 +614,13 @@ ipmi_main(int argc, char ** argv,
|
|||||||
oemtype = NULL;
|
oemtype = NULL;
|
||||||
}
|
}
|
||||||
oemtype = strdup(optarg);
|
oemtype = strdup(optarg);
|
||||||
if (oemtype == NULL) {
|
if (!oemtype) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (strncmp(oemtype, "list", 4) == 0 ||
|
if (!strcmp(oemtype, "list")
|
||||||
strncmp(oemtype, "help", 4) == 0) {
|
|| !strcmp(oemtype, "help"))
|
||||||
|
{
|
||||||
ipmi_oem_print();
|
ipmi_oem_print();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
@ -635,7 +648,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
password = NULL;
|
password = NULL;
|
||||||
}
|
}
|
||||||
password = strdup(optarg);
|
password = strdup(optarg);
|
||||||
if (password == NULL) {
|
if (!password) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -651,7 +664,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
password = NULL;
|
password = NULL;
|
||||||
}
|
}
|
||||||
password = strdup(tmp_env);
|
password = strdup(tmp_env);
|
||||||
if (password == NULL) {
|
if (!password) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -662,7 +675,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
password = NULL;
|
password = NULL;
|
||||||
}
|
}
|
||||||
password = strdup(tmp_env);
|
password = strdup(tmp_env);
|
||||||
if (password == NULL) {
|
if (!password) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -736,7 +749,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
seloem = NULL;
|
seloem = NULL;
|
||||||
}
|
}
|
||||||
seloem = strdup(optarg);
|
seloem = strdup(optarg);
|
||||||
if (seloem == NULL) {
|
if (!seloem) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -763,6 +776,9 @@ ipmi_main(int argc, char ** argv,
|
|||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'Z':
|
||||||
|
time_in_utc = 1;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
ipmi_option_usage(progname, cmdlist, intflist);
|
ipmi_option_usage(progname, cmdlist, intflist);
|
||||||
@ -771,8 +787,9 @@ ipmi_main(int argc, char ** argv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check for command before doing anything */
|
/* check for command before doing anything */
|
||||||
if (argc-optind > 0 &&
|
if (argc-optind > 0
|
||||||
strncmp(argv[optind], "help", 4) == 0) {
|
&& !strcmp(argv[optind], "help"))
|
||||||
|
{
|
||||||
ipmi_cmd_print(cmdlist);
|
ipmi_cmd_print(cmdlist);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
@ -786,17 +803,17 @@ ipmi_main(int argc, char ** argv,
|
|||||||
* and the authtype was not explicitly set to NONE
|
* and the authtype was not explicitly set to NONE
|
||||||
* then prompt the user.
|
* then prompt the user.
|
||||||
*/
|
*/
|
||||||
if (hostname != NULL && password == NULL &&
|
if (hostname && !password &&
|
||||||
(authtype != IPMI_SESSION_AUTHTYPE_NONE || authtype < 0)) {
|
(authtype != IPMI_SESSION_AUTHTYPE_NONE || authtype < 0)) {
|
||||||
#ifdef HAVE_GETPASSPHRASE
|
#ifdef HAVE_GETPASSPHRASE
|
||||||
tmp_pass = getpassphrase("Password: ");
|
tmp_pass = getpassphrase("Password: ");
|
||||||
#else
|
#else
|
||||||
tmp_pass = getpass("Password: ");
|
tmp_pass = getpass("Password: ");
|
||||||
#endif
|
#endif
|
||||||
if (tmp_pass != NULL) {
|
if (tmp_pass) {
|
||||||
password = strdup(tmp_pass);
|
password = strdup(tmp_pass);
|
||||||
tmp_pass = NULL;
|
tmp_pass = NULL;
|
||||||
if (password == NULL) {
|
if (!password) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -808,49 +825,49 @@ ipmi_main(int argc, char ** argv,
|
|||||||
* otherwise the default is hardcoded
|
* otherwise the default is hardcoded
|
||||||
* to use the first entry in the list
|
* to use the first entry in the list
|
||||||
*/
|
*/
|
||||||
if (intfname == NULL && hostname != NULL) {
|
if (!intfname && hostname) {
|
||||||
intfname = strdup("lan");
|
intfname = strdup("lan");
|
||||||
if (intfname == NULL) {
|
if (!intfname) {
|
||||||
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
lprintf(LOG_ERR, "%s: malloc failure", progname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (password != NULL && intfname != NULL) {
|
if (password && intfname) {
|
||||||
if (strcmp(intfname, "lan") == 0 && strlen(password) > 16) {
|
if (!strcmp(intfname, "lan") && strlen(password) > 16) {
|
||||||
lprintf(LOG_ERR, "%s: password is longer than 16 bytes.", intfname);
|
lprintf(LOG_ERR, "%s: password is longer than 16 bytes.", intfname);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
} else if (strcmp(intfname, "lanplus") == 0 && strlen(password) > 20) {
|
} else if (!strcmp(intfname, "lanplus") && strlen(password) > 20) {
|
||||||
lprintf(LOG_ERR, "%s: password is longer than 20 bytes.", intfname);
|
lprintf(LOG_ERR, "%s: password is longer than 20 bytes.", intfname);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
} /* if (password != NULL && intfname != NULL) */
|
}
|
||||||
|
|
||||||
/* load interface */
|
/* load interface */
|
||||||
ipmi_main_intf = ipmi_intf_load(intfname);
|
ipmi_main_intf = ipmi_intf_load(intfname);
|
||||||
if (ipmi_main_intf == NULL) {
|
if (!ipmi_main_intf) {
|
||||||
lprintf(LOG_ERR, "Error loading interface %s", intfname);
|
lprintf(LOG_ERR, "Error loading interface %s", intfname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup log */
|
/* load the IANA PEN registry */
|
||||||
log_init(progname, 0, verbose);
|
ipmi_oem_info_init();
|
||||||
|
|
||||||
/* run OEM setup if found */
|
/* run OEM setup if found */
|
||||||
if (oemtype != NULL &&
|
if (oemtype &&
|
||||||
ipmi_oem_setup(ipmi_main_intf, oemtype) < 0) {
|
ipmi_oem_setup(ipmi_main_intf, oemtype) < 0) {
|
||||||
lprintf(LOG_ERR, "OEM setup for \"%s\" failed", oemtype);
|
lprintf(LOG_ERR, "OEM setup for \"%s\" failed", oemtype);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set session variables */
|
/* set session variables */
|
||||||
if (hostname != NULL)
|
if (hostname)
|
||||||
ipmi_intf_session_set_hostname(ipmi_main_intf, hostname);
|
ipmi_intf_session_set_hostname(ipmi_main_intf, hostname);
|
||||||
if (username != NULL)
|
if (username)
|
||||||
ipmi_intf_session_set_username(ipmi_main_intf, username);
|
ipmi_intf_session_set_username(ipmi_main_intf, username);
|
||||||
if (password != NULL)
|
if (password)
|
||||||
ipmi_intf_session_set_password(ipmi_main_intf, password);
|
ipmi_intf_session_set_password(ipmi_main_intf, password);
|
||||||
ipmi_intf_session_set_kgkey(ipmi_main_intf, kgkey);
|
ipmi_intf_session_set_kgkey(ipmi_main_intf, kgkey);
|
||||||
if (port > 0)
|
if (port > 0)
|
||||||
@ -870,7 +887,9 @@ ipmi_main(int argc, char ** argv,
|
|||||||
|
|
||||||
ipmi_intf_session_set_lookupbit(ipmi_main_intf, lookupbit);
|
ipmi_intf_session_set_lookupbit(ipmi_main_intf, lookupbit);
|
||||||
ipmi_intf_session_set_sol_escape_char(ipmi_main_intf, sol_escape_char);
|
ipmi_intf_session_set_sol_escape_char(ipmi_main_intf, sol_escape_char);
|
||||||
|
#ifdef IPMI_INTF_LANPLUS
|
||||||
ipmi_intf_session_set_cipher_suite_id(ipmi_main_intf, cipher_suite_id);
|
ipmi_intf_session_set_cipher_suite_id(ipmi_main_intf, cipher_suite_id);
|
||||||
|
#endif /* IPMI_INTF_LANPLUS */
|
||||||
|
|
||||||
ipmi_main_intf->devnum = devnum;
|
ipmi_main_intf->devnum = devnum;
|
||||||
|
|
||||||
@ -880,7 +899,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
ipmi_main_intf->ai_family = ai_family;
|
ipmi_main_intf->ai_family = ai_family;
|
||||||
/* Open the interface with the specified or default IPMB address */
|
/* Open the interface with the specified or default IPMB address */
|
||||||
ipmi_main_intf->my_addr = arg_addr ? arg_addr : IPMI_BMC_SLAVE_ADDR;
|
ipmi_main_intf->my_addr = arg_addr ? arg_addr : IPMI_BMC_SLAVE_ADDR;
|
||||||
if (ipmi_main_intf->open != NULL) {
|
if (ipmi_main_intf->open) {
|
||||||
if (ipmi_main_intf->open(ipmi_main_intf) < 0) {
|
if (ipmi_main_intf->open(ipmi_main_intf) < 0) {
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -975,11 +994,11 @@ ipmi_main(int argc, char ** argv,
|
|||||||
ipmi_main_intf->target_ipmb_addr);
|
ipmi_main_intf->target_ipmb_addr);
|
||||||
|
|
||||||
/* parse local SDR cache if given */
|
/* parse local SDR cache if given */
|
||||||
if (sdrcache != NULL) {
|
if (sdrcache) {
|
||||||
ipmi_sdr_list_cache_fromfile(ipmi_main_intf, sdrcache);
|
ipmi_sdr_list_cache_fromfile(sdrcache);
|
||||||
}
|
}
|
||||||
/* Parse SEL OEM file if given */
|
/* Parse SEL OEM file if given */
|
||||||
if (seloem != NULL) {
|
if (seloem) {
|
||||||
ipmi_sel_oem_init(seloem);
|
ipmi_sel_oem_init(seloem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1016,37 +1035,37 @@ ipmi_main(int argc, char ** argv,
|
|||||||
ipmi_cleanup(ipmi_main_intf);
|
ipmi_cleanup(ipmi_main_intf);
|
||||||
|
|
||||||
/* call interface close function if available */
|
/* call interface close function if available */
|
||||||
if (ipmi_main_intf->opened > 0 && ipmi_main_intf->close != NULL)
|
if (ipmi_main_intf->opened && ipmi_main_intf->close)
|
||||||
ipmi_main_intf->close(ipmi_main_intf);
|
ipmi_main_intf->close(ipmi_main_intf);
|
||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
log_halt();
|
log_halt();
|
||||||
|
|
||||||
if (intfname != NULL) {
|
if (intfname) {
|
||||||
free(intfname);
|
free(intfname);
|
||||||
intfname = NULL;
|
intfname = NULL;
|
||||||
}
|
}
|
||||||
if (hostname != NULL) {
|
if (hostname) {
|
||||||
free(hostname);
|
free(hostname);
|
||||||
hostname = NULL;
|
hostname = NULL;
|
||||||
}
|
}
|
||||||
if (username != NULL) {
|
if (username) {
|
||||||
free(username);
|
free(username);
|
||||||
username = NULL;
|
username = NULL;
|
||||||
}
|
}
|
||||||
if (password != NULL) {
|
if (password) {
|
||||||
free(password);
|
free(password);
|
||||||
password = NULL;
|
password = NULL;
|
||||||
}
|
}
|
||||||
if (oemtype != NULL) {
|
if (oemtype) {
|
||||||
free(oemtype);
|
free(oemtype);
|
||||||
oemtype = NULL;
|
oemtype = NULL;
|
||||||
}
|
}
|
||||||
if (seloem != NULL) {
|
if (seloem) {
|
||||||
free(seloem);
|
free(seloem);
|
||||||
seloem = NULL;
|
seloem = NULL;
|
||||||
}
|
}
|
||||||
if (sdrcache != NULL) {
|
if (sdrcache) {
|
||||||
free(sdrcache);
|
free(sdrcache);
|
||||||
sdrcache = NULL;
|
sdrcache = NULL;
|
||||||
}
|
}
|
||||||
@ -1055,6 +1074,8 @@ ipmi_main(int argc, char ** argv,
|
|||||||
devfile = NULL;
|
devfile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ipmi_oem_info_free();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
782
lib/ipmi_mc.c
782
lib/ipmi_mc.c
File diff suppressed because it is too large
Load Diff
@ -37,8 +37,9 @@
|
|||||||
#include <ipmitool/helper.h>
|
#include <ipmitool/helper.h>
|
||||||
#include <ipmitool/ipmi_sel.h>
|
#include <ipmitool/ipmi_sel.h>
|
||||||
|
|
||||||
static int ipmi_oem_supermicro(struct ipmi_intf * intf);
|
static int ipmi_oem_supermicro(struct ipmi_intf *intf);
|
||||||
static int ipmi_oem_ibm(struct ipmi_intf * intf);
|
static int ipmi_oem_ibm(struct ipmi_intf *intf);
|
||||||
|
static int ipmi_oem_quanta(struct ipmi_intf *intf);
|
||||||
|
|
||||||
static struct ipmi_oem_handle ipmi_oem_list[] = {
|
static struct ipmi_oem_handle ipmi_oem_list[] = {
|
||||||
{
|
{
|
||||||
@ -71,36 +72,49 @@ static struct ipmi_oem_handle ipmi_oem_list[] = {
|
|||||||
.name = "kontron",
|
.name = "kontron",
|
||||||
.desc = "Kontron OEM big buffer support"
|
.desc = "Kontron OEM big buffer support"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "quanta",
|
||||||
|
.desc = "Quanta IPMIv1.5 BMC with OEM LAN authentication support",
|
||||||
|
.setup = ipmi_oem_quanta,
|
||||||
|
},
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Supermicro IPMIv2 BMCs use OEM authtype */
|
/* Supermicro IPMIv2 BMCs use OEM authtype */
|
||||||
static int
|
static int
|
||||||
ipmi_oem_supermicro(struct ipmi_intf * intf)
|
ipmi_oem_supermicro(struct ipmi_intf *intf)
|
||||||
{
|
{
|
||||||
ipmi_intf_session_set_authtype(intf, IPMI_SESSION_AUTHTYPE_OEM);
|
ipmi_intf_session_set_authtype(intf, IPMI_SESSION_AUTHTYPE_OEM);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_oem_ibm(struct ipmi_intf * intf)
|
ipmi_oem_ibm(struct ipmi_intf *__UNUSED__(intf))
|
||||||
{
|
{
|
||||||
char * filename;
|
char *filename = getenv("IPMI_OEM_IBM_DATAFILE");
|
||||||
if ((filename = getenv("IPMI_OEM_IBM_DATAFILE")) == NULL) {
|
if (!filename) {
|
||||||
lprintf(LOG_ERR, "Unable to read IPMI_OEM_IBM_DATAFILE from environment");
|
lprintf(LOG_ERR, "Unable to read IPMI_OEM_IBM_DATAFILE from environment");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return ipmi_sel_oem_init((const char *)filename);
|
return ipmi_sel_oem_init((const char *)filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Quanta IPMIv2 BMCs use OEM authtype */
|
||||||
|
static int
|
||||||
|
ipmi_oem_quanta(struct ipmi_intf *intf)
|
||||||
|
{
|
||||||
|
ipmi_intf_session_set_authtype(intf, IPMI_SESSION_AUTHTYPE_OEM);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ipmi_oem_print - print list of OEM handles
|
/* ipmi_oem_print - print list of OEM handles
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ipmi_oem_print(void)
|
ipmi_oem_print(void)
|
||||||
{
|
{
|
||||||
struct ipmi_oem_handle * oem;
|
struct ipmi_oem_handle *oem;
|
||||||
lprintf(LOG_NOTICE, "\nOEM Support:");
|
lprintf(LOG_NOTICE, "\nOEM Support:");
|
||||||
for (oem=ipmi_oem_list; oem->name != NULL && oem->desc != NULL; oem++) {
|
for (oem=ipmi_oem_list; oem->name && oem->desc; oem++) {
|
||||||
lprintf(LOG_NOTICE, "\t%-12s %s", oem->name, oem->desc);
|
lprintf(LOG_NOTICE, "\t%-12s %s", oem->name, oem->desc);
|
||||||
}
|
}
|
||||||
lprintf(LOG_NOTICE, "");
|
lprintf(LOG_NOTICE, "");
|
||||||
@ -120,26 +134,27 @@ ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
|
|||||||
struct ipmi_oem_handle * oem;
|
struct ipmi_oem_handle * oem;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (oemtype == NULL ||
|
if (!oemtype
|
||||||
strncmp(oemtype, "help", 4) == 0 ||
|
|| !strcmp(oemtype, "help")
|
||||||
strncmp(oemtype, "list", 4) == 0) {
|
|| !strcmp(oemtype, "list"))
|
||||||
|
{
|
||||||
ipmi_oem_print();
|
ipmi_oem_print();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (oem=ipmi_oem_list; oem->name != NULL; oem++) {
|
for (oem=ipmi_oem_list; oem->name; oem++) {
|
||||||
if (strncmp(oemtype, oem->name, strlen(oem->name)) == 0)
|
if (!strcmp(oemtype, oem->name))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oem->name == NULL)
|
if (!oem->name)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* save pointer for later use */
|
/* save pointer for later use */
|
||||||
intf->oem = oem;
|
intf->oem = oem;
|
||||||
|
|
||||||
/* run optional setup function if it is defined */
|
/* run optional setup function if it is defined */
|
||||||
if (oem->setup != NULL) {
|
if (oem->setup) {
|
||||||
lprintf(LOG_DEBUG, "Running OEM setup for \"%s\"", oem->desc);
|
lprintf(LOG_DEBUG, "Running OEM setup for \"%s\"", oem->desc);
|
||||||
rc = oem->setup(intf);
|
rc = oem->setup(intf);
|
||||||
}
|
}
|
||||||
@ -158,10 +173,10 @@ ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
|
|||||||
int
|
int
|
||||||
ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype)
|
ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype)
|
||||||
{
|
{
|
||||||
if (intf->oem == NULL)
|
if (!intf->oem)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (strncmp(intf->oem->name, oemtype, strlen(oemtype)) == 0)
|
if (!strcmp(intf->oem->name, oemtype))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
429
lib/ipmi_pef.c
429
lib/ipmi_pef.c
@ -42,6 +42,7 @@
|
|||||||
#include <ipmitool/ipmi_mc.h>
|
#include <ipmitool/ipmi_mc.h>
|
||||||
#include <ipmitool/ipmi_pef.h>
|
#include <ipmitool/ipmi_pef.h>
|
||||||
#include <ipmitool/ipmi_sel.h>
|
#include <ipmitool/ipmi_sel.h>
|
||||||
|
#include <ipmitool/ipmi_time.h>
|
||||||
#include <ipmitool/log.h>
|
#include <ipmitool/log.h>
|
||||||
|
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
@ -78,6 +79,307 @@ static const char * pef_flag_fmts[][3] = {
|
|||||||
};
|
};
|
||||||
static const char * listitem[] = {" | %s", ",%s", "%s"};
|
static const char * listitem[] = {" | %s", ",%s", "%s"};
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_actions = {
|
||||||
|
BIT_DESC_MAP_ALL,
|
||||||
|
{ {"Alert", PEF_ACTION_ALERT},
|
||||||
|
{"Power-off", PEF_ACTION_POWER_DOWN},
|
||||||
|
{"Reset", PEF_ACTION_RESET},
|
||||||
|
{"Power-cycle", PEF_ACTION_POWER_CYCLE},
|
||||||
|
{"OEM-defined", PEF_ACTION_OEM},
|
||||||
|
{"Diagnostic-interrupt", PEF_ACTION_DIAGNOSTIC_INTERRUPT},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_severities = {
|
||||||
|
BIT_DESC_MAP_ANY,
|
||||||
|
{ {"Non-recoverable", PEF_SEVERITY_NON_RECOVERABLE},
|
||||||
|
{"Critical", PEF_SEVERITY_CRITICAL},
|
||||||
|
{"Warning", PEF_SEVERITY_WARNING},
|
||||||
|
{"OK", PEF_SEVERITY_OK},
|
||||||
|
{"Information", PEF_SEVERITY_INFORMATION},
|
||||||
|
{"Monitor", PEF_SEVERITY_MONITOR},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_sensortypes = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"Any", 255},
|
||||||
|
{"Temperature", 1},
|
||||||
|
{"Voltage", 2},
|
||||||
|
{"Current", 3},
|
||||||
|
{"Fan", 4},
|
||||||
|
{"Chassis Intrusion", 5},
|
||||||
|
{"Platform security breach", 6},
|
||||||
|
{"Processor", 7},
|
||||||
|
{"Power supply", 8},
|
||||||
|
{"Power Unit", 9},
|
||||||
|
{"Cooling device", 10},
|
||||||
|
{"Other (units-based)", 11},
|
||||||
|
{"Memory", 12},
|
||||||
|
{"Drive Slot", 13},
|
||||||
|
{"POST memory resize", 14},
|
||||||
|
{"POST error", 15},
|
||||||
|
{"Logging disabled", 16},
|
||||||
|
{"Watchdog 1", 17},
|
||||||
|
{"System event", 18},
|
||||||
|
{"Critical Interrupt", 19},
|
||||||
|
{"Button", 20},
|
||||||
|
{"Module/board", 21},
|
||||||
|
{"uController/coprocessor", 22},
|
||||||
|
{"Add-in card", 23},
|
||||||
|
{"Chassis", 24},
|
||||||
|
{"Chipset", 25},
|
||||||
|
{"Other (FRU)", 26},
|
||||||
|
{"Cable/interconnect", 27},
|
||||||
|
{"Terminator", 28},
|
||||||
|
{"System boot", 29},
|
||||||
|
{"Boot error", 30},
|
||||||
|
{"OS boot", 31},
|
||||||
|
{"OS critical stop", 32},
|
||||||
|
{"Slot/connector", 33},
|
||||||
|
{"ACPI power state", 34},
|
||||||
|
{"Watchdog 2", 35},
|
||||||
|
{"Platform alert", 36},
|
||||||
|
{"Entity presence", 37},
|
||||||
|
{"Monitor ASIC/IC", 38},
|
||||||
|
{"LAN", 39},
|
||||||
|
{"Management subsystem health", 40},
|
||||||
|
{"Battery", 41},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_1 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"<LNC", 0}, /* '<' : getting worse */
|
||||||
|
{">LNC", 1}, /* '>' : getting better */
|
||||||
|
{"<LC", 2},
|
||||||
|
{">LC", 3},
|
||||||
|
{"<LNR", 4},
|
||||||
|
{">LNR", 5},
|
||||||
|
{">UNC", 6},
|
||||||
|
{"<UNC", 7},
|
||||||
|
{">UC", 8},
|
||||||
|
{"<UC", 9},
|
||||||
|
{">UNR", 10},
|
||||||
|
{"<UNR", 11},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_2 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"transition to idle", 0},
|
||||||
|
{"transition to active", 1},
|
||||||
|
{"transition to busy", 2},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_3 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"state deasserted", 0},
|
||||||
|
{"state asserted", 1},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_4 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"predictive failure deasserted", 0},
|
||||||
|
{"predictive failure asserted", 1},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_5 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"limit not exceeded", 0},
|
||||||
|
{"limit exceeded", 1},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_6 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"performance met", 0},
|
||||||
|
{"performance lags", 1},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_7 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"ok", 0},
|
||||||
|
{"<warn", 1}, /* '<' : getting worse */
|
||||||
|
{"<fail", 2},
|
||||||
|
{"<dead", 3},
|
||||||
|
{">warn", 4}, /* '>' : getting better */
|
||||||
|
{">fail", 5},
|
||||||
|
{"dead", 6},
|
||||||
|
{"monitor", 7},
|
||||||
|
{"informational", 8},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_8 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"device removed/absent", 0},
|
||||||
|
{"device inserted/present", 1},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_9 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"device disabled", 0},
|
||||||
|
{"device enabled", 1},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_10 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"transition to running", 0},
|
||||||
|
{"transition to in test", 1},
|
||||||
|
{"transition to power off", 2},
|
||||||
|
{"transition to online", 3},
|
||||||
|
{"transition to offline", 4},
|
||||||
|
{"transition to off duty", 5},
|
||||||
|
{"transition to degraded", 6},
|
||||||
|
{"transition to power save", 7},
|
||||||
|
{"install error", 8},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_11 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"fully redundant", 0},
|
||||||
|
{"redundancy lost", 1},
|
||||||
|
{"redundancy degraded", 2},
|
||||||
|
{"<non-redundant/sufficient", 3}, /* '<' : getting worse */
|
||||||
|
{">non-redundant/sufficient", 4}, /* '>' : getting better */
|
||||||
|
{"non-redundant/insufficient", 5},
|
||||||
|
{"<redundancy degraded", 6},
|
||||||
|
{">redundancy degraded", 7},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_gentype_12 = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"D0 power state", 0},
|
||||||
|
{"D1 power state", 1},
|
||||||
|
{"D2 power state", 2},
|
||||||
|
{"D3 power state", 3},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map *
|
||||||
|
pef_b2s_generic_ER[] = {
|
||||||
|
&pef_b2s_gentype_1,
|
||||||
|
&pef_b2s_gentype_2,
|
||||||
|
&pef_b2s_gentype_3,
|
||||||
|
&pef_b2s_gentype_4,
|
||||||
|
&pef_b2s_gentype_5,
|
||||||
|
&pef_b2s_gentype_6,
|
||||||
|
&pef_b2s_gentype_7,
|
||||||
|
&pef_b2s_gentype_8,
|
||||||
|
&pef_b2s_gentype_9,
|
||||||
|
&pef_b2s_gentype_10,
|
||||||
|
&pef_b2s_gentype_11,
|
||||||
|
&pef_b2s_gentype_12,
|
||||||
|
};
|
||||||
|
#define PEF_B2S_GENERIC_ER_ENTRIES ARRAY_SIZE(pef_b2s_generic_ER)
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_policies = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"Match-always", PEF_POLICY_FLAGS_MATCH_ALWAYS},
|
||||||
|
{"Try-next-entry", PEF_POLICY_FLAGS_PREV_OK_SKIP},
|
||||||
|
{"Try-next-set", PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET},
|
||||||
|
{"Try-next-channel", PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET},
|
||||||
|
{"Try-next-destination", PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_ch_medium = {
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_IPMB 1
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_ICMB_10 2
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_ICMB_09 3
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_LAN 4
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_SERIAL 5
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_XLAN 6
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_PCI_SMBUS 7
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_SMBUS_V1X 8
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_SMBUS_V2X 9
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_USB_V1X 10
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_USB_V2X 11
|
||||||
|
#define PEF_CH_MEDIUM_TYPE_SYSTEM 12
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"IPMB (I2C)", PEF_CH_MEDIUM_TYPE_IPMB},
|
||||||
|
{"ICMB v1.0", PEF_CH_MEDIUM_TYPE_ICMB_10},
|
||||||
|
{"ICMB v0.9", PEF_CH_MEDIUM_TYPE_ICMB_09},
|
||||||
|
{"802.3 LAN", PEF_CH_MEDIUM_TYPE_LAN},
|
||||||
|
{"Serial/Modem (RS-232)", PEF_CH_MEDIUM_TYPE_SERIAL},
|
||||||
|
{"Other LAN", PEF_CH_MEDIUM_TYPE_XLAN},
|
||||||
|
{"PCI SMBus", PEF_CH_MEDIUM_TYPE_PCI_SMBUS},
|
||||||
|
{"SMBus v1.0/1.1", PEF_CH_MEDIUM_TYPE_SMBUS_V1X},
|
||||||
|
{"SMBus v2.0", PEF_CH_MEDIUM_TYPE_SMBUS_V2X},
|
||||||
|
{"USB 1.x", PEF_CH_MEDIUM_TYPE_USB_V1X},
|
||||||
|
{"USB 2.x", PEF_CH_MEDIUM_TYPE_USB_V2X},
|
||||||
|
{"System I/F (KCS,SMIC,BT)", PEF_CH_MEDIUM_TYPE_SYSTEM},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_control = {
|
||||||
|
BIT_DESC_MAP_ALL,
|
||||||
|
{ {"PEF", PEF_CONTROL_ENABLE},
|
||||||
|
{"PEF event messages", PEF_CONTROL_ENABLE_EVENT_MESSAGES},
|
||||||
|
{"PEF startup delay", PEF_CONTROL_ENABLE_STARTUP_DELAY},
|
||||||
|
{"Alert startup delay", PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_lan_desttype = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"Acknowledged", PEF_LAN_DEST_TYPE_ACK},
|
||||||
|
{"PET", PEF_LAN_DEST_TYPE_PET},
|
||||||
|
{"OEM 1", PEF_LAN_DEST_TYPE_OEM_1},
|
||||||
|
{"OEM 2", PEF_LAN_DEST_TYPE_OEM_2},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_serial_desttype = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"Acknowledged", PEF_SERIAL_DEST_TYPE_ACK},
|
||||||
|
{"TAP page", PEF_SERIAL_DEST_TYPE_TAP},
|
||||||
|
{"PPP PET", PEF_SERIAL_DEST_TYPE_PPP},
|
||||||
|
{"Basic callback", PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK},
|
||||||
|
{"PPP callback", PEF_SERIAL_DEST_TYPE_PPP_CALLBACK},
|
||||||
|
{"OEM 1", PEF_SERIAL_DEST_TYPE_OEM_1},
|
||||||
|
{"OEM 2", PEF_SERIAL_DEST_TYPE_OEM_2},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
|
static struct bit_desc_map
|
||||||
|
pef_b2s_tap_svc_confirm = {
|
||||||
|
BIT_DESC_MAP_LIST,
|
||||||
|
{ {"ACK", PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX},
|
||||||
|
{"211+ACK", PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX},
|
||||||
|
{"{211|213}+ACK", PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX},
|
||||||
|
{NULL}
|
||||||
|
} };
|
||||||
|
|
||||||
static int ipmi_pef2_list_filters(struct ipmi_intf *);
|
static int ipmi_pef2_list_filters(struct ipmi_intf *);
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@ -193,7 +495,7 @@ ipmi_pef_print_1xd(const char * text, uint32_t val)
|
|||||||
static int
|
static int
|
||||||
ipmi_pef_print_guid(uint8_t *guid)
|
ipmi_pef_print_guid(uint8_t *guid)
|
||||||
{
|
{
|
||||||
if (guid == NULL) {
|
if (!guid) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +549,7 @@ _ipmi_get_pef_capabilities(struct ipmi_intf *intf,
|
|||||||
{
|
{
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
if (pcap == NULL) {
|
if (!pcap) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,9 +559,9 @@ _ipmi_get_pef_capabilities(struct ipmi_intf *intf,
|
|||||||
req.msg.cmd = IPMI_CMD_GET_PEF_CAPABILITIES;
|
req.msg.cmd = IPMI_CMD_GET_PEF_CAPABILITIES;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
} else if (rsp->data_len != 3) {
|
} else if (rsp->data_len != 3) {
|
||||||
return (-2);
|
return (-2);
|
||||||
@ -287,7 +589,7 @@ _ipmi_get_pef_filter_entry(struct ipmi_intf *intf, uint8_t filter_id,
|
|||||||
uint8_t data[3];
|
uint8_t data[3];
|
||||||
uint8_t data_len = 3 * sizeof(uint8_t);
|
uint8_t data_len = 3 * sizeof(uint8_t);
|
||||||
int dest_size;
|
int dest_size;
|
||||||
if (filter_entry == NULL) {
|
if (!filter_entry) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,9 +605,9 @@ _ipmi_get_pef_filter_entry(struct ipmi_intf *intf, uint8_t filter_id,
|
|||||||
req.msg.data = (uint8_t *)&data;
|
req.msg.data = (uint8_t *)&data;
|
||||||
req.msg.data_len = data_len;
|
req.msg.data_len = data_len;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
} else if (rsp->data_len != 22 || (rsp->data_len - 1) != dest_size) {
|
} else if (rsp->data_len != 22 || (rsp->data_len - 1) != dest_size) {
|
||||||
return (-2);
|
return (-2);
|
||||||
@ -331,7 +633,7 @@ _ipmi_get_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id,
|
|||||||
uint8_t data[3];
|
uint8_t data[3];
|
||||||
uint8_t data_len = 3 * sizeof(uint8_t);
|
uint8_t data_len = 3 * sizeof(uint8_t);
|
||||||
int dest_size;
|
int dest_size;
|
||||||
if (filter_cfg == NULL) {
|
if (!filter_cfg) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,9 +649,9 @@ _ipmi_get_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id,
|
|||||||
req.msg.data = (uint8_t *)&data;
|
req.msg.data = (uint8_t *)&data;
|
||||||
req.msg.data_len = data_len;
|
req.msg.data_len = data_len;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
} else if (rsp->data_len != 3 || (rsp->data_len - 1) != dest_size) {
|
} else if (rsp->data_len != 3 || (rsp->data_len - 1) != dest_size) {
|
||||||
return (-2);
|
return (-2);
|
||||||
@ -375,7 +677,7 @@ _ipmi_get_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id,
|
|||||||
uint8_t data[3];
|
uint8_t data[3];
|
||||||
uint8_t data_len = 3 * sizeof(uint8_t);
|
uint8_t data_len = 3 * sizeof(uint8_t);
|
||||||
int dest_size;
|
int dest_size;
|
||||||
if (policy_entry == NULL) {
|
if (!policy_entry) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,9 +693,9 @@ _ipmi_get_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id,
|
|||||||
req.msg.data = (uint8_t *)&data;
|
req.msg.data = (uint8_t *)&data;
|
||||||
req.msg.data_len = data_len;
|
req.msg.data_len = data_len;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
} else if (rsp->data_len != 5 || (rsp->data_len - 1) != dest_size) {
|
} else if (rsp->data_len != 5 || (rsp->data_len - 1) != dest_size) {
|
||||||
return (-2);
|
return (-2);
|
||||||
@ -416,7 +718,7 @@ _ipmi_get_pef_filter_table_size(struct ipmi_intf *intf, uint8_t *table_size)
|
|||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
struct pef_cfgparm_selector psel;
|
struct pef_cfgparm_selector psel;
|
||||||
|
|
||||||
if (table_size == NULL) {
|
if (!table_size) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,9 +732,9 @@ _ipmi_get_pef_filter_table_size(struct ipmi_intf *intf, uint8_t *table_size)
|
|||||||
req.msg.data = (uint8_t *)&psel;
|
req.msg.data = (uint8_t *)&psel;
|
||||||
req.msg.data_len = sizeof(psel);
|
req.msg.data_len = sizeof(psel);
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
} else if (rsp->data_len != 2) {
|
} else if (rsp->data_len != 2) {
|
||||||
return (-2);
|
return (-2);
|
||||||
@ -455,7 +757,7 @@ _ipmi_get_pef_policy_table_size(struct ipmi_intf *intf, uint8_t *table_size)
|
|||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
struct pef_cfgparm_selector psel;
|
struct pef_cfgparm_selector psel;
|
||||||
|
|
||||||
if (table_size == NULL) {
|
if (!table_size) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,9 +771,9 @@ _ipmi_get_pef_policy_table_size(struct ipmi_intf *intf, uint8_t *table_size)
|
|||||||
req.msg.data = (uint8_t *)&psel;
|
req.msg.data = (uint8_t *)&psel;
|
||||||
req.msg.data_len = sizeof(psel);
|
req.msg.data_len = sizeof(psel);
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
} else if (rsp->data_len != 2) {
|
} else if (rsp->data_len != 2) {
|
||||||
return (-2);
|
return (-2);
|
||||||
@ -494,7 +796,7 @@ _ipmi_get_pef_system_guid(struct ipmi_intf *intf,
|
|||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
struct pef_cfgparm_selector psel;
|
struct pef_cfgparm_selector psel;
|
||||||
if (system_guid == NULL) {
|
if (!system_guid) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,9 +810,9 @@ _ipmi_get_pef_system_guid(struct ipmi_intf *intf,
|
|||||||
req.msg.data_len = sizeof(psel);
|
req.msg.data_len = sizeof(psel);
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
} else if (rsp->data_len != 18
|
} else if (rsp->data_len != 18
|
||||||
|| (rsp->data_len - 2) != sizeof(system_guid->guid)) {
|
|| (rsp->data_len - 2) != sizeof(system_guid->guid)) {
|
||||||
@ -537,7 +839,7 @@ _ipmi_set_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id,
|
|||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
uint8_t data[3];
|
uint8_t data[3];
|
||||||
uint8_t data_len = 3 * sizeof(uint8_t);
|
uint8_t data_len = 3 * sizeof(uint8_t);
|
||||||
if (filter_cfg == NULL) {
|
if (!filter_cfg) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,9 +855,9 @@ _ipmi_set_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id,
|
|||||||
data[2] = filter_cfg->cfg;
|
data[2] = filter_cfg->cfg;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -576,7 +878,7 @@ _ipmi_set_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id,
|
|||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
struct pef_cfgparm_set_policy_table_entry payload;
|
struct pef_cfgparm_set_policy_table_entry payload;
|
||||||
if (policy_entry == NULL) {
|
if (!policy_entry) {
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,16 +895,17 @@ _ipmi_set_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id,
|
|||||||
sizeof(policy_entry->entry));
|
sizeof(policy_entry->entry));
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
return rsp->ccode;
|
return rsp->ccode;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ipmi_pef_print_oem_lan_dest(struct ipmi_intf *intf, uint8_t ch, uint8_t dest)
|
ipmi_pef_print_oem_lan_dest(struct ipmi_intf *intf,
|
||||||
|
uint8_t dest)
|
||||||
{
|
{
|
||||||
char address[128];
|
char address[128];
|
||||||
int len;
|
int len;
|
||||||
@ -865,7 +1168,7 @@ ipmi_pef_print_serial_dest(struct ipmi_intf *intf, uint8_t ch, uint8_t dest)
|
|||||||
if (!dest || tbl_size == 0) /* Page alerting not supported */
|
if (!dest || tbl_size == 0) /* Page alerting not supported */
|
||||||
return;
|
return;
|
||||||
if (dest > tbl_size) {
|
if (dest > tbl_size) {
|
||||||
ipmi_pef_print_oem_lan_dest(intf, ch, dest - tbl_size);
|
ipmi_pef_print_oem_lan_dest(intf, dest - tbl_size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -903,7 +1206,7 @@ ipmi_pef_print_serial_dest(struct ipmi_intf *intf, uint8_t ch, uint8_t dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ipmi_pef_print_dest(struct ipmi_intf * intf, uint8_t ch, uint8_t dest)
|
ipmi_pef_print_dest(uint8_t dest)
|
||||||
{ /*
|
{ /*
|
||||||
// print generic alert destination info
|
// print generic alert destination info
|
||||||
*/
|
*/
|
||||||
@ -1095,13 +1398,13 @@ ipmi_pef2_filter(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
ipmi_pef2_filter_help();
|
ipmi_pef2_filter_help();
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
} else if (!strncmp(argv[0], "help\0", 5)) {
|
} else if (!strcmp(argv[0], "help")) {
|
||||||
ipmi_pef2_filter_help();
|
ipmi_pef2_filter_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (!strncmp(argv[0], "list\0", 5)) {
|
} else if (!strcmp(argv[0], "list")) {
|
||||||
rc = ipmi_pef2_list_filters(intf);
|
rc = ipmi_pef2_list_filters(intf);
|
||||||
} else if (!strncmp(argv[0], "enable\0", 7)
|
} else if (!strcmp(argv[0], "enable")
|
||||||
||(!strncmp(argv[0], "disable\0", 8))) {
|
||(!strcmp(argv[0], "disable"))) {
|
||||||
uint8_t enable;
|
uint8_t enable;
|
||||||
uint8_t filter_id;
|
uint8_t filter_id;
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
@ -1117,16 +1420,16 @@ ipmi_pef2_filter(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
"Valid range is <1..255>.");
|
"Valid range is <1..255>.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[0], "enable\0", 7)) {
|
if (!strcmp(argv[0], "enable")) {
|
||||||
enable = 1;
|
enable = 1;
|
||||||
} else {
|
} else {
|
||||||
enable = 0;
|
enable = 0;
|
||||||
}
|
}
|
||||||
rc = ipmi_pef2_filter_enable(intf, enable, filter_id);
|
rc = ipmi_pef2_filter_enable(intf, enable, filter_id);
|
||||||
} else if (!strncmp(argv[0], "create\0", 7)) {
|
} else if (!strcmp(argv[0], "create")) {
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "delete\0", 7)) {
|
} else if (!strcmp(argv[0], "delete")) {
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -1143,7 +1446,7 @@ ipmi_pef2_get_info(struct ipmi_intf *intf)
|
|||||||
{
|
{
|
||||||
struct pef_capabilities pcap;
|
struct pef_capabilities pcap;
|
||||||
struct pef_cfgparm_system_guid psys_guid;
|
struct pef_cfgparm_system_guid psys_guid;
|
||||||
struct ipmi_guid_t guid;
|
ipmi_guid_t guid;
|
||||||
int rc;
|
int rc;
|
||||||
uint8_t *guid_ptr = NULL;
|
uint8_t *guid_ptr = NULL;
|
||||||
uint8_t policy_table_size;
|
uint8_t policy_table_size;
|
||||||
@ -1183,6 +1486,7 @@ ipmi_pef2_get_info(struct ipmi_intf *intf)
|
|||||||
ipmi_pef_print_guid(guid_ptr);
|
ipmi_pef_print_guid(guid_ptr);
|
||||||
}
|
}
|
||||||
ipmi_pef_print_flags(&pef_b2s_actions, P_SUPP, pcap.actions);
|
ipmi_pef_print_flags(&pef_b2s_actions, P_SUPP, pcap.actions);
|
||||||
|
putchar('\n');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1193,8 +1497,6 @@ ipmi_pef2_get_status(struct ipmi_intf *intf)
|
|||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
struct pef_cfgparm_selector psel;
|
struct pef_cfgparm_selector psel;
|
||||||
char tbuf[40];
|
|
||||||
uint32_t timei;
|
|
||||||
time_t ts;
|
time_t ts;
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
@ -1206,15 +1508,9 @@ ipmi_pef2_get_status(struct ipmi_intf *intf)
|
|||||||
"Last S/W processed ID");
|
"Last S/W processed ID");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
memcpy(&timei, rsp->data, sizeof(timei));
|
|
||||||
#if WORDS_BIGENDIAN
|
|
||||||
timei = BSWAP_32(timei);
|
|
||||||
#endif
|
|
||||||
ts = (time_t)timei;
|
|
||||||
|
|
||||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", gmtime(&ts));
|
ts = ipmi32toh(rsp->data);
|
||||||
|
ipmi_pef_print_str("Last SEL addition", ipmi_timestamp_numeric(ts));
|
||||||
ipmi_pef_print_str("Last SEL addition", tbuf);
|
|
||||||
ipmi_pef_print_2xd("Last SEL record ID", rsp->data[5], rsp->data[4]);
|
ipmi_pef_print_2xd("Last SEL record ID", rsp->data[5], rsp->data[4]);
|
||||||
ipmi_pef_print_2xd("Last S/W processed ID", rsp->data[7], rsp->data[6]);
|
ipmi_pef_print_2xd("Last S/W processed ID", rsp->data[7], rsp->data[6]);
|
||||||
ipmi_pef_print_2xd("Last BMC processed ID", rsp->data[9], rsp->data[8]);
|
ipmi_pef_print_2xd("Last BMC processed ID", rsp->data[9], rsp->data[8]);
|
||||||
@ -1242,6 +1538,7 @@ ipmi_pef2_get_status(struct ipmi_intf *intf)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
ipmi_pef_print_flags(&pef_b2s_actions, P_ACTV, rsp->data[1]);
|
ipmi_pef_print_flags(&pef_b2s_actions, P_ACTV, rsp->data[1]);
|
||||||
|
putchar('\n');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1337,7 +1634,7 @@ ipmi_pef2_list_policies(struct ipmi_intf *intf)
|
|||||||
dest);
|
dest);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ipmi_pef_print_dest(intf, channel_info.channel, dest);
|
ipmi_pef_print_dest(dest);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -1424,13 +1721,13 @@ ipmi_pef2_policy(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
ipmi_pef2_policy_help();
|
ipmi_pef2_policy_help();
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
} else if (!strncmp(argv[0], "help\0", 5)) {
|
} else if (!strcmp(argv[0], "help")) {
|
||||||
ipmi_pef2_policy_help();
|
ipmi_pef2_policy_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (!strncmp(argv[0], "list\0", 5)) {
|
} else if (!strcmp(argv[0], "list")) {
|
||||||
rc = ipmi_pef2_list_policies(intf);
|
rc = ipmi_pef2_list_policies(intf);
|
||||||
} else if (!strncmp(argv[0], "enable\0", 7)
|
} else if (!strcmp(argv[0], "enable")
|
||||||
|| !strncmp(argv[0], "disable\0", 8)) {
|
|| !strcmp(argv[0], "disable")) {
|
||||||
uint8_t enable;
|
uint8_t enable;
|
||||||
uint8_t policy_id;
|
uint8_t policy_id;
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
@ -1445,16 +1742,16 @@ ipmi_pef2_policy(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "PEF Policy ID out of range. Valid range is <1..127>.");
|
lprintf(LOG_ERR, "PEF Policy ID out of range. Valid range is <1..127>.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[0], "enable\0", 7)) {
|
if (!strcmp(argv[0], "enable")) {
|
||||||
enable = 1;
|
enable = 1;
|
||||||
} else {
|
} else {
|
||||||
enable = 0;
|
enable = 0;
|
||||||
}
|
}
|
||||||
rc = ipmi_pef2_policy_enable(intf, enable, policy_id);
|
rc = ipmi_pef2_policy_enable(intf, enable, policy_id);
|
||||||
} else if (!strncmp(argv[0], "create\0", 7)) {
|
} else if (!strcmp(argv[0], "create")) {
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "delete\0", 7)) {
|
} else if (!strcmp(argv[0], "delete")) {
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -1515,30 +1812,30 @@ int ipmi_pef_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
ipmi_pef2_help();
|
ipmi_pef2_help();
|
||||||
rc = (-1);
|
rc = (-1);
|
||||||
} else if (!strncmp(argv[0], "help\0", 5)) {
|
} else if (!strcmp(argv[0], "help")) {
|
||||||
ipmi_pef2_help();
|
ipmi_pef2_help();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (!strncmp(argv[0], "capabilities\0", 13)) {
|
} else if (!strcmp(argv[0], "capabilities")) {
|
||||||
/* rc = ipmi_pef2_get_capabilities(intf); */
|
/* rc = ipmi_pef2_get_capabilities(intf); */
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "event\0", 6)) {
|
} else if (!strcmp(argv[0], "event")) {
|
||||||
/* rc = ipmi_pef2_event(intf, (argc - 1), ++argv); */
|
/* rc = ipmi_pef2_event(intf, (argc - 1), ++argv); */
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "filter\0", 7)) {
|
} else if (!strcmp(argv[0], "filter")) {
|
||||||
rc = ipmi_pef2_filter(intf, (argc - 1), ++argv);
|
rc = ipmi_pef2_filter(intf, (argc - 1), ++argv);
|
||||||
} else if (!strncmp(argv[0], "info\0", 5)) {
|
} else if (!strcmp(argv[0], "info")) {
|
||||||
rc = ipmi_pef2_get_info(intf);
|
rc = ipmi_pef2_get_info(intf);
|
||||||
} else if (!strncmp(argv[0], "pet\0", 4)) {
|
} else if (!strcmp(argv[0], "pet")) {
|
||||||
/* rc = ipmi_pef2_pet(intf, (argc - 1), ++argv); */
|
/* rc = ipmi_pef2_pet(intf, (argc - 1), ++argv); */
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else if (!strncmp(argv[0], "policy\0", 7)) {
|
} else if (!strcmp(argv[0], "policy")) {
|
||||||
rc = ipmi_pef2_policy(intf, (argc - 1), ++argv);
|
rc = ipmi_pef2_policy(intf, (argc - 1), ++argv);
|
||||||
} else if (!strncmp(argv[0], "status\0", 7)) {
|
} else if (!strcmp(argv[0], "status")) {
|
||||||
rc = ipmi_pef2_get_status(intf);
|
rc = ipmi_pef2_get_status(intf);
|
||||||
} else if (!strncmp(argv[0], "timer\0", 6)) {
|
} else if (!strcmp(argv[0], "timer")) {
|
||||||
/* rc = ipmi_pef2_timer(intf, (argc - 1), ++argv); */
|
/* rc = ipmi_pef2_timer(intf, (argc - 1), ++argv); */
|
||||||
lprintf(LOG_ERR, "Not implemented.");
|
lprintf(LOG_ERR, "Not implemented.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
|
278
lib/ipmi_picmg.c
278
lib/ipmi_picmg.c
@ -37,11 +37,6 @@
|
|||||||
#include <ipmitool/ipmi_strings.h>
|
#include <ipmitool/ipmi_strings.h>
|
||||||
#include <ipmitool/log.h>
|
#include <ipmitool/log.h>
|
||||||
|
|
||||||
#define PICMG_EXTENSION_ATCA_MAJOR_VERSION 2
|
|
||||||
#define PICMG_EXTENSION_AMC0_MAJOR_VERSION 4
|
|
||||||
#define PICMG_EXTENSION_UTCA_MAJOR_VERSION 5
|
|
||||||
|
|
||||||
|
|
||||||
#define PICMG_EKEY_MODE_QUERY 0
|
#define PICMG_EKEY_MODE_QUERY 0
|
||||||
#define PICMG_EKEY_MODE_PRINT_ALL 1
|
#define PICMG_EKEY_MODE_PRINT_ALL 1
|
||||||
#define PICMG_EKEY_MODE_PRINT_ENABLED 2
|
#define PICMG_EKEY_MODE_PRINT_ENABLED 2
|
||||||
@ -67,7 +62,84 @@ typedef enum picmg_card_type {
|
|||||||
PICMG_CARD_TYPE_RESERVED
|
PICMG_CARD_TYPE_RESERVED
|
||||||
} t_picmg_card_type ;
|
} t_picmg_card_type ;
|
||||||
|
|
||||||
/* This is the version of the PICMG Extenstion */
|
static const char* amc_link_type_str[] = {
|
||||||
|
"RESERVED",
|
||||||
|
"RESERVED1",
|
||||||
|
"PCI EXPRESS",
|
||||||
|
"ADVANCED SWITCHING1",
|
||||||
|
"ADVANCED SWITCHING2",
|
||||||
|
"ETHERNET",
|
||||||
|
"RAPIDIO",
|
||||||
|
"STORAGE",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* amc_link_type_ext_str[][16] = {
|
||||||
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED */
|
||||||
|
{
|
||||||
|
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
|
||||||
|
},
|
||||||
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 */
|
||||||
|
{
|
||||||
|
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
|
||||||
|
},
|
||||||
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS */
|
||||||
|
{
|
||||||
|
"Gen 1 - NSSC",
|
||||||
|
"Gen 1 - SSC",
|
||||||
|
"Gen 2 - NSSC",
|
||||||
|
"Gen 2 - SSC",
|
||||||
|
"", "", "", "",
|
||||||
|
"", "", "", "",
|
||||||
|
"", "", "", ""
|
||||||
|
},
|
||||||
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 */
|
||||||
|
{
|
||||||
|
"Gen 1 - NSSC",
|
||||||
|
"Gen 1 - SSC",
|
||||||
|
"Gen 2 - NSSC",
|
||||||
|
"Gen 2 - SSC",
|
||||||
|
"", "", "", "",
|
||||||
|
"", "", "", "",
|
||||||
|
"", "", "", ""
|
||||||
|
},
|
||||||
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 */
|
||||||
|
{
|
||||||
|
"Gen 1 - NSSC",
|
||||||
|
"Gen 1 - SSC",
|
||||||
|
"Gen 2 - NSSC",
|
||||||
|
"Gen 2 - SSC",
|
||||||
|
"", "", "", "",
|
||||||
|
"", "", "", "",
|
||||||
|
"", "", "", ""
|
||||||
|
},
|
||||||
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */
|
||||||
|
{
|
||||||
|
"1000BASE-BX (SerDES Gigabit)",
|
||||||
|
"10GBASE-BX410 Gigabit XAUI",
|
||||||
|
"", "",
|
||||||
|
"", "", "", "",
|
||||||
|
"", "", "", "",
|
||||||
|
"", "", "", ""
|
||||||
|
},
|
||||||
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */
|
||||||
|
{
|
||||||
|
"1.25 Gbaud transmission rate",
|
||||||
|
"2.5 Gbaud transmission rate",
|
||||||
|
"3.125 Gbaud transmission rate",
|
||||||
|
"", "", "", "", "",
|
||||||
|
"", "", "", "", "", "", "", ""
|
||||||
|
},
|
||||||
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */
|
||||||
|
{
|
||||||
|
"Fibre Channel",
|
||||||
|
"Serial ATA",
|
||||||
|
"Serial Attached SCSI",
|
||||||
|
"", "", "", "", "",
|
||||||
|
"", "", "", "", "", "", "", ""
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This is the version of the PICMG Extension */
|
||||||
static t_picmg_card_type PicmgCardType = PICMG_CARD_TYPE_RESERVED;
|
static t_picmg_card_type PicmgCardType = PICMG_CARD_TYPE_RESERVED;
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -130,6 +202,28 @@ struct sAmcAddrMap {
|
|||||||
{0x88, "reserved", 0},
|
{0x88, "reserved", 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* the LED color capabilities */
|
||||||
|
static const char *led_color_str[] = {
|
||||||
|
"reserved",
|
||||||
|
"BLUE",
|
||||||
|
"RED",
|
||||||
|
"GREEN",
|
||||||
|
"AMBER",
|
||||||
|
"ORANGE",
|
||||||
|
"WHITE",
|
||||||
|
"reserved"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *
|
||||||
|
picmg_led_color_str(int color)
|
||||||
|
{
|
||||||
|
if (color < 0 || (size_t)color >= ARRAY_SIZE(led_color_str)) {
|
||||||
|
return "invalid";
|
||||||
|
}
|
||||||
|
|
||||||
|
return led_color_str[color];
|
||||||
|
}
|
||||||
|
|
||||||
/* is_amc_channel - wrapper to convert user input into integer
|
/* is_amc_channel - wrapper to convert user input into integer
|
||||||
* AMC Channel range seems to be <0..255>, bits [7:0]
|
* AMC Channel range seems to be <0..255>, bits [7:0]
|
||||||
*
|
*
|
||||||
@ -151,7 +245,7 @@ is_amc_channel(const char *argv_ptr, uint8_t *amc_chan_ptr)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* is_amc_dev - wrapper to convert user input into integer.
|
/* is_amc_dev - wrapper to convert user input into integer.
|
||||||
* AMC Dev ID limits are uknown.
|
* AMC Dev ID limits are unknown.
|
||||||
*
|
*
|
||||||
* @argv_ptr: source string to convert from; usually argv
|
* @argv_ptr: source string to convert from; usually argv
|
||||||
* @amc_dev_ptr: pointer where to store result
|
* @amc_dev_ptr: pointer where to store result
|
||||||
@ -172,7 +266,7 @@ is_amc_dev(const char *argv_ptr, int32_t *amc_dev_ptr)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* is_amc_intf - wrapper to convert user input into integer.
|
/* is_amc_intf - wrapper to convert user input into integer.
|
||||||
* AMC Interface (ID) limits are uknown.
|
* AMC Interface (ID) limits are unknown.
|
||||||
*
|
*
|
||||||
* @argv_ptr: source string to convert from; usually argv
|
* @argv_ptr: source string to convert from; usually argv
|
||||||
* @amc_intf_ptr: pointer where to store result
|
* @amc_intf_ptr: pointer where to store result
|
||||||
@ -193,7 +287,7 @@ is_amc_intf(const char *argv_ptr, int32_t *amc_intf_ptr)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* is_amc_port - wrapper to convert user input into integer.
|
/* is_amc_port - wrapper to convert user input into integer.
|
||||||
* AMC Port limits are uknown.
|
* AMC Port limits are unknown.
|
||||||
*
|
*
|
||||||
* @argv_ptr: source string to convert from; usually argv
|
* @argv_ptr: source string to convert from; usually argv
|
||||||
* @amc_port_ptr: pointer where to store result
|
* @amc_port_ptr: pointer where to store result
|
||||||
@ -213,7 +307,7 @@ is_amc_port(const char *argv_ptr, int32_t *amc_port_ptr)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* is_clk_acc - wrapper to convert user input into integer.
|
/* is_clk_acc - wrapper to convert user input into integer.
|
||||||
* Clock Accuracy limits are uknown[1byte by spec].
|
* Clock Accuracy limits are unknown[1byte by spec].
|
||||||
*
|
*
|
||||||
* @argv_ptr: source string to convert from; usually argv
|
* @argv_ptr: source string to convert from; usually argv
|
||||||
* @clk_acc_ptr: pointer where to store result
|
* @clk_acc_ptr: pointer where to store result
|
||||||
@ -234,7 +328,7 @@ is_clk_acc(const char *argv_ptr, uint8_t *clk_acc_ptr)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* is_clk_family - wrapper to convert user input into integer.
|
/* is_clk_family - wrapper to convert user input into integer.
|
||||||
* Clock Family limits are uknown[1byte by spec].
|
* Clock Family limits are unknown[1byte by spec].
|
||||||
*
|
*
|
||||||
* @argv_ptr: source string to convert from; usually argv
|
* @argv_ptr: source string to convert from; usually argv
|
||||||
* @clk_family_ptr: pointer where to store result
|
* @clk_family_ptr: pointer where to store result
|
||||||
@ -255,7 +349,7 @@ is_clk_family(const char *argv_ptr, uint8_t *clk_family_ptr)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* is_clk_freq - wrapper to convert user input into integer.
|
/* is_clk_freq - wrapper to convert user input into integer.
|
||||||
* Clock Frequency limits are uknown, but specification says
|
* Clock Frequency limits are unknown, but specification says
|
||||||
* 3Bytes + 1B checksum
|
* 3Bytes + 1B checksum
|
||||||
*
|
*
|
||||||
* @argv_ptr: source string to convert from; usually argv
|
* @argv_ptr: source string to convert from; usually argv
|
||||||
@ -277,7 +371,7 @@ is_clk_freq(const char *argv_ptr, uint32_t *clk_freq_ptr)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* is_clk_id - wrapper to convert user input into integer.
|
/* is_clk_id - wrapper to convert user input into integer.
|
||||||
* Clock ID limits are uknown, however it's 1B by specification and I've
|
* Clock ID limits are unknown, however it's 1B by specification and I've
|
||||||
* found two ranges: <1..5> or <0..15>
|
* found two ranges: <1..5> or <0..15>
|
||||||
*
|
*
|
||||||
* @argv_ptr: source string to convert from; usually argv
|
* @argv_ptr: source string to convert from; usually argv
|
||||||
@ -298,7 +392,7 @@ is_clk_id(const char *argv_ptr, uint8_t *clk_id_ptr)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* is_clk_index - wrapper to convert user input into integer.
|
/* is_clk_index - wrapper to convert user input into integer.
|
||||||
* Clock Index limits are uknown[1B by spec]
|
* Clock Index limits are unknown[1B by spec]
|
||||||
*
|
*
|
||||||
* @argv_ptr: source string to convert from; usually argv
|
* @argv_ptr: source string to convert from; usually argv
|
||||||
* @clk_index_ptr: pointer where to store result
|
* @clk_index_ptr: pointer where to store result
|
||||||
@ -318,7 +412,7 @@ is_clk_index(const char *argv_ptr, uint8_t *clk_index_ptr)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* is_clk_resid - wrapper to convert user input into integer.
|
/* is_clk_resid - wrapper to convert user input into integer.
|
||||||
* Clock Resource Index(?) limits are uknown, but maximum seems to be 15.
|
* Clock Resource Index(?) limits are unknown, but maximum seems to be 15.
|
||||||
*
|
*
|
||||||
* @argv_ptr: source string to convert from; usually argv
|
* @argv_ptr: source string to convert from; usually argv
|
||||||
* @clk_resid_ptr: pointer where to store result
|
* @clk_resid_ptr: pointer where to store result
|
||||||
@ -661,7 +755,7 @@ ipmi_picmg_properties(struct ipmi_intf * intf, int show )
|
|||||||
#define PICMG_FRU_ACTIVATE (unsigned char) 0x01
|
#define PICMG_FRU_ACTIVATE (unsigned char) 0x01
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsigned char state)
|
ipmi_picmg_fru_activation(struct ipmi_intf * intf, char ** argv, unsigned char state)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -695,7 +789,7 @@ ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsig
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, char ** argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -734,7 +828,7 @@ ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char **
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_fru_activation_policy_set(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_fru_activation_policy_set(struct ipmi_intf * intf, char ** argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -1029,7 +1123,7 @@ ipmi_picmg_amc_portstate_get(struct ipmi_intf * intf, int32_t device,
|
|||||||
|
|
||||||
|
|
||||||
/* Removed endianness check here, probably not required
|
/* Removed endianness check here, probably not required
|
||||||
as we dont use bitfields */
|
as we don't use bitfields */
|
||||||
port = d->linkInfo[0] & 0x0F;
|
port = d->linkInfo[0] & 0x0F;
|
||||||
type = ((d->linkInfo[0] & 0xF0) >> 4 )|(d->linkInfo[1] & 0x0F );
|
type = ((d->linkInfo[0] & 0xF0) >> 4 )|(d->linkInfo[1] & 0x0F );
|
||||||
ext = ((d->linkInfo[1] & 0xF0) >> 4 );
|
ext = ((d->linkInfo[1] & 0xF0) >> 4 );
|
||||||
@ -1158,7 +1252,7 @@ ipmi_picmg_amc_portstate_set(struct ipmi_intf * intf, uint8_t channel,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_get_led_properties(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_get_led_properties(struct ipmi_intf * intf, char ** argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -1197,7 +1291,7 @@ ipmi_picmg_get_led_properties(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, char ** argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
@ -1234,20 +1328,20 @@ ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf("LED Color Capabilities: ");
|
printf("LED Color Capabilities: ");
|
||||||
for ( i=0 ; i<8 ; i++ ) {
|
for ( i=0 ; i<8 ; i++ ) {
|
||||||
if ( rsp->data[1] & (0x01 << i) ) {
|
if ( rsp->data[1] & (0x01 << i) ) {
|
||||||
printf("%s, ", led_color_str[ i ]);
|
printf("%s, ", picmg_led_color_str(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Default LED Color in\n");
|
printf("Default LED Color in\n");
|
||||||
printf(" LOCAL control: %s\n", led_color_str[ rsp->data[2] ] );
|
printf(" LOCAL control: %s\n", picmg_led_color_str(rsp->data[2]));
|
||||||
printf(" OVERRIDE state: %s\n", led_color_str[ rsp->data[3] ] );
|
printf(" OVERRIDE state: %s\n", picmg_led_color_str(rsp->data[3]));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_get_led_state(struct ipmi_intf * intf, char ** argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -1308,7 +1402,9 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf(" Local Control On-Duration: %x\n", rsp->data[3] );
|
printf(" Local Control On-Duration: %x\n", rsp->data[3] );
|
||||||
printf(" Local Control Color: %x [%s]\n", rsp->data[4], led_color_str[ rsp->data[4] ]);
|
printf(" Local Control Color: %x [%s]\n",
|
||||||
|
rsp->data[4],
|
||||||
|
picmg_led_color_str(rsp->data[4]));
|
||||||
|
|
||||||
/* override state or lamp test */
|
/* override state or lamp test */
|
||||||
if (rsp->data[1] & 0x02) {
|
if (rsp->data[1] & 0x02) {
|
||||||
@ -1322,7 +1418,9 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf(" Override On-Duration: %x\n", rsp->data[6] );
|
printf(" Override On-Duration: %x\n", rsp->data[6] );
|
||||||
printf(" Override Color: %x [%s]\n", rsp->data[7], led_color_str[ rsp->data[7] ]);
|
printf(" Override Color: %x [%s]\n",
|
||||||
|
rsp->data[7],
|
||||||
|
picmg_led_color_str(rsp->data[7]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,7 +1432,7 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_set_led_state(struct ipmi_intf * intf, char ** argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -1410,7 +1508,7 @@ ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_get_power_level(struct ipmi_intf * intf, char ** argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
@ -1461,7 +1559,7 @@ ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_set_power_level(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_set_power_level(struct ipmi_intf * intf, char ** argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -1565,7 +1663,7 @@ ipmi_picmg_bused_resource(struct ipmi_intf * intf, t_picmg_bused_resource_mode m
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_fru_control(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_fru_control(struct ipmi_intf * intf, char ** argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -1654,7 +1752,7 @@ ipmi_picmg_clk_get(struct ipmi_intf * intf, uint8_t clk_id, int8_t clk_res,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rsp->ccode == 0 ) {
|
if (!rsp->ccode) {
|
||||||
enabled = (rsp->data[1]&0x8)!=0;
|
enabled = (rsp->data[1]&0x8)!=0;
|
||||||
direction = (rsp->data[1]&0x4)!=0;
|
direction = (rsp->data[1]&0x4)!=0;
|
||||||
|
|
||||||
@ -1785,24 +1883,24 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
int showProperties = 0;
|
int showProperties = 0;
|
||||||
|
|
||||||
if (argc == 0 || (!strncmp(argv[0], "help", 4))) {
|
if (!argc || !strcmp(argv[0], "help")) {
|
||||||
ipmi_picmg_help();
|
ipmi_picmg_help();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get PICMG properties is called to obtain version information */
|
/* Get PICMG properties is called to obtain version information */
|
||||||
if (argc !=0 && !strncmp(argv[0], "properties", 10)) {
|
if (!strcmp(argv[0], "properties")) {
|
||||||
showProperties =1;
|
showProperties =1;
|
||||||
}
|
}
|
||||||
rc = ipmi_picmg_properties(intf,showProperties);
|
rc = ipmi_picmg_properties(intf,showProperties);
|
||||||
|
|
||||||
/* address info command */
|
/* address info command */
|
||||||
if (!strncmp(argv[0], "addrinfo", 8)) {
|
if (!strcmp(argv[0], "addrinfo")) {
|
||||||
rc = ipmi_picmg_getaddr(intf, argc-1, &argv[1]);
|
rc = ipmi_picmg_getaddr(intf, argc-1, &argv[1]);
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[0], "busres", 6)) {
|
else if (!strcmp(argv[0], "busres")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "summary", 7)) {
|
if (!strcmp(argv[1], "summary")) {
|
||||||
ipmi_picmg_bused_resource(intf, PICMG_BUSED_RESOURCE_SUMMARY );
|
ipmi_picmg_bused_resource(intf, PICMG_BUSED_RESOURCE_SUMMARY );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1810,9 +1908,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* fru control command */
|
/* fru control command */
|
||||||
else if (!strncmp(argv[0], "frucontrol", 10)) {
|
else if (!strcmp(argv[0], "frucontrol")) {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
rc = ipmi_picmg_fru_control(intf, argc-1, &(argv[1]));
|
rc = ipmi_picmg_fru_control(intf, &(argv[1]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_NOTICE, "usage: frucontrol <FRU-ID> <OPTION>");
|
lprintf(LOG_NOTICE, "usage: frucontrol <FRU-ID> <OPTION>");
|
||||||
@ -1830,9 +1928,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fru activation command */
|
/* fru activation command */
|
||||||
else if (!strncmp(argv[0], "activate", 8)) {
|
else if (!strcmp(argv[0], "activate")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
rc = ipmi_picmg_fru_activation(intf, argc-1, &(argv[1]), PICMG_FRU_ACTIVATE);
|
rc = ipmi_picmg_fru_activation(intf, &(argv[1]), PICMG_FRU_ACTIVATE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR, "Specify the FRU to activate.");
|
lprintf(LOG_ERR, "Specify the FRU to activate.");
|
||||||
@ -1841,9 +1939,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fru deactivation command */
|
/* fru deactivation command */
|
||||||
else if (!strncmp(argv[0], "deactivate", 10)) {
|
else if (!strcmp(argv[0], "deactivate")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
rc = ipmi_picmg_fru_activation(intf, argc-1, &(argv[1]), PICMG_FRU_DEACTIVATE);
|
rc = ipmi_picmg_fru_activation(intf, &(argv[1]), PICMG_FRU_DEACTIVATE);
|
||||||
}else {
|
}else {
|
||||||
lprintf(LOG_ERR, "Specify the FRU to deactivate.");
|
lprintf(LOG_ERR, "Specify the FRU to deactivate.");
|
||||||
return -1;
|
return -1;
|
||||||
@ -1851,17 +1949,17 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* activation policy command */
|
/* activation policy command */
|
||||||
else if (!strncmp(argv[0], "policy", 6)) {
|
else if (!strcmp(argv[0], "policy")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
rc = ipmi_picmg_fru_activation_policy_get(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_fru_activation_policy_get(intf, &(argv[2]));
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_NOTICE, "usage: get <fruid>");
|
lprintf(LOG_NOTICE, "usage: get <fruid>");
|
||||||
}
|
}
|
||||||
} else if (!strncmp(argv[1], "set", 3)) {
|
} else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 4) {
|
if (argc > 4) {
|
||||||
rc = ipmi_picmg_fru_activation_policy_set(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_fru_activation_policy_set(intf, &(argv[2]));
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_NOTICE, "usage: set <fruid> <lockmask> <lock>");
|
lprintf(LOG_NOTICE, "usage: set <fruid> <lockmask> <lock>");
|
||||||
lprintf(LOG_NOTICE,
|
lprintf(LOG_NOTICE,
|
||||||
@ -1884,18 +1982,18 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* portstate command */
|
/* portstate command */
|
||||||
else if (!strncmp(argv[0], "portstate", 9)) {
|
else if (!strcmp(argv[0], "portstate")) {
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: portstate API");
|
lprintf(LOG_DEBUG,"PICMG: portstate API");
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
int32_t iface;
|
int32_t iface;
|
||||||
uint8_t channel = 0;
|
uint8_t channel = 0;
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: get");
|
lprintf(LOG_DEBUG,"PICMG: get");
|
||||||
|
|
||||||
if(!strncmp(argv[1], "getall", 6)) {
|
if(!strcmp(argv[1], "getall")) {
|
||||||
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
||||||
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
||||||
if(!(( iface == FRU_PICMGEXT_DESIGN_IF_FABRIC ) &&
|
if(!(( iface == FRU_PICMGEXT_DESIGN_IF_FABRIC ) &&
|
||||||
@ -1907,7 +2005,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getgranted", 10)) {
|
else if(!strcmp(argv[1], "getgranted")) {
|
||||||
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
||||||
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
||||||
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
||||||
@ -1915,7 +2013,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getdenied", 9)){
|
else if(!strcmp(argv[1], "getdenied")){
|
||||||
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
|
||||||
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
|
||||||
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
||||||
@ -1938,7 +2036,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_NOTICE, "<intf> <chn>|getall|getgranted|getdenied");
|
lprintf(LOG_NOTICE, "<intf> <chn>|getall|getgranted|getdenied");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc == 9) {
|
if (argc == 9) {
|
||||||
int32_t interface = 0;
|
int32_t interface = 0;
|
||||||
int32_t port = 0;
|
int32_t port = 0;
|
||||||
@ -1981,18 +2079,18 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* amc portstate command */
|
/* amc portstate command */
|
||||||
else if (!strncmp(argv[0], "amcportstate", 12)) {
|
else if (!strcmp(argv[0], "amcportstate")) {
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: amcportstate API");
|
lprintf(LOG_DEBUG,"PICMG: amcportstate API");
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)){
|
if (!strcmp(argv[1], "get")){
|
||||||
int32_t device;
|
int32_t device;
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: get");
|
lprintf(LOG_DEBUG,"PICMG: get");
|
||||||
|
|
||||||
if(!strncmp(argv[1], "getall", 6)){
|
if(!strcmp(argv[1], "getall")){
|
||||||
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
||||||
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
||||||
maxDevice = 0;
|
maxDevice = 0;
|
||||||
@ -2004,7 +2102,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getgranted", 10)){
|
else if(!strcmp(argv[1], "getgranted")){
|
||||||
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
||||||
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
||||||
maxDevice = 0;
|
maxDevice = 0;
|
||||||
@ -2016,7 +2114,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getdenied", 9)){
|
else if(!strcmp(argv[1], "getdenied")){
|
||||||
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
|
||||||
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
|
||||||
maxDevice = 0;
|
maxDevice = 0;
|
||||||
@ -2049,7 +2147,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_NOTICE, "<chn> <device>|getall|getgranted|getdenied");
|
lprintf(LOG_NOTICE, "<chn> <device>|getall|getgranted|getdenied");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 7) {
|
if (argc > 7) {
|
||||||
int32_t device = -1;
|
int32_t device = -1;
|
||||||
int32_t port = 0;
|
int32_t port = 0;
|
||||||
@ -2096,35 +2194,35 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* ATCA led commands */
|
/* ATCA led commands */
|
||||||
else if (!strncmp(argv[0], "led", 3)) {
|
else if (!strcmp(argv[0], "led")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "prop", 4)) {
|
if (!strcmp(argv[1], "prop")) {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
rc = ipmi_picmg_get_led_properties(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_get_led_properties(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_NOTICE, "led prop <FRU-ID>");
|
lprintf(LOG_NOTICE, "led prop <FRU-ID>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "cap", 3)) {
|
else if (!strcmp(argv[1], "cap")) {
|
||||||
if (argc > 3) {
|
if (argc > 3) {
|
||||||
rc = ipmi_picmg_get_led_capabilities(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_get_led_capabilities(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_NOTICE, "led cap <FRU-ID> <LED-ID>");
|
lprintf(LOG_NOTICE, "led cap <FRU-ID> <LED-ID>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "get", 3)) {
|
else if (!strcmp(argv[1], "get")) {
|
||||||
if (argc > 3) {
|
if (argc > 3) {
|
||||||
rc = ipmi_picmg_get_led_state(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_get_led_state(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_NOTICE, "led get <FRU-ID> <LED-ID>");
|
lprintf(LOG_NOTICE, "led get <FRU-ID> <LED-ID>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 6) {
|
if (argc > 6) {
|
||||||
rc = ipmi_picmg_set_led_state(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_set_led_state(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_NOTICE,
|
lprintf(LOG_NOTICE,
|
||||||
@ -2164,11 +2262,11 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* power commands */
|
/* power commands */
|
||||||
else if (!strncmp(argv[0], "power", 5)) {
|
else if (!strcmp(argv[0], "power")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
if (argc > 3) {
|
if (argc > 3) {
|
||||||
rc = ipmi_picmg_get_power_level(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_get_power_level(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_NOTICE, "power get <FRU-ID> <type>");
|
lprintf(LOG_NOTICE, "power get <FRU-ID> <type>");
|
||||||
@ -2181,9 +2279,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 4) {
|
if (argc > 4) {
|
||||||
rc = ipmi_picmg_set_power_level(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_set_power_level(intf, &(argv[2]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_NOTICE, "power set <FRU-ID> <level> <present-desired>");
|
lprintf(LOG_NOTICE, "power set <FRU-ID> <level> <present-desired>");
|
||||||
@ -2208,9 +2306,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}/* clk commands*/
|
}/* clk commands*/
|
||||||
else if (!strncmp(argv[0], "clk", 3)) {
|
else if (!strcmp(argv[0], "clk")) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncmp(argv[1], "get", 3)) {
|
if (!strcmp(argv[1], "get")) {
|
||||||
int8_t clk_res = -1;
|
int8_t clk_res = -1;
|
||||||
uint8_t clk_id;
|
uint8_t clk_id;
|
||||||
uint8_t max_res = 15;
|
uint8_t max_res = 15;
|
||||||
@ -2219,7 +2317,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
max_res = 0;
|
max_res = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strncmp(argv[1], "getall", 6)) {
|
if(!strcmp(argv[1], "getall")) {
|
||||||
if( verbose ) { printf("Getting all clock state\n") ;}
|
if( verbose ) { printf("Getting all clock state\n") ;}
|
||||||
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
||||||
for(clk_id=0;clk_id<=15;clk_id++) {
|
for(clk_id=0;clk_id<=15;clk_id++) {
|
||||||
@ -2228,7 +2326,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getdenied", 6)) {
|
else if(!strcmp(argv[1], "getdenied")) {
|
||||||
if( verbose ) { printf("Getting disabled clocks\n") ;}
|
if( verbose ) { printf("Getting disabled clocks\n") ;}
|
||||||
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
||||||
for(clk_id=0;clk_id<=15;clk_id++) {
|
for(clk_id=0;clk_id<=15;clk_id++) {
|
||||||
@ -2237,7 +2335,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "getgranted", 6)) {
|
else if(!strcmp(argv[1], "getgranted")) {
|
||||||
if( verbose ) { printf("Getting enabled clocks\n") ;}
|
if( verbose ) { printf("Getting enabled clocks\n") ;}
|
||||||
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
for(clk_res=0;clk_res<=max_res;clk_res++) {
|
||||||
for(clk_id=0;clk_id<=15;clk_id++) {
|
for(clk_id=0;clk_id<=15;clk_id++) {
|
||||||
@ -2266,7 +2364,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strcmp(argv[1], "set")) {
|
||||||
if (argc > 7) {
|
if (argc > 7) {
|
||||||
rc = ipmi_picmg_clk_set(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_clk_set(intf, argc-1, &(argv[2]));
|
||||||
}
|
}
|
||||||
@ -2330,7 +2428,7 @@ ipmi_picmg_ipmb_address(struct ipmi_intf *intf) {
|
|||||||
uint8_t
|
uint8_t
|
||||||
picmg_discover(struct ipmi_intf *intf) {
|
picmg_discover(struct ipmi_intf *intf) {
|
||||||
/* Check if PICMG extension is available to use the function
|
/* Check if PICMG extension is available to use the function
|
||||||
* GetDeviceLocator to retreive i2c address PICMG hack to set
|
* GetDeviceLocator to retrieve i2c address PICMG hack to set
|
||||||
* right IPMB address, If extension is not supported, should
|
* right IPMB address, If extension is not supported, should
|
||||||
* not give any problems
|
* not give any problems
|
||||||
* PICMG Extension Version 2.0 (PICMG 3.0 Revision 1.0 ATCA) to
|
* PICMG Extension Version 2.0 (PICMG 3.0 Revision 1.0 ATCA) to
|
||||||
@ -2353,13 +2451,13 @@ picmg_discover(struct ipmi_intf *intf) {
|
|||||||
req.msg.data_len = 1;
|
req.msg.data_len = 1;
|
||||||
msg_data = 0;
|
msg_data = 0;
|
||||||
|
|
||||||
lprintf(LOG_INFO, "Running Get PICMG Properties my_addr %#x, transit %#x, target %#x",
|
lprintf(LOG_DEBUG, "Running Get PICMG Properties my_addr %#x, transit %#x, target %#x",
|
||||||
intf->my_addr, intf->transit_addr, intf->target_addr);
|
intf->my_addr, intf->transit_addr, intf->target_addr);
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_INFO,"No response from Get PICMG Properties");
|
lprintf(LOG_DEBUG,"No response from Get PICMG Properties");
|
||||||
} else if (rsp->ccode != 0) {
|
} else if (rsp->ccode) {
|
||||||
lprintf(LOG_INFO,"Error response %#x from Get PICMG Properities",
|
lprintf(LOG_DEBUG,"Error response %#x from Get PICMG Properties",
|
||||||
rsp->ccode);
|
rsp->ccode);
|
||||||
} else if (rsp->data_len < 4) {
|
} else if (rsp->data_len < 4) {
|
||||||
lprintf(LOG_INFO,"Invalid Get PICMG Properties response length %d",
|
lprintf(LOG_INFO,"Invalid Get PICMG Properties response length %d",
|
||||||
@ -2367,14 +2465,14 @@ picmg_discover(struct ipmi_intf *intf) {
|
|||||||
} else if (rsp->data[0] != 0) {
|
} else if (rsp->data[0] != 0) {
|
||||||
lprintf(LOG_INFO,"Invalid Get PICMG Properties group extension %#x",
|
lprintf(LOG_INFO,"Invalid Get PICMG Properties group extension %#x",
|
||||||
rsp->data[0]);
|
rsp->data[0]);
|
||||||
} else if ((rsp->data[1] & 0x0F) != PICMG_EXTENSION_ATCA_MAJOR_VERSION
|
} else if ((rsp->data[1] & 0x0F) != PICMG_ATCA_MAJOR_VERSION
|
||||||
&& (rsp->data[1] & 0x0F) != PICMG_EXTENSION_AMC0_MAJOR_VERSION
|
&& (rsp->data[1] & 0x0F) != PICMG_AMC_MAJOR_VERSION
|
||||||
&& (rsp->data[1] & 0x0F) != PICMG_EXTENSION_UTCA_MAJOR_VERSION) {
|
&& (rsp->data[1] & 0x0F) != PICMG_UTCA_MAJOR_VERSION) {
|
||||||
lprintf(LOG_INFO,"Unknown PICMG Extension Version %d.%d",
|
lprintf(LOG_INFO,"Unknown PICMG Extension Version %d.%d",
|
||||||
(rsp->data[1] & 0x0F), (rsp->data[1] >> 4));
|
(rsp->data[1] & 0x0F), (rsp->data[1] >> 4));
|
||||||
} else {
|
} else {
|
||||||
picmg_avail = 1;
|
picmg_avail = 1;
|
||||||
lprintf(LOG_INFO, "Discovered PICMG Extension Version %d.%d",
|
lprintf(LOG_DEBUG, "Discovered PICMG Extension Version %d.%d",
|
||||||
(rsp->data[1] & 0x0f), (rsp->data[1] >> 4));
|
(rsp->data[1] & 0x0f), (rsp->data[1] >> 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
184
lib/ipmi_quantaoem.c
Normal file
184
lib/ipmi_quantaoem.c
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Quanta Computer 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 Quanta Computer 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.
|
||||||
|
* Quanta Computer Inc. 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
|
||||||
|
* Quanta Computer Inc. 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.
|
||||||
|
*/
|
||||||
|
#define _XOPEN_SOURCE
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <ipmitool/ipmi.h>
|
||||||
|
#include <ipmitool/ipmi_mc.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_quantaoem.h>
|
||||||
|
#include <ipmitool/ipmi_raw.h>
|
||||||
|
|
||||||
|
/* Max Size of the description String to be displyed for the Each sel entry */
|
||||||
|
#define SIZE_OF_DESC 128
|
||||||
|
|
||||||
|
#define CPU_SHIFT 6
|
||||||
|
#define CPU_MASK 0X03
|
||||||
|
#define CPU_NUM(x) (((x) >> CPU_SHIFT) & CPU_MASK)
|
||||||
|
|
||||||
|
#define CHANNEL_BASE 0x41
|
||||||
|
#define CHANNEL_SHIFT 3
|
||||||
|
#define CHANNEL_MASK 0x07
|
||||||
|
#define CHANNEL_OFFSET(x) (((x) >> CHANNEL_SHIFT) & CHANNEL_MASK)
|
||||||
|
#define CHANNEL_NUM(x) (CHANNEL_BASE + CHANNEL_OFFSET(x))
|
||||||
|
|
||||||
|
#define DIMM_MASK 0x07
|
||||||
|
#define DIMM_NUM(x) ((x) & DIMM_MASK)
|
||||||
|
|
||||||
|
#define GET_PLATFORM_ID_DATA_SIZE 4
|
||||||
|
|
||||||
|
// Magic code to check if it's valid command
|
||||||
|
#define QCT_MAGIC_1 0x4C
|
||||||
|
#define QCT_MAGIC_2 0x1C
|
||||||
|
#define QCT_MAGIC_3 0x00
|
||||||
|
#define QCT_MAGIC_4 0x02
|
||||||
|
|
||||||
|
qct_platform_t
|
||||||
|
oem_qct_get_platform_id(struct ipmi_intf *intf)
|
||||||
|
{
|
||||||
|
/* Execute a Get platform ID command to determine the board */
|
||||||
|
struct ipmi_rs *rsp;
|
||||||
|
struct ipmi_rq req;
|
||||||
|
qct_platform_t platform_id;
|
||||||
|
uint8_t msg_data[GET_PLATFORM_ID_DATA_SIZE];
|
||||||
|
|
||||||
|
/* Ask for IPMI v2 data as well */
|
||||||
|
msg_data[0] = QCT_MAGIC_1;
|
||||||
|
msg_data[1] = QCT_MAGIC_2;
|
||||||
|
msg_data[2] = QCT_MAGIC_3;
|
||||||
|
msg_data[3] = QCT_MAGIC_4;
|
||||||
|
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.msg.netfn = OEM_QCT_NETFN;
|
||||||
|
req.msg.cmd = OEM_QCT_GET_INFO;
|
||||||
|
req.msg.data = msg_data;
|
||||||
|
req.msg.data_len = sizeof(msg_data);
|
||||||
|
|
||||||
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
if (!rsp) {
|
||||||
|
lprintf(LOG_ERR, "Get Platform ID command failed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (rsp->ccode) {
|
||||||
|
lprintf(LOG_ERR, "Get Platform ID command failed: %#x %s",
|
||||||
|
rsp->ccode, val2str(rsp->ccode, completion_code_vals));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
platform_id = rsp->data[0];
|
||||||
|
lprintf(LOG_DEBUG,"Platform ID: %hhx", rsp->data[0]);
|
||||||
|
return platform_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
oem_qct_get_evt_desc(struct ipmi_intf *intf, struct sel_event_record *rec)
|
||||||
|
{
|
||||||
|
struct ipmi_rs *rsp;
|
||||||
|
struct ipmi_rq req;
|
||||||
|
char *desc = NULL;
|
||||||
|
int data;
|
||||||
|
int sensor_type;
|
||||||
|
qct_platform_t platform_id;
|
||||||
|
|
||||||
|
/* Get the OEM event Bytes of the SEL Records byte 15 to data */
|
||||||
|
data = rec->sel_type.standard_type.event_data[2];
|
||||||
|
/* Check for the Standard Event type == 0x6F */
|
||||||
|
if (rec->sel_type.standard_type.event_type != 0x6F) {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
/* Allocate mem for the Description string */
|
||||||
|
desc = malloc(SIZE_OF_DESC);
|
||||||
|
if (!desc) {
|
||||||
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
memset(desc, 0, SIZE_OF_DESC);
|
||||||
|
sensor_type = rec->sel_type.standard_type.sensor_type;
|
||||||
|
switch (sensor_type) {
|
||||||
|
case SENSOR_TYPE_MEMORY:
|
||||||
|
memset(&req, 0, sizeof (req));
|
||||||
|
req.msg.netfn = IPMI_NETFN_APP;
|
||||||
|
req.msg.lun = 0;
|
||||||
|
req.msg.cmd = BMC_GET_DEVICE_ID;
|
||||||
|
req.msg.data = NULL;
|
||||||
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
if (!rsp) {
|
||||||
|
lprintf(LOG_ERR, " Error getting system info");
|
||||||
|
goto out;
|
||||||
|
} else if (rsp->ccode) {
|
||||||
|
lprintf(LOG_ERR, " Error getting system info: %s",
|
||||||
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
/* check the platform type */
|
||||||
|
platform_id = oem_qct_get_platform_id(intf);
|
||||||
|
if (OEM_QCT_PLATFORM_PURLEY == platform_id) {
|
||||||
|
snprintf(desc, SIZE_OF_DESC, "CPU%d_%c%d",
|
||||||
|
CPU_NUM(data),
|
||||||
|
CHANNEL_NUM(data),
|
||||||
|
DIMM_NUM(data));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
return desc;
|
||||||
|
out:
|
||||||
|
if (desc) {
|
||||||
|
free(desc);
|
||||||
|
desc = NULL;
|
||||||
|
}
|
||||||
|
return desc;
|
||||||
|
}
|
@ -101,11 +101,11 @@ ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, uint8_t addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "I2C Master Write-Read command failed");
|
lprintf(LOG_ERR, "I2C Master Write-Read command failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (rsp->ccode > 0) {
|
else if (rsp->ccode) {
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x81:
|
case 0x81:
|
||||||
lprintf(LOG_ERR, "I2C Master Write-Read command failed: Lost Arbitration");
|
lprintf(LOG_ERR, "I2C Master Write-Read command failed: Lost Arbitration");
|
||||||
@ -145,7 +145,7 @@ ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
memset(spd_data, 0, RAW_SPD_SIZE);
|
memset(spd_data, 0, RAW_SPD_SIZE);
|
||||||
|
|
||||||
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 2 || !strcmp(argv[0], "help")) {
|
||||||
lprintf(LOG_NOTICE, "usage: spd <i2cbus> <i2caddr> [channel] [maxread]");
|
lprintf(LOG_NOTICE, "usage: spd <i2cbus> <i2caddr> [channel] [maxread]");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
for (i = 0; i < RAW_SPD_SIZE; i+= msize) {
|
for (i = 0; i < RAW_SPD_SIZE; i+= msize) {
|
||||||
rsp = ipmi_master_write_read(intf, i2cbus, i2caddr,
|
rsp = ipmi_master_write_read(intf, i2cbus, i2caddr,
|
||||||
(uint8_t *)&i, 1, msize );
|
(uint8_t *)&i, 1, msize );
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Unable to perform I2C Master Write-Read");
|
lprintf(LOG_ERR, "Unable to perform I2C Master Write-Read");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -190,6 +190,9 @@ static void rawi2c_usage(void)
|
|||||||
lprintf(LOG_NOTICE, " chan=0 is default, bus= must be specified to use chan=");
|
lprintf(LOG_NOTICE, " chan=0 is default, bus= must be specified to use chan=");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BUS_KW "bus="
|
||||||
|
#define CHAN_KW "chan="
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
@ -203,25 +206,25 @@ ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
/* handle bus= argument */
|
/* handle bus= argument */
|
||||||
if (argc > 2 && strncmp(argv[0], "bus=", 4) == 0) {
|
if (argc > 2 && !strncmp(argv[0], BUS_KW, strlen(BUS_KW))) {
|
||||||
i = 1;
|
i = 1;
|
||||||
if (strncmp(argv[0], "bus=public", 10) == 0)
|
if (!strcmp(argv[0], BUS_KW "public"))
|
||||||
bus = 0;
|
bus = 0;
|
||||||
else if (sscanf(argv[0], "bus=%u", &rbus) == 1)
|
else if (sscanf(argv[0], BUS_KW "%u", &rbus) == 1)
|
||||||
bus = ((rbus & 7) << 1) | 1;
|
bus = ((rbus & 7) << 1) | 1;
|
||||||
else
|
else
|
||||||
bus = 0;
|
bus = 0;
|
||||||
|
|
||||||
/* handle channel= argument
|
/* handle channel= argument
|
||||||
* the bus= argument must be supplied first on command line */
|
* the bus= argument must be supplied first on command line */
|
||||||
if (argc > 3 && strncmp(argv[1], "chan=", 5) == 0) {
|
if (argc > 3 && !strncmp(argv[1], CHAN_KW, strlen(CHAN_KW))) {
|
||||||
i = 2;
|
i = 2;
|
||||||
if (sscanf(argv[1], "chan=%u", &rbus) == 1)
|
if (sscanf(argv[1], CHAN_KW "%u", &rbus) == 1)
|
||||||
bus |= rbus << 4;
|
bus |= rbus << 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((argc-i) < 2 || strncmp(argv[0], "help", 4) == 0) {
|
if ((argc - i) < 2 || !strcmp(argv[0], "help")) {
|
||||||
rawi2c_usage();
|
rawi2c_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -259,7 +262,7 @@ ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printbuf(wdata, wsize, "WRITE DATA");
|
printbuf(wdata, wsize, "WRITE DATA");
|
||||||
|
|
||||||
rsp = ipmi_master_write_read(intf, bus, i2caddr, wdata, wsize, rsize);
|
rsp = ipmi_master_write_read(intf, bus, i2caddr, wdata, wsize, rsize);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Unable to perform I2C Master Write-Read");
|
lprintf(LOG_ERR, "Unable to perform I2C Master Write-Read");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -322,7 +325,7 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int i;
|
int i;
|
||||||
uint8_t data[256];
|
uint8_t data[256];
|
||||||
|
|
||||||
if (argc == 1 && strncmp(argv[0], "help", 4) == 0) {
|
if (argc == 1 && !strcmp(argv[0], "help")) {
|
||||||
ipmi_raw_help();
|
ipmi_raw_help();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -379,13 +382,13 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Unable to send RAW command "
|
lprintf(LOG_ERR, "Unable to send RAW command "
|
||||||
"(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x)",
|
"(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x)",
|
||||||
intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd);
|
intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Unable to send RAW command "
|
lprintf(LOG_ERR, "Unable to send RAW command "
|
||||||
"(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x rsp=0x%x): %s",
|
"(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x rsp=0x%x): %s",
|
||||||
intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd, rsp->ccode,
|
intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd, rsp->ccode,
|
||||||
@ -417,7 +420,7 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
is_valid_param(const char *input_param, uint8_t *uchr_ptr, const char *label) {
|
is_valid_param(const char *input_param, uint8_t *uchr_ptr, const char *label) {
|
||||||
if (input_param == NULL || label == NULL) {
|
if (!input_param || !label) {
|
||||||
lprintf(LOG_ERROR, "ERROR: NULL pointer passed.");
|
lprintf(LOG_ERROR, "ERROR: NULL pointer passed.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
725
lib/ipmi_sdr.c
725
lib/ipmi_sdr.c
File diff suppressed because it is too large
Load Diff
@ -80,7 +80,7 @@ partial_send(struct ipmi_intf *intf, struct ipmi_rq *req, uint16_t *id)
|
|||||||
{
|
{
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
rsp = intf->sendrecv(intf, req);
|
rsp = intf->sendrecv(intf, req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ ipmi_sdr_add_record(struct ipmi_intf *intf, struct sdr_record_list *sdrr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sdr_rq = (struct sdr_add_rq *)malloc(sizeof(*sdr_rq) + sdr_max_write_len);
|
sdr_rq = (struct sdr_add_rq *)malloc(sizeof(*sdr_rq) + sdr_max_write_len);
|
||||||
if (sdr_rq == NULL) {
|
if (!sdr_rq) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -202,11 +202,11 @@ ipmi_sdr_repo_clear(struct ipmi_intf *intf)
|
|||||||
|
|
||||||
for (try = 0; try < 5; try++) {
|
for (try = 0; try < 5; try++) {
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Unable to clear SDRR");
|
lprintf(LOG_ERR, "Unable to clear SDRR");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Unable to clear SDRR: %s",
|
lprintf(LOG_ERR, "Unable to clear SDRR: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -248,11 +248,11 @@ sdrr_get_records(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr,
|
|||||||
queue->head = NULL;
|
queue->head = NULL;
|
||||||
queue->tail = NULL;
|
queue->tail = NULL;
|
||||||
|
|
||||||
while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL) {
|
while ((header = ipmi_sdr_get_next_header(intf, itr))) {
|
||||||
struct sdr_record_list *sdrr;
|
struct sdr_record_list *sdrr;
|
||||||
|
|
||||||
sdrr = malloc(sizeof (struct sdr_record_list));
|
sdrr = malloc(sizeof (struct sdr_record_list));
|
||||||
if (sdrr == NULL) {
|
if (!sdrr) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -263,10 +263,10 @@ sdrr_get_records(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr,
|
|||||||
sdrr->type = header->type;
|
sdrr->type = header->type;
|
||||||
sdrr->length = header->length;
|
sdrr->length = header->length;
|
||||||
sdrr->raw = ipmi_sdr_get_record(intf, header, itr);
|
sdrr->raw = ipmi_sdr_get_record(intf, header, itr);
|
||||||
(void)ipmi_sdr_print_name_from_rawentry(intf, sdrr->id, sdrr->type,sdrr->raw);
|
(void)ipmi_sdr_print_name_from_rawentry(sdrr->id, sdrr->type,sdrr->raw);
|
||||||
|
|
||||||
/* put in the record queue */
|
/* put in the record queue */
|
||||||
if (queue->head == NULL)
|
if (!queue->head)
|
||||||
queue->head = sdrr;
|
queue->head = sdrr;
|
||||||
else
|
else
|
||||||
queue->tail->next = sdrr;
|
queue->tail->next = sdrr;
|
||||||
@ -295,12 +295,12 @@ sdr_copy_to_sdrr(struct ipmi_intf *intf, int use_builtin,
|
|||||||
|
|
||||||
printf("Load SDRs from 0x%x\n", from_addr);
|
printf("Load SDRs from 0x%x\n", from_addr);
|
||||||
rc = sdrr_get_records(intf, itr, &sdrr_queue);
|
rc = sdrr_get_records(intf, itr, &sdrr_queue);
|
||||||
ipmi_sdr_end(intf, itr);
|
ipmi_sdr_end(itr);
|
||||||
/* ... */
|
/* ... */
|
||||||
|
|
||||||
/* write the SDRs to the destination SDR Repository */
|
/* write the SDRs to the destination SDR Repository */
|
||||||
intf->target_addr = to_addr;
|
intf->target_addr = to_addr;
|
||||||
for (sdrr = sdrr_queue.head; sdrr != NULL; sdrr = sdrr_next) {
|
for (sdrr = sdrr_queue.head; sdrr; sdrr = sdrr_next) {
|
||||||
sdrr_next = sdrr->next;
|
sdrr_next = sdrr->next;
|
||||||
rc = ipmi_sdr_add_record(intf, sdrr);
|
rc = ipmi_sdr_add_record(intf, sdrr);
|
||||||
if(rc < 0){
|
if(rc < 0){
|
||||||
@ -433,7 +433,7 @@ int ipmi_parse_range_list(const char *rangeList, unsigned char * pHexList)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(nextString != NULL)
|
if(nextString)
|
||||||
{
|
{
|
||||||
(*nextString)= 0;
|
(*nextString)= 0;
|
||||||
nextString ++;
|
nextString ++;
|
||||||
@ -446,8 +446,7 @@ int ipmi_parse_range_list(const char *rangeList, unsigned char * pHexList)
|
|||||||
|
|
||||||
/* At this point, it is a single entry or a range */
|
/* At this point, it is a single entry or a range */
|
||||||
rangeString = strstr( inProcessString, "-" );
|
rangeString = strstr( inProcessString, "-" );
|
||||||
if(rangeString == NULL)
|
if (!rangeString) {
|
||||||
{
|
|
||||||
unsigned char decValue = 0;
|
unsigned char decValue = 0;
|
||||||
|
|
||||||
/* Single entry */
|
/* Single entry */
|
||||||
@ -597,7 +596,7 @@ ipmi_sdr_read_records(const char *filename, struct sdrr_queue *queue)
|
|||||||
lprintf(LOG_DEBUG, "binHdr[4] (length) = 0x%02x", binHdr[4]);
|
lprintf(LOG_DEBUG, "binHdr[4] (length) = 0x%02x", binHdr[4]);
|
||||||
|
|
||||||
sdrr = malloc(sizeof(*sdrr));
|
sdrr = malloc(sizeof(*sdrr));
|
||||||
if (sdrr == NULL) {
|
if (!sdrr) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
rc = -1;
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
@ -607,7 +606,8 @@ ipmi_sdr_read_records(const char *filename, struct sdrr_queue *queue)
|
|||||||
sdrr->type = binHdr[3];
|
sdrr->type = binHdr[3];
|
||||||
sdrr->length = binHdr[4];
|
sdrr->length = binHdr[4];
|
||||||
|
|
||||||
if ((sdrr->raw = malloc(sdrr->length)) == NULL) {
|
sdrr->raw = malloc(sdrr->length);
|
||||||
|
if (!sdrr->raw) {
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||||
free(sdrr);
|
free(sdrr);
|
||||||
sdrr = NULL;
|
sdrr = NULL;
|
||||||
@ -626,7 +626,7 @@ ipmi_sdr_read_records(const char *filename, struct sdrr_queue *queue)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* put in the record queue */
|
/* put in the record queue */
|
||||||
if (queue->head == NULL)
|
if (!queue->head)
|
||||||
queue->head = sdrr;
|
queue->head = sdrr;
|
||||||
else
|
else
|
||||||
queue->tail->next = sdrr;
|
queue->tail->next = sdrr;
|
||||||
@ -654,7 +654,7 @@ ipmi_sdr_add_from_file(struct ipmi_intf *intf, const char *ifile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* write the SDRs to the SDR Repository */
|
/* write the SDRs to the SDR Repository */
|
||||||
for (sdrr = sdrr_queue.head; sdrr != NULL; sdrr = sdrr_next) {
|
for (sdrr = sdrr_queue.head; sdrr; sdrr = sdrr_next) {
|
||||||
sdrr_next = sdrr->next;
|
sdrr_next = sdrr->next;
|
||||||
rc = ipmi_sdr_add_record(intf, sdrr);
|
rc = ipmi_sdr_add_record(intf, sdrr);
|
||||||
if(rc < 0){
|
if(rc < 0){
|
||||||
|
414
lib/ipmi_sel.c
414
lib/ipmi_sel.c
File diff suppressed because it is too large
Load Diff
@ -62,7 +62,7 @@ ipmi_sensor_get_sensor_reading_factors(
|
|||||||
|
|
||||||
char id[17];
|
char id[17];
|
||||||
|
|
||||||
if (intf == NULL || sensor == NULL)
|
if (!intf || !sensor)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(id, 0, sizeof(id));
|
memset(id, 0, sizeof(id));
|
||||||
@ -80,7 +80,7 @@ ipmi_sensor_get_sensor_reading_factors(
|
|||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error updating reading factor for sensor %s (#%02x)",
|
lprintf(LOG_ERR, "Error updating reading factor for sensor %s (#%02x)",
|
||||||
id, sensor->cmn.keys.sensor_num);
|
id, sensor->cmn.keys.sensor_num);
|
||||||
return -1;
|
return -1;
|
||||||
@ -164,12 +164,30 @@ ipmi_sensor_print_fc_discrete(struct ipmi_intf *intf,
|
|||||||
|
|
||||||
sr = ipmi_sdr_read_sensor_value(intf, sensor, sdr_record_type, 3);
|
sr = ipmi_sdr_read_sensor_value(intf, sensor, sdr_record_type, 3);
|
||||||
|
|
||||||
if (sr == NULL) {
|
if (!sr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csv_output) {
|
if (csv_output) {
|
||||||
/* NOT IMPLEMENTED */
|
printf("%s", sr->s_id);
|
||||||
|
if (sr->s_reading_valid) {
|
||||||
|
if (sr->s_has_analog_value) {
|
||||||
|
/* don't show discrete component */
|
||||||
|
printf(",%s,%s,%s",
|
||||||
|
sr->s_a_str, sr->s_a_units, "ok");
|
||||||
|
} else {
|
||||||
|
printf(",0x%x,%s,0x%02x%02x",
|
||||||
|
sr->s_reading, "discrete",
|
||||||
|
sr->s_data2, sr->s_data3);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf(",%s,%s,%s",
|
||||||
|
"na", "discrete", "na");
|
||||||
|
}
|
||||||
|
printf(",%s,%s,%s,%s,%s,%s",
|
||||||
|
"na", "na", "na", "na", "na", "na");
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
} else {
|
} else {
|
||||||
if (verbose == 0) {
|
if (verbose == 0) {
|
||||||
/* output format
|
/* output format
|
||||||
@ -242,40 +260,54 @@ print_thresh_setting(struct sdr_record_full_sensor *full,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ipmi_sensor_print_fc_threshold(struct ipmi_intf *intf,
|
dump_sensor_fc_thredshold_csv(
|
||||||
struct sdr_record_common_sensor *sensor,
|
int thresh_available,
|
||||||
uint8_t sdr_record_type)
|
const char *thresh_status,
|
||||||
|
struct ipmi_rs *rsp,
|
||||||
|
struct sensor_reading *sr)
|
||||||
{
|
{
|
||||||
int thresh_available = 1;
|
printf("%s", sr->s_id);
|
||||||
struct ipmi_rs *rsp;
|
if (sr->s_reading_valid) {
|
||||||
struct sensor_reading *sr;
|
if (sr->s_has_analog_value)
|
||||||
|
printf(",%.3f,%s,%s",
|
||||||
sr = ipmi_sdr_read_sensor_value(intf, sensor, sdr_record_type, 3);
|
sr->s_a_val, sr->s_a_units, thresh_status);
|
||||||
|
else
|
||||||
if (sr == NULL) {
|
printf(",0x%x,%s,%s",
|
||||||
return -1;
|
sr->s_reading, sr->s_a_units, thresh_status);
|
||||||
}
|
|
||||||
|
|
||||||
const char *thresh_status = ipmi_sdr_get_thresh_status(sr, "ns");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get sensor thresholds
|
|
||||||
*/
|
|
||||||
rsp = ipmi_sdr_get_sensor_thresholds(intf,
|
|
||||||
sensor->keys.sensor_num, sensor->keys.owner_id,
|
|
||||||
sensor->keys.lun, sensor->keys.channel);
|
|
||||||
|
|
||||||
if ((rsp == NULL) || (rsp->ccode > 0) || (rsp->data_len == 0))
|
|
||||||
thresh_available = 0;
|
|
||||||
|
|
||||||
if (csv_output) {
|
|
||||||
/* NOT IMPLEMENTED */
|
|
||||||
} else {
|
} else {
|
||||||
if (verbose == 0) {
|
printf(",%s,%s,%s",
|
||||||
/* output format
|
"na", sr->s_a_units, "na");
|
||||||
|
}
|
||||||
|
if (thresh_available && sr->full) {
|
||||||
|
#define PTS(bit, dataidx) { \
|
||||||
|
print_thresh_setting(sr->full, rsp->data[0] & (bit), \
|
||||||
|
rsp->data[(dataidx)], ",", "%.3f", "0x%x", "%s"); \
|
||||||
|
}
|
||||||
|
PTS(LOWER_NON_RECOV_SPECIFIED, 3);
|
||||||
|
PTS(LOWER_CRIT_SPECIFIED, 2);
|
||||||
|
PTS(LOWER_NON_CRIT_SPECIFIED, 1);
|
||||||
|
PTS(UPPER_NON_CRIT_SPECIFIED, 4);
|
||||||
|
PTS(UPPER_CRIT_SPECIFIED, 5);
|
||||||
|
PTS(UPPER_NON_RECOV_SPECIFIED, 6);
|
||||||
|
#undef PTS
|
||||||
|
} else {
|
||||||
|
printf(",%s,%s,%s,%s,%s,%s",
|
||||||
|
"na", "na", "na", "na", "na", "na");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* output format
|
||||||
* id value units status thresholds....
|
* id value units status thresholds....
|
||||||
*/
|
*/
|
||||||
|
static void
|
||||||
|
dump_sensor_fc_thredshold(
|
||||||
|
int thresh_available,
|
||||||
|
const char *thresh_status,
|
||||||
|
struct ipmi_rs *rsp,
|
||||||
|
struct sensor_reading *sr)
|
||||||
|
{
|
||||||
printf("%-16s ", sr->s_id);
|
printf("%-16s ", sr->s_id);
|
||||||
if (sr->s_reading_valid) {
|
if (sr->s_reading_valid) {
|
||||||
if (sr->s_has_analog_value)
|
if (sr->s_has_analog_value)
|
||||||
@ -290,8 +322,8 @@ ipmi_sensor_print_fc_threshold(struct ipmi_intf *intf,
|
|||||||
}
|
}
|
||||||
if (thresh_available && sr->full) {
|
if (thresh_available && sr->full) {
|
||||||
#define PTS(bit, dataidx) { \
|
#define PTS(bit, dataidx) { \
|
||||||
print_thresh_setting(sr->full, rsp->data[0] & (bit), \
|
print_thresh_setting(sr->full, rsp->data[0] & (bit), \
|
||||||
rsp->data[(dataidx)], "| ", "%-10.3f", "0x-8x", "%-10s"); \
|
rsp->data[(dataidx)], "| ", "%-10.3f", "0x%-8x", "%-10s"); \
|
||||||
}
|
}
|
||||||
PTS(LOWER_NON_RECOV_SPECIFIED, 3);
|
PTS(LOWER_NON_RECOV_SPECIFIED, 3);
|
||||||
PTS(LOWER_CRIT_SPECIFIED, 2);
|
PTS(LOWER_CRIT_SPECIFIED, 2);
|
||||||
@ -301,13 +333,22 @@ ipmi_sensor_print_fc_threshold(struct ipmi_intf *intf,
|
|||||||
PTS(UPPER_NON_RECOV_SPECIFIED, 6);
|
PTS(UPPER_NON_RECOV_SPECIFIED, 6);
|
||||||
#undef PTS
|
#undef PTS
|
||||||
} else {
|
} else {
|
||||||
printf
|
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
||||||
("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
|
||||||
"na", "na", "na", "na", "na", "na");
|
"na", "na", "na", "na", "na", "na");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dump_sensor_fc_thredshold_verbose(
|
||||||
|
int thresh_available,
|
||||||
|
const char *thresh_status,
|
||||||
|
struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_common_sensor *sensor,
|
||||||
|
struct ipmi_rs *rsp,
|
||||||
|
struct sensor_reading *sr)
|
||||||
|
{
|
||||||
printf("Sensor ID : %s (0x%x)\n",
|
printf("Sensor ID : %s (0x%x)\n",
|
||||||
sr->s_id, sensor->keys.sensor_num);
|
sr->s_id, sensor->keys.sensor_num);
|
||||||
|
|
||||||
@ -315,8 +356,7 @@ ipmi_sensor_print_fc_threshold(struct ipmi_intf *intf,
|
|||||||
sensor->entity.id, sensor->entity.instance);
|
sensor->entity.id, sensor->entity.instance);
|
||||||
|
|
||||||
printf(" Sensor Type (Threshold) : %s\n",
|
printf(" Sensor Type (Threshold) : %s\n",
|
||||||
ipmi_get_sensor_type(intf, sensor->sensor.
|
ipmi_get_sensor_type(intf, sensor->sensor.type));
|
||||||
type));
|
|
||||||
|
|
||||||
printf(" Sensor Reading : ");
|
printf(" Sensor Reading : ");
|
||||||
if (sr->s_reading_valid) {
|
if (sr->s_reading_valid) {
|
||||||
@ -339,8 +379,8 @@ ipmi_sensor_print_fc_threshold(struct ipmi_intf *intf,
|
|||||||
sr->s_a_units);
|
sr->s_a_units);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("0x%x %s\n", sr->s_reading,
|
printf("0x%x %s\n",
|
||||||
sr->s_a_units);
|
sr->s_reading, sr->s_a_units);
|
||||||
}
|
}
|
||||||
printf(" Status : %s\n", thresh_status);
|
printf(" Status : %s\n", thresh_status);
|
||||||
|
|
||||||
@ -351,7 +391,6 @@ print_thresh_setting(sr->full, rsp->data[0] & (bit), \
|
|||||||
rsp->data[(dataidx)], \
|
rsp->data[(dataidx)], \
|
||||||
(str), "%.3f\n", "0x%x\n", "%s\n"); \
|
(str), "%.3f\n", "0x%x\n", "%s\n"); \
|
||||||
}
|
}
|
||||||
|
|
||||||
PTS(LOWER_NON_RECOV_SPECIFIED, 3, " Lower Non-Recoverable : ");
|
PTS(LOWER_NON_RECOV_SPECIFIED, 3, " Lower Non-Recoverable : ");
|
||||||
PTS(LOWER_CRIT_SPECIFIED, 2, " Lower Critical : ");
|
PTS(LOWER_CRIT_SPECIFIED, 2, " Lower Critical : ");
|
||||||
PTS(LOWER_NON_CRIT_SPECIFIED, 1, " Lower Non-Critical : ");
|
PTS(LOWER_NON_CRIT_SPECIFIED, 1, " Lower Non-Critical : ");
|
||||||
@ -397,6 +436,43 @@ print_thresh_setting(sr->full, rsp->data[0] & (bit), \
|
|||||||
sensor->keys.channel);
|
sensor->keys.channel);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
ipmi_sensor_print_fc_threshold(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_common_sensor *sensor,
|
||||||
|
uint8_t sdr_record_type)
|
||||||
|
{
|
||||||
|
int thresh_available = 1;
|
||||||
|
struct ipmi_rs *rsp;
|
||||||
|
struct sensor_reading *sr;
|
||||||
|
|
||||||
|
sr = ipmi_sdr_read_sensor_value(intf, sensor, sdr_record_type, 3);
|
||||||
|
|
||||||
|
if (!sr) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *thresh_status = ipmi_sdr_get_thresh_status(sr, "ns");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get sensor thresholds
|
||||||
|
*/
|
||||||
|
rsp = ipmi_sdr_get_sensor_thresholds(intf,
|
||||||
|
sensor->keys.sensor_num, sensor->keys.owner_id,
|
||||||
|
sensor->keys.lun, sensor->keys.channel);
|
||||||
|
|
||||||
|
if (!rsp || rsp->ccode || !rsp->data_len)
|
||||||
|
thresh_available = 0;
|
||||||
|
|
||||||
|
if (csv_output) {
|
||||||
|
dump_sensor_fc_thredshold_csv(thresh_available, thresh_status, rsp, sr);
|
||||||
|
} else {
|
||||||
|
if (verbose == 0) {
|
||||||
|
dump_sensor_fc_thredshold(thresh_available, thresh_status, rsp, sr);
|
||||||
|
} else {
|
||||||
|
dump_sensor_fc_thredshold_verbose(thresh_available, thresh_status,
|
||||||
|
intf, sensor, rsp, sr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,16 +500,16 @@ ipmi_sensor_list(struct ipmi_intf *intf)
|
|||||||
lprintf(LOG_DEBUG, "Querying SDR for sensor list");
|
lprintf(LOG_DEBUG, "Querying SDR for sensor list");
|
||||||
|
|
||||||
itr = ipmi_sdr_start(intf, 0);
|
itr = ipmi_sdr_start(intf, 0);
|
||||||
if (itr == NULL) {
|
if (!itr) {
|
||||||
lprintf(LOG_ERR, "Unable to open SDR for reading");
|
lprintf(LOG_ERR, "Unable to open SDR for reading");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL) {
|
while ((header = ipmi_sdr_get_next_header(intf, itr))) {
|
||||||
uint8_t *rec;
|
uint8_t *rec;
|
||||||
|
|
||||||
rec = ipmi_sdr_get_record(intf, header, itr);
|
rec = ipmi_sdr_get_record(intf, header, itr);
|
||||||
if (rec == NULL) {
|
if (!rec) {
|
||||||
lprintf(LOG_DEBUG, "rec == NULL");
|
lprintf(LOG_DEBUG, "rec == NULL");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -456,7 +532,7 @@ ipmi_sensor_list(struct ipmi_intf *intf)
|
|||||||
/* rc = (r == 0) ? rc : r; */
|
/* rc = (r == 0) ? rc : r; */
|
||||||
}
|
}
|
||||||
|
|
||||||
ipmi_sdr_end(intf, itr);
|
ipmi_sdr_end(itr);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -481,11 +557,11 @@ __ipmi_sensor_set_threshold(struct ipmi_intf *intf,
|
|||||||
rsp = ipmi_sensor_set_sensor_thresholds(intf, num, mask, setting,
|
rsp = ipmi_sensor_set_sensor_thresholds(intf, num, mask, setting,
|
||||||
target, lun, channel);
|
target, lun, channel);
|
||||||
|
|
||||||
if (rsp == NULL) {
|
if (!rsp) {
|
||||||
lprintf(LOG_ERR, "Error setting threshold");
|
lprintf(LOG_ERR, "Error setting threshold");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Error setting threshold: %s",
|
lprintf(LOG_ERR, "Error setting threshold: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return -1;
|
||||||
@ -529,7 +605,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
struct sdr_record_list *sdr;
|
struct sdr_record_list *sdr;
|
||||||
|
|
||||||
if (argc < 3 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 3 || !strcmp(argv[0], "help")) {
|
||||||
print_sensor_thresh_usage();
|
print_sensor_thresh_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -537,7 +613,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
id = argv[0];
|
id = argv[0];
|
||||||
thresh = argv[1];
|
thresh = argv[1];
|
||||||
|
|
||||||
if (strncmp(thresh, "upper", 5) == 0) {
|
if (!strcmp(thresh, "upper")) {
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"usage: sensor thresh <id> upper <unc> <ucr> <unr>");
|
"usage: sensor thresh <id> upper <unc> <ucr> <unr>");
|
||||||
@ -559,7 +635,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
argv[4]);
|
argv[4]);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} else if (strncmp(thresh, "lower", 5) == 0) {
|
} else if (!strcmp(thresh, "lower")) {
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
"usage: sensor thresh <id> lower <lnr> <lcr> <lnc>");
|
"usage: sensor thresh <id> lower <lnr> <lcr> <lnc>");
|
||||||
@ -582,17 +658,17 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (strncmp(thresh, "unr", 3) == 0)
|
if (!strcmp(thresh, "unr"))
|
||||||
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
||||||
else if (strncmp(thresh, "ucr", 3) == 0)
|
else if (!strcmp(thresh, "ucr"))
|
||||||
settingMask = UPPER_CRIT_SPECIFIED;
|
settingMask = UPPER_CRIT_SPECIFIED;
|
||||||
else if (strncmp(thresh, "unc", 3) == 0)
|
else if (!strcmp(thresh, "unc"))
|
||||||
settingMask = UPPER_NON_CRIT_SPECIFIED;
|
settingMask = UPPER_NON_CRIT_SPECIFIED;
|
||||||
else if (strncmp(thresh, "lnc", 3) == 0)
|
else if (!strcmp(thresh, "lnc"))
|
||||||
settingMask = LOWER_NON_CRIT_SPECIFIED;
|
settingMask = LOWER_NON_CRIT_SPECIFIED;
|
||||||
else if (strncmp(thresh, "lcr", 3) == 0)
|
else if (!strcmp(thresh, "lcr"))
|
||||||
settingMask = LOWER_CRIT_SPECIFIED;
|
settingMask = LOWER_CRIT_SPECIFIED;
|
||||||
else if (strncmp(thresh, "lnr", 3) == 0)
|
else if (!strcmp(thresh, "lnr"))
|
||||||
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR,
|
lprintf(LOG_ERR,
|
||||||
@ -612,7 +688,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
/* lookup by sensor name */
|
/* lookup by sensor name */
|
||||||
sdr = ipmi_sdr_find_sdr_byid(intf, id);
|
sdr = ipmi_sdr_find_sdr_byid(intf, id);
|
||||||
if (sdr == NULL) {
|
if (!sdr) {
|
||||||
lprintf(LOG_ERR, "Sensor data record not found!");
|
lprintf(LOG_ERR, "Sensor data record not found!");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -721,7 +797,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
sdr->record.common->keys.owner_id,
|
sdr->record.common->keys.owner_id,
|
||||||
sdr->record.common->keys.lun,
|
sdr->record.common->keys.lun,
|
||||||
sdr->record.common->keys.channel);
|
sdr->record.common->keys.channel);
|
||||||
if ((rsp == NULL) || (rsp->ccode > 0)) {
|
if (!rsp || rsp->ccode) {
|
||||||
lprintf(LOG_ERR, "Sensor data record not found!");
|
lprintf(LOG_ERR, "Sensor data record not found!");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -810,7 +886,7 @@ ipmi_sensor_get_reading(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
struct sdr_record_list *sdr;
|
struct sdr_record_list *sdr;
|
||||||
int i, rc=0;
|
int i, rc=0;
|
||||||
|
|
||||||
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 1 || !strcmp(argv[0], "help")) {
|
||||||
lprintf(LOG_NOTICE, "sensor reading <id> ... [id]");
|
lprintf(LOG_NOTICE, "sensor reading <id> ... [id]");
|
||||||
lprintf(LOG_NOTICE, " id : name of desired sensor");
|
lprintf(LOG_NOTICE, " id : name of desired sensor");
|
||||||
return -1;
|
return -1;
|
||||||
@ -818,7 +894,7 @@ ipmi_sensor_get_reading(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
sdr = ipmi_sdr_find_sdr_byid(intf, argv[i]);
|
sdr = ipmi_sdr_find_sdr_byid(intf, argv[i]);
|
||||||
if (sdr == NULL) {
|
if (!sdr) {
|
||||||
lprintf(LOG_ERR, "Sensor \"%s\" not found!",
|
lprintf(LOG_ERR, "Sensor \"%s\" not found!",
|
||||||
argv[i]);
|
argv[i]);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
@ -833,7 +909,7 @@ ipmi_sensor_get_reading(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
struct sdr_record_common_sensor *sensor = sdr->record.common;
|
struct sdr_record_common_sensor *sensor = sdr->record.common;
|
||||||
sr = ipmi_sdr_read_sensor_value(intf, sensor, sdr->type, 3);
|
sr = ipmi_sdr_read_sensor_value(intf, sensor, sdr->type, 3);
|
||||||
|
|
||||||
if (sr == NULL) {
|
if (!sr) {
|
||||||
rc = -1;
|
rc = -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -874,7 +950,7 @@ ipmi_sensor_get(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
lprintf(LOG_ERR, "Not enough parameters given.");
|
lprintf(LOG_ERR, "Not enough parameters given.");
|
||||||
print_sensor_get_usage();
|
print_sensor_get_usage();
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (strcmp(argv[0], "help") == 0) {
|
} else if (!strcmp(argv[0], "help")) {
|
||||||
print_sensor_get_usage();
|
print_sensor_get_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -882,7 +958,7 @@ ipmi_sensor_get(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
/* lookup by sensor name */
|
/* lookup by sensor name */
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
sdr = ipmi_sdr_find_sdr_byid(intf, argv[i]);
|
sdr = ipmi_sdr_find_sdr_byid(intf, argv[i]);
|
||||||
if (sdr == NULL) {
|
if (!sdr) {
|
||||||
lprintf(LOG_ERR, "Sensor data record \"%s\" not found!",
|
lprintf(LOG_ERR, "Sensor data record \"%s\" not found!",
|
||||||
argv[i]);
|
argv[i]);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
@ -919,15 +995,15 @@ ipmi_sensor_main(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
rc = ipmi_sensor_list(intf);
|
rc = ipmi_sensor_list(intf);
|
||||||
} else if (strncmp(argv[0], "help", 4) == 0) {
|
} else if (!strcmp(argv[0], "help")) {
|
||||||
lprintf(LOG_NOTICE, "Sensor Commands: list thresh get reading");
|
lprintf(LOG_NOTICE, "Sensor Commands: list thresh get reading");
|
||||||
} else if (strncmp(argv[0], "list", 4) == 0) {
|
} else if (!strcmp(argv[0], "list")) {
|
||||||
rc = ipmi_sensor_list(intf);
|
rc = ipmi_sensor_list(intf);
|
||||||
} else if (strncmp(argv[0], "thresh", 5) == 0) {
|
} else if (!strcmp(argv[0], "thresh")) {
|
||||||
rc = ipmi_sensor_set_threshold(intf, argc - 1, &argv[1]);
|
rc = ipmi_sensor_set_threshold(intf, argc - 1, &argv[1]);
|
||||||
} else if (strncmp(argv[0], "get", 3) == 0) {
|
} else if (!strcmp(argv[0], "get")) {
|
||||||
rc = ipmi_sensor_get(intf, argc - 1, &argv[1]);
|
rc = ipmi_sensor_get(intf, argc - 1, &argv[1]);
|
||||||
} else if (strncmp(argv[0], "reading", 7) == 0) {
|
} else if (!strcmp(argv[0], "reading")) {
|
||||||
rc = ipmi_sensor_get_reading(intf, argc - 1, &argv[1]);
|
rc = ipmi_sensor_get_reading(intf, argc - 1, &argv[1]);
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Invalid sensor command: %s", argv[0]);
|
lprintf(LOG_ERR, "Invalid sensor command: %s", argv[0]);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user