Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2003 Linux Networx |
| 5 | * Copyright (C) 2003 SuSE Linux AG |
| 6 | * Copyright (C) 2004 Tyan Computer |
| 7 | * Written by Yinghai Lu <yhlu@tyan.com> for Tyan Computer. |
| 8 | * Copyright (C) 2006,2007 AMD |
| 9 | * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #include <console/console.h> |
| 23 | #include <device/device.h> |
| 24 | #include <device/pci.h> |
| 25 | #include <device/pnp.h> |
| 26 | #include <device/pci_ids.h> |
| 27 | #include <device/pci_ops.h> |
| 28 | #include <pc80/mc146818rtc.h> |
| 29 | #include <pc80/isa-dma.h> |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 30 | #include <arch/io.h> |
Stefan Reinauer | 0401bd8 | 2010-01-16 18:31:34 +0000 | [diff] [blame] | 31 | #include <arch/ioapic.h> |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 32 | #include <cpu/x86/lapic.h> |
Vladimir Serbinenko | 6985d4e | 2014-09-21 14:31:19 +0200 | [diff] [blame] | 33 | #include <arch/acpi.h> |
Carl-Daniel Hailfinger | 2ee6779 | 2008-10-01 12:52:52 +0000 | [diff] [blame] | 34 | #include <stdlib.h> |
Vladimir Serbinenko | f21271e | 2014-10-16 18:00:27 +0200 | [diff] [blame] | 35 | #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) |
Vladimir Serbinenko | 6985d4e | 2014-09-21 14:31:19 +0200 | [diff] [blame] | 36 | #include <arch/acpigen.h> |
| 37 | #endif |
Vladimir Serbinenko | 4743254 | 2014-10-05 14:54:26 +0200 | [diff] [blame] | 38 | #include <cpu/amd/powernow.h> |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 39 | #include "mcp55.h" |
| 40 | |
| 41 | #define NMI_OFF 0 |
| 42 | |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 43 | // 0x7a or e3 |
| 44 | #define PREVIOUS_POWER_STATE 0x7A |
| 45 | |
| 46 | #define MAINBOARD_POWER_OFF 0 |
| 47 | #define MAINBOARD_POWER_ON 1 |
Yinghai Lu | f327d9f | 2008-02-20 17:41:38 +0000 | [diff] [blame] | 48 | #define SLOW_CPU_OFF 0 |
| 49 | #define SLOW_CPU__ON 1 |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 50 | |
Elyes HAOUAS | 1df39c3 | 2018-05-19 10:55:18 +0200 | [diff] [blame] | 51 | static void lpc_common_init(struct device *dev, int master) |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 52 | { |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 53 | u8 byte; |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 54 | void *ioapic_base; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 55 | |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 56 | /* IOAPIC initialization. */ |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 57 | byte = pci_read_config8(dev, 0x74); |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 58 | byte |= (1 << 0); /* Enable IOAPIC. */ |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 59 | pci_write_config8(dev, 0x74, byte); |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 60 | ioapic_base = (void *)pci_read_config32(dev, PCI_BASE_ADDRESS_1); /* 0x14 */ |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 61 | |
Stefan Reinauer | 0401bd8 | 2010-01-16 18:31:34 +0000 | [diff] [blame] | 62 | if (master) |
| 63 | setup_ioapic(ioapic_base, 0); |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 64 | else |
Stefan Reinauer | 0401bd8 | 2010-01-16 18:31:34 +0000 | [diff] [blame] | 65 | clear_ioapic(ioapic_base); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 66 | } |
| 67 | |
Elyes HAOUAS | 1df39c3 | 2018-05-19 10:55:18 +0200 | [diff] [blame] | 68 | static void lpc_slave_init(struct device *dev) |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 69 | { |
Yinghai Lu | f327d9f | 2008-02-20 17:41:38 +0000 | [diff] [blame] | 70 | lpc_common_init(dev, 0); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 71 | } |
| 72 | |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 73 | static void enable_hpet(struct device *dev) |
| 74 | { |
| 75 | unsigned long hpet_address; |
| 76 | |
Jonathan A. Kollasch | 6f0e8bd | 2015-07-15 13:47:33 -0500 | [diff] [blame] | 77 | pci_write_config32(dev, 0x44, CONFIG_HPET_ADDRESS|1); |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 78 | hpet_address=pci_read_config32(dev, 0x44) & 0xfffffffe; |
Myles Watson | 08e0fb8 | 2010-03-22 16:33:25 +0000 | [diff] [blame] | 79 | printk(BIOS_DEBUG, "enabling HPET @0x%lx\n", hpet_address); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 80 | } |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 81 | |
Elyes HAOUAS | 1df39c3 | 2018-05-19 10:55:18 +0200 | [diff] [blame] | 82 | static void lpc_init(struct device *dev) |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 83 | { |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 84 | u8 byte, byte_old; |
| 85 | int on, nmi_option; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 86 | |
Yinghai Lu | f327d9f | 2008-02-20 17:41:38 +0000 | [diff] [blame] | 87 | lpc_common_init(dev, 1); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 88 | |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 89 | /* power after power fail */ |
| 90 | |
| 91 | #if 1 |
Nico Huber | 9faae2b | 2018-11-14 00:00:35 +0100 | [diff] [blame] | 92 | on = CONFIG_MAINBOARD_POWER_FAILURE_STATE; |
Luc Verhaegen | a9c5ea0 | 2009-06-03 14:19:33 +0000 | [diff] [blame] | 93 | get_option(&on, "power_on_after_fail"); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 94 | byte = pci_read_config8(dev, PREVIOUS_POWER_STATE); |
| 95 | byte &= ~0x40; |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 96 | if (!on) |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 97 | byte |= 0x40; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 98 | pci_write_config8(dev, PREVIOUS_POWER_STATE, byte); |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 99 | printk(BIOS_INFO, "set power %s after power fail\n", on ? "on" : "off"); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 100 | #endif |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 101 | /* Throttle the CPU speed down for testing. */ |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 102 | on = SLOW_CPU_OFF; |
Luc Verhaegen | a9c5ea0 | 2009-06-03 14:19:33 +0000 | [diff] [blame] | 103 | get_option(&on, "slow_cpu"); |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 104 | if (on) { |
| 105 | u16 pm10_bar; |
| 106 | u32 dword; |
| 107 | pm10_bar = (pci_read_config16(dev, 0x60) & 0xff00); |
| 108 | outl(((on << 1) + 0x10), (pm10_bar + 0x10)); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 109 | dword = inl(pm10_bar + 0x10); |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 110 | on = 8 - on; |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 111 | printk(BIOS_DEBUG, "Throttling CPU %2d.%1.1d percent.\n", |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 112 | (on * 12) + (on >> 1), (on & 1) * 5); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 113 | } |
| 114 | |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 115 | /* Enable error reporting. */ |
| 116 | /* Set up sync flood detected. */ |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 117 | byte = pci_read_config8(dev, 0x47); |
| 118 | byte |= (1 << 1); |
| 119 | pci_write_config8(dev, 0x47, byte); |
| 120 | |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 121 | /* Set up NMI on errors. */ |
| 122 | byte = inb(0x70); /* RTC70 */ |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 123 | byte_old = byte; |
| 124 | nmi_option = NMI_OFF; |
Luc Verhaegen | a9c5ea0 | 2009-06-03 14:19:33 +0000 | [diff] [blame] | 125 | get_option(&nmi_option, "nmi"); |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 126 | if (nmi_option) |
| 127 | byte &= ~(1 << 7); /* Set NMI. */ |
| 128 | else |
Elyes HAOUAS | 64e091f | 2018-04-26 22:16:42 +0200 | [diff] [blame] | 129 | byte |= (1 << 7); /* Can't mask NMI from PCI-E and NMI_NOW. */ |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 130 | if (byte != byte_old) |
Ed Swierk | e42e142 | 2009-07-10 15:05:35 +0000 | [diff] [blame] | 131 | outb(byte, 0x70); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 132 | |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 133 | /* Initialize the real time clock. */ |
Gabe Black | b3f08c6 | 2014-04-30 17:12:25 -0700 | [diff] [blame] | 134 | cmos_init(0); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 135 | |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 136 | /* Initialize ISA DMA. */ |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 137 | isa_dma_init(); |
| 138 | |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 139 | /* Initialize the High Precision Event Timers (HPET). */ |
Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 140 | enable_hpet(dev); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 141 | } |
| 142 | |
Elyes HAOUAS | 1df39c3 | 2018-05-19 10:55:18 +0200 | [diff] [blame] | 143 | static void mcp55_lpc_read_resources(struct device *dev) |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 144 | { |
| 145 | struct resource *res; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 146 | |
Myles Watson | 29cc9ed | 2009-07-02 18:56:24 +0000 | [diff] [blame] | 147 | /* Get the normal PCI resources of this device. */ |
| 148 | /* We got one for APIC, or one more for TRAP. */ |
| 149 | pci_dev_read_resources(dev); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 150 | |
Myles Watson | 29cc9ed | 2009-07-02 18:56:24 +0000 | [diff] [blame] | 151 | /* Add an extra subtractive resource for both memory and I/O. */ |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 152 | res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0)); |
Myles Watson | 29cc9ed | 2009-07-02 18:56:24 +0000 | [diff] [blame] | 153 | res->base = 0; |
| 154 | res->size = 0x1000; |
| 155 | res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE | |
| 156 | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 157 | |
| 158 | res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0)); |
Myles Watson | 29cc9ed | 2009-07-02 18:56:24 +0000 | [diff] [blame] | 159 | res->base = 0xff800000; |
| 160 | res->size = 0x00800000; /* 8 MB for flash */ |
| 161 | res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE | |
| 162 | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 163 | |
Myles Watson | 29cc9ed | 2009-07-02 18:56:24 +0000 | [diff] [blame] | 164 | res = new_resource(dev, 3); /* IOAPIC */ |
Uwe Hermann | 74d1a6e | 2010-10-12 17:34:08 +0000 | [diff] [blame] | 165 | res->base = IO_APIC_ADDR; |
Myles Watson | 29cc9ed | 2009-07-02 18:56:24 +0000 | [diff] [blame] | 166 | res->size = 0x00001000; |
| 167 | res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | /** |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 171 | * Enable resources for children devices. |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 172 | * |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 173 | * @param dev The device whose children's resources are to be enabled. |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 174 | */ |
Elyes HAOUAS | 1df39c3 | 2018-05-19 10:55:18 +0200 | [diff] [blame] | 175 | static void mcp55_lpc_enable_childrens_resources(struct device *dev) |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 176 | { |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 177 | u32 reg, reg_var[4]; |
| 178 | int i, var_num = 0; |
Myles Watson | 894a347 | 2010-06-09 22:41:35 +0000 | [diff] [blame] | 179 | struct bus *link; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 180 | |
| 181 | reg = pci_read_config32(dev, 0xa0); |
| 182 | |
Myles Watson | 894a347 | 2010-06-09 22:41:35 +0000 | [diff] [blame] | 183 | for (link = dev->link_list; link; link = link->next) { |
Elyes HAOUAS | 1df39c3 | 2018-05-19 10:55:18 +0200 | [diff] [blame] | 184 | struct device *child; |
Myles Watson | 894a347 | 2010-06-09 22:41:35 +0000 | [diff] [blame] | 185 | for (child = link->children; child; child = child->sibling) { |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 186 | if (child->enabled && (child->path.type == DEVICE_PATH_PNP)) { |
Myles Watson | c25cc11 | 2010-05-21 14:33:48 +0000 | [diff] [blame] | 187 | struct resource *res; |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 188 | for (res = child->resource_list; res; res = res->next) { |
| 189 | unsigned long base, end; /* Don't need long long. */ |
| 190 | if (!(res->flags & IORESOURCE_IO)) |
| 191 | continue; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 192 | base = res->base; |
| 193 | end = resource_end(res); |
Myles Watson | 08e0fb8 | 2010-03-22 16:33:25 +0000 | [diff] [blame] | 194 | printk(BIOS_DEBUG, "mcp55 lpc decode:%s, base=0x%08lx, end=0x%08lx\n",dev_path(child),base, end); |
Elyes HAOUAS | f9de5a4 | 2018-05-03 17:21:02 +0200 | [diff] [blame] | 195 | switch (base) { |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 196 | case 0x3f8: /* COM1 */ |
| 197 | reg |= (1 << 0); |
| 198 | break; |
| 199 | case 0x2f8: /* COM2 */ |
| 200 | reg |= (1 << 1); |
| 201 | break; |
| 202 | case 0x378: /* Parallel 1 */ |
| 203 | reg |= (1 << 24); |
| 204 | break; |
| 205 | case 0x3f0: /* FD0 */ |
| 206 | reg |= (1 << 20); |
| 207 | break; |
| 208 | case 0x220: /* Audio 0 */ |
| 209 | reg |= (1 << 8); |
| 210 | break; |
| 211 | case 0x300: /* Midi 0 */ |
| 212 | reg |= (1 << 12); |
| 213 | break; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 214 | } |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 215 | if ((base == 0x290) |
| 216 | || (base >= 0x400)) { |
| 217 | /* Only 4 var; compact them? */ |
| 218 | if (var_num >= 4) |
| 219 | continue; |
| 220 | reg |= (1 << (28 + var_num)); |
| 221 | reg_var[var_num++] = (base & 0xffff) | ((end & 0xffff) << 16); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 222 | } |
| 223 | } |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | pci_write_config32(dev, 0xa0, reg); |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 228 | for (i = 0; i < var_num; i++) |
| 229 | pci_write_config32(dev, 0xa8 + i * 4, reg_var[i]); |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 230 | } |
| 231 | |
Elyes HAOUAS | 1df39c3 | 2018-05-19 10:55:18 +0200 | [diff] [blame] | 232 | static void mcp55_lpc_enable_resources(struct device *dev) |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 233 | { |
| 234 | pci_dev_enable_resources(dev); |
| 235 | mcp55_lpc_enable_childrens_resources(dev); |
| 236 | } |
| 237 | |
Arthur Heymans | 1eef32d | 2016-12-28 12:35:06 +0100 | [diff] [blame] | 238 | #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) |
Elyes HAOUAS | 1df39c3 | 2018-05-19 10:55:18 +0200 | [diff] [blame] | 239 | static void southbridge_acpi_fill_ssdt_generator(struct device *device) |
Arthur Heymans | 1eef32d | 2016-12-28 12:35:06 +0100 | [diff] [blame] | 240 | { |
| 241 | amd_generate_powernow(0, 0, 0); |
| 242 | } |
| 243 | #endif |
| 244 | |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 245 | static struct device_operations lpc_ops = { |
| 246 | .read_resources = mcp55_lpc_read_resources, |
| 247 | .set_resources = pci_dev_set_resources, |
| 248 | .enable_resources = mcp55_lpc_enable_resources, |
Arthur Heymans | 1eef32d | 2016-12-28 12:35:06 +0100 | [diff] [blame] | 249 | #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) |
| 250 | .acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator, |
| 251 | .write_acpi_tables = acpi_write_hpet, |
| 252 | #endif |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 253 | .init = lpc_init, |
Kyösti Mälkki | d0e212c | 2015-02-26 20:47:47 +0200 | [diff] [blame] | 254 | .scan_bus = scan_lpc_bus, |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 255 | .ops_pci = &mcp55_pci_ops, |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 256 | }; |
Patrick Georgi | efff733 | 2012-07-26 19:48:23 +0200 | [diff] [blame] | 257 | static const unsigned short lpc_ids[] = { |
| 258 | PCI_DEVICE_ID_NVIDIA_MCP55_LPC, |
| 259 | PCI_DEVICE_ID_NVIDIA_MCP55_PRO, |
| 260 | PCI_DEVICE_ID_NVIDIA_MCP55_LPC_2, |
| 261 | PCI_DEVICE_ID_NVIDIA_MCP55_LPC_3, |
| 262 | PCI_DEVICE_ID_NVIDIA_MCP55_LPC_4, |
| 263 | PCI_DEVICE_ID_NVIDIA_MCP55_LPC_5, |
| 264 | PCI_DEVICE_ID_NVIDIA_MCP55_LPC_6, |
| 265 | 0 |
| 266 | }; |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 267 | static const struct pci_driver lpc_driver __pci_driver = { |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 268 | .ops = &lpc_ops, |
| 269 | .vendor = PCI_VENDOR_ID_NVIDIA, |
Patrick Georgi | efff733 | 2012-07-26 19:48:23 +0200 | [diff] [blame] | 270 | .devices = lpc_ids, |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 271 | }; |
| 272 | |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 273 | static struct device_operations lpc_slave_ops = { |
| 274 | .read_resources = mcp55_lpc_read_resources, |
| 275 | .set_resources = pci_dev_set_resources, |
| 276 | .enable_resources = pci_dev_enable_resources, |
Vladimir Serbinenko | 83f81ca | 2014-11-09 13:30:50 +0100 | [diff] [blame] | 277 | #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) |
Vladimir Serbinenko | 6985d4e | 2014-09-21 14:31:19 +0200 | [diff] [blame] | 278 | .write_acpi_tables = acpi_write_hpet, |
| 279 | #endif |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 280 | .init = lpc_slave_init, |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 281 | .ops_pci = &mcp55_pci_ops, |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 282 | }; |
| 283 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 284 | static const struct pci_driver lpc_driver_slave __pci_driver = { |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 285 | .ops = &lpc_slave_ops, |
| 286 | .vendor = PCI_VENDOR_ID_NVIDIA, |
| 287 | .device = PCI_DEVICE_ID_NVIDIA_MCP55_SLAVE, |
| 288 | }; |