Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
Stefan Reinauer | fe8290d | 2013-04-23 15:00:02 -0700 | [diff] [blame] | 5 | * Copyright (C) 2011 Google Inc. |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 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. |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <types.h> |
| 18 | #include <string.h> |
| 19 | #include <device/device.h> |
| 20 | #include <device/pci_def.h> |
| 21 | #include <device/pci_ops.h> |
| 22 | #include <console/console.h> |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 23 | #include <drivers/intel/gma/int15.h> |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 24 | #include <pc80/mc146818rtc.h> |
| 25 | #include <arch/acpi.h> |
| 26 | #include <arch/io.h> |
| 27 | #include <arch/interrupt.h> |
Stefan Reinauer | 3e4e303 | 2013-03-20 14:08:04 -0700 | [diff] [blame] | 28 | #include <boot/coreboot_tables.h> |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 29 | #include "onboard.h" |
| 30 | #include "ec.h" |
| 31 | #include <southbridge/intel/bd82x6x/pch.h> |
| 32 | #include <smbios.h> |
| 33 | #include <device/pci.h> |
| 34 | #include <ec/compal/ene932/ec.h> |
| 35 | |
| 36 | void mainboard_suspend_resume(void) |
| 37 | { |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 38 | /* Enable ACPI mode before OS resume */ |
| 39 | outb(0xe1, 0xb2); |
| 40 | } |
| 41 | |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 42 | |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 43 | static void mainboard_init(device_t dev) |
| 44 | { |
| 45 | /* Initialize the Embedded Controller */ |
| 46 | parrot_ec_init(); |
| 47 | } |
| 48 | |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 49 | static int parrot_onboard_smbios_data(device_t dev, int *handle, |
| 50 | unsigned long *current) |
| 51 | { |
| 52 | int len = 0; |
| 53 | u8 hardware_version = parrot_rev(); |
| 54 | if (hardware_version < 0x2) { /* DVT vs PVT */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 55 | len += smbios_write_type41( |
| 56 | current, handle, |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 57 | BOARD_TRACKPAD_NAME, /* name */ |
| 58 | BOARD_TRACKPAD_IRQ_DVT, /* instance */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 59 | 0, /* segment */ |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 60 | BOARD_TRACKPAD_I2C_ADDR, /* bus */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 61 | 0, /* device */ |
| 62 | 0); /* function */ |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 63 | } else { |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 64 | len += smbios_write_type41( |
| 65 | current, handle, |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 66 | BOARD_TRACKPAD_NAME, /* name */ |
| 67 | BOARD_TRACKPAD_IRQ_PVT, /* instance */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 68 | 0, /* segment */ |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 69 | BOARD_TRACKPAD_I2C_ADDR, /* bus */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 70 | 0, /* device */ |
| 71 | 0); /* function */ |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 72 | } |
| 73 | |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 74 | return len; |
| 75 | } |
| 76 | |
| 77 | // mainboard_enable is executed as first thing after |
| 78 | // enumerate_buses(). |
| 79 | |
| 80 | static void mainboard_enable(device_t dev) |
| 81 | { |
| 82 | dev->ops->init = mainboard_init; |
| 83 | dev->ops->get_smbios_data = parrot_onboard_smbios_data; |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 84 | install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | struct chip_operations mainboard_ops = { |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 88 | .enable_dev = mainboard_enable, |
| 89 | }; |