Paolo Bonzini | cb9c377 | 2012-12-06 12:15:58 +0100 | [diff] [blame] | 1 | #ifndef HW_PCMCIA_H |
Markus Armbruster | 175de52 | 2016-06-29 15:29:06 +0200 | [diff] [blame] | 2 | #define HW_PCMCIA_H |
Paolo Bonzini | cb9c377 | 2012-12-06 12:15:58 +0100 | [diff] [blame] | 3 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 4 | /* PCMCIA/Cardbus */ |
| 5 | |
Andreas Färber | d1f2c96 | 2013-07-17 19:46:16 +0200 | [diff] [blame] | 6 | #include "hw/qdev.h" |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 7 | |
Andreas Färber | d1f2c96 | 2013-07-17 19:46:16 +0200 | [diff] [blame] | 8 | typedef struct PCMCIASocket { |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 9 | qemu_irq irq; |
Andreas Färber | d1f2c96 | 2013-07-17 19:46:16 +0200 | [diff] [blame] | 10 | bool attached; |
Paul Brook | bc24a22 | 2009-05-10 01:44:56 +0100 | [diff] [blame] | 11 | } PCMCIASocket; |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 12 | |
Andreas Färber | d1f2c96 | 2013-07-17 19:46:16 +0200 | [diff] [blame] | 13 | #define TYPE_PCMCIA_CARD "pcmcia-card" |
| 14 | #define PCMCIA_CARD(obj) \ |
| 15 | OBJECT_CHECK(PCMCIACardState, (obj), TYPE_PCMCIA_CARD) |
| 16 | #define PCMCIA_CARD_GET_CLASS(obj) \ |
| 17 | OBJECT_GET_CLASS(PCMCIACardClass, obj, TYPE_PCMCIA_CARD) |
| 18 | #define PCMCIA_CARD_CLASS(cls) \ |
| 19 | OBJECT_CLASS_CHECK(PCMCIACardClass, cls, TYPE_PCMCIA_CARD) |
| 20 | |
Paul Brook | bc24a22 | 2009-05-10 01:44:56 +0100 | [diff] [blame] | 21 | struct PCMCIACardState { |
Andreas Färber | d1f2c96 | 2013-07-17 19:46:16 +0200 | [diff] [blame] | 22 | /*< private >*/ |
| 23 | DeviceState parent_obj; |
| 24 | /*< public >*/ |
| 25 | |
Paul Brook | bc24a22 | 2009-05-10 01:44:56 +0100 | [diff] [blame] | 26 | PCMCIASocket *slot; |
Andreas Färber | d1f2c96 | 2013-07-17 19:46:16 +0200 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | typedef struct PCMCIACardClass { |
| 30 | /*< private >*/ |
| 31 | DeviceClass parent_class; |
| 32 | /*< public >*/ |
| 33 | |
| 34 | int (*attach)(PCMCIACardState *state); |
| 35 | int (*detach)(PCMCIACardState *state); |
| 36 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 37 | const uint8_t *cis; |
| 38 | int cis_len; |
| 39 | |
| 40 | /* Only valid if attached */ |
Andreas Färber | d1f2c96 | 2013-07-17 19:46:16 +0200 | [diff] [blame] | 41 | uint8_t (*attr_read)(PCMCIACardState *card, uint32_t address); |
| 42 | void (*attr_write)(PCMCIACardState *card, uint32_t address, uint8_t value); |
| 43 | uint16_t (*common_read)(PCMCIACardState *card, uint32_t address); |
| 44 | void (*common_write)(PCMCIACardState *card, |
| 45 | uint32_t address, uint16_t value); |
| 46 | uint16_t (*io_read)(PCMCIACardState *card, uint32_t address); |
| 47 | void (*io_write)(PCMCIACardState *card, uint32_t address, uint16_t value); |
| 48 | } PCMCIACardClass; |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 49 | |
| 50 | #define CISTPL_DEVICE 0x01 /* 5V Device Information Tuple */ |
| 51 | #define CISTPL_NO_LINK 0x14 /* No Link Tuple */ |
| 52 | #define CISTPL_VERS_1 0x15 /* Level 1 Version Tuple */ |
| 53 | #define CISTPL_JEDEC_C 0x18 /* JEDEC ID Tuple */ |
| 54 | #define CISTPL_JEDEC_A 0x19 /* JEDEC ID Tuple */ |
| 55 | #define CISTPL_CONFIG 0x1a /* Configuration Tuple */ |
| 56 | #define CISTPL_CFTABLE_ENTRY 0x1b /* 16-bit PCCard Configuration */ |
| 57 | #define CISTPL_DEVICE_OC 0x1c /* Additional Device Information */ |
| 58 | #define CISTPL_DEVICE_OA 0x1d /* Additional Device Information */ |
| 59 | #define CISTPL_DEVICE_GEO 0x1e /* Additional Device Information */ |
| 60 | #define CISTPL_DEVICE_GEO_A 0x1f /* Additional Device Information */ |
| 61 | #define CISTPL_MANFID 0x20 /* Manufacture ID Tuple */ |
| 62 | #define CISTPL_FUNCID 0x21 /* Function ID Tuple */ |
| 63 | #define CISTPL_FUNCE 0x22 /* Function Extension Tuple */ |
| 64 | #define CISTPL_END 0xff /* Tuple End */ |
| 65 | #define CISTPL_ENDMARK 0xff |
| 66 | |
| 67 | /* dscm1xxxx.c */ |
Gerd Hoffmann | f455e98 | 2009-08-28 15:47:03 +0200 | [diff] [blame] | 68 | PCMCIACardState *dscm1xxxx_init(DriveInfo *bdrv); |
Paolo Bonzini | cb9c377 | 2012-12-06 12:15:58 +0100 | [diff] [blame] | 69 | |
| 70 | #endif |