diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/an5206.c | 5 | ||||
-rw-r--r-- | hw/arm_pic.c | 5 | ||||
-rw-r--r-- | hw/etraxfs_pic.c | 5 | ||||
-rw-r--r-- | hw/i8259.c | 21 | ||||
-rw-r--r-- | hw/pc.c | 9 | ||||
-rw-r--r-- | hw/pc.h | 7 | ||||
-rw-r--r-- | hw/pci-hotplug.c | 51 | ||||
-rw-r--r-- | hw/pci.c | 32 | ||||
-rw-r--r-- | hw/pci.h | 4 | ||||
-rw-r--r-- | hw/pcmcia.h | 4 | ||||
-rw-r--r-- | hw/shix.c | 5 | ||||
-rw-r--r-- | hw/slavio_intctl.c | 20 | ||||
-rw-r--r-- | hw/sun4c_intctl.c | 16 | ||||
-rw-r--r-- | hw/sun4m.c | 8 | ||||
-rw-r--r-- | hw/sun4m.h | 10 | ||||
-rw-r--r-- | hw/usb.h | 2 |
16 files changed, 112 insertions, 92 deletions
diff --git a/hw/an5206.c b/hw/an5206.c index 419d416151..83078aa81b 100644 --- a/hw/an5206.c +++ b/hw/an5206.c @@ -7,6 +7,7 @@ */ #include "hw.h" +#include "pc.h" #include "mcf.h" #include "sysemu.h" #include "boards.h" @@ -16,11 +17,11 @@ #define AN5206_RAMBAR_ADDR 0x20000000 /* Stub functions for hardware that doesn't exist. */ -void pic_info(void) +void pic_info(Monitor *mon) { } -void irq_info(void) +void irq_info(Monitor *mon) { } diff --git a/hw/arm_pic.c b/hw/arm_pic.c index 1fe55b71be..c9f3cadff4 100644 --- a/hw/arm_pic.c +++ b/hw/arm_pic.c @@ -8,14 +8,15 @@ */ #include "hw.h" +#include "pc.h" #include "arm-misc.h" /* Stub functions for hardware that doesn't exist. */ -void pic_info(void) +void pic_info(Monitor *mon) { } -void irq_info(void) +void irq_info(Monitor *mon) { } diff --git a/hw/etraxfs_pic.c b/hw/etraxfs_pic.c index 7aa0568700..f32b3021c4 100644 --- a/hw/etraxfs_pic.c +++ b/hw/etraxfs_pic.c @@ -24,6 +24,7 @@ #include <stdio.h> #include "hw.h" +#include "pc.h" #include "etraxfs.h" #define D(x) @@ -135,11 +136,11 @@ static CPUWriteMemoryFunc *pic_write[] = { &pic_writel, }; -void pic_info(void) +void pic_info(Monitor *mon) { } -void irq_info(void) +void irq_info(Monitor *mon) { } diff --git a/hw/i8259.c b/hw/i8259.c index 933289b7b9..f813525009 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -24,7 +24,7 @@ #include "hw.h" #include "pc.h" #include "isa.h" -#include "console.h" +#include "monitor.h" /* debug PIC */ //#define DEBUG_PIC @@ -511,7 +511,7 @@ static void pic_init1(int io_addr, int elcr_addr, PicState *s) qemu_register_reset(pic_reset, s); } -void pic_info(void) +void pic_info(Monitor *mon) { int i; PicState *s; @@ -521,26 +521,27 @@ void pic_info(void) for(i=0;i<2;i++) { s = &isa_pic->pics[i]; - term_printf("pic%d: irr=%02x imr=%02x isr=%02x hprio=%d irq_base=%02x rr_sel=%d elcr=%02x fnm=%d\n", - i, s->irr, s->imr, s->isr, s->priority_add, - s->irq_base, s->read_reg_select, s->elcr, - s->special_fully_nested_mode); + monitor_printf(mon, "pic%d: irr=%02x imr=%02x isr=%02x hprio=%d " + "irq_base=%02x rr_sel=%d elcr=%02x fnm=%d\n", + i, s->irr, s->imr, s->isr, s->priority_add, + s->irq_base, s->read_reg_select, s->elcr, + s->special_fully_nested_mode); } } -void irq_info(void) +void irq_info(Monitor *mon) { #ifndef DEBUG_IRQ_COUNT - term_printf("irq statistic code not compiled.\n"); + monitor_printf(mon, "irq statistic code not compiled.\n"); #else int i; int64_t count; - term_printf("IRQ statistics:\n"); + monitor_printf(mon, "IRQ statistics:\n"); for (i = 0; i < 16; i++) { count = irq_count[i]; if (count > 0) - term_printf("%2d: %" PRId64 "\n", i, count); + monitor_printf(mon, "%2d: %" PRId64 "\n", i, count); } #endif } @@ -31,7 +31,7 @@ #include "net.h" #include "smbus.h" #include "boards.h" -#include "console.h" +#include "monitor.h" #include "fw_cfg.h" #include "virtio-blk.h" #include "virtio-balloon.h" @@ -208,6 +208,7 @@ static int boot_device2nibble(char boot_device) and used there as well */ static int pc_boot_set(void *opaque, const char *boot_device) { + Monitor *mon = cur_mon; #define PC_MAX_BOOT_DEVICES 3 RTCState *s = (RTCState *)opaque; int nbds, bds[3] = { 0, }; @@ -215,14 +216,14 @@ static int pc_boot_set(void *opaque, const char *boot_device) nbds = strlen(boot_device); if (nbds > PC_MAX_BOOT_DEVICES) { - term_printf("Too many boot devices for PC\n"); + monitor_printf(mon, "Too many boot devices for PC\n"); return(1); } for (i = 0; i < nbds; i++) { bds[i] = boot_device2nibble(boot_device[i]); if (bds[i] == 0) { - term_printf("Invalid boot device for PC: '%c'\n", - boot_device[i]); + monitor_printf(mon, "Invalid boot device for PC: '%c'\n", + boot_device[i]); return(1); } } @@ -1,5 +1,8 @@ #ifndef HW_PC_H #define HW_PC_H + +#include "qemu-common.h" + /* PC-style peripherals (also used by other machines). */ /* serial.c */ @@ -34,8 +37,8 @@ void pic_set_alt_irq_func(PicState2 *s, SetIRQFunc *alt_irq_func, int pic_read_irq(PicState2 *s); void pic_update_irq(PicState2 *s); uint32_t pic_intack_read(PicState2 *s); -void pic_info(void); -void irq_info(void); +void pic_info(Monitor *mon); +void irq_info(Monitor *mon); /* APIC */ typedef struct IOAPICState IOAPICState; diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 628676444e..a01efe0963 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -28,7 +28,7 @@ #include "net.h" #include "sysemu.h" #include "pc.h" -#include "console.h" +#include "monitor.h" #include "block_int.h" #include "virtio-blk.h" @@ -43,7 +43,7 @@ static PCIDevice *qemu_pci_hot_add_nic(PCIBus *pci_bus, const char *opts) return pci_nic_init (pci_bus, &nd_table[ret], -1, "rtl8139"); } -void drive_hot_add(const char *pci_addr, const char *opts) +void drive_hot_add(Monitor *mon, const char *pci_addr, const char *opts) { int dom, pci_bus; unsigned slot; @@ -52,13 +52,13 @@ void drive_hot_add(const char *pci_addr, const char *opts) PCIDevice *dev; if (pci_read_devaddr(pci_addr, &dom, &pci_bus, &slot)) { - term_printf("Invalid pci address\n"); + monitor_printf(mon, "Invalid pci address\n"); return; } dev = pci_find_device(pci_bus, slot, 0); if (!dev) { - term_printf("no pci device with address %s\n", pci_addr); + monitor_printf(mon, "no pci device with address %s\n", pci_addr); return; } @@ -75,16 +75,18 @@ void drive_hot_add(const char *pci_addr, const char *opts) drives_table[drive_idx].unit); break; default: - term_printf("Can't hot-add drive to type %d\n", type); + monitor_printf(mon, "Can't hot-add drive to type %d\n", type); } if (success) - term_printf("OK bus %d, unit %d\n", drives_table[drive_idx].bus, - drives_table[drive_idx].unit); + monitor_printf(mon, "OK bus %d, unit %d\n", + drives_table[drive_idx].bus, + drives_table[drive_idx].unit); return; } -static PCIDevice *qemu_pci_hot_add_storage(PCIBus *pci_bus, const char *opts) +static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, PCIBus *pci_bus, + const char *opts) { void *opaque = NULL; int type = -1, drive_idx = -1; @@ -97,7 +99,7 @@ static PCIDevice *qemu_pci_hot_add_storage(PCIBus *pci_bus, const char *opts) type = IF_VIRTIO; } } else { - term_printf("no if= specified\n"); + monitor_printf(mon, "no if= specified\n"); return NULL; } @@ -106,7 +108,7 @@ static PCIDevice *qemu_pci_hot_add_storage(PCIBus *pci_bus, const char *opts) if (drive_idx < 0) return NULL; } else if (type == IF_VIRTIO) { - term_printf("virtio requires a backing file/device.\n"); + monitor_printf(mon, "virtio requires a backing file/device.\n"); return NULL; } @@ -121,13 +123,14 @@ static PCIDevice *qemu_pci_hot_add_storage(PCIBus *pci_bus, const char *opts) opaque = virtio_blk_init (pci_bus, drives_table[drive_idx].bdrv); break; default: - term_printf ("type %s not a hotpluggable PCI device.\n", buf); + monitor_printf(mon, "type %s not a hotpluggable PCI device.\n", buf); } return opaque; } -void pci_device_hot_add(const char *pci_addr, const char *type, const char *opts) +void pci_device_hot_add(Monitor *mon, const char *pci_addr, const char *type, + const char *opts) { PCIDevice *dev = NULL; PCIBus *pci_bus; @@ -135,47 +138,47 @@ void pci_device_hot_add(const char *pci_addr, const char *type, const char *opts unsigned slot; if (pci_assign_devaddr(pci_addr, &dom, &bus, &slot)) { - term_printf("Invalid pci address\n"); + monitor_printf(mon, "Invalid pci address\n"); return; } pci_bus = pci_find_bus(bus); if (!pci_bus) { - term_printf("Can't find pci_bus %d\n", bus); + monitor_printf(mon, "Can't find pci_bus %d\n", bus); return; } if (strcmp(type, "nic") == 0) dev = qemu_pci_hot_add_nic(pci_bus, opts); else if (strcmp(type, "storage") == 0) - dev = qemu_pci_hot_add_storage(pci_bus, opts); + dev = qemu_pci_hot_add_storage(mon, pci_bus, opts); else - term_printf("invalid type: %s\n", type); + monitor_printf(mon, "invalid type: %s\n", type); if (dev) { qemu_system_device_hot_add(bus, PCI_SLOT(dev->devfn), 1); - term_printf("OK domain %d, bus %d, slot %d, function %d\n", - 0, pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn)); + monitor_printf(mon, "OK domain %d, bus %d, slot %d, function %d\n", + 0, pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); } else - term_printf("failed to add %s\n", opts); + monitor_printf(mon, "failed to add %s\n", opts); } #endif -void pci_device_hot_remove(const char *pci_addr) +void pci_device_hot_remove(Monitor *mon, const char *pci_addr) { PCIDevice *d; int dom, bus; unsigned slot; if (pci_read_devaddr(pci_addr, &dom, &bus, &slot)) { - term_printf("Invalid pci address\n"); + monitor_printf(mon, "Invalid pci address\n"); return; } d = pci_find_device(bus, slot, 0); if (!d) { - term_printf("slot %d empty\n", slot); + monitor_printf(mon, "slot %d empty\n", slot); return; } @@ -199,7 +202,7 @@ void pci_device_hot_remove_success(int pcibus, int slot) int class_code; if (!d) { - term_printf("invalid slot %d\n", slot); + monitor_printf(cur_mon, "invalid slot %d\n", slot); return; } @@ -23,7 +23,7 @@ */ #include "hw.h" #include "pci.h" -#include "console.h" +#include "monitor.h" #include "net.h" #include "virtio-net.h" #include "sysemu.h" @@ -705,42 +705,44 @@ static const pci_class_desc pci_class_descriptions[] = static void pci_info_device(PCIDevice *d) { + Monitor *mon = cur_mon; int i, class; PCIIORegion *r; const pci_class_desc *desc; - term_printf(" Bus %2d, device %3d, function %d:\n", - d->bus->bus_num, d->devfn >> 3, d->devfn & 7); + monitor_printf(mon, " Bus %2d, device %3d, function %d:\n", + d->bus->bus_num, d->devfn >> 3, d->devfn & 7); class = le16_to_cpu(*((uint16_t *)(d->config + PCI_CLASS_DEVICE))); - term_printf(" "); + monitor_printf(mon, " "); desc = pci_class_descriptions; while (desc->desc && class != desc->class) desc++; if (desc->desc) { - term_printf("%s", desc->desc); + monitor_printf(mon, "%s", desc->desc); } else { - term_printf("Class %04x", class); + monitor_printf(mon, "Class %04x", class); } - term_printf(": PCI device %04x:%04x\n", + monitor_printf(mon, ": PCI device %04x:%04x\n", le16_to_cpu(*((uint16_t *)(d->config + PCI_VENDOR_ID))), le16_to_cpu(*((uint16_t *)(d->config + PCI_DEVICE_ID)))); if (d->config[PCI_INTERRUPT_PIN] != 0) { - term_printf(" IRQ %d.\n", d->config[PCI_INTERRUPT_LINE]); + monitor_printf(mon, " IRQ %d.\n", + d->config[PCI_INTERRUPT_LINE]); } if (class == 0x0604) { - term_printf(" BUS %d.\n", d->config[0x19]); + monitor_printf(mon, " BUS %d.\n", d->config[0x19]); } for(i = 0;i < PCI_NUM_REGIONS; i++) { r = &d->io_regions[i]; if (r->size != 0) { - term_printf(" BAR%d: ", i); + monitor_printf(mon, " BAR%d: ", i); if (r->type & PCI_ADDRESS_SPACE_IO) { - term_printf("I/O at 0x%04x [0x%04x].\n", - r->addr, r->addr + r->size - 1); + monitor_printf(mon, "I/O at 0x%04x [0x%04x].\n", + r->addr, r->addr + r->size - 1); } else { - term_printf("32 bit memory at 0x%08x [0x%08x].\n", - r->addr, r->addr + r->size - 1); + monitor_printf(mon, "32 bit memory at 0x%08x [0x%08x].\n", + r->addr, r->addr + r->size - 1); } } } @@ -766,7 +768,7 @@ void pci_for_each_device(int bus_num, void (*fn)(PCIDevice *d)) } } -void pci_info(void) +void pci_info(Monitor *mon) { pci_for_each_device(0, pci_info_device); } @@ -1,6 +1,8 @@ #ifndef QEMU_PCI_H #define QEMU_PCI_H +#include "qemu-common.h" + /* PCI includes legacy ISA access. */ #include "isa.h" @@ -242,7 +244,7 @@ PCIDevice *pci_find_device(int bus_num, int slot, int function); int pci_read_devaddr(const char *addr, int *domp, int *busp, unsigned *slotp); int pci_assign_devaddr(const char *addr, int *domp, int *busp, unsigned *slotp); -void pci_info(void); +void pci_info(Monitor *mon); PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did, pci_map_irq_fn map_irq, const char *name); diff --git a/hw/pcmcia.h b/hw/pcmcia.h index 8f8366c83d..290a76f075 100644 --- a/hw/pcmcia.h +++ b/hw/pcmcia.h @@ -1,5 +1,7 @@ /* PCMCIA/Cardbus */ +#include "qemu-common.h" + struct pcmcia_socket_s { qemu_irq irq; int attached; @@ -9,7 +11,7 @@ struct pcmcia_socket_s { void pcmcia_socket_register(struct pcmcia_socket_s *socket); void pcmcia_socket_unregister(struct pcmcia_socket_s *socket); -void pcmcia_info(void); +void pcmcia_info(Monitor *mon); struct pcmcia_card_s { void *state; @@ -28,6 +28,7 @@ More information in target-sh4/README.sh4 */ #include "hw.h" +#include "pc.h" #include "sh.h" #include "sysemu.h" #include "boards.h" @@ -35,12 +36,12 @@ #define BIOS_FILENAME "shix_bios.bin" #define BIOS_ADDRESS 0xA0000000 -void irq_info(void) +void irq_info(Monitor *mon) { /* XXXXX */ } -void pic_info(void) +void pic_info(Monitor *mon) { /* XXXXX */ } diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c index b481b2c853..dffa11539a 100644 --- a/hw/slavio_intctl.c +++ b/hw/slavio_intctl.c @@ -23,7 +23,7 @@ */ #include "hw.h" #include "sun4m.h" -#include "console.h" +#include "monitor.h" //#define DEBUG_IRQ_COUNT //#define DEBUG_IRQ @@ -219,33 +219,33 @@ static CPUWriteMemoryFunc *slavio_intctlm_mem_write[3] = { slavio_intctlm_mem_writel, }; -void slavio_pic_info(void *opaque) +void slavio_pic_info(Monitor *mon, void *opaque) { SLAVIO_INTCTLState *s = opaque; int i; for (i = 0; i < MAX_CPUS; i++) { - term_printf("per-cpu %d: pending 0x%08x\n", i, - s->slaves[i]->intreg_pending); + monitor_printf(mon, "per-cpu %d: pending 0x%08x\n", i, + s->slaves[i]->intreg_pending); } - term_printf("master: pending 0x%08x, disabled 0x%08x\n", - s->intregm_pending, s->intregm_disabled); + monitor_printf(mon, "master: pending 0x%08x, disabled 0x%08x\n", + s->intregm_pending, s->intregm_disabled); } -void slavio_irq_info(void *opaque) +void slavio_irq_info(Monitor *mon, void *opaque) { #ifndef DEBUG_IRQ_COUNT - term_printf("irq statistic code not compiled.\n"); + monitor_printf(mon, "irq statistic code not compiled.\n"); #else SLAVIO_INTCTLState *s = opaque; int i; int64_t count; - term_printf("IRQ statistics:\n"); + monitor_printf(mon, "IRQ statistics:\n"); for (i = 0; i < 32; i++) { count = s->irq_count[i]; if (count > 0) - term_printf("%2d: %" PRId64 "\n", i, count); + monitor_printf(mon, "%2d: %" PRId64 "\n", i, count); } #endif } diff --git a/hw/sun4c_intctl.c b/hw/sun4c_intctl.c index 17591572fa..33df65309c 100644 --- a/hw/sun4c_intctl.c +++ b/hw/sun4c_intctl.c @@ -23,7 +23,7 @@ */ #include "hw.h" #include "sun4m.h" -#include "console.h" +#include "monitor.h" //#define DEBUG_IRQ_COUNT //#define DEBUG_IRQ @@ -90,26 +90,26 @@ static CPUWriteMemoryFunc *sun4c_intctl_mem_write[3] = { NULL, }; -void sun4c_pic_info(void *opaque) +void sun4c_pic_info(Monitor *mon, void *opaque) { Sun4c_INTCTLState *s = opaque; - term_printf("master: pending 0x%2.2x, enabled 0x%2.2x\n", s->pending, - s->reg); + monitor_printf(mon, "master: pending 0x%2.2x, enabled 0x%2.2x\n", + s->pending, s->reg); } -void sun4c_irq_info(void *opaque) +void sun4c_irq_info(Monitor *mon, void *opaque) { #ifndef DEBUG_IRQ_COUNT - term_printf("irq statistic code not compiled.\n"); + monitor_printf(mon, "irq statistic code not compiled.\n"); #else Sun4c_INTCTLState *s = opaque; int64_t count; - term_printf("IRQ statistics:\n"); + monitor_printf(mon, "IRQ statistics:\n"); count = s->irq_count[i]; if (count > 0) - term_printf("%2d: %" PRId64 "\n", i, count); + monitor_printf(mon, "%2d: %" PRId64 "\n", i, count); #endif } diff --git a/hw/sun4m.c b/hw/sun4m.c index bae8803d80..21667c038e 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -283,16 +283,16 @@ static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline, static void *slavio_intctl; -void pic_info(void) +void pic_info(Monitor *mon) { if (slavio_intctl) - slavio_pic_info(slavio_intctl); + slavio_pic_info(mon, slavio_intctl); } -void irq_info(void) +void irq_info(Monitor *mon) { if (slavio_intctl) - slavio_irq_info(slavio_intctl); + slavio_irq_info(mon, slavio_intctl); } void cpu_check_irqs(CPUState *env) diff --git a/hw/sun4m.h b/hw/sun4m.h index e1fa8376ca..219aaef2ea 100644 --- a/hw/sun4m.h +++ b/hw/sun4m.h @@ -1,6 +1,8 @@ #ifndef SUN4M_H #define SUN4M_H +#include "qemu-common.h" + /* Devices used by sparc32 system. */ /* iommu.c */ @@ -31,8 +33,8 @@ void *slavio_intctl_init(target_phys_addr_t addr, target_phys_addr_t addrg, const uint32_t *intbit_to_level, qemu_irq **irq, qemu_irq **cpu_irq, qemu_irq **parent_irq, unsigned int cputimer); -void slavio_pic_info(void *opaque); -void slavio_irq_info(void *opaque); +void slavio_pic_info(Monitor *mon, void *opaque); +void slavio_irq_info(Monitor *mon, void *opaque); /* sbi.c */ void *sbi_init(target_phys_addr_t addr, qemu_irq **irq, qemu_irq **cpu_irq, @@ -41,8 +43,8 @@ void *sbi_init(target_phys_addr_t addr, qemu_irq **irq, qemu_irq **cpu_irq, /* sun4c_intctl.c */ void *sun4c_intctl_init(target_phys_addr_t addr, qemu_irq **irq, qemu_irq *parent_irq); -void sun4c_pic_info(void *opaque); -void sun4c_irq_info(void *opaque); +void sun4c_pic_info(Monitor *mon, void *opaque); +void sun4c_irq_info(Monitor *mon, void *opaque); /* slavio_timer.c */ void slavio_timer_init_all(target_phys_addr_t base, qemu_irq master_irq, @@ -244,7 +244,7 @@ USBDevice *usb_hub_init(int nb_ports); /* usb-linux.c */ USBDevice *usb_host_device_open(const char *devname); int usb_host_device_close(const char *devname); -void usb_host_info(void); +void usb_host_info(Monitor *mon); /* usb-hid.c */ USBDevice *usb_mouse_init(void); |