1 /* 2 * Xilinx CFI interface 3 * 4 * Copyright (C) 2023, Advanced Micro Devices, Inc. 5 * 6 * Written by Francisco Iglesias <francisco.iglesias@amd.com> 7 * 8 * SPDX-License-Identifier: GPL-2.0-or-later 9 */ 10 #ifndef XLNX_CFI_IF_H 11 #define XLNX_CFI_IF_H 1 12 13 #include "qemu/help-texts.h" 14 #include "hw/hw.h" 15 #include "qom/object.h" 16 17 #define TYPE_XLNX_CFI_IF "xlnx-cfi-if" 18 typedef struct XlnxCfiIfClass XlnxCfiIfClass; 19 DECLARE_CLASS_CHECKERS(XlnxCfiIfClass, XLNX_CFI_IF, TYPE_XLNX_CFI_IF) 20 21 #define XLNX_CFI_IF(obj) \ 22 INTERFACE_CHECK(XlnxCfiIf, (obj), TYPE_XLNX_CFI_IF) 23 24 typedef enum { 25 PACKET_TYPE_CFU = 0x52, 26 PACKET_TYPE_CFRAME = 0xA1, 27 } xlnx_cfi_packet_type; 28 29 typedef enum { 30 CFRAME_FAR = 1, 31 CFRAME_SFR = 2, 32 CFRAME_FDRI = 4, 33 CFRAME_CMD = 6, 34 } xlnx_cfi_reg_addr; 35 36 typedef struct XlnxCfiPacket { 37 uint8_t reg_addr; 38 uint32_t data[4]; 39 } XlnxCfiPacket; 40 41 typedef struct XlnxCfiIf { 42 Object Parent; 43 } XlnxCfiIf; 44 45 typedef struct XlnxCfiIfClass { 46 InterfaceClass parent; 47 48 void (*cfi_transfer_packet)(XlnxCfiIf *cfi_if, XlnxCfiPacket *pkt); 49 } XlnxCfiIfClass; 50 51 /** 52 * Transfer a XlnxCfiPacket. 53 * 54 * @cfi_if: the object implementing this interface 55 * @XlnxCfiPacket: a pointer to the XlnxCfiPacket to transfer 56 */ 57 void xlnx_cfi_transfer_packet(XlnxCfiIf *cfi_if, XlnxCfiPacket *pkt); 58 59 #endif /* XLNX_CFI_IF_H */ 60