2 * This file is part of the coreboot project.
4 * Copyright (C) 2003-2004 Linux Networx
5 * (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
6 * Copyright (C) 2003 Ronald G. Minnich <rminnich@gmail.com>
7 * Copyright (C) 2004-2005 Li-Ta Lo <ollie@lanl.gov>
8 * Copyright (C) 2005 Tyan
9 * (Written by Yinghai Lu <yhlu@tyan.com> for Tyan)
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #include <console/console.h>
22 #include <device/device.h>
23 #include <device/pci.h>
26 const char mainboard_name
[] = CONFIG_MAINBOARD_VENDOR
" " CONFIG_MAINBOARD_PART_NUMBER
;
29 * Scan devices on static buses.
31 * The enumeration of certain buses is purely static. The existence of
32 * devices on those buses can be completely determined at compile time
33 * and is specified in the config file. Typical examples are the 'PNP'
34 * devices on a legacy ISA/LPC bus. There is no need of probing of any kind,
35 * the only thing we have to do is to walk through the bus and
36 * enable or disable devices as indicated in the config file.
38 * On the other hand, some devices are virtual and their existence is
39 * artificial. They can not be probed at run time. One example is the
40 * debug device. Those virtual devices have to be listed in the config
41 * file under some static bus in order to be enumerated at run time.
43 * @param bus Pointer to the device to which the static buses are attached to.
46 static void scan_static_bus(device_t bus
)
51 for (link
= bus
->link_list
; link
; link
= link
->next
) {
52 for (child
= link
->children
; child
; child
= child
->sibling
) {
54 if (child
->chip_ops
&& child
->chip_ops
->enable_dev
)
55 child
->chip_ops
->enable_dev(child
);
57 if (child
->ops
&& child
->ops
->enable
)
58 child
->ops
->enable(child
);
60 printk(BIOS_DEBUG
, "%s %s\n", dev_path(child
),
61 child
->enabled
? "enabled" : "disabled");
66 void scan_lpc_bus(device_t bus
)
68 printk(BIOS_SPEW
, "%s for %s\n", __func__
, dev_path(bus
));
72 printk(BIOS_SPEW
, "%s for %s done\n", __func__
, dev_path(bus
));
75 void scan_smbus(device_t bus
)
79 static int smbus_max
= 0;
81 printk(BIOS_SPEW
, "%s for %s\n", __func__
, dev_path(bus
));
83 for (link
= bus
->link_list
; link
; link
= link
->next
) {
85 link
->secondary
= ++smbus_max
;
87 for (child
= link
->children
; child
; child
= child
->sibling
) {
89 if (child
->chip_ops
&& child
->chip_ops
->enable_dev
)
90 child
->chip_ops
->enable_dev(child
);
92 if (child
->ops
&& child
->ops
->enable
)
93 child
->ops
->enable(child
);
95 printk(BIOS_DEBUG
, "smbus: %s[%d]->", dev_path(child
->bus
->dev
),
96 child
->bus
->link_num
);
98 printk(BIOS_DEBUG
, "%s %s\n", dev_path(child
),
99 child
->enabled
? "enabled" : "disabled");
103 printk(BIOS_SPEW
, "%s for %s done\n", __func__
, dev_path(bus
));
107 * Scan root bus for generic systems.
109 * This function is the default scan_bus() method of the root device.
111 * @param root The root device structure.
113 static void root_dev_scan_bus(device_t bus
)
117 printk(BIOS_SPEW
, "%s for %s\n", __func__
, dev_path(bus
));
119 scan_static_bus(bus
);
121 for (link
= bus
->link_list
; link
; link
= link
->next
)
124 printk(BIOS_SPEW
, "%s for %s done\n", __func__
, dev_path(bus
));
127 static void root_dev_reset(struct bus
*bus
)
129 printk(BIOS_INFO
, "Resetting board...\n");
134 * Default device operation for root device.
136 * This is the default device operation for root devices. These operations
137 * should be fully usable as is. However the chip_operations::enable_dev()
138 * of a motherboard can override this if you want non-default behavior.
140 struct device_operations default_dev_ops_root
= {
141 .read_resources
= DEVICE_NOOP
,
142 .set_resources
= DEVICE_NOOP
,
143 .enable_resources
= DEVICE_NOOP
,
145 .scan_bus
= root_dev_scan_bus
,
146 .reset_bus
= root_dev_reset
,