These two patches are the resource allocator I've been working on.  The biggest thing it does is simplify the resource allocator by splitting it into distinct phases:<br>1. read resources<br>2. constrain resources around fixed resources<br>
3. sum resource needs<br>4. assign values<br><br>This means that there are no more calls to compute_allocate_resources from specific devices, which makes the process easier to follow.<br><br>Boot tested (with patches that will be coming shortly) on qemu, serengeti, kontron, and dbe62.<br>
<br>Signed-off-by: Myles Watson <<a href="mailto:mylesgw@gmail.com">mylesgw@gmail.com</a>><br>
<br>
Thanks,<br>
Myles<br><br>I split it into two patches: one which implements most of the changes, and the other which updates device code.<br><br>resource-allocation.diff:<br><br>device/device.c:<br>    Remove references to have_resources.<br>
    Remove read_resources from compute allocate resources.<br>    Split compute_allocate_resources into two<br>    1. compute_resource_needs<br>        A. Traverse the tree depth first<br>        B. Sum resources<br>        C. Adjust limits and bases<br>
        D. Update bridge resources sizes<br>    2. assign_resource_values<br>        A. Traverse the tree breadth first<br>        B. Assign resource values<br><br>device/device_util.c:<br>    Remove references to have_resources.<br>
<br>device/pci_device.c:<br>    Remove saved values stubs (they're not needed now.)<br>        1. Sizing function restores values<br>    Fix 64-bit flag masking.<br>    Add an error message for an invalid value.<br>    Update pci_record_bridge_resource:<br>
        1. remove compute_allocate_resource call<br>        2. remove pci_set_resource call<br>    Update pci_bus_read_resources to read children's too.<br>    Update pci_set_resource:<br>        1. change logic for setting zero-size resources<br>
            A. Set range to [limit->limit-2^gran]<br>                (Could have been any range with base > limit)<br>        2. remove compute_allocate_resource calls<br>        3. Change phase4_assign_resources ->phase4_set_resources<br>
<br>device/pci_ops.c:<br>    Change an error message to be more helpful.<br><br>device/root_device.c:<br>    Remove code for read_resources and set resources.<br>    Add a .id to the ops.<br><br>include/device/device.h:<br>
    Remove have_resources.<br>    Comment out assign_resources.  I think we could comment out more here.<br>    Add debugging function prototypes.<br>    Change phase4_assign_resources to phase4_set_resources.<br><br>include/device/resource.h<br>
    Add a IORESOURCE_BRIDGE flag.<br><br>device/cardbus_device.c<br>    Remove compute_allocate_resource call.<br>    Use probe_resource (doesn't die) instead of find_resource.<br><br>specific-resources.diff:<br><br>This patch makes specific devices use the updated resource allocation code.<br>
<br>The changes necessary are:<br>    1. Remove all calls to compute_allocate_resources.<br>    2. Don't store resources except in phase4_set_resources.<br><br>northbridge/amd/k8/pci.c:<br>    Remove calls to compute_allocate_resource.<br>
    Change phase4_assign_resources to phase4_set_resources<br><br>southbridge/amd/amd8132/amd8132_bridge.c:<br>    Remove NPUML and NPUMB.<br>    Add a warning for bus disabling.<br>    Remove bridge_{read|set}_resources (they were there for NPUML)<br>
    <br>southbridge/nvidia/mcp55/lpc.c:<br>southbridge/amd/sb600/lpc.c:<br>    Remove references to have_resources.<br><br>southbridge/amd/amd8111/lpc.c:<br>    Add resources for subtractive IO and ROM.<br><br>northbridge/amd/k8/domain.c:<br>
northbridge/intel/i440bxemulation/i440bx.c:<br>northbridge/amd/geodelx/geodelx.c:<br>northbridge/intel/i945/northbridge.c:<br>northbridge/via/cn700/stage2.c:<br>    Change phase4_assign_resources->phase4_set_resources.<br>