xref: /openbmc/qemu/include/hw/pcmcia.h (revision d6032e06)
1 #ifndef HW_PCMCIA_H
2 #define HW_PCMCIA_H 1
3 
4 /* PCMCIA/Cardbus */
5 
6 #include "hw/qdev.h"
7 
8 typedef struct PCMCIASocket {
9     qemu_irq irq;
10     bool attached;
11     const char *slot_string;
12     const char *card_string;
13 } PCMCIASocket;
14 
15 void pcmcia_socket_register(PCMCIASocket *socket);
16 void pcmcia_socket_unregister(PCMCIASocket *socket);
17 void pcmcia_info(Monitor *mon, const QDict *qdict);
18 
19 #define TYPE_PCMCIA_CARD "pcmcia-card"
20 #define PCMCIA_CARD(obj) \
21     OBJECT_CHECK(PCMCIACardState, (obj), TYPE_PCMCIA_CARD)
22 #define PCMCIA_CARD_GET_CLASS(obj) \
23     OBJECT_GET_CLASS(PCMCIACardClass, obj, TYPE_PCMCIA_CARD)
24 #define PCMCIA_CARD_CLASS(cls) \
25     OBJECT_CLASS_CHECK(PCMCIACardClass, cls, TYPE_PCMCIA_CARD)
26 
27 struct PCMCIACardState {
28     /*< private >*/
29     DeviceState parent_obj;
30     /*< public >*/
31 
32     PCMCIASocket *slot;
33 };
34 
35 typedef struct PCMCIACardClass {
36     /*< private >*/
37     DeviceClass parent_class;
38     /*< public >*/
39 
40     int (*attach)(PCMCIACardState *state);
41     int (*detach)(PCMCIACardState *state);
42 
43     const uint8_t *cis;
44     int cis_len;
45 
46     /* Only valid if attached */
47     uint8_t (*attr_read)(PCMCIACardState *card, uint32_t address);
48     void (*attr_write)(PCMCIACardState *card, uint32_t address, uint8_t value);
49     uint16_t (*common_read)(PCMCIACardState *card, uint32_t address);
50     void (*common_write)(PCMCIACardState *card,
51                          uint32_t address, uint16_t value);
52     uint16_t (*io_read)(PCMCIACardState *card, uint32_t address);
53     void (*io_write)(PCMCIACardState *card, uint32_t address, uint16_t value);
54 } PCMCIACardClass;
55 
56 #define CISTPL_DEVICE		0x01	/* 5V Device Information Tuple */
57 #define CISTPL_NO_LINK		0x14	/* No Link Tuple */
58 #define CISTPL_VERS_1		0x15	/* Level 1 Version Tuple */
59 #define CISTPL_JEDEC_C		0x18	/* JEDEC ID Tuple */
60 #define CISTPL_JEDEC_A		0x19	/* JEDEC ID Tuple */
61 #define CISTPL_CONFIG		0x1a	/* Configuration Tuple */
62 #define CISTPL_CFTABLE_ENTRY	0x1b	/* 16-bit PCCard Configuration */
63 #define CISTPL_DEVICE_OC	0x1c	/* Additional Device Information */
64 #define CISTPL_DEVICE_OA	0x1d	/* Additional Device Information */
65 #define CISTPL_DEVICE_GEO	0x1e	/* Additional Device Information */
66 #define CISTPL_DEVICE_GEO_A	0x1f	/* Additional Device Information */
67 #define CISTPL_MANFID		0x20	/* Manufacture ID Tuple */
68 #define CISTPL_FUNCID		0x21	/* Function ID Tuple */
69 #define CISTPL_FUNCE		0x22	/* Function Extension Tuple */
70 #define CISTPL_END		0xff	/* Tuple End */
71 #define CISTPL_ENDMARK		0xff
72 
73 /* dscm1xxxx.c */
74 PCMCIACardState *dscm1xxxx_init(DriveInfo *bdrv);
75 
76 #endif
77