1#ifndef HW_ISA_H
2#define HW_ISA_H
3
4
5
6#include "exec/ioport.h"
7#include "exec/memory.h"
8#include "hw/qdev.h"
9
10#define ISA_NUM_IRQS 16
11
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
20#define TYPE_ISA_BUS "ISA"
21#define ISA_BUS(obj) OBJECT_CHECK(ISABus, (obj), TYPE_ISA_BUS)
22
23typedef struct ISADeviceClass {
24 DeviceClass parent_class;
25 int (*init)(ISADevice *dev);
26} ISADeviceClass;
27
28struct ISABus {
29 BusState qbus;
30 MemoryRegion *address_space_io;
31 qemu_irq *irqs;
32};
33
34struct ISADevice {
35 DeviceState qdev;
36 uint32_t isairq[2];
37 int nirqs;
38 int ioport_id;
39};
40
41ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io);
42void isa_bus_irqs(ISABus *bus, qemu_irq *irqs);
43qemu_irq isa_get_irq(ISADevice *dev, int isairq);
44void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
45MemoryRegion *isa_address_space(ISADevice *dev);
46MemoryRegion *isa_address_space_io(ISADevice *dev);
47ISADevice *isa_create(ISABus *bus, const char *name);
48ISADevice *isa_try_create(ISABus *bus, const char *name);
49ISADevice *isa_create_simple(ISABus *bus, const char *name);
50
51ISADevice *isa_vga_init(ISABus *bus);
52
53
54
55
56
57
58
59
60
61
62
63void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start);
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79void isa_register_portio_list(ISADevice *dev, uint16_t start,
80 const MemoryRegionPortio *portio,
81 void *opaque, const char *name);
82
83static inline ISABus *isa_bus_from_device(ISADevice *d)
84{
85 return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
86}
87
88extern hwaddr isa_mem_base;
89
90void isa_mmio_setup(MemoryRegion *mr, hwaddr size);
91void isa_mmio_init(hwaddr base, hwaddr size);
92
93
94int DMA_get_channel_mode (int nchan);
95int DMA_read_memory (int nchan, void *buf, int pos, int size);
96int DMA_write_memory (int nchan, void *buf, int pos, int size);
97void DMA_hold_DREQ (int nchan);
98void DMA_release_DREQ (int nchan);
99void DMA_schedule(int nchan);
100void DMA_init(int high_page_enable, qemu_irq *cpu_request_exit);
101void DMA_register_channel (int nchan,
102 DMA_transfer_handler transfer_handler,
103 void *opaque);
104#endif
105