Add DSDT node for AppleSMC
[qemu/ar7.git] / include / hw / isa / isa.h
blobe0c749f9e9d8ac5e98f677cf4def613a983ff09c
1 #ifndef HW_ISA_H
2 #define HW_ISA_H
4 /* ISA bus */
6 #include "exec/ioport.h"
7 #include "exec/memory.h"
8 #include "hw/qdev.h"
10 #define ISA_NUM_IRQS 16
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)
20 #define TYPE_ISA_BUS "ISA"
21 #define ISA_BUS(obj) OBJECT_CHECK(ISABus, (obj), TYPE_ISA_BUS)
23 #define TYPE_APPLE_SMC "isa-applesmc"
25 static inline bool applesmc_find(void)
27 return object_resolve_path_type("", TYPE_APPLE_SMC, NULL);
30 typedef struct ISADeviceClass {
31 DeviceClass parent_class;
32 } ISADeviceClass;
34 struct ISABus {
35 /*< private >*/
36 BusState parent_obj;
37 /*< public >*/
39 MemoryRegion *address_space_io;
40 qemu_irq *irqs;
43 struct ISADevice {
44 /*< private >*/
45 DeviceState parent_obj;
46 /*< public >*/
48 uint32_t isairq[2];
49 int nirqs;
50 int ioport_id;
53 ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io);
54 void isa_bus_irqs(ISABus *bus, qemu_irq *irqs);
55 qemu_irq isa_get_irq(ISADevice *dev, int isairq);
56 void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
57 MemoryRegion *isa_address_space(ISADevice *dev);
58 MemoryRegion *isa_address_space_io(ISADevice *dev);
59 ISADevice *isa_create(ISABus *bus, const char *name);
60 ISADevice *isa_try_create(ISABus *bus, const char *name);
61 ISADevice *isa_create_simple(ISABus *bus, const char *name);
63 ISADevice *isa_vga_init(ISABus *bus);
65 /**
66 * isa_register_ioport: Install an I/O port region on the ISA bus.
68 * Register an I/O port region via memory_region_add_subregion
69 * inside the ISA I/O address space.
71 * @dev: the ISADevice against which these are registered; may be NULL.
72 * @io: the #MemoryRegion being registered.
73 * @start: the base I/O port.
75 void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start);
77 /**
78 * isa_register_portio_list: Initialize a set of ISA io ports
80 * Several ISA devices have many dis-joint I/O ports. Worse, these I/O
81 * ports can be interleaved with I/O ports from other devices. This
82 * function makes it easy to create multiple MemoryRegions for a single
83 * device and use the legacy portio routines.
85 * @dev: the ISADevice against which these are registered; may be NULL.
86 * @start: the base I/O port against which the portio->offset is applied.
87 * @portio: the ports, sorted by offset.
88 * @opaque: passed into the portio callbacks.
89 * @name: passed into memory_region_init_io.
91 void isa_register_portio_list(ISADevice *dev, uint16_t start,
92 const MemoryRegionPortio *portio,
93 void *opaque, const char *name);
95 static inline ISABus *isa_bus_from_device(ISADevice *d)
97 return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
100 extern hwaddr isa_mem_base;
102 /* dma.c */
103 int DMA_get_channel_mode (int nchan);
104 int DMA_read_memory (int nchan, void *buf, int pos, int size);
105 int DMA_write_memory (int nchan, void *buf, int pos, int size);
106 void DMA_hold_DREQ (int nchan);
107 void DMA_release_DREQ (int nchan);
108 void DMA_schedule(int nchan);
109 void DMA_init(int high_page_enable, qemu_irq *cpu_request_exit);
110 void DMA_register_channel (int nchan,
111 DMA_transfer_handler transfer_handler,
112 void *opaque);
113 #endif