From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BNG4I-00060q-G4 for qemu-devel@nongnu.org; Mon, 10 May 2004 15:04:02 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BNG2j-0005fQ-PB for qemu-devel@nongnu.org; Mon, 10 May 2004 15:02:56 -0400 Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BNFyH-00048l-Qp for qemu-devel@nongnu.org; Mon, 10 May 2004 14:57:50 -0400 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BNFyH-0002CG-00 for ; Mon, 10 May 2004 20:57:49 +0200 Received: from h68-144-28-252.sbm.shawcable.net ([68.144.28.252]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 10 May 2004 20:57:48 +0200 Received: from matt by h68-144-28-252.sbm.shawcable.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 10 May 2004 20:57:48 +0200 From: Matthew Mastracci Date: Mon, 10 May 2004 12:57:45 -0600 Message-ID: <409FD0A9.5020108@aclaro.com> References: <1084144380.6742.31.camel@matt> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000103060909030402060700" In-Reply-To: <1084144380.6742.31.camel@matt> Sender: news Subject: [Qemu-devel] Re: 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 This is a multi-part message in MIME format. --------------000103060909030402060700 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit After playing around with this a bit, it might even be easier to register your IO port routines with the ISAPNP manager. The ISAPNP manager could then add/remove them from the global IO port list as necessary: isapnp_register_ioport_write(c, 0, 16, 1, ne2000_ioport_write, s); isapnp_register_ioport_read(c, 0, 16, 1, ne2000_ioport_read, s); Note that c is the ISAPNP context from below and 0 is the first bank of IO port registers. Matt. Matthew Mastracci wrote: >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); >} > > --------------000103060909030402060700 Content-Type: text/x-vcard; charset=utf8; name="matt.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="matt.vcf" begin:vcard fn:Matthew Mastracci n:Mastracci;Matthew org:aclaro Softworks, inc. adr:;;1900 a - 11 St. SE;Calgary;Alberta;T2H 3G2;Canada email;internet:matt@aclaro.com title:Software Developer tel;work:(403) 299-6612 x-mozilla-html:FALSE url:http://www.aclaro.com version:2.1 end:vcard --------------000103060909030402060700--