From: Matthew Mastracci <matt@aclaro.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: Using ISA-PNP for resource management
Date: Mon, 10 May 2004 12:57:45 -0600 [thread overview]
Message-ID: <409FD0A9.5020108@aclaro.com> (raw)
In-Reply-To: <1084144380.6742.31.camel@matt>
[-- 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
prev parent reply other threads:[~2004-05-10 19:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=409FD0A9.5020108@aclaro.com \
--to=matt@aclaro.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).