Name Date Size #Lines LOC

..25-Nov-2024-

oem/ibm/H11-Mar-2021-235188

README.mdH A D22-Jun-20246 KiB251181

meson.buildH A D23-Aug-2024693 3329

pldm_base_cmd.cppH A D30-Nov-202415.1 KiB425379

pldm_base_cmd.hppH A D11-Mar-2021142 159

pldm_bios_cmd.cppH A D19-Aug-202435.5 KiB990866

pldm_bios_cmd.hppH A D11-Mar-2021160 159

pldm_cmd_helper.cppH A D19-Aug-20242.7 KiB10886

pldm_cmd_helper.hppH A D19-Aug-20243.3 KiB14784

pldm_fru_cmd.cppH A D19-Aug-202417.1 KiB473408

pldm_fru_cmd.hppH A D11-Mar-2021141 159

pldm_fw_update_cmd.cppH A D19-Aug-202424.7 KiB638548

pldm_fw_update_cmd.hppH A D30-Nov-2021171 169

pldm_platform_cmd.cppH A D30-Aug-202491.4 KiB2,2782,033

pldm_platform_cmd.hppH A D21-Jul-2023289 2311

pldmtool.cppH A D19-Aug-20242 KiB8669

README.md

1# Overview of pldmtool
2
3pldmtool is a client tool that acts as a PLDM requester which runs on the BMC.
4pldmtool sends the request message and displays the response message also
5provides flexibility to parse the response message and display it in readable
6format.
7
8pldmtool supports the subcommands for PLDM types such as base, platform, bios,
9fru, and oem-ibm.
10
11- Source files are implemented in C++.
12- Consumes pldm/libpldm encode and decode functions.
13- Communicates with pldmd daemon running on BMC.
14- Enables writing functional test cases for PLDM stack.
15
16please refer the [DMTF PLDM specifications](https://www.dmtf.org/) with respect
17to the pldm types.
18
19## Code organization
20
21Source files in pldmtool repository are named with respect to the PLDM type.
22
23Example:
24
25```txt
26pldm_base_cmd.[hpp/cpp], pldm_fru_cmd.[hpp/cpp]
27```
28
29pldmtool commands for corresponding PLDM type is constructed with the help of
30encode request and decode response APIs which are implemented in pldm/libpldm.
31
32Example:
33
34Given a PLDM command "foo" of PLDM type "base" the pldmtool should consume
35following API from the libpldm.
36
37```c
38- encode_foo_req()  - Send the required input parameters in the request message.
39- decode_foo_resp() - Decode the response message.
40```
41
42If PLDM commands are not yet supported in the pldmtool repository user can
43directly send the request message with the help of **pldmtool raw -d \<data\>**
44option.
45
46## Usage
47
48User can see the pldmtool supported PLDM types in the usage output available
49with the **-h** help option as shown below:
50
51```bash
52$ pldmtool -h
53PLDM requester tool for OpenBMC
54Usage: pldmtool [OPTIONS] SUBCOMMAND
55
56Options:
57  -h,--help                   Print this help message and exit
58
59Subcommands:
60  raw                         send a raw request and print response
61  base                        base type command
62  bios                        bios type command
63  platform                    platform type command
64  fru                         FRU type command
65  oem-ibm                     oem type command
66
67```
68
69pldmtool command prompt expects a PLDM type to display the list of supported
70commands that are already implemented for that particular PLDM type.
71
72```bash
73# command format
74pldmtool <pldmType> -h
75```
76
77Example:
78
79```bash
80$ pldmtool base -h
81
82base type command
83Usage: pldmtool base [OPTIONS] SUBCOMMAND
84
85Options:
86  -h,--help                   Print this help message and exit
87
88Subcommands:
89  GetPLDMTypes                get pldm supported types
90  GetPLDMVersion              get version of a certain type
91  GetTID                      get Terminus ID (TID)
92  GetPLDMCommands             get supported commands of pldm type
93
94```
95
96More help on the command usage can be found by specifying the PLDM type and the
97command name with **-h** argument as shown below.
98
99```bash
100# command format
101pldmtool <pldmType> <commandName> -h
102```
103
104Example:
105
106```bash
107$ pldmtool base GetPLDMTypes -h
108
109get pldm supported types
110Usage: pldmtool base GetPLDMTypes [OPTIONS]
111
112Options:
113  -h,--help                   Print this help message and exit
114  -m,--mctp_eid UINT          MCTP endpoint ID
115  -v,--verbose
116```
117
118## pldmtool raw command usage
119
120pldmtool raw command option accepts request message in the hexadecimal bytes and
121send the response message in hexadecimal bytes.
122
123```bash
124$ pldmtool raw -h
125send a raw request and print response
126Usage: pldmtool raw [OPTIONS]
127
128Options:
129  -h,--help                   Print this help message and exit
130  -m,--mctp_eid UINT          MCTP endpoint ID
131  -v,--verbose
132  -d,--data UINT              REQUIRED raw data
133```
134
135**pldmtool request message format:**
136
137```bash
138pldmtool raw --data 0x80 <pldmType> <cmdType> <payloadReq>
139
140payloadReq - stream of bytes constructed based on the request message format
141             defined for the command type as per the spec.
142```
143
144**pldmtool response message format:**
145
146```txt
147<instanceId> <hdrVersion> <pldmType> <cmdType> <completionCode> <payloadResp>
148
149payloadResp - stream of bytes displayed based on the response message format
150              defined for the command type as per the spec.
151```
152
153Example:
154
155```bash
156$ pldmtool raw -d 0x80 0x00 0x04 0x00 0x00
157
158Request Message:
15908 01 80 00 04 00 00
160Response Message:
16108 01 00 00 04 00 1d 00 00 00 00 00 00 80
162
163```
164
165## pldmtool output format
166
167In the current pldmtool implementation response message from pldmtool is parsed
168and displayed in the JSON format.
169
170Example:
171
172```bash
173$ pldmtool base GetPLDMTypes
174[
175    {
176        "PLDM Type": "base",
177        "PLDM Type Code": 0
178    },
179    {
180        "PLDM Type": "platform",
181        "PLDM Type Code": 2
182    },
183    {
184        "PLDM Type": "bios",
185        "PLDM Type Code": 3
186    },
187    {
188        "PLDM Type": "fru",
189        "PLDM Type Code": 4
190    },
191    {
192        "PLDM Type": "oem-ibm",
193        "PLDM Type Code": 63
194    }
195]
196```
197
198## Understanding pldmtool output error scenario
199
200When the pldmtool receives the wrong response for the request sent it errors out
201with a response code and completion code. The completion code represents the
202type of error and is defined in every pldm type `pldm_\<type\>_completion_codes`
203enum values.
204
205Example:
206
207This is a platform command and the completion code can be understood from
208[`libpldm/platform.h`](https://github.com/openbmc/libpldm/blob/a98814fc37a5d59207163cb2fa81f4162eaf69cd/include/libpldm/platform.h#L204)
209file.
210
211```bash
212$ pldmtool platform getpdr -d 17
213Response Message Error: rc=0 , cc=130
214```
215
216## pldmtool with mctp_eid option
217
218Use **-m** or **--mctp_eid** option to send pldm request message to remote mctp
219end point and by default pldmtool consider mctp_eid value as **'08'**.
220
221```bash
222# Command format:
223pldmtool <pldmType> <cmdType> -m <mctpId>
224
225# pldmtool raw command format
226pldmtool raw -d 0x80 <pldmType> <cmdType> <payloadReq> -m <mctpId>
227```
228
229Example:
230
231```bash
232# Get PLDM Types
233pldmtool base GetPLDMTypes -m 8
234
235# pldmtool raw command
236pldmtool raw -d 0x80 0x00 0x04 0x00 0x00 -m 0x08
237
238```
239
240## pldmtool verbosity
241
242By default verbose flag is disabled on the pldmtool.
243
244Enable verbosity with **-v** flag as shown below.
245
246Example:
247
248```bash
249pldmtool base GetPLDMTypes -v
250```
251