xref: /openbmc/libpldm/docs/oem/meta/file-io.md (revision 893a08f0d99ca5b80f84e53d77bdd20e910d3973)
1*893a08f0SLora Lin# Description of file IO messages
2*893a08f0SLora Lin
3*893a08f0SLora Lin## Read Message Format
4*893a08f0SLora Lin
5*893a08f0SLora Lin### Table 1. Read Request
6*893a08f0SLora Lin
7*893a08f0SLora Lin| Offset   | Type   | Name     | Description                                                                                                                                                  |
8*893a08f0SLora Lin| -------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
9*893a08f0SLora Lin| 0        | uint8  | Handle   | This field is a handle that is used to identify PLDM command type.                                                                                           |
10*893a08f0SLora Lin| 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*893a08f0SLora Lin| 2:3      | uint16 | Length   | The length in bytes N of data being sent in this part in the ReadInfo field.                                                                                 |
12*893a08f0SLora Lin| 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*893a08f0SLora Lin
14*893a08f0SLora Lin### Table 2. Read response
15*893a08f0SLora Lin
16*893a08f0SLora Lin| Offset   | Type  | Name           | Description                                                                                                                                            |
17*893a08f0SLora Lin| -------- | ----- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
18*893a08f0SLora Lin| 0        | int   | CompletionCode | value: { PLDM_SUCCESS, PLDM_ERROR_INVALID_DATA, PLDM_ERROR_INVALID_LENGTH }                                                                            |
19*893a08f0SLora Lin| 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*893a08f0SLora Lin
21*893a08f0SLora Lin### Table 3. Option of message type
22*893a08f0SLora Lin
23*893a08f0SLora Lin| Value | Name              | Description                |
24*893a08f0SLora Lin| ----- | ----------------- | -------------------------- |
25*893a08f0SLora Lin| 0x00  | ReadFileAttribute | Get file size and checksum |
26*893a08f0SLora Lin| 0x01  | ReadFileData      | Get file data              |
27*893a08f0SLora Lin
28*893a08f0SLora Lin### Table 4. ReadInfo Definition when ReadOption is ReadFileAttribute in message type
29*893a08f0SLora Lin
30*893a08f0SLora Lin| Offset | Type | Name | Description     |
31*893a08f0SLora Lin| ------ | ---- | ---- | --------------- |
32*893a08f0SLora Lin| 0      | -    | -    | No request data |
33*893a08f0SLora Lin
34*893a08f0SLora Lin### Table 5. ReadInfo Definition when ReadOption is ReadFileData in message type
35*893a08f0SLora Lin
36*893a08f0SLora Lin| Offset | Type   | Name         | Description                                                                                                                                                    |
37*893a08f0SLora Lin| ------ | ------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
38*893a08f0SLora Lin| 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*893a08f0SLora Lin| 1:2    | uint16 | Offset       | Offset in read file.                                                                                                                                           |
40*893a08f0SLora Lin
41*893a08f0SLora Lin### Table 6. ReadResponse Definition when ReadOption is ReadFileAttribute in message type
42*893a08f0SLora Lin
43*893a08f0SLora Lin| Offset | Type   | Name     | Description                                                 |
44*893a08f0SLora Lin| ------ | ------ | -------- | ----------------------------------------------------------- |
45*893a08f0SLora Lin| 0:1    | uint16 | Size     | This field indicates the size of the entire file, in bytes. |
46*893a08f0SLora Lin| 2:5    | uint32 | Checksum | This field indicates the checksum of the entire file.       |
47*893a08f0SLora Lin
48*893a08f0SLora Lin### Table 7. ReadResponse Definition when ReadOption is ReadFileData in message type
49*893a08f0SLora Lin
50*893a08f0SLora Lin| Offset   | Type   | Name         | Description                                                                                                                                                     |
51*893a08f0SLora Lin| -------- | ------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52*893a08f0SLora Lin| 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*893a08f0SLora Lin| 1:2      | uint16 | Offset       | Offset in read file.                                                                                                                                            |
54*893a08f0SLora Lin| Variable | uint8  | FileData     | File data can be up to 255 bytes.                                                                                                                               |
55