Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
| 5 | * Copyright (C) 2012 Google Inc. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <types.h> |
| 18 | #include <string.h> |
Duncan Laurie | 22419e0 | 2013-05-24 12:37:02 -0700 | [diff] [blame] | 19 | #include <smbios.h> |
Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 20 | #include <device/device.h> |
| 21 | #include <device/device.h> |
| 22 | #include <device/pci_def.h> |
| 23 | #include <device/pci_ops.h> |
| 24 | #include <console/console.h> |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 25 | #include <drivers/intel/gma/int15.h> |
Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 26 | #include <pc80/mc146818rtc.h> |
| 27 | #include <arch/acpi.h> |
| 28 | #include <arch/io.h> |
| 29 | #include <arch/interrupt.h> |
| 30 | #include <boot/coreboot_tables.h> |
Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 31 | #include <southbridge/intel/lynxpoint/pch.h> |
| 32 | #include "ec.h" |
Duncan Laurie | 22419e0 | 2013-05-24 12:37:02 -0700 | [diff] [blame] | 33 | #include "onboard.h" |
Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 34 | |
| 35 | void mainboard_suspend_resume(void) |
| 36 | { |
| 37 | /* Call SMM finalize() handlers before resume */ |
| 38 | outb(0xcb, 0xb2); |
| 39 | } |
| 40 | |
Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 41 | |
Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 42 | |
| 43 | static void mainboard_init(device_t dev) |
| 44 | { |
| 45 | mainboard_ec_init(); |
| 46 | } |
| 47 | |
Duncan Laurie | 22419e0 | 2013-05-24 12:37:02 -0700 | [diff] [blame] | 48 | static int mainboard_smbios_data(device_t dev, int *handle, |
| 49 | unsigned long *current) |
| 50 | { |
| 51 | int len = 0; |
| 52 | |
| 53 | len += smbios_write_type41( |
| 54 | current, handle, |
| 55 | BOARD_LIGHTSENSOR_NAME, /* name */ |
| 56 | BOARD_LIGHTSENSOR_IRQ, /* instance */ |
| 57 | BOARD_LIGHTSENSOR_I2C_BUS, /* segment */ |
| 58 | BOARD_LIGHTSENSOR_I2C_ADDR, /* bus */ |
| 59 | 0, /* device */ |
| 60 | 0); /* function */ |
| 61 | |
| 62 | len += smbios_write_type41( |
| 63 | current, handle, |
| 64 | BOARD_TRACKPAD_NAME, /* name */ |
| 65 | BOARD_TRACKPAD_IRQ, /* instance */ |
| 66 | BOARD_TRACKPAD_I2C_BUS, /* segment */ |
| 67 | BOARD_TRACKPAD_I2C_ADDR, /* bus */ |
| 68 | 0, /* device */ |
| 69 | 0); /* function */ |
| 70 | |
| 71 | len += smbios_write_type41( |
| 72 | current, handle, |
| 73 | BOARD_TOUCHSCREEN_NAME, /* name */ |
| 74 | BOARD_TOUCHSCREEN_IRQ, /* instance */ |
| 75 | BOARD_TOUCHSCREEN_I2C_BUS, /* segment */ |
| 76 | BOARD_TOUCHSCREEN_I2C_ADDR, /* bus */ |
| 77 | 0, /* device */ |
| 78 | 0); /* function */ |
| 79 | |
| 80 | return len; |
| 81 | } |
| 82 | |
Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 83 | // mainboard_enable is executed as first thing after |
| 84 | // enumerate_buses(). |
| 85 | |
| 86 | static void mainboard_enable(device_t dev) |
| 87 | { |
| 88 | dev->ops->init = mainboard_init; |
Duncan Laurie | 22419e0 | 2013-05-24 12:37:02 -0700 | [diff] [blame] | 89 | dev->ops->get_smbios_data = mainboard_smbios_data; |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 90 | install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); |
Duncan Laurie | 5290f71 | 2013-05-22 16:31:09 -0700 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | struct chip_operations mainboard_ops = { |
| 94 | .enable_dev = mainboard_enable, |
| 95 | }; |