1 /* 2 * ASPEED iBT Device 3 * 4 * Copyright (c) 2016-2021 Cédric Le Goater, IBM Corporation. 5 * 6 * This code is licensed under the GPL version 2 or later. See 7 * the COPYING file in the top-level directory. 8 */ 9 #ifndef ASPEED_IBT_H 10 #define ASPEED_IBT_H 11 12 #include "hw/sysbus.h" 13 #include "chardev/char-fe.h" 14 15 #define TYPE_ASPEED_IBT "aspeed.ibt" 16 #define ASPEED_IBT(obj) OBJECT_CHECK(AspeedIBTState, (obj), TYPE_ASPEED_IBT) 17 18 #define ASPEED_IBT_NR_REGS (0x1C >> 2) 19 20 #define ASPEED_IBT_BUFFER_SIZE 64 21 22 typedef struct AspeedIBTState { 23 /*< private >*/ 24 SysBusDevice parent_obj; 25 26 /*< public >*/ 27 CharBackend chr; 28 bool connected; 29 30 uint8_t recv_msg[ASPEED_IBT_BUFFER_SIZE]; 31 uint8_t recv_msg_len; 32 int recv_msg_index; 33 int recv_msg_too_many; 34 bool recv_waiting; 35 int in_escape; 36 37 uint8_t send_msg[ASPEED_IBT_BUFFER_SIZE]; 38 uint8_t send_msg_len; 39 40 MemoryRegion iomem; 41 qemu_irq irq; 42 43 uint32_t regs[ASPEED_IBT_NR_REGS]; 44 45 } AspeedIBTState; 46 47 #endif /* ASPEED_IBT_H */ 48