mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
rename walk_static_devices
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1552 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
75337f7500
commit
9f0d0f9669
4 changed files with 26 additions and 24 deletions
|
@ -37,8 +37,8 @@ static struct device **last_dev_p = &dev_root.next;
|
||||||
/**
|
/**
|
||||||
* @brief Allocate a new device structure.
|
* @brief Allocate a new device structure.
|
||||||
*
|
*
|
||||||
* Allocte a new device structure and attached it to the device tree as a child
|
* Allocte a new device structure and attached it to the device tree as a
|
||||||
* of the parent bus.
|
* child of the parent bus.
|
||||||
*
|
*
|
||||||
* @param parent parent bus the newly created device attached to.
|
* @param parent parent bus the newly created device attached to.
|
||||||
* @param path path to the device to be created.
|
* @param path path to the device to be created.
|
||||||
|
@ -76,7 +76,7 @@ device_t alloc_dev(struct bus *parent, struct device_path *path)
|
||||||
dev->link[link].link = link;
|
dev->link[link].link = link;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the new device to the children of the bus. */
|
/* Add the new device as a children of the bus. */
|
||||||
dev->bus = parent;
|
dev->bus = parent;
|
||||||
if (child) {
|
if (child) {
|
||||||
child->sibling = dev;
|
child->sibling = dev;
|
||||||
|
@ -452,8 +452,10 @@ 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 the method to call it's children's enable_resoruces() via
|
* method and let that method to call it's children's enable_resoruces() via
|
||||||
* enable_childrens_resources().
|
* enable_childrens_resources().
|
||||||
|
*
|
||||||
|
* Indirect mutual recursion:
|
||||||
*/
|
*/
|
||||||
void enable_resources(struct device *dev)
|
void enable_resources(struct device *dev)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/pnp.h>
|
#include <device/pnp.h>
|
||||||
|
|
||||||
|
|
||||||
/* PNP fundamental operations */
|
/* PNP fundamental operations */
|
||||||
|
|
||||||
void pnp_write_config(device_t dev, uint8_t reg, uint8_t value)
|
void pnp_write_config(device_t dev, uint8_t reg, uint8_t value)
|
||||||
|
@ -53,7 +52,6 @@ void pnp_set_irq(device_t dev, unsigned index, unsigned irq)
|
||||||
pnp_write_config(dev, index, irq);
|
pnp_write_config(dev, index, irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pnp_set_drq(device_t dev, unsigned drq, unsigned index)
|
void pnp_set_drq(device_t dev, unsigned drq, unsigned index)
|
||||||
{
|
{
|
||||||
/* Index == 0x74 */
|
/* Index == 0x74 */
|
||||||
|
@ -76,7 +74,6 @@ static void pnp_set_resource(device_t dev, struct resource *resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now store the resource */
|
/* Now store the resource */
|
||||||
resource->flags |= IORESOURCE_STORED;
|
|
||||||
if (resource->flags & IORESOURCE_IO) {
|
if (resource->flags & IORESOURCE_IO) {
|
||||||
pnp_set_iobase(dev, resource->index, resource->base);
|
pnp_set_iobase(dev, resource->index, resource->base);
|
||||||
} else if (resource->flags & IORESOURCE_DRQ) {
|
} else if (resource->flags & IORESOURCE_DRQ) {
|
||||||
|
@ -84,12 +81,11 @@ static void pnp_set_resource(device_t dev, struct resource *resource)
|
||||||
} else if (resource->flags & IORESOURCE_IRQ) {
|
} else if (resource->flags & IORESOURCE_IRQ) {
|
||||||
pnp_set_irq(dev, resource->index, resource->base);
|
pnp_set_irq(dev, resource->index, resource->base);
|
||||||
} else {
|
} else {
|
||||||
/* Don't let me think I stored the resource */
|
|
||||||
resource->flags &= ~IORESOURCE_STORED;
|
|
||||||
printk_err("ERROR: %s %02x unknown resource type\n",
|
printk_err("ERROR: %s %02x unknown resource type\n",
|
||||||
dev_path(dev), resource->index);
|
dev_path(dev), resource->index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
resource->flags |= IORESOURCE_STORED;
|
||||||
|
|
||||||
printk_debug("%s %02x <- [0x%08lx - 0x%08lx] %s\n", dev_path(dev),
|
printk_debug("%s %02x <- [0x%08lx - 0x%08lx] %s\n", dev_path(dev),
|
||||||
resource->index, resource->base,
|
resource->index, resource->base,
|
||||||
|
|
|
@ -11,7 +11,7 @@ void root_dev_read_resources(device_t root)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
printk_spew("%s . Root is %p\n", __FUNCTION__, root);
|
printk_spew("%s . Root is %p\n", __FUNCTION__, dev_path(root));
|
||||||
/* Initialize the system wide io space constraints */
|
/* Initialize the system wide io space constraints */
|
||||||
root->resource[res].base = 0x400;
|
root->resource[res].base = 0x400;
|
||||||
root->resource[res].size = 0;
|
root->resource[res].size = 0;
|
||||||
|
@ -63,11 +63,12 @@ void root_dev_set_resources(device_t root)
|
||||||
/**
|
/**
|
||||||
* @brief Scan devices on static buses.
|
* @brief Scan devices on static buses.
|
||||||
*
|
*
|
||||||
* The existence of devices on certain buses can be completely determined at
|
* The enumeration of certain buses is purely static. The existence of
|
||||||
* compile time by the config file. Typical expamles are the 'PNP' devices
|
* devices on those buses can be completely determined at compile time
|
||||||
* on an legacy ISA/LPC bus. There is no need of probing of any kind, the
|
* by the config file. Typical expamles are the 'PNP' devices on a legacy
|
||||||
* only thing we have to do is to walk through the bus and enable or disable
|
* ISA/LPC bus. There is no need of probing of any kind, the only thing
|
||||||
* devices as indicated in the config file.
|
* we have to do is to walk through the bus and enable or disable devices
|
||||||
|
* as indicated in the config file.
|
||||||
*
|
*
|
||||||
* This function is the default scan_bus() method for LPC bridges.
|
* This function is the default scan_bus() method for LPC bridges.
|
||||||
*
|
*
|
||||||
|
@ -80,7 +81,7 @@ unsigned int scan_static_bus(device_t bus, unsigned int max)
|
||||||
device_t child;
|
device_t child;
|
||||||
unsigned link;
|
unsigned link;
|
||||||
|
|
||||||
printk_debug("%s entered\n", __FUNCTION__);
|
printk_debug("%s for %s\n", __FUNCTION__, dev_path(bus));
|
||||||
|
|
||||||
for (link = 0; link < bus->links; link++) {
|
for (link = 0; link < bus->links; link++) {
|
||||||
for (child = bus->link[link].children; child; child = child->sibling) {
|
for (child = bus->link[link].children; child; child = child->sibling) {
|
||||||
|
@ -110,7 +111,10 @@ 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()
|
* This function is call by the enable_resource() indirectly via the
|
||||||
|
* enable_resources() method of devices.
|
||||||
|
*
|
||||||
|
* Indirect mutual recursion:
|
||||||
*/
|
*/
|
||||||
void enable_childrens_resources(device_t dev)
|
void enable_childrens_resources(device_t dev)
|
||||||
{
|
{
|
||||||
|
@ -144,10 +148,10 @@ unsigned int root_dev_scan_pci_bus(device_t root, unsigned int max)
|
||||||
*
|
*
|
||||||
* This is the default device operation for root devices in PCI based systems.
|
* This is the default device operation for root devices in PCI based systems.
|
||||||
* The static enumeration code chip_control::enumerate() of mainboards usually
|
* The static enumeration code chip_control::enumerate() of mainboards usually
|
||||||
* override this operation with their own device operations. An notable example
|
* override this operation with their own device operations. An notable
|
||||||
* is mainboard operations for AMD K8 mainboards. They replace the scan_bus()
|
* example is mainboard operations for AMD K8 mainboards. They replace the
|
||||||
* method with amdk8_scan_root_bus() due to the special device layout of AMD K8
|
* scan_bus() method with amdk8_scan_root_bus() due to the special device
|
||||||
* systems.
|
* layout of AMD K8 systems.
|
||||||
*/
|
*/
|
||||||
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,
|
||||||
|
|
|
@ -84,7 +84,7 @@ static void setup_ioapic(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printk_spew("for IRQ, reg 0x%08x value 0x%08x 0x%08x\n",
|
printk_spew("for IRQ, reg 0x%08x value 0x%08x 0x%08x\n",
|
||||||
a->reg, a->value_low, a->value_high);
|
a->reg, a->value_low, a->value_high);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ static void lpc_init(struct device *dev)
|
||||||
pci_write_config8(dev, 0x40, byte);
|
pci_write_config8(dev, 0x40, byte);
|
||||||
nmi_option = NMI_OFF;
|
nmi_option = NMI_OFF;
|
||||||
get_option(&nmi_option, "nmi");
|
get_option(&nmi_option, "nmi");
|
||||||
if(nmi_option) {
|
if (nmi_option) {
|
||||||
byte |= (1 << 7); /* set NMI */
|
byte |= (1 << 7); /* set NMI */
|
||||||
pci_write_config8(dev, 0x40, byte);
|
pci_write_config8(dev, 0x40, byte);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ static struct device_operations lpc_ops = {
|
||||||
.set_resources = pci_dev_set_resources,
|
.set_resources = pci_dev_set_resources,
|
||||||
.enable_resources = pci_dev_enable_resources,
|
.enable_resources = pci_dev_enable_resources,
|
||||||
.init = lpc_init,
|
.init = lpc_init,
|
||||||
.scan_bus = walk_static_devices,
|
.scan_bus = scan_static_bus,
|
||||||
.enable = amd8111_enable,
|
.enable = amd8111_enable,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue