6 #include "exec/ioport.h"
7 #include "exec/memory.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"
24 #define APPLESMC_MAX_DATA_LENGTH 32
25 #define APPLESMC_PROP_IO_BASE "iobase"
27 static inline uint16_t applesmc_port(void)
29 Object *obj = object_resolve_path_type("", TYPE_APPLE_SMC, NULL);
32 return object_property_get_int(obj, APPLESMC_PROP_IO_BASE, NULL);
37 typedef struct ISADeviceClass {
38 DeviceClass parent_class;
46 MemoryRegion *address_space;
47 MemoryRegion *address_space_io;
53 DeviceState parent_obj;
61 ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space,
62 MemoryRegion *address_space_io, Error **errp);
63 void isa_bus_irqs(ISABus *bus, qemu_irq *irqs);
64 qemu_irq isa_get_irq(ISADevice *dev, int isairq);
65 void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
66 MemoryRegion *isa_address_space(ISADevice *dev);
67 MemoryRegion *isa_address_space_io(ISADevice *dev);
68 ISADevice *isa_create(ISABus *bus, const char *name);
69 ISADevice *isa_try_create(ISABus *bus, const char *name);
70 ISADevice *isa_create_simple(ISABus *bus, const char *name);
72 ISADevice *isa_vga_init(ISABus *bus);
75 * isa_register_ioport: Install an I/O port region on the ISA bus.
77 * Register an I/O port region via memory_region_add_subregion
78 * inside the ISA I/O address space.
80 * @dev: the ISADevice against which these are registered; may be NULL.
81 * @io: the #MemoryRegion being registered.
82 * @start: the base I/O port.
84 void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start);
87 * isa_register_portio_list: Initialize a set of ISA io ports
89 * Several ISA devices have many dis-joint I/O ports. Worse, these I/O
90 * ports can be interleaved with I/O ports from other devices. This
91 * function makes it easy to create multiple MemoryRegions for a single
92 * device and use the legacy portio routines.
94 * @dev: the ISADevice against which these are registered; may be NULL.
95 * @start: the base I/O port against which the portio->offset is applied.
96 * @portio: the ports, sorted by offset.
97 * @opaque: passed into the portio callbacks.
98 * @name: passed into memory_region_init_io.
100 void isa_register_portio_list(ISADevice *dev, uint16_t start,
101 const MemoryRegionPortio *portio,
102 void *opaque, const char *name);
104 static inline ISABus *isa_bus_from_device(ISADevice *d)
106 return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
110 int DMA_get_channel_mode (int nchan);
111 int DMA_read_memory (int nchan, void *buf, int pos, int size);
112 int DMA_write_memory (int nchan, void *buf, int pos, int size);
113 void DMA_hold_DREQ (int nchan);
114 void DMA_release_DREQ (int nchan);
115 void DMA_schedule(void);
116 void DMA_init(ISABus *bus, int high_page_enable);
117 void DMA_register_channel (int nchan,
118 DMA_transfer_handler transfer_handler,