Re: newbus ioport usage

From: M. Warner Losh (imp_at_bsdimp.com)
Date: 01/27/04

  • Next message: Nate Lawson: "Re: newbus ioport usage"
    Date: Tue, 27 Jan 2004 15:31:20 -0700 (MST)
    To: nate@root.org
    
    

    In message: <20040127141708.O75272@root.org>
                Nate Lawson <nate@root.org> writes:
    : On Tue, 27 Jan 2004, M. Warner Losh wrote:
    : > In message: <20040127133251.W75080@root.org>
    : > Nate Lawson <nate@root.org> writes:
    : > : > There's nothing magical about the acpi_sysresource device, and it can
    : > : > be relegated to the scrap-heap of history if needed.
    : > :
    : > : Well, the way we find out about the resources is through a pseudo-device
    : > : with a PNPID. So it makes sense to use the normal device discovery method
    : > : to find these resources. This leads me to do the allocation for the
    : > : parent by the acpi_sysresource0 attach method.
    : >
    : > This gets ugly. The reason that I suggested not doing the discovery
    : > this way is because you want to allocate *ALL* resources up front
    : > before giving any to any children. pci has issues with this right now
    : > that I'm working to fix.
    :
    : I'm pretty sure there is no other way to know what resources acpi devices
    : will be using without evaluating the resource pseudo-device. The other
    : way (which we currently do) is assume everything is available and let each
    : driver grab whatever is free and then attach the resource pseudo-device
    : last to claim all remaining acpi resources. Unless you have a better
    : idea, the short-term approach will not change any of the above. It will
    : just add the ability for acpi devices to later reclaim resources from
    : acpi0 (by having acpi_sysresource0 attach remaining resources to its
    : parent).

    You could add acpi_sysresource as the first child, which would get
    around the issues. It could then call a private method on its parent
    to give it the resources. But why couldn't that code be moved up into
    parent? I guess I'm not understanding the difficulty here, because
    right now there's only one sysresource, and it does:

    static int
    acpi_sysresource_probe(device_t dev)
    {
        if (!acpi_disabled("sysresource") && acpi_MatchHid(dev, "PNP0C02"))
            device_set_desc(dev, "System Resource");
        else
            return (ENXIO);

        device_quiet(dev);
        return (-100);
    }

    static int
    acpi_sysresource_attach(device_t dev)
    {
        struct resource *res;
        int i, rid;

        /*
         * Suck up all the resources that might have been assigned to us.
         * Note that it's impossible to tell the difference between a
         * resource that someone else has claimed, and one that doesn't
         * exist.
         */
        for (i = 0; i < 100; i++) {
            rid = i;
            res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, 0);
            rid = i;
            res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, 0);
            rid = i;
            res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
                                     RF_SHAREABLE);
        }

        return (0);
    }

    I'm not sure that I see.

    : Allocating all resources up front would require multiple passes of the
    : namespace and I'm not ready to make that drastic of a change without some
    : more design work about how this fits in with the rest of FreeBSD (in
    : particular, PCI).

    Yes. We do need to redesign the probe/attach code to have multiple
    passes.

    Warner
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Nate Lawson: "Re: newbus ioport usage"

    Relevant Pages

    • Re: newbus ioport usage
      ... : On Mon, 26 Jan 2004, M. Warner Losh wrote: ... :>: allocate all ports at boot time, ... Have acpi bus own the resources that acpi_sysresource0 uses. ...
      (freebsd-arch)
    • Re: Writing a driver for a card reader controller - how?
      ... On Thursday 24 November 2005 01:26 pm, M. Warner Losh wrote: ... > without actually talking about the sets of registers themselves. ... smart enough to allocate resources for a device when bus_alloc_resourceis ... called to choose available resources when a device is not configured. ...
      (freebsd-hackers)
    • Re: newbus ioport usage
      ... I'm pretty sure there is no other way to know what resources acpi devices ... last to claim all remaining acpi resources. ... It could then call a private method on its parent ... The first step is to move the resource attach code into acpi0. ...
      (freebsd-arch)
    • Re: 2 AD domains same physical switches and router ?
      ... Currently the remote sites resources live on our parent companies ... I'm not really wanting to have to put static dns entries onto the ... the workstations and user accounts to be part of your Active Directory ...
      (microsoft.public.windows.server.networking)
    • Re: sub domain
      ... In a Windows 2000 network, parent and child domains have an automatic ... resources in both domains using the user accounts in each. ... assign permissions to the Domain Local group. ... I was going to create groups on the>subdomain and add the users from the parent to that domain. ...
      (microsoft.public.win2000.active_directory)

  • Quantcast