aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMyles Watson <mylesgw@gmail.com>2009-07-02 18:56:24 +0000
committerMyles Watson <mylesgw@gmail.com>2009-07-02 18:56:24 +0000
commit29cc9eda2021a87396ef31a6fc81daff6fd1be7a (patch)
treed3dfa07ca85547c77c5d07825fc8afcc19489076 /src/include
parent2468331952bae0abdc4d76dbe6cf26f05b7825e5 (diff)
Move the v3 resource allocator to v2.
Major changes: 1. Separate resource allocation into: A. Read Resources B. Avoid fixed resources (constrain limits) C. Allocate resources D. Set resources Usage notes: Resources which have IORESOURCE_FIXED set in the flags constrain the placement of other resources. All fixed resources will end up outside (above or below) the allocated resources. Domains usually start with base = 0 and limit = 2^address_bits - 1. I've added an IOAPIC to all platforms so that the old limit of 0xfec00000 is still there for resources. Some platforms may want to change that, but I didn't want to break anyone's board. Resources are allocated in a single block for memory and another for I/O. Currently the resource allocator doesn't support holes. Signed-off-by: Myles Watson <mylesgw@gmail.com> Acked-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Patrick Georgi <patrick.georgi@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4394 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/include')
-rw-r--r--src/include/device/device.h9
-rw-r--r--src/include/device/resource.h15
2 files changed, 14 insertions, 10 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 22d6c71829..1990454d6a 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -69,17 +69,16 @@ struct device {
unsigned int hdr_type; /* PCI header type */
unsigned int enabled : 1; /* set if we should enable the device */
unsigned int initialized : 1; /* set if we have initialized the device */
- unsigned int have_resources : 1; /* Set if we have read the devices resources */
unsigned int on_mainboard : 1;
unsigned long rom_address;
- uint8_t command;
+ u8 command;
/* Base registers for this device. I/O, MEM and Expansion ROM */
struct resource resource[MAX_RESOURCES];
unsigned int resources;
- /* link are (down stream) buses attached to the device, usually a leaf
+ /* links are (downstream) buses attached to the device, usually a leaf
* device with no children have 0 buses attached and a bridge has 1 bus
*/
struct bus link[MAX_LINKS];
@@ -106,8 +105,6 @@ 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 enable_resources(struct device *dev);
void enumerate_static_device(void);
@@ -142,6 +139,8 @@ void show_all_devs_resources(int debug_level, const char* msg);
#define DEVICE_MEM_ALIGN 4096
extern struct device_operations default_dev_ops_root;
+void pci_domain_read_resources(struct device *dev);
+unsigned int pci_domain_scan_bus(struct device *dev, unsigned int max);
void root_dev_read_resources(device_t dev);
void root_dev_set_resources(device_t dev);
unsigned int scan_static_bus(device_t bus, unsigned int max);
diff --git a/src/include/device/resource.h b/src/include/device/resource.h
index 902cf686c9..5452d4360c 100644
--- a/src/include/device/resource.h
+++ b/src/include/device/resource.h
@@ -1,5 +1,5 @@
-#ifndef RESOURCE_H
-#define RESOURCE_H
+#ifndef DEVICE_RESOURCE_H
+#define DEVICE_RESOURCE_H
#include <stdint.h>
@@ -19,6 +19,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 */
@@ -62,7 +63,7 @@
#define IORESOURCE_MEM_EXPANSIONROM (1<<6)
-typedef uint64_t resource_t;
+typedef u64 resource_t;
struct resource {
resource_t base; /* Base address of the resource */
resource_t size; /* Size of the resource */
@@ -74,10 +75,14 @@ struct resource {
/* Alignment must be >= the granularity of the resource */
};
-/* Macros to generate index values for subtractive resources */
+/* Macros to generate index values for resources */
#define IOINDEX_SUBTRACTIVE(IDX,LINK) (0x10000000 + ((IDX) << 8) + LINK)
#define IOINDEX_SUBTRACTIVE_LINK(IDX) (IDX & 0xff)
+#define IOINDEX(IDX,LINK) (((LINK) << 16) + IDX)
+#define IOINDEX_LINK(IDX) (( IDX & 0xf0000) >> 16)
+#define IOINDEX_IDX(IDX) (IDX & 0xffff)
+
/* Generic resource helper functions */
struct device;
struct bus;
@@ -101,4 +106,4 @@ extern void search_global_resources(
#define RESOURCE_TYPE_MAX 20
extern const char *resource_type(struct resource *resource);
-#endif /* RESOURCE_H */
+#endif /* DEVICE_RESOURCE_H */