This patch simplifies the resource allocator by splitting it into distinct
phases. One benefit of this is that it makes the call chain easier to follow. device/device.c: Remove references to have_resources. Remove read_resources from compute allocate resources. Split compute_allocate_resources into two 1. compute_resource_needs A. Traverse the tree depth first B. Sum resources C. Adjust limits and bases D. Update bridge resources sizes 2. assign_resource_values A. Traverse the tree breadth first B. Assign resource values device/device_util.c: Remove references to have_resources. device/pci_device.c: Remove saved values stubs (they're not needed now.) 1. Sizing function restores values Fix 64-bit flag masking. Add an error message for an invalid value. Update pci_record_bridge_resource: 1. remove compute_allocate_resource call 2. remove pci_set_resource call Update pci_bus_read_resources to read children's too. Update pci_set_resource: 1. change logic for setting zero-size resources A. Set range to [limit->limit-2^gran] (Could have been any range with base > limit) 2. remove compute_allocate_resource calls 3. Change phase4_assign_resources ->phase4_set_resources device/pci_ops.c: Change an error message to be more helpful. device/root_device.c: Remove code for read_resources and set resources. Add a .id to the ops. include/device/device.h: Remove have_resources. Comment out assign_resources. I think we could comment out more here. Add debugging function prototypes. Change phase4_assign_resources to phase4_set_resources. include/device/resource.h Add a IORESOURCE_BRIDGE flag. device/cardbus_device.c Remove compute_allocate_resource call. Use probe_resource (doesn't die) instead of find_resource. Signed-off-by: Myles Watson <mylesgw@gmail.com> Acked-by: Ronald G. Minnich <rminnich@gmail.com> git-svn-id: svn://coreboot.org/repository/coreboot-v3@1089 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
034ea33797
commit
0fb2a8f081
8 changed files with 572 additions and 329 deletions
|
|
@ -199,12 +199,11 @@ struct device {
|
|||
u16 subsystem_vendor;
|
||||
u16 subsystem_device;
|
||||
|
||||
unsigned int class; /* 3 bytes: (base,sub,prog-if) */
|
||||
unsigned int hdr_type; /* PCI header type */
|
||||
unsigned int enabled:1; /* set if we should enable the device */
|
||||
unsigned int have_resources:1; /* Set if we have read the devices resources */
|
||||
unsigned int on_mainboard:1;
|
||||
unsigned long rom_address;
|
||||
unsigned int class; /* 3 bytes: (base,sub,prog-if) */
|
||||
unsigned int hdr_type; /* PCI header type */
|
||||
unsigned int enabled : 1; /* set if we should enable the device */
|
||||
unsigned int on_mainboard : 1;
|
||||
unsigned long rom_address;
|
||||
|
||||
u8 command;
|
||||
|
||||
|
|
@ -239,9 +238,7 @@ void dev_optimize(void);
|
|||
/* Generic device helper functions */
|
||||
int reset_bus(struct bus *bus);
|
||||
unsigned int scan_bus(struct device *bus, unsigned int max);
|
||||
void compute_allocate_resource(struct bus *bus, struct resource *bridge,
|
||||
unsigned long type_mask, unsigned long type);
|
||||
void assign_resources(struct bus *bus);
|
||||
//void assign_resources(struct bus *bus);
|
||||
void enable_resources(struct device *dev);
|
||||
void enumerate_static_device(void);
|
||||
void enumerate_static_devices(void);
|
||||
|
|
@ -267,12 +264,9 @@ void default_device_constructor(struct device *dev,
|
|||
const struct device_operations *constructor);
|
||||
void show_all_devs(int debug_level, const char *msg);
|
||||
void show_all_devs_tree(int debug_level, const char *msg);
|
||||
|
||||
/* Rounding for boundaries.
|
||||
* Due to some chip bugs, go ahead and round IO to 16
|
||||
*/
|
||||
#define DEVICE_IO_ALIGN 16
|
||||
#define DEVICE_MEM_ALIGN 4096
|
||||
void show_all_devs(int debug_level, const char *msg);
|
||||
void show_all_devs_tree(int debug_level, const char *msg);
|
||||
void print_resource_tree(const struct device * const dev, int debug_level, const char* msg);
|
||||
|
||||
resource_t align_up(resource_t val, unsigned long gran);
|
||||
resource_t align_down(resource_t val, unsigned long gran);
|
||||
|
|
@ -296,7 +290,7 @@ void dev_phase4(void);
|
|||
void dev_root_phase5(void);
|
||||
void dev_phase6(void);
|
||||
|
||||
void phase4_assign_resources(struct bus *bus);
|
||||
void phase4_set_resources(struct bus *bus);
|
||||
unsigned int dev_phase3(struct device *bus, unsigned int max);
|
||||
void dev_phase5(struct device *dev);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#define IORESOURCE_SUBTRACTIVE 0x00040000 /* This resource filters all of the unclaimed transactions
|
||||
* to the bus below.
|
||||
*/
|
||||
#define IORESOURCE_BRIDGE 0x00080000 /* The IO resource has a bus below it. */
|
||||
#define IORESOURCE_STORED 0x20000000 /* The IO resource assignment has been stored in the device */
|
||||
#define IORESOURCE_ASSIGNED 0x40000000 /* An IO resource that has been assigned a value */
|
||||
#define IORESOURCE_FIXED 0x80000000 /* An IO resource the allocator must not change */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue