Cyril Bur | 314929b | 2016-10-14 15:55:16 +1100 | [diff] [blame] | 1 | /* Copyright 2016 IBM |
| 2 | * |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | #define MBOX_C_RESET_STATE 0x01 |
| 18 | #define MBOX_C_GET_MBOX_INFO 0x02 |
| 19 | #define MBOX_C_GET_FLASH_INFO 0x03 |
| 20 | #define MBOX_C_READ_WINDOW 0x04 |
| 21 | #define MBOX_C_CLOSE_WINDOW 0x05 |
| 22 | #define MBOX_C_WRITE_WINDOW 0x06 |
| 23 | #define MBOX_C_WRITE_DIRTY 0x07 |
| 24 | #define MBOX_C_WRITE_FENCE 0x08 |
| 25 | #define MBOX_C_ACK 0x09 |
| 26 | #define MBOX_C_COMPLETED_COMMANDS 0x0a |
| 27 | |
| 28 | #define MBOX_R_SUCCESS 0x01 |
| 29 | #define MBOX_R_PARAM_ERROR 0x02 |
| 30 | #define MBOX_R_WRITE_ERROR 0x03 |
| 31 | #define MBOX_R_SYSTEM_ERROR 0x4 |
| 32 | #define MBOX_R_TIMEOUT 0x05 |
| 33 | |
| 34 | #define MBOX_HOST_PATH "/dev/aspeed-mbox" |
| 35 | #define MBOX_HOST_TIMEOUT_SEC 1 |
| 36 | #define MBOX_DATA_BYTES 11 |
| 37 | #define MBOX_REG_BYTES 16 |
| 38 | #define MBOX_HOST_BYTE 14 |
| 39 | #define MBOX_BMC_BYTE 15 |
| 40 | |
| 41 | struct mbox_msg { |
| 42 | uint8_t command; |
| 43 | uint8_t seq; |
| 44 | uint8_t data[MBOX_DATA_BYTES]; |
| 45 | uint8_t response; |
| 46 | }; |
| 47 | |
| 48 | union mbox_regs { |
| 49 | char raw[MBOX_REG_BYTES]; |
| 50 | struct mbox_msg msg; |
| 51 | }; |
| 52 | |
| 53 | |