Statistics
| Branch: | Revision:

root / hw / isa.h @ 0200db65

History | View | Annotate | Download (2.7 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 f915a115 Gerd Hoffmann
typedef struct ISABus ISABus;
11 f915a115 Gerd Hoffmann
typedef struct ISADevice ISADevice;
12 f915a115 Gerd Hoffmann
typedef struct ISADeviceInfo ISADeviceInfo;
13 f915a115 Gerd Hoffmann
14 f915a115 Gerd Hoffmann
struct ISADevice {
15 f915a115 Gerd Hoffmann
    DeviceState qdev;
16 2091ba23 Gerd Hoffmann
    uint32_t isairq[2];
17 78e20593 Richard Henderson
    int nirqs;
18 ebf47c24 Richard Henderson
    int ioport_id;
19 f915a115 Gerd Hoffmann
};
20 f915a115 Gerd Hoffmann
21 81a322d4 Gerd Hoffmann
typedef int (*isa_qdev_initfn)(ISADevice *dev);
22 f915a115 Gerd Hoffmann
struct ISADeviceInfo {
23 f915a115 Gerd Hoffmann
    DeviceInfo qdev;
24 f915a115 Gerd Hoffmann
    isa_qdev_initfn init;
25 f915a115 Gerd Hoffmann
};
26 f915a115 Gerd Hoffmann
27 c2d0d012 Richard Henderson
ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io);
28 2091ba23 Gerd Hoffmann
void isa_bus_irqs(qemu_irq *irqs);
29 ee951a37 Jan Kiszka
qemu_irq isa_get_irq(int isairq);
30 2e15e23b Gerd Hoffmann
void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
31 f915a115 Gerd Hoffmann
void isa_qdev_register(ISADeviceInfo *info);
32 c839adec Avi Kivity
MemoryRegion *isa_address_space(ISADevice *dev);
33 924f6d72 Gerd Hoffmann
ISADevice *isa_create(const char *name);
34 86f4a9a5 Blue Swirl
ISADevice *isa_try_create(const char *name);
35 2e15e23b Gerd Hoffmann
ISADevice *isa_create_simple(const char *name);
36 87ecb68b pbrook
37 d7500734 Avi Kivity
/**
38 d7500734 Avi Kivity
 * isa_register_ioport: Install an I/O port region on the ISA bus.
39 d7500734 Avi Kivity
 *
40 d7500734 Avi Kivity
 * Register an I/O port region via memory_region_add_subregion
41 d7500734 Avi Kivity
 * inside the ISA I/O address space.
42 d7500734 Avi Kivity
 *
43 d7500734 Avi Kivity
 * @dev: the ISADevice against which these are registered; may be NULL.
44 d7500734 Avi Kivity
 * @io: the #MemoryRegion being registered.
45 d7500734 Avi Kivity
 * @start: the base I/O port.
46 d7500734 Avi Kivity
 */
47 d7500734 Avi Kivity
void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start);
48 d7500734 Avi Kivity
49 d7500734 Avi Kivity
/**
50 d7500734 Avi Kivity
 * isa_register_portio_list: Initialize a set of ISA io ports
51 d7500734 Avi Kivity
 *
52 d7500734 Avi Kivity
 * Several ISA devices have many dis-joint I/O ports.  Worse, these I/O
53 d7500734 Avi Kivity
 * ports can be interleaved with I/O ports from other devices.  This
54 d7500734 Avi Kivity
 * function makes it easy to create multiple MemoryRegions for a single
55 d7500734 Avi Kivity
 * device and use the legacy portio routines.
56 d7500734 Avi Kivity
 *
57 d7500734 Avi Kivity
 * @dev: the ISADevice against which these are registered; may be NULL.
58 d7500734 Avi Kivity
 * @start: the base I/O port against which the portio->offset is applied.
59 d7500734 Avi Kivity
 * @portio: the ports, sorted by offset.
60 d7500734 Avi Kivity
 * @opaque: passed into the old_portio callbacks.
61 d7500734 Avi Kivity
 * @name: passed into memory_region_init_io.
62 d7500734 Avi Kivity
 */
63 d7500734 Avi Kivity
void isa_register_portio_list(ISADevice *dev, uint16_t start,
64 d7500734 Avi Kivity
                              const MemoryRegionPortio *portio,
65 d7500734 Avi Kivity
                              void *opaque, const char *name);
66 d7500734 Avi Kivity
67 c227f099 Anthony Liguori
extern target_phys_addr_t isa_mem_base;
68 87ecb68b pbrook
69 af956cad Avi Kivity
void isa_mmio_setup(MemoryRegion *mr, target_phys_addr_t size);
70 968d683c Alexander Graf
void isa_mmio_init(target_phys_addr_t base, target_phys_addr_t size);
71 87ecb68b pbrook
72 87ecb68b pbrook
/* dma.c */
73 87ecb68b pbrook
int DMA_get_channel_mode (int nchan);
74 87ecb68b pbrook
int DMA_read_memory (int nchan, void *buf, int pos, int size);
75 87ecb68b pbrook
int DMA_write_memory (int nchan, void *buf, int pos, int size);
76 87ecb68b pbrook
void DMA_hold_DREQ (int nchan);
77 87ecb68b pbrook
void DMA_release_DREQ (int nchan);
78 87ecb68b pbrook
void DMA_schedule(int nchan);
79 4556bd8b Blue Swirl
void DMA_init(int high_page_enable, qemu_irq *cpu_request_exit);
80 87ecb68b pbrook
void DMA_register_channel (int nchan,
81 87ecb68b pbrook
                           DMA_transfer_handler transfer_handler,
82 87ecb68b pbrook
                           void *opaque);
83 79383c9c blueswir1
#endif