From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.33) id 1BMxUB-0004LT-RB for qemu-devel@nongnu.org; Sun, 09 May 2004 19:13:32 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.33) id 1BMxTf-0004Cx-QL for qemu-devel@nongnu.org; Sun, 09 May 2004 19:13:30 -0400 Received: from [64.59.128.220] (helo=bpd2mo2no.prod.shawcable.com) by monty-python.gnu.org with esmtp (Exim 4.33) id 1BMxTf-0004Cl-Gt for qemu-devel@nongnu.org; Sun, 09 May 2004 19:12:59 -0400 Received: from bpd2mi6no.prod.shawcable.com (bpd2mi6no-qfe3.prod.shawcable.com [10.0.184.161]) by bpd2mo2no.prod.shawcable.com (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0HXG00HGGZ5MBHB0@bpd2mo2no.prod.shawcable.com> for qemu-devel@nongnu.org; Sun, 09 May 2004 17:12:58 -0600 (MDT) Received: from [192.168.145.99] (S01060050bae85601.cg.shawcable.net [68.145.131.109]) by bpd2mi6no.prod.shawcable.com (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0HXG00B5VZ5MXR00@bpd2mi6no.prod.shawcable.com> for qemu-devel@nongnu.org; Sun, 09 May 2004 17:12:58 -0600 (MDT) Date: Sun, 09 May 2004 17:13:00 -0600 From: Matthew Mastracci Message-id: <1084144380.6742.31.camel@matt> MIME-version: 1.0 Content-type: text/plain Content-transfer-encoding: 7bit Subject: [Qemu-devel] Using ISA-PNP for resource management Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I was looking at how much work it would take to switch to using ISA-PNP for resource management. I believe that it might simplify some of the QEMU internals, as well as make things like having multiple network/other devices much easier. It may make moving to PCI (or having an option to boot with either ISAPNP or PCI on the fly) much easier. For anyone interested, the ISAPNP spec page is at: http://osdev.neopages.net/docs/PNP-ISA-v1.0a.pdf?the_id=54 I believe the best way to implement ISA-PNP would be for each device to register an ISA-PNP context, then add specific resource requirements to the context as necessary. The ISAPNP manager would then interact with the operating system and call the isapnp_configure method whenever the OS changes the setup. Perhaps something like this. I would imagine that the ISAPNP resource manager would clear the IO port range back to the default IO port manager before calling the *_isapnp_configure routine: static void ne2000_isapnp_configure(void* opaque, ISAPNPContext *c) { /* Get the first IO port as the base IO address */ int base = isapnp_get_ioport(c, 0); register_ioport_write(base, 16, 1, ne2000_ioport_write, s); register_ioport_read(base, 16, 1, ne2000_ioport_read, s); register_ioport_write(base + 0x10, 1, 1, ne2000_asic_ioport_write, s); register_ioport_read(base + 0x10, 1, 1, ne2000_asic_ioport_read, s); register_ioport_write(base + 0x10, 2, 2, ne2000_asic_ioport_write, s); register_ioport_read(base + 0x10, 2, 2, ne2000_asic_ioport_read, s); register_ioport_write(base + 0x1f, 1, 1, ne2000_reset_ioport_write, s); register_ioport_read(base + 0x1f, 1, 1, ne2000_reset_ioport_read, s); s->irq = isapnp_get_irq(c, 0); /* Perhaps this would happen below... (?) */ ne2000_reset(); } void ne2000_init(int base, int irq, NetDriverState *nd) { ISAPNPContext *c; /* KTC2000 is an ISAPNP vendor ID for an NE2000 compatible card */ /* No serial number specified here, ISAPNP manager can autogenerate it */ c = isapnp_create_context("KTC", 2000, ne2000_isapnp_configure, s); /* Need an edge-triggered IRQ, default is irq */ isapnp_register_irq(IRQ_MODE_EDGE, irq); /* Need a block of 32 IO ports, default is base */ isapnp_register_ioport(32, base); } -- Matthew Mastracci