10f310cd6SCorey Minyard /* 20f310cd6SCorey Minyard * QEMU IPMI KCS emulation 30f310cd6SCorey Minyard * 40f310cd6SCorey Minyard * Copyright (c) 2015,2017 Corey Minyard, MontaVista Software, LLC 50f310cd6SCorey Minyard * 60f310cd6SCorey Minyard * Permission is hereby granted, free of charge, to any person obtaining a copy 70f310cd6SCorey Minyard * of this software and associated documentation files (the "Software"), to deal 80f310cd6SCorey Minyard * in the Software without restriction, including without limitation the rights 90f310cd6SCorey Minyard * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 100f310cd6SCorey Minyard * copies of the Software, and to permit persons to whom the Software is 110f310cd6SCorey Minyard * furnished to do so, subject to the following conditions: 120f310cd6SCorey Minyard * 130f310cd6SCorey Minyard * The above copyright notice and this permission notice shall be included in 140f310cd6SCorey Minyard * all copies or substantial portions of the Software. 150f310cd6SCorey Minyard * 160f310cd6SCorey Minyard * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 170f310cd6SCorey Minyard * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 180f310cd6SCorey Minyard * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 190f310cd6SCorey Minyard * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 200f310cd6SCorey Minyard * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 210f310cd6SCorey Minyard * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 220f310cd6SCorey Minyard * THE SOFTWARE. 230f310cd6SCorey Minyard */ 240f310cd6SCorey Minyard 250f310cd6SCorey Minyard #ifndef HW_IPMI_KCS_H 260f310cd6SCorey Minyard #define HW_IPMI_KCS_H 270f310cd6SCorey Minyard 280f310cd6SCorey Minyard #include "hw/ipmi/ipmi.h" 290f310cd6SCorey Minyard 300f310cd6SCorey Minyard typedef struct IPMIKCS { 310f310cd6SCorey Minyard IPMIBmc *bmc; 320f310cd6SCorey Minyard 330f310cd6SCorey Minyard bool do_wake; 340f310cd6SCorey Minyard 350f310cd6SCorey Minyard bool obf_irq_set; 360f310cd6SCorey Minyard bool atn_irq_set; 370f310cd6SCorey Minyard bool irqs_enabled; 380f310cd6SCorey Minyard 390f310cd6SCorey Minyard uint8_t outmsg[MAX_IPMI_MSG_SIZE]; 400f310cd6SCorey Minyard uint32_t outpos; 410f310cd6SCorey Minyard uint32_t outlen; 420f310cd6SCorey Minyard 430f310cd6SCorey Minyard uint8_t inmsg[MAX_IPMI_MSG_SIZE]; 440f310cd6SCorey Minyard uint32_t inlen; 450f310cd6SCorey Minyard bool write_end; 460f310cd6SCorey Minyard 470f310cd6SCorey Minyard uint8_t status_reg; 480f310cd6SCorey Minyard uint8_t data_out_reg; 490f310cd6SCorey Minyard 500f310cd6SCorey Minyard int16_t data_in_reg; /* -1 means not written */ 510f310cd6SCorey Minyard int16_t cmd_reg; 520f310cd6SCorey Minyard 530f310cd6SCorey Minyard /* 540f310cd6SCorey Minyard * This is a response number that we send with the command to make 550f310cd6SCorey Minyard * sure that the response matches the command. 560f310cd6SCorey Minyard */ 570f310cd6SCorey Minyard uint8_t waiting_rsp; 580f310cd6SCorey Minyard 590f310cd6SCorey Minyard uint32_t io_base; 600f310cd6SCorey Minyard unsigned long io_length; 610f310cd6SCorey Minyard MemoryRegion io; 62*79d29a9dSCorey Minyard unsigned long size_mask; 630f310cd6SCorey Minyard 640f310cd6SCorey Minyard void (*raise_irq)(struct IPMIKCS *ik); 650f310cd6SCorey Minyard void (*lower_irq)(struct IPMIKCS *ik); 660f310cd6SCorey Minyard void *opaque; 670f310cd6SCorey Minyard 680f310cd6SCorey Minyard bool use_irq; 690f310cd6SCorey Minyard } IPMIKCS; 700f310cd6SCorey Minyard 710f310cd6SCorey Minyard void ipmi_kcs_get_fwinfo(IPMIKCS *ik, IPMIFwInfo *info); 720f310cd6SCorey Minyard void ipmi_kcs_class_init(IPMIInterfaceClass *iic); 730f310cd6SCorey Minyard extern const VMStateDescription vmstate_IPMIKCS; 740f310cd6SCorey Minyard int ipmi_kcs_vmstate_post_load(void *opaque, int version); 750f310cd6SCorey Minyard 760f310cd6SCorey Minyard #endif /* HW_IPMI_KCS_H */ 77