1461a6a6fSTong Ho /* 2461a6a6fSTong Ho * QEMU model of the Xilinx BBRAM Battery Backed RAM 3461a6a6fSTong Ho * 4461a6a6fSTong Ho * Copyright (c) 2015-2021 Xilinx Inc. 5461a6a6fSTong Ho * 6461a6a6fSTong Ho * Written by Edgar E. Iglesias <edgari@xilinx.com> 7461a6a6fSTong Ho * 8461a6a6fSTong Ho * Permission is hereby granted, free of charge, to any person obtaining a copy 9461a6a6fSTong Ho * of this software and associated documentation files (the "Software"), to deal 10461a6a6fSTong Ho * in the Software without restriction, including without limitation the rights 11461a6a6fSTong Ho * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12461a6a6fSTong Ho * copies of the Software, and to permit persons to whom the Software is 13461a6a6fSTong Ho * furnished to do so, subject to the following conditions: 14461a6a6fSTong Ho * 15461a6a6fSTong Ho * The above copyright notice and this permission notice shall be included in 16461a6a6fSTong Ho * all copies or substantial portions of the Software. 17461a6a6fSTong Ho * 18461a6a6fSTong Ho * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19461a6a6fSTong Ho * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20461a6a6fSTong Ho * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21461a6a6fSTong Ho * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22461a6a6fSTong Ho * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23461a6a6fSTong Ho * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24461a6a6fSTong Ho * THE SOFTWARE. 25461a6a6fSTong Ho */ 26461a6a6fSTong Ho #ifndef XLNX_BBRAM_H 27461a6a6fSTong Ho #define XLNX_BBRAM_H 28461a6a6fSTong Ho 29461a6a6fSTong Ho #include "sysemu/block-backend.h" 30461a6a6fSTong Ho #include "hw/qdev-core.h" 31461a6a6fSTong Ho #include "hw/irq.h" 32461a6a6fSTong Ho #include "hw/sysbus.h" 33461a6a6fSTong Ho #include "hw/register.h" 34461a6a6fSTong Ho 35461a6a6fSTong Ho #define RMAX_XLNX_BBRAM ((0x4c / 4) + 1) 36461a6a6fSTong Ho 37b65b4b7aSTong Ho #define TYPE_XLNX_BBRAM "xlnx.bbram-ctrl" 38461a6a6fSTong Ho OBJECT_DECLARE_SIMPLE_TYPE(XlnxBBRam, XLNX_BBRAM); 39461a6a6fSTong Ho 40461a6a6fSTong Ho struct XlnxBBRam { 41461a6a6fSTong Ho SysBusDevice parent_obj; 42461a6a6fSTong Ho qemu_irq irq_bbram; 43461a6a6fSTong Ho 44461a6a6fSTong Ho BlockBackend *blk; 45461a6a6fSTong Ho 46461a6a6fSTong Ho uint32_t crc_zpads; 47461a6a6fSTong Ho bool bbram8_wo; 48461a6a6fSTong Ho bool blk_ro; 49461a6a6fSTong Ho 50*4a87373fSPeter Maydell RegisterInfoArray *reg_array; 51461a6a6fSTong Ho uint32_t regs[RMAX_XLNX_BBRAM]; 52461a6a6fSTong Ho RegisterInfo regs_info[RMAX_XLNX_BBRAM]; 53461a6a6fSTong Ho }; 54461a6a6fSTong Ho 55461a6a6fSTong Ho #endif 56