1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/pci.h>
4 #include <device/pci_ids.h>
5 #include <device/pci_ops.h>
6 #include <pc80/mc146818rtc.h>
9 #define PREVIOUS_POWER_STATE 0x43
10 #define MAINBOARD_POWER_OFF 0
11 #define MAINBOARD_POWER_ON 1
13 #ifndef MAINBOARD_POWER_ON_AFTER_POWER_FAIL
14 #define MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON
18 static void acpi_init(struct device *dev)
25 printk_debug("ACPI: disabling NMI watchdog.. ");
26 pci_read_config_byte(dev, 0x49, &byte);
27 pci_write_config_byte(dev, 0x49, byte | (1<<2));
30 pci_read_config_byte(dev, 0x41, &byte);
31 pci_write_config_byte(dev, 0x41, byte | (1<<6)|(1<<2));
33 /* added from sourceforge */
34 pci_read_config_byte(dev, 0x48, &byte);
35 pci_write_config_byte(dev, 0x48, byte | (1<<3));
37 printk_debug("done.\n");
40 printk_debug("ACPI: Routing IRQ 12 to PS2 port.. ");
41 pci_read_config_word(dev, 0x46, &word);
42 pci_write_config_word(dev, 0x46, word | (1<<9));
43 printk_debug("done.\n");
46 printk_debug("ACPI: setting PM class code.. ");
47 pci_write_config_dword(dev, 0x60, 0x06800000);
48 printk_debug("done.\n");
50 on = MAINBOARD_POWER_ON_AFTER_POWER_FAIL;
51 get_option(&on, "power_on_after_fail");
52 byte = pci_read_config8(dev, PREVIOUS_POWER_STATE);
57 pci_write_config8(dev, PREVIOUS_POWER_STATE, byte);
58 printk_info("set power %s after power fail\n", on?"on":"off");
62 static struct device_operations acpi_ops = {
63 .read_resources = pci_dev_read_resources,
64 .set_resources = pci_dev_set_resources,
65 .enable_resources = pci_dev_enable_resources,
68 .enable = amd8111_enable,
71 static struct pci_driver acpi_driver __pci_driver = {
73 .vendor = PCI_VENDOR_ID_AMD,
74 .device = PCI_DEVICE_ID_AMD_8111_ACPI,