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