xlnx-cfi-if.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include "qemu/help-texts.h"
  13. #include "hw/hw.h"
  14. #include "qom/object.h"
  15. #define TYPE_XLNX_CFI_IF "xlnx-cfi-if"
  16. typedef struct XlnxCfiIfClass XlnxCfiIfClass;
  17. DECLARE_CLASS_CHECKERS(XlnxCfiIfClass, XLNX_CFI_IF, TYPE_XLNX_CFI_IF)
  18. #define XLNX_CFI_IF(obj) \
  19. INTERFACE_CHECK(XlnxCfiIf, (obj), TYPE_XLNX_CFI_IF)
  20. typedef enum {
  21. PACKET_TYPE_CFU = 0x52,
  22. PACKET_TYPE_CFRAME = 0xA1,
  23. } xlnx_cfi_packet_type;
  24. typedef enum {
  25. CFRAME_FAR = 1,
  26. CFRAME_SFR = 2,
  27. CFRAME_FDRI = 4,
  28. CFRAME_CMD = 6,
  29. } xlnx_cfi_reg_addr;
  30. typedef struct XlnxCfiPacket {
  31. uint8_t reg_addr;
  32. uint32_t data[4];
  33. } XlnxCfiPacket;
  34. typedef struct XlnxCfiIf {
  35. Object Parent;
  36. } XlnxCfiIf;
  37. typedef struct XlnxCfiIfClass {
  38. InterfaceClass parent;
  39. void (*cfi_transfer_packet)(XlnxCfiIf *cfi_if, XlnxCfiPacket *pkt);
  40. } XlnxCfiIfClass;
  41. /**
  42. * Transfer a XlnxCfiPacket.
  43. *
  44. * @cfi_if: the object implementing this interface
  45. * @XlnxCfiPacket: a pointer to the XlnxCfiPacket to transfer
  46. */
  47. void xlnx_cfi_transfer_packet(XlnxCfiIf *cfi_if, XlnxCfiPacket *pkt);
  48. #endif /* XLNX_CFI_IF_H */