Matt DeVillier | c12e5ae | 2016-11-27 02:19:02 -0600 | [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. |
| 15 | */ |
| 16 | |
| 17 | #include <types.h> |
| 18 | #include <string.h> |
| 19 | #include <smbios.h> |
| 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> |
| 25 | #include <drivers/intel/gma/int15.h> |
| 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> |
| 31 | #include <southbridge/intel/lynxpoint/pch.h> |
| 32 | #include <vendorcode/google/chromeos/chromeos.h> |
| 33 | #include "ec.h" |
| 34 | #include "onboard.h" |
| 35 | |
| 36 | void mainboard_suspend_resume(void) |
| 37 | { |
| 38 | /* Call SMM finalize() handlers before resume */ |
| 39 | outb(0xcb, 0xb2); |
| 40 | } |
| 41 | |
| 42 | |
| 43 | |
| 44 | static void mainboard_init(device_t dev) |
| 45 | { |
| 46 | mainboard_ec_init(); |
| 47 | } |
| 48 | |
| 49 | static int mainboard_smbios_data(device_t dev, int *handle, |
| 50 | unsigned long *current) |
| 51 | { |
| 52 | int len = 0; |
| 53 | |
| 54 | len += smbios_write_type41( |
| 55 | current, handle, |
| 56 | BOARD_LIGHTSENSOR_NAME, /* name */ |
| 57 | BOARD_LIGHTSENSOR_IRQ, /* instance */ |
| 58 | BOARD_LIGHTSENSOR_I2C_BUS, /* segment */ |
| 59 | BOARD_LIGHTSENSOR_I2C_ADDR, /* bus */ |
| 60 | 0, /* device */ |
| 61 | 0); /* function */ |
| 62 | |
| 63 | len += smbios_write_type41( |
| 64 | current, handle, |
| 65 | BOARD_TRACKPAD_NAME, /* name */ |
| 66 | BOARD_TRACKPAD_IRQ, /* instance */ |
| 67 | BOARD_TRACKPAD_I2C_BUS, /* segment */ |
| 68 | BOARD_TRACKPAD_I2C_ADDR, /* bus */ |
| 69 | 0, /* device */ |
| 70 | 0); /* function */ |
| 71 | |
| 72 | len += smbios_write_type41( |
| 73 | current, handle, |
| 74 | BOARD_TOUCHSCREEN_NAME, /* name */ |
| 75 | BOARD_TOUCHSCREEN_IRQ, /* instance */ |
| 76 | BOARD_TOUCHSCREEN_I2C_BUS, /* segment */ |
| 77 | BOARD_TOUCHSCREEN_I2C_ADDR, /* bus */ |
| 78 | 0, /* device */ |
| 79 | 0); /* function */ |
| 80 | |
| 81 | return len; |
| 82 | } |
| 83 | |
| 84 | // mainboard_enable is executed as first thing after |
| 85 | // enumerate_buses(). |
| 86 | |
| 87 | static void mainboard_enable(device_t dev) |
| 88 | { |
| 89 | dev->ops->init = mainboard_init; |
| 90 | dev->ops->get_smbios_data = mainboard_smbios_data; |
| 91 | dev->ops->acpi_inject_dsdt_generator = chromeos_dsdt_generator; |
| 92 | install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); |
| 93 | } |
| 94 | |
| 95 | struct chip_operations mainboard_ops = { |
| 96 | .enable_dev = mainboard_enable, |
| 97 | }; |