2007-04-22 21:08:13 +02:00
|
|
|
/*
|
2008-01-18 11:35:56 +01:00
|
|
|
* This file is part of the coreboot project.
|
2007-04-22 21:08:13 +02:00
|
|
|
*
|
|
|
|
* Copyright (C) 2003-2004 Linux Networx
|
|
|
|
* (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
|
|
|
|
* Copyright (C) 2003 Ronald G. Minnich <rminnich@gmail.com>
|
|
|
|
* Copyright (C) 2004-2005 Li-Ta Lo <ollie@lanl.gov>
|
|
|
|
* Copyright (C) 2005 Tyan
|
|
|
|
* (Written by Yinghai Lu <yhlu@tyan.com> for Tyan)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
Remove address from GPLv2 headers
As per discussion with lawyers[tm], it's not a good idea to
shorten the license header too much - not for legal reasons
but because there are tools that look for them, and giving
them a standard pattern simplifies things.
However, we got confirmation that we don't have to update
every file ever added to coreboot whenever the FSF gets a
new lease, but can drop the address instead.
util/kconfig is excluded because that's imported code that
we may want to synchronize every now and then.
$ find * -type f -exec sed -i "s:Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *MA[, ]*02110-1301[, ]*USA:Foundation, Inc.:" {} +
$ find * -type f -exec sed -i "s:Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA:Foundation, Inc.:" {} +
$ find * -type f -exec sed -i "s:Foundation, Inc., 59 Temple Place[-, ]*Suite 330, Boston, MA *02111-1307[, ]*USA:Foundation, Inc.:" {} +
$ find * -type f -exec sed -i "s:Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.:Foundation, Inc.:" {} +
$ find * -type f
-a \! -name \*.patch \
-a \! -name \*_shipped \
-a \! -name LICENSE_GPL \
-a \! -name LGPL.txt \
-a \! -name COPYING \
-a \! -name DISCLAIMER \
-exec sed -i "/Foundation, Inc./ N;s:Foundation, Inc.* USA\.* *:Foundation, Inc. :;s:Foundation, Inc. $:Foundation, Inc.:" {} +
Change-Id: Icc968a5a5f3a5df8d32b940f9cdb35350654bef9
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/9233
Tested-by: build bot (Jenkins)
Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
2015-03-26 15:17:45 +01:00
|
|
|
* Foundation, Inc.
|
2007-04-22 21:08:13 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-02 05:36:25 +02:00
|
|
|
#include <console/console.h>
|
|
|
|
#include <device/device.h>
|
|
|
|
#include <device/pci.h>
|
2010-02-22 07:09:43 +01:00
|
|
|
#include <reset.h>
|
2003-09-02 05:36:25 +02:00
|
|
|
|
2012-10-09 21:28:56 +02:00
|
|
|
const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_NUMBER;
|
|
|
|
|
2003-09-02 05:36:25 +02:00
|
|
|
/**
|
2010-10-17 21:01:48 +02:00
|
|
|
* Scan devices on static buses.
|
2004-05-07 23:52:47 +02:00
|
|
|
*
|
2004-05-10 18:05:16 +02:00
|
|
|
* The enumeration of certain buses is purely static. The existence of
|
|
|
|
* devices on those buses can be completely determined at compile time
|
2010-04-27 08:56:47 +02:00
|
|
|
* and is specified in the config file. Typical examples are the 'PNP'
|
|
|
|
* devices on a legacy ISA/LPC bus. There is no need of probing of any kind,
|
|
|
|
* the only thing we have to do is to walk through the bus and
|
2004-11-25 18:37:19 +01:00
|
|
|
* enable or disable devices as indicated in the config file.
|
2004-05-07 23:52:47 +02:00
|
|
|
*
|
2004-11-25 18:37:19 +01:00
|
|
|
* 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.
|
2004-05-07 23:52:47 +02:00
|
|
|
*
|
2010-10-17 21:01:48 +02:00
|
|
|
* @param bus Pointer to the device to which the static buses are attached to.
|
|
|
|
* @param max Maximum bus number currently used before scanning.
|
2010-10-18 02:00:57 +02:00
|
|
|
* @return The largest bus number used.
|
2003-09-02 05:36:25 +02:00
|
|
|
*/
|
2015-02-26 19:47:47 +01:00
|
|
|
|
2015-02-25 06:38:01 +01:00
|
|
|
static unsigned int scan_static_bus(device_t bus, unsigned int passthru)
|
2003-09-02 05:36:25 +02:00
|
|
|
{
|
|
|
|
device_t child;
|
2010-10-18 02:00:57 +02:00
|
|
|
struct bus *link;
|
2004-03-23 22:28:05 +01:00
|
|
|
|
2010-10-18 02:00:57 +02:00
|
|
|
for (link = bus->link_list; link; link = link->next) {
|
|
|
|
for (child = link->children; child; child = child->sibling) {
|
2015-02-26 19:47:47 +01:00
|
|
|
|
2010-10-18 02:00:57 +02:00
|
|
|
if (child->chip_ops && child->chip_ops->enable_dev)
|
2004-10-16 08:20:29 +02:00
|
|
|
child->chip_ops->enable_dev(child);
|
2010-10-18 02:00:57 +02:00
|
|
|
|
|
|
|
if (child->ops && child->ops->enable)
|
2003-09-02 05:36:25 +02:00
|
|
|
child->ops->enable(child);
|
2010-10-18 02:00:57 +02:00
|
|
|
|
|
|
|
printk(BIOS_DEBUG, "%s %s\n", dev_path(child),
|
|
|
|
child->enabled ? "enabled" : "disabled");
|
2003-09-02 05:36:25 +02:00
|
|
|
}
|
|
|
|
}
|
2010-10-18 02:00:57 +02:00
|
|
|
|
2015-02-25 06:38:01 +01:00
|
|
|
return passthru;
|
2015-02-26 19:47:47 +01:00
|
|
|
}
|
|
|
|
|
2015-02-25 06:38:01 +01:00
|
|
|
unsigned int scan_lpc_bus(device_t bus, unsigned int passthru)
|
2015-02-26 19:47:47 +01:00
|
|
|
{
|
|
|
|
printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus));
|
|
|
|
|
2015-02-25 06:38:01 +01:00
|
|
|
scan_static_bus(bus, 0);
|
2015-02-26 19:47:47 +01:00
|
|
|
|
|
|
|
printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
|
|
|
|
|
2015-02-25 06:38:01 +01:00
|
|
|
return passthru;
|
2015-02-26 19:47:47 +01:00
|
|
|
}
|
|
|
|
|
2015-02-25 06:38:01 +01:00
|
|
|
unsigned int scan_smbus(device_t bus, unsigned int passthru)
|
2015-02-26 19:47:47 +01:00
|
|
|
{
|
|
|
|
device_t child;
|
|
|
|
struct bus *link;
|
|
|
|
static int smbus_max = 0;
|
|
|
|
|
|
|
|
printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus));
|
|
|
|
|
2010-10-18 02:00:57 +02:00
|
|
|
for (link = bus->link_list; link; link = link->next) {
|
2015-02-26 19:47:47 +01:00
|
|
|
|
|
|
|
link->secondary = ++smbus_max;
|
|
|
|
|
2010-10-18 02:00:57 +02:00
|
|
|
for (child = link->children; child; child = child->sibling) {
|
2015-02-26 19:47:47 +01:00
|
|
|
|
|
|
|
if (child->chip_ops && child->chip_ops->enable_dev)
|
|
|
|
child->chip_ops->enable_dev(child);
|
|
|
|
|
|
|
|
if (child->ops && child->ops->enable)
|
|
|
|
child->ops->enable(child);
|
|
|
|
|
|
|
|
printk(BIOS_DEBUG, "smbus: %s[%d]->", dev_path(child->bus->dev),
|
|
|
|
child->bus->link_num);
|
|
|
|
|
|
|
|
printk(BIOS_DEBUG, "%s %s\n", dev_path(child),
|
|
|
|
child->enabled ? "enabled" : "disabled");
|
2003-09-02 05:36:25 +02:00
|
|
|
}
|
|
|
|
}
|
2004-05-07 23:52:47 +02:00
|
|
|
|
2010-03-22 12:42:32 +01:00
|
|
|
printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
|
2004-05-07 23:52:47 +02:00
|
|
|
|
2015-02-25 06:38:01 +01:00
|
|
|
return passthru;
|
2003-09-02 05:36:25 +02:00
|
|
|
}
|
|
|
|
|
2004-05-05 23:15:42 +02:00
|
|
|
/**
|
2010-10-17 21:01:48 +02:00
|
|
|
* Scan root bus for generic systems.
|
2004-05-05 23:15:42 +02:00
|
|
|
*
|
2004-11-25 18:37:19 +01:00
|
|
|
* This function is the default scan_bus() method of the root device.
|
2010-10-17 21:01:48 +02:00
|
|
|
*
|
|
|
|
* @param root The root device structure.
|
|
|
|
* @param max The current bus number scanned so far, usually 0x00.
|
2010-10-18 02:00:57 +02:00
|
|
|
* @return The largest bus number used.
|
2004-05-05 23:15:42 +02:00
|
|
|
*/
|
2015-02-25 06:38:01 +01:00
|
|
|
static unsigned int root_dev_scan_bus(device_t bus, unsigned int passthru)
|
2004-10-14 23:25:53 +02:00
|
|
|
{
|
2015-02-26 19:47:47 +01:00
|
|
|
struct bus *link;
|
|
|
|
|
|
|
|
printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus));
|
|
|
|
|
2015-02-25 06:38:01 +01:00
|
|
|
scan_static_bus(bus, 0);
|
2015-02-26 19:47:47 +01:00
|
|
|
|
2015-02-20 20:28:31 +01:00
|
|
|
for (link = bus->link_list; link; link = link->next)
|
|
|
|
scan_bridges(link);
|
2015-02-26 19:47:47 +01:00
|
|
|
|
|
|
|
printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
|
|
|
|
|
2015-02-25 06:38:01 +01:00
|
|
|
return passthru;
|
2004-10-14 23:25:53 +02:00
|
|
|
}
|
|
|
|
|
2010-06-17 18:16:56 +02:00
|
|
|
static void root_dev_reset(struct bus *bus)
|
2005-07-08 04:49:49 +02:00
|
|
|
{
|
2010-10-18 02:00:57 +02:00
|
|
|
printk(BIOS_INFO, "Resetting board...\n");
|
2005-07-08 04:49:49 +02:00
|
|
|
hard_reset();
|
|
|
|
}
|
|
|
|
|
2004-05-05 23:15:42 +02:00
|
|
|
/**
|
2010-10-17 21:01:48 +02:00
|
|
|
* Default device operation for root device.
|
2004-05-05 23:15:42 +02:00
|
|
|
*
|
2004-11-25 18:37:19 +01:00
|
|
|
* This is the default device operation for root devices. These operations
|
2010-10-17 21:01:48 +02:00
|
|
|
* should be fully usable as is. However the chip_operations::enable_dev()
|
2004-11-25 18:37:19 +01:00
|
|
|
* of a motherboard can override this if you want non-default behavior.
|
2004-05-05 23:15:42 +02:00
|
|
|
*/
|
2003-09-02 05:36:25 +02:00
|
|
|
struct device_operations default_dev_ops_root = {
|
2015-02-06 08:15:52 +01:00
|
|
|
.read_resources = DEVICE_NOOP,
|
|
|
|
.set_resources = DEVICE_NOOP,
|
|
|
|
.enable_resources = DEVICE_NOOP,
|
|
|
|
.init = DEVICE_NOOP,
|
2004-10-14 23:25:53 +02:00
|
|
|
.scan_bus = root_dev_scan_bus,
|
2005-07-08 04:49:49 +02:00
|
|
|
.reset_bus = root_dev_reset,
|
2003-09-02 05:36:25 +02:00
|
|
|
};
|