* [Qemu-devel] Using ISA-PNP for resource management @ 2004-05-09 23:13 Matthew Mastracci 2004-05-10 18:34 ` Fabrice Bellard 2004-05-10 18:57 ` Matthew Mastracci 0 siblings, 2 replies; 4+ messages in thread From: Matthew Mastracci @ 2004-05-09 23:13 UTC (permalink / raw) To: qemu-devel 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 <matt@aclaro.com> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Using ISA-PNP for resource management 2004-05-09 23:13 [Qemu-devel] Using ISA-PNP for resource management Matthew Mastracci @ 2004-05-10 18:34 ` Fabrice Bellard 2004-05-10 21:31 ` [Qemu-devel] " Matthew Mastracci 2004-05-10 18:57 ` Matthew Mastracci 1 sibling, 1 reply; 4+ messages in thread From: Fabrice Bellard @ 2004-05-10 18:34 UTC (permalink / raw) To: qemu-devel 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: OK for ISAPNP, but it should just indicate what is the hardcoded configuration. I don't want to use it to set the exact ioports and irqs. Moreover PCI is about to be integrated in QEMU, so it may not be worth the effort. Fabrice. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: Using ISA-PNP for resource management 2004-05-10 18:34 ` Fabrice Bellard @ 2004-05-10 21:31 ` Matthew Mastracci 0 siblings, 0 replies; 4+ messages in thread From: Matthew Mastracci @ 2004-05-10 21:31 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 793 bytes --] Fabrice Bellard wrote: > OK for ISAPNP, but it should just indicate what is the hardcoded > configuration. I don't want to use it to set the exact ioports and > irqs. Moreover PCI is about to be integrated in QEMU, so it may not be > worth the effort. Cool! Will you be adding an option whether to include PCI or not in the host? I believe that only devices actually on the ISA bus (not those on the PCI bus) will participate in the ISAPNP process. If PCI is enabled, the ISAPNP enumerator should not respond (since no ISA devices are around to participate in the process). I suppose it might not be very useful to add ISAPNP if something as old as Windows '95 supports PCI. PCI is far better for device enumeration anyways. Might be better to wait in this case. :) Matt. [-- Attachment #2: matt.vcf --] [-- Type: text/x-vcard, Size: 286 bytes --] 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: Using ISA-PNP for resource management 2004-05-09 23:13 [Qemu-devel] Using ISA-PNP for resource management Matthew Mastracci 2004-05-10 18:34 ` Fabrice Bellard @ 2004-05-10 18:57 ` Matthew Mastracci 1 sibling, 0 replies; 4+ messages in thread From: Matthew Mastracci @ 2004-05-10 18:57 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 2856 bytes --] 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); >} > > [-- Attachment #2: matt.vcf --] [-- Type: text/x-vcard, Size: 286 bytes --] 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-05-10 21:32 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-05-09 23:13 [Qemu-devel] Using ISA-PNP for resource management Matthew Mastracci 2004-05-10 18:34 ` Fabrice Bellard 2004-05-10 21:31 ` [Qemu-devel] " Matthew Mastracci 2004-05-10 18:57 ` Matthew Mastracci
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).