update comment according to the new DOM
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1799 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
f0ee1efcaf
commit
0493069aa9
|
@ -378,11 +378,12 @@ static void allocate_vga_resource(void)
|
||||||
vga = 0;
|
vga = 0;
|
||||||
for (dev = all_devices; dev; dev = dev->next) {
|
for (dev = all_devices; dev; dev = dev->next) {
|
||||||
if (((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
|
if (((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
|
||||||
((dev->class >> 8) != PCI_CLASS_DISPLAY_OTHER))
|
((dev->class >> 8) != PCI_CLASS_DISPLAY_OTHER)) {
|
||||||
{
|
|
||||||
if (!vga) {
|
if (!vga) {
|
||||||
printk_debug("Allocating VGA resource %s\n",
|
printk_debug("Allocating VGA resource %s\n",
|
||||||
dev_path(dev));
|
dev_path(dev));
|
||||||
|
printk_debug("parent of the vga device %s\n",
|
||||||
|
dev_path(dev->bus->dev));
|
||||||
vga = dev;
|
vga = dev;
|
||||||
}
|
}
|
||||||
if (vga == dev) {
|
if (vga == dev) {
|
||||||
|
@ -399,17 +400,26 @@ static void allocate_vga_resource(void)
|
||||||
}
|
}
|
||||||
/* Now walk up the bridges setting the VGA enable */
|
/* Now walk up the bridges setting the VGA enable */
|
||||||
while (bus) {
|
while (bus) {
|
||||||
|
printk_info("Enabling VGA forward on bus connect to %s\n",
|
||||||
|
dev_path(bus->dev));
|
||||||
bus->bridge_ctrl |= PCI_BRIDGE_CTL_VGA;
|
bus->bridge_ctrl |= PCI_BRIDGE_CTL_VGA;
|
||||||
bus = (bus == bus->dev->bus)? 0 : bus->dev->bus;
|
bus = (bus == bus->dev->bus)? 0 : bus->dev->bus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Assign the computed resources to the bridges and devices on the bus.
|
/**
|
||||||
* Recurse to any bridges found on this bus first. Then do the devices
|
* @brief Assign the computed resources to the devices on the bus.
|
||||||
* on this bus.
|
|
||||||
*
|
*
|
||||||
* @param bus Pointer to the structure for this bus
|
* @param bus Pointer to the structure for this bus
|
||||||
|
*
|
||||||
|
* Use the device specific set_resources method to store the computed
|
||||||
|
* resources to hardware. For bridge devices, the set_resources() method
|
||||||
|
* has to recurse into every down stream buses.
|
||||||
|
*
|
||||||
|
* Mutual recursion:
|
||||||
|
* assign_resources() -> device_operation::set_resources()
|
||||||
|
* device_operation::set_resources() -> assign_resources()
|
||||||
*/
|
*/
|
||||||
void assign_resources(struct bus *bus)
|
void assign_resources(struct bus *bus)
|
||||||
{
|
{
|
||||||
|
@ -443,10 +453,13 @@ void assign_resources(struct bus *bus)
|
||||||
*
|
*
|
||||||
* The parent's resources should be enabled first to avoid having enabling
|
* The parent's resources should be enabled first to avoid having enabling
|
||||||
* order problem. This is done by calling the parent's enable_resources()
|
* order problem. This is done by calling the parent's enable_resources()
|
||||||
* method and let that method to call it's children's enable_resoruces() via
|
* method and let that method to call it's children's enable_resoruces()
|
||||||
* enable_childrens_resources().
|
* method via the (global) enable_childrens_resources().
|
||||||
*
|
*
|
||||||
* Indirect mutual recursion:
|
* Indirect mutual recursion:
|
||||||
|
* enable_resources() -> device_operations::enable_resource()
|
||||||
|
* device_operations::enable_resource() -> enable_children_resources()
|
||||||
|
* enable_children_resources() -> enable_resources()
|
||||||
*/
|
*/
|
||||||
void enable_resources(struct device *dev)
|
void enable_resources(struct device *dev)
|
||||||
{
|
{
|
||||||
|
@ -461,16 +474,25 @@ void enable_resources(struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Determine the existence of dynamic devices and construct dynamic
|
* @brief Determine the existence of devices and extend the device tree.
|
||||||
|
*
|
||||||
|
* Most of the devices in the system are listed in the mainboard Config.lb
|
||||||
|
* file. The device structures for these devices are generated at compile
|
||||||
|
* time by the config tool and are organized into the device tree. This
|
||||||
|
* function determines if the devices created at compile time actually exist
|
||||||
|
* in the physical system.
|
||||||
|
*
|
||||||
|
* For devices in the physical system but not listed in the Config.lb file,
|
||||||
|
* the device structures have to be created at run time and attached to the
|
||||||
* device tree.
|
* device tree.
|
||||||
*
|
*
|
||||||
* Start from the root device 'dev_root', scan the buses in the system
|
* This function starts from the root device 'dev_root', scan the buses in
|
||||||
* recursively, build the dynamic device tree according to the result
|
* the system recursively, modify the device tree according to the result of
|
||||||
* of the probe.
|
* the probe.
|
||||||
*
|
*
|
||||||
* This function has no idea how to scan and probe buses and devices at all.
|
* This function has no idea how to scan and probe buses and devices at all.
|
||||||
* It depends on the bus/device specific scan_bus() method to do it. The
|
* It depends on the bus/device specific scan_bus() method to do it. The
|
||||||
* scan_bus() function also has to create the device structure and attach
|
* scan_bus() method also has to create the device structure and attach
|
||||||
* it to the device tree.
|
* it to the device tree.
|
||||||
*/
|
*/
|
||||||
void dev_enumerate(void)
|
void dev_enumerate(void)
|
||||||
|
@ -490,12 +512,13 @@ void dev_enumerate(void)
|
||||||
printk_info("done\n");
|
printk_info("done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configure devices on the devices tree.
|
* @brief Configure devices on the devices tree.
|
||||||
*
|
*
|
||||||
* Starting at the root of the dynamic device tree, travel recursively,
|
* Starting at the root of the device tree, travel it recursively in two
|
||||||
* and compute resources needed by each device and allocate them.
|
* passes. In the first pass, we compute and allocate resources (ranges)
|
||||||
|
* requried by each device. In the second pass, the resources ranges are
|
||||||
|
* relocated to their final position and stored to the hardware.
|
||||||
*
|
*
|
||||||
* I/O resources start at DEVICE_IO_START and grow upward. MEM resources start
|
* I/O resources start at DEVICE_IO_START and grow upward. MEM resources start
|
||||||
* at DEVICE_MEM_START and grow downward.
|
* at DEVICE_MEM_START and grow downward.
|
||||||
|
@ -519,7 +542,10 @@ void dev_configure(void)
|
||||||
printk_err("dev_root missing set_resources\n");
|
printk_err("dev_root missing set_resources\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printk_info("Reading resources...\n");
|
||||||
root->ops->read_resources(root);
|
root->ops->read_resources(root);
|
||||||
|
printk_info("Done\n");
|
||||||
|
|
||||||
/* Get the resources */
|
/* Get the resources */
|
||||||
io = &root->resource[0];
|
io = &root->resource[0];
|
||||||
|
@ -539,8 +565,9 @@ void dev_configure(void)
|
||||||
allocate_vga_resource();
|
allocate_vga_resource();
|
||||||
|
|
||||||
/* Store the computed resource allocations into device registers ... */
|
/* Store the computed resource allocations into device registers ... */
|
||||||
|
printk_info("Setting resources...\n");
|
||||||
root->ops->set_resources(root);
|
root->ops->set_resources(root);
|
||||||
|
printk_info("Done\n");
|
||||||
#if 0
|
#if 0
|
||||||
mem->flags |= IORESOURCE_STORED;
|
mem->flags |= IORESOURCE_STORED;
|
||||||
report_resource_stored(root, mem, "");
|
report_resource_stored(root, mem, "");
|
||||||
|
@ -569,7 +596,8 @@ void dev_enable(void)
|
||||||
* @brief Initialize all devices in the global device list.
|
* @brief Initialize all devices in the global device list.
|
||||||
*
|
*
|
||||||
* Starting at the first device on the global device link list,
|
* Starting at the first device on the global device link list,
|
||||||
* walk the list and call a driver to do device specific setup.
|
* walk the list and call the device's init() method to do deivce
|
||||||
|
* specific setup.
|
||||||
*/
|
*/
|
||||||
void dev_initialize(void)
|
void dev_initialize(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -665,9 +665,6 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn)
|
||||||
* Determine the existence of devices and bridges on a PCI bus. If there are
|
* Determine the existence of devices and bridges on a PCI bus. If there are
|
||||||
* bridges on the bus, recursively scan the buses behind the bridges.
|
* bridges on the bus, recursively scan the buses behind the bridges.
|
||||||
*
|
*
|
||||||
* This function is the default scan_bus() method for the root device
|
|
||||||
* 'dev_root'.
|
|
||||||
*
|
|
||||||
* @param bus pointer to the bus structure
|
* @param bus pointer to the bus structure
|
||||||
* @param min_devfn minimum devfn to look at in the scan usually 0x00
|
* @param min_devfn minimum devfn to look at in the scan usually 0x00
|
||||||
* @param max_devfn maximum devfn to look at in the scan usually 0xff
|
* @param max_devfn maximum devfn to look at in the scan usually 0xff
|
||||||
|
|
|
@ -35,7 +35,8 @@ void root_dev_read_resources(device_t root)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the resources for the root device,
|
* @brief Write the resources for the root device
|
||||||
|
*
|
||||||
* and every device under it which are all of the devices.
|
* and every device under it which are all of the devices.
|
||||||
* @param root Pointer to the device structure for the system root device
|
* @param root Pointer to the device structure for the system root device
|
||||||
*/
|
*/
|
||||||
|
@ -44,10 +45,10 @@ void root_dev_set_resources(device_t root)
|
||||||
struct bus *bus;
|
struct bus *bus;
|
||||||
|
|
||||||
bus = &root->link[0];
|
bus = &root->link[0];
|
||||||
compute_allocate_resource(bus,
|
compute_allocate_resource(bus, &root->resource[0],
|
||||||
&root->resource[0], IORESOURCE_IO, IORESOURCE_IO);
|
IORESOURCE_IO, IORESOURCE_IO);
|
||||||
compute_allocate_resource(bus,
|
compute_allocate_resource(bus, &root->resource[1],
|
||||||
&root->resource[1], IORESOURCE_MEM, IORESOURCE_MEM);
|
IORESOURCE_MEM, IORESOURCE_MEM);
|
||||||
assign_resources(bus);
|
assign_resources(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,26 +57,32 @@ void root_dev_set_resources(device_t root)
|
||||||
*
|
*
|
||||||
* The enumeration of certain buses is purely static. The existence of
|
* The enumeration of certain buses is purely static. The existence of
|
||||||
* devices on those buses can be completely determined at compile time
|
* devices on those buses can be completely determined at compile time
|
||||||
* by the config file. Typical expamles are the 'PNP' devices on a legacy
|
* and is specified in the config file. Typical exapmles are the 'PNP'
|
||||||
* ISA/LPC bus. There is no need of probing of any kind, the only thing
|
* devices on a legacy ISA/LPC bus. There is no need of probing of any
|
||||||
* we have to do is to walk through the bus and enable or disable devices
|
* kind, the only thing we have to do is to walk through the bus and
|
||||||
* as indicated in the config file.
|
* enable or disable devices as indicated in the config file.
|
||||||
*
|
*
|
||||||
* This function is the default scan_bus() method for LPC bridges.
|
* On the other hand, some devices are virtual and their existence is
|
||||||
|
* artificial. They can not be probed at run time. One example is the
|
||||||
|
* debug device. Those virtual devices have to be listed in the config
|
||||||
|
* file under some static bus in order to be enumerated at run time.
|
||||||
*
|
*
|
||||||
* @param root Pointer to the device structure for the system root device
|
* This function is the default scan_bus() method for the root device and
|
||||||
* @param max Maximum bus number allowed in the system.
|
* LPC bridges.
|
||||||
* @return Largest bus number used.
|
*
|
||||||
|
* @param root Pointer to the root device which the static buses are attached
|
||||||
|
* @param max Maximum bus number currently used before scanning.
|
||||||
|
* @return Largest bus number used after scanning.
|
||||||
*/
|
*/
|
||||||
unsigned int scan_static_bus(device_t bus, unsigned int max)
|
unsigned int scan_static_bus(device_t root, unsigned int max)
|
||||||
{
|
{
|
||||||
device_t child;
|
device_t child;
|
||||||
unsigned link;
|
unsigned link;
|
||||||
|
|
||||||
printk_spew("%s for %s\n", __func__, dev_path(bus));
|
printk_spew("%s for %s\n", __func__, dev_path(root));
|
||||||
|
|
||||||
for(link = 0; link < bus->links; link++) {
|
for (link = 0; link < root->links; link++) {
|
||||||
for(child = bus->link[link].children; child; child = child->sibling) {
|
for (child = root->link[link].children; child; child = child->sibling) {
|
||||||
if (child->chip_ops && child->chip_ops->enable_dev) {
|
if (child->chip_ops && child->chip_ops->enable_dev) {
|
||||||
child->chip_ops->enable_dev(child);
|
child->chip_ops->enable_dev(child);
|
||||||
}
|
}
|
||||||
|
@ -87,8 +94,8 @@ unsigned int scan_static_bus(device_t bus, unsigned int max)
|
||||||
child->enabled?"enabled": "disabled");
|
child->enabled?"enabled": "disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(link = 0; link < bus->links; link++) {
|
for (link = 0; link < root->links; link++) {
|
||||||
for(child = bus->link[link].children; child; child = child->sibling) {
|
for (child = root->link[link].children; child; child = child->sibling) {
|
||||||
if (!child->ops || !child->ops->scan_bus)
|
if (!child->ops || !child->ops->scan_bus)
|
||||||
continue;
|
continue;
|
||||||
printk_spew("%s scanning...\n", dev_path(child));
|
printk_spew("%s scanning...\n", dev_path(child));
|
||||||
|
@ -96,7 +103,7 @@ unsigned int scan_static_bus(device_t bus, unsigned int max)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printk_spew("%s done\n", __func__);
|
printk_spew("%s for %s done\n", __func__, dev_path(root));
|
||||||
|
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
@ -106,10 +113,13 @@ unsigned int scan_static_bus(device_t bus, unsigned int max)
|
||||||
*
|
*
|
||||||
* @param dev the device whos children's resources are to be enabled
|
* @param dev the device whos children's resources are to be enabled
|
||||||
*
|
*
|
||||||
* This function is call by the enable_resource() indirectly via the
|
* This function is call by the global enable_resources() indirectly via the
|
||||||
* enable_resources() method of devices.
|
* device_operation::enable_resources() method of devices.
|
||||||
*
|
*
|
||||||
* Indirect mutual recursion:
|
* Indirect mutual recursion:
|
||||||
|
* enable_childrens_resources() -> enable_resources()
|
||||||
|
* enable_resources() -> device_operation::enable_resources()
|
||||||
|
* device_operation::enable_resources() -> enable_children_resources()
|
||||||
*/
|
*/
|
||||||
void enable_childrens_resources(device_t dev)
|
void enable_childrens_resources(device_t dev)
|
||||||
{
|
{
|
||||||
|
@ -131,12 +141,9 @@ void root_dev_enable_resources(device_t dev)
|
||||||
* @brief Scan root bus for generic systems
|
* @brief Scan root bus for generic systems
|
||||||
*
|
*
|
||||||
* @param root The root device structure
|
* @param root The root device structure
|
||||||
* @param max The current bus number scanned so fat, usually 0x00
|
* @param max The current bus number scanned so far, usually 0x00
|
||||||
*
|
*
|
||||||
* This function is the default scan_bus() method of the dynamic root device.
|
* This function is the default scan_bus() method of the root device.
|
||||||
* The bus heirachy is rooted at the host/northbridge. The northbridge of a
|
|
||||||
* generic PCI bus system is at Bus 0, Dev 0, Fun 0 so we scan the whole PCI
|
|
||||||
* buses from there.
|
|
||||||
*/
|
*/
|
||||||
unsigned int root_dev_scan_bus(device_t root, unsigned int max)
|
unsigned int root_dev_scan_bus(device_t root, unsigned int max)
|
||||||
{
|
{
|
||||||
|
@ -150,11 +157,9 @@ void root_dev_init(device_t root)
|
||||||
/**
|
/**
|
||||||
* @brief Default device operation for root device
|
* @brief Default device operation for root device
|
||||||
*
|
*
|
||||||
* This is the default device operation for root devices in PCI based systems.
|
* This is the default device operation for root devices. These operations
|
||||||
* These operations should be fully usable as is. However the
|
* should be fully usable as is. However the chip_operations::enable_dev()
|
||||||
* chip_operations::dev_enable of a motherboard can override this if you
|
* of a motherboard can override this if you want non-default behavior.
|
||||||
* want non-default behavior. Currently src/mainboard/arima/hdama/mainbaord.c
|
|
||||||
* does this for debugging purposes.
|
|
||||||
*/
|
*/
|
||||||
struct device_operations default_dev_ops_root = {
|
struct device_operations default_dev_ops_root = {
|
||||||
.read_resources = root_dev_read_resources,
|
.read_resources = root_dev_read_resources,
|
||||||
|
@ -165,9 +170,9 @@ struct device_operations default_dev_ops_root = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The root of dynamic device tree.
|
* @brief The root of device tree.
|
||||||
*
|
*
|
||||||
* This is the root of the dynamic device tree. A PCI tree always has
|
* This is the root of the device tree. The device tree is defined in the
|
||||||
* one bus, bus 0. Bus 0 contains devices and bridges.
|
* static.c file and is generated by config tool during compile time.
|
||||||
*/
|
*/
|
||||||
extern struct device dev_root;
|
extern struct device dev_root;
|
||||||
|
|
|
@ -57,7 +57,8 @@ struct bus {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct device {
|
struct device {
|
||||||
struct bus * bus; /* bus this device is on */
|
struct bus * bus; /* bus this device is on, for bridge
|
||||||
|
* devices, it is the up stream bus */
|
||||||
device_t sibling; /* next device on this bus */
|
device_t sibling; /* next device on this bus */
|
||||||
device_t next; /* chain of all devices */
|
device_t next; /* chain of all devices */
|
||||||
|
|
||||||
|
@ -79,7 +80,10 @@ struct device {
|
||||||
struct resource resource[MAX_RESOURCES];
|
struct resource resource[MAX_RESOURCES];
|
||||||
unsigned int resources;
|
unsigned int resources;
|
||||||
|
|
||||||
|
/* link are (down sream) buses attached to the device, usually a leaf
|
||||||
|
* device with no child have 0 bus attached and a bridge has 1 bus */
|
||||||
struct bus link[MAX_LINKS];
|
struct bus link[MAX_LINKS];
|
||||||
|
/* number of buses attached to the device */
|
||||||
unsigned int links;
|
unsigned int links;
|
||||||
|
|
||||||
unsigned long rom_address;
|
unsigned long rom_address;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
/* Common pci operations without a standard interface */
|
/* Common pci operations without a standard interface */
|
||||||
struct pci_operations {
|
struct pci_operations {
|
||||||
|
/* set the Subsystem IDs for the PCI device */
|
||||||
void (*set_subsystem)(device_t dev, unsigned vendor, unsigned device);
|
void (*set_subsystem)(device_t dev, unsigned vendor, unsigned device);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue