xref: /openbmc/libpldm/docs/oem/meta/file-io.md (revision 1c4c704d)
1# Description of file IO messages
2
3## Read Message Format
4
5### Table 1. Read Request
6
7| Offset   | Type   | Name     | Description                                                                                                                                                  |
8| -------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
9| 0        | uint8  | Handle   | This field is a handle that is used to identify PLDM command type.                                                                                           |
10| 1        | enum8  | Option   | This field is a read option is used to identify the read file option. <br> See Table 3 for the option.                                                       |
11| 2:3      | uint16 | Length   | The length in bytes N of data being sent in this part in the ReadInfo field.                                                                                 |
12| Variable | uint8  | ReadInfo | Portion of reading information. <br> There will be different reading information according to different ReadOption. <br> See Table 4 and Table 5 for details |
13
14### Table 2. Read response
15
16| Offset   | Type  | Name           | Description                                                                                                                                            |
17| -------- | ----- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
18| 0        | int   | CompletionCode | value: { PLDM_SUCCESS, PLDM_ERROR_INVALID_DATA, PLDM_ERROR_INVALID_LENGTH }                                                                            |
19| Variable | uint8 | ReadResponse   | Portion of reading response. <br> There will be different reading response according to different ReadOption. <br> See Table 6 and Table 7 for details |
20
21### Table 3. Option of message type
22
23| Value | Name              | Description                |
24| ----- | ----------------- | -------------------------- |
25| 0x00  | ReadFileAttribute | Get file size and checksum |
26| 0x01  | ReadFileData      | Get file data              |
27
28### Table 4. ReadInfo Definition when ReadOption is ReadFileAttribute in message type
29
30| Offset | Type | Name | Description     |
31| ------ | ---- | ---- | --------------- |
32| 0      | -    | -    | No request data |
33
34### Table 5. ReadInfo Definition when ReadOption is ReadFileData in message type
35
36| Offset | Type   | Name         | Description                                                                                                                                                    |
37| ------ | ------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
38| 0      | uint8  | TransferFlag | The transfer flag that indiates what part of the transfer this request represents. <br> Possible values: {Start=0x01, Middle=0x02, End=0x04, StartAndEnd=0x05} |
39| 1:2    | uint16 | Offset       | Offset in read file.                                                                                                                                           |
40
41### Table 6. ReadResponse Definition when ReadOption is ReadFileAttribute in message type
42
43| Offset | Type   | Name     | Description                                                 |
44| ------ | ------ | -------- | ----------------------------------------------------------- |
45| 0:1    | uint16 | Size     | This field indicates the size of the entire file, in bytes. |
46| 2:5    | uint32 | Checksum | This field indicates the checksum of the entire file.       |
47
48### Table 7. ReadResponse Definition when ReadOption is ReadFileData in message type
49
50| Offset   | Type   | Name         | Description                                                                                                                                                     |
51| -------- | ------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52| 0        | uint8  | TransferFlag | The transfer flag that indiates what part of the transfer this response represents. <br> Possible values: {Start=0x01, Middle=0x02, End=0x04, StartAndEnd=0x05} |
53| 1:2      | uint16 | Offset       | Offset in read file.                                                                                                                                            |
54| Variable | uint8  | FileData     | File data can be up to 255 bytes.                                                                                                                               |
55