bus_alloc_resource question

From: Chuck Tuffli (chuck_tuffli_at_agilent.com)
Date: 07/27/04

  • Next message: M. Warner Losh: "Re: bus_alloc_resource question"
    Date: Mon, 26 Jul 2004 18:59:24 -0700
    To: hackers@freebsd.org
    
    

    I'm having some trouble adding a bus resource and am hoping someone
    can point out where I goofed.

    The host bus to a new x86 chipset has a memory mapped region in PCI
    space that provides access to status and control registers. For a
    driver to get access to this region, I figured it should call
    bus_alloc_resource() the same as for any other memory mapped region.
    This currently doesn't "just work" as the region is not a part of any
    device's BARs. To add this region as a resource, I used
    bus_set_resource()

        device_t dev;
        uint32_t e_mem = 0xe0000000;
        struct resource *ecfg_res;

        dev = pci_find_device(PCI_VENDOR_INTEL, ...);
        bus_set_resource(dev, SYS_RES_MEMORY, e_mem, 0xe0000000, 0x10000000);

    but a subsequent call to bus_alloc_resource() returns NULL

        ecfg_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &e_mem,
                0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);

    A call to bus_get_resource() shows that the resource did get set as
    the call returns the correct starting address and count. Is there
    something else that needs to happen between the set and the alloc? Is
    this even the correct approach? Thanks in advance!

    -- 
    Chuck Tuffli
    Agilent Technologies, Storage Area Networking
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
    

  • Next message: M. Warner Losh: "Re: bus_alloc_resource question"

    Relevant Pages

    • Re: bus_alloc_resource question
      ... The host bus to a new x86 chipset has a memory mapped region in PCI ... bus_alloc_resourcethe same as for any other memory mapped region. ... To add this region as a resource, ... On the PCI bus, ...
      (freebsd-hackers)
    • Re: pci_find_parent_resource patch
      ... we currently pick the _first_ exactly matching bus resource entry, ... the _last_ inexactly matching one. ... so if 'res->flags' has the PREFETCH ...
      (Linux-Kernel)
    • Re: [PATCH] pci: only release that resource index is less than 3
      ... get larger bridge ranges when space is available ... found one of resource of peer root bus get released from root ... other peer root buses is ok. ... related to the job of "finding an available bus resource." ...
      (Linux-Kernel)
    • Re: [PATCH 0/1] Recurse when searching for empty slots in resources trees
      ... find_resource() found room for a resource. ... your patch returns another - equally valid one. ... where the ambiguity doesn't exist any more ... I just looked at our PCI bus resource allocation code, ...
      (Linux-Kernel)
    • Re: [PATCH 0/1] Recurse when searching for empty slots in resources trees
      ... find_resource() found room for a resource. ... But the reason I don't like your patch is that I think the _deeper_ ... the ambiguity doesn't exist any more (because we'd explicitly take the ... I just looked at our PCI bus resource allocation code, ...
      (Linux-Kernel)