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