X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=hw%2Fisa-bus.c;h=27655436a0f423eb6d618ece3e6128121c1d8b54;hb=db78ef5b0a93b16ad56b70a70e21b1c5e7d06ba8;hp=0cb1afbf2e44c446b33004217f567a76f7183eb1;hpb=9d861fa595c93f22d1d55b723a691531c36c9672;p=mirror_qemu.git diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 0cb1afbf2e..27655436a0 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -17,7 +17,6 @@ * License along with this library; if not, see . */ #include "hw.h" -#include "sysemu.h" #include "monitor.h" #include "sysbus.h" #include "isa.h" @@ -25,7 +24,6 @@ struct ISABus { BusState qbus; qemu_irq *irqs; - uint32_t assigned; }; static ISABus *isabus; target_phys_addr_t isa_mem_base = 0; @@ -61,33 +59,24 @@ void isa_bus_irqs(qemu_irq *irqs) } /* - * isa_reserve_irq() reserves the ISA irq and returns the corresponding - * qemu_irq entry for the i8259. + * isa_get_irq() returns the corresponding qemu_irq entry for the i8259. * * This function is only for special cases such as the 'ferr', and * temporary use for normal devices until they are converted to qdev. */ -qemu_irq isa_reserve_irq(int isairq) +qemu_irq isa_get_irq(int isairq) { if (isairq < 0 || isairq > 15) { hw_error("isa irq %d invalid", isairq); } - if (isabus->assigned & (1 << isairq)) { - hw_error("isa irq %d already assigned", isairq); - } - isabus->assigned |= (1 << isairq); return isabus->irqs[isairq]; } void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq) { assert(dev->nirqs < ARRAY_SIZE(dev->isairq)); - if (isabus->assigned & (1 << isairq)) { - hw_error("isa irq %d already assigned", isairq); - } - isabus->assigned |= (1 << isairq); dev->isairq[dev->nirqs] = isairq; - *p = isabus->irqs[isairq]; + *p = isa_get_irq(isairq); dev->nirqs++; } @@ -146,6 +135,18 @@ ISADevice *isa_create(const char *name) return DO_UPCAST(ISADevice, qdev, dev); } +ISADevice *isa_try_create(const char *name) +{ + DeviceState *dev; + + if (!isabus) { + hw_error("Tried to create isa device %s with no isa bus present.", + name); + } + dev = qdev_try_create(&isabus->qbus, name); + return DO_UPCAST(ISADevice, qdev, dev); +} + ISADevice *isa_create_simple(const char *name) { ISADevice *dev;