2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2011 Sven Schnelle <svens@stackframe.org>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; version 2 of
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
23 #include <console/console.h>
24 #include <device/device.h>
26 #include <boot/tables.h>
28 #include <arch/coreboot_tables.h>
30 #include <device/pci_def.h>
31 #include <device/pci_ops.h>
33 #include <ec/lenovo/pmh7/pmh7.h>
34 #include <ec/acpi/ec.h>
35 #include <ec/lenovo/h8/h8.h>
36 #include <northbridge/intel/i945/i945.h>
37 #include <pc80/mc146818rtc.h>
38 #include <arch/x86/include/arch/acpigen.h>
40 static struct cst_entry cst_entries[] = {
41 { 0x7f, 1, 2, 0, 1, 1, 1, 1000 },
42 { 0x01, 8, 0, 0, DEFAULT_PMBASE + LV2, 2, 1, 500 },
43 { 0x01, 8, 0, 0, DEFAULT_PMBASE + LV3, 2, 17, 250 },
46 int get_cst_entries(struct cst_entry **entries)
48 *entries = cst_entries;
49 return ARRAY_SIZE(cst_entries);
52 static void mainboard_enable(device_t dev)
54 struct southbridge_intel_i82801gx_config *config;
55 device_t dev0, idedev;
56 u8 defaults_loaded = 0;
58 /* If we're resuming from suspend, blink suspend LED */
59 dev0 = dev_find_slot(0, PCI_DEVFN(0,0));
60 if (dev0 && pci_read_config32(dev0, SKPAD) == SKPAD_ACPI_S3_MAGIC)
63 idedev = dev_find_slot(0, PCI_DEVFN(0x1f,1));
65 if (!(inb(DEFAULT_GPIOBASE + 0x0c) & 0x40)) {
66 /* legacy I/O connected */
67 pmh7_ultrabay_power_enable(1);
69 } else if (idedev && idedev->chip_info &&
70 h8_ultrabay_device_present()) {
71 config = idedev->chip_info;
72 config->ide_enable_primary = 1;
73 pmh7_ultrabay_power_enable(1);
76 pmh7_ultrabay_power_enable(0);
80 /* set dock status led */
82 ec_write(0x0c, inb(0x164c) & 8 ? 0x89 : 0x09);
84 if (get_option(&defaults_loaded, "cmos_defaults_loaded") < 0) {
85 printk(BIOS_INFO, "failed to get cmos_defaults_loaded");
89 if (!defaults_loaded) {
90 printk(BIOS_INFO, "Restoring CMOS defaults\n");
91 set_option("tft_brightness", &(u8[]){ 0xff });
92 set_option("volume", &(u8[]){ 0x03 });
93 set_option("cmos_defaults_loaded", &(u8[]){ 0x01 });
97 struct chip_operations mainboard_ops = {
98 CHIP_NAME(CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_NUMBER)
99 .enable_dev = mainboard_enable,