]>
Commit | Line | Data |
---|---|---|
79383c9c BS |
1 | #ifndef HW_ISA_H |
2 | #define HW_ISA_H | |
f915a115 | 3 | |
87ecb68b PB |
4 | /* ISA bus */ |
5 | ||
022c62cb PB |
6 | #include "exec/ioport.h" |
7 | #include "exec/memory.h" | |
f915a115 GH |
8 | #include "qdev.h" |
9 | ||
b881fbe9 JK |
10 | #define ISA_NUM_IRQS 16 |
11 | ||
8f04ee08 AL |
12 | #define TYPE_ISA_DEVICE "isa-device" |
13 | #define ISA_DEVICE(obj) \ | |
14 | OBJECT_CHECK(ISADevice, (obj), TYPE_ISA_DEVICE) | |
15 | #define ISA_DEVICE_CLASS(klass) \ | |
16 | OBJECT_CLASS_CHECK(ISADeviceClass, (klass), TYPE_ISA_DEVICE) | |
17 | #define ISA_DEVICE_GET_CLASS(obj) \ | |
18 | OBJECT_GET_CLASS(ISADeviceClass, (obj), TYPE_ISA_DEVICE) | |
19 | ||
0d936928 AL |
20 | #define TYPE_ISA_BUS "ISA" |
21 | #define ISA_BUS(obj) OBJECT_CHECK(ISABus, (obj), TYPE_ISA_BUS) | |
22 | ||
8f04ee08 AL |
23 | typedef struct ISADeviceClass { |
24 | DeviceClass parent_class; | |
25 | int (*init)(ISADevice *dev); | |
26 | } ISADeviceClass; | |
f915a115 | 27 | |
d1a1be18 HP |
28 | struct ISABus { |
29 | BusState qbus; | |
30 | MemoryRegion *address_space_io; | |
31 | qemu_irq *irqs; | |
32 | }; | |
33 | ||
f915a115 GH |
34 | struct ISADevice { |
35 | DeviceState qdev; | |
2091ba23 | 36 | uint32_t isairq[2]; |
78e20593 | 37 | int nirqs; |
ebf47c24 | 38 | int ioport_id; |
f915a115 GH |
39 | }; |
40 | ||
c2d0d012 | 41 | ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io); |
48a18b3c HP |
42 | void isa_bus_irqs(ISABus *bus, qemu_irq *irqs); |
43 | qemu_irq isa_get_irq(ISADevice *dev, int isairq); | |
2e15e23b | 44 | void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq); |
c839adec | 45 | MemoryRegion *isa_address_space(ISADevice *dev); |
ac100273 | 46 | MemoryRegion *isa_address_space_io(ISADevice *dev); |
48a18b3c HP |
47 | ISADevice *isa_create(ISABus *bus, const char *name); |
48 | ISADevice *isa_try_create(ISABus *bus, const char *name); | |
49 | ISADevice *isa_create_simple(ISABus *bus, const char *name); | |
87ecb68b | 50 | |
14e7a645 AJ |
51 | ISADevice *isa_vga_init(ISABus *bus); |
52 | ||
d7500734 AK |
53 | /** |
54 | * isa_register_ioport: Install an I/O port region on the ISA bus. | |
55 | * | |
56 | * Register an I/O port region via memory_region_add_subregion | |
57 | * inside the ISA I/O address space. | |
58 | * | |
59 | * @dev: the ISADevice against which these are registered; may be NULL. | |
60 | * @io: the #MemoryRegion being registered. | |
61 | * @start: the base I/O port. | |
62 | */ | |
63 | void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start); | |
64 | ||
65 | /** | |
66 | * isa_register_portio_list: Initialize a set of ISA io ports | |
67 | * | |
68 | * Several ISA devices have many dis-joint I/O ports. Worse, these I/O | |
69 | * ports can be interleaved with I/O ports from other devices. This | |
70 | * function makes it easy to create multiple MemoryRegions for a single | |
71 | * device and use the legacy portio routines. | |
72 | * | |
73 | * @dev: the ISADevice against which these are registered; may be NULL. | |
74 | * @start: the base I/O port against which the portio->offset is applied. | |
75 | * @portio: the ports, sorted by offset. | |
76 | * @opaque: passed into the old_portio callbacks. | |
77 | * @name: passed into memory_region_init_io. | |
78 | */ | |
79 | void isa_register_portio_list(ISADevice *dev, uint16_t start, | |
80 | const MemoryRegionPortio *portio, | |
81 | void *opaque, const char *name); | |
82 | ||
a527b545 HP |
83 | static inline ISABus *isa_bus_from_device(ISADevice *d) |
84 | { | |
3e7b8f4e | 85 | return ISA_BUS(qdev_get_parent_bus(DEVICE(d))); |
a527b545 HP |
86 | } |
87 | ||
a8170e5e | 88 | extern hwaddr isa_mem_base; |
87ecb68b | 89 | |
a8170e5e AK |
90 | void isa_mmio_setup(MemoryRegion *mr, hwaddr size); |
91 | void isa_mmio_init(hwaddr base, hwaddr size); | |
87ecb68b PB |
92 | |
93 | /* dma.c */ | |
94 | int DMA_get_channel_mode (int nchan); | |
95 | int DMA_read_memory (int nchan, void *buf, int pos, int size); | |
96 | int DMA_write_memory (int nchan, void *buf, int pos, int size); | |
97 | void DMA_hold_DREQ (int nchan); | |
98 | void DMA_release_DREQ (int nchan); | |
99 | void DMA_schedule(int nchan); | |
4556bd8b | 100 | void DMA_init(int high_page_enable, qemu_irq *cpu_request_exit); |
87ecb68b PB |
101 | void DMA_register_channel (int nchan, |
102 | DMA_transfer_handler transfer_handler, | |
103 | void *opaque); | |
79383c9c | 104 | #endif |