Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2010 Advanced Micro Devices, Inc. |
| 5 | * Copyright (C) 2014 Sage Electronic Engineering, LLC |
| 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. |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef HUDSON_H |
| 18 | #define HUDSON_H |
| 19 | |
Marshall Dawson | d8019a6 | 2017-01-29 17:22:36 -0700 | [diff] [blame^] | 20 | #include <types.h> |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 21 | #include <device/pci_ids.h> |
| 22 | #include <device/device.h> |
| 23 | #include "chip.h" |
| 24 | |
| 25 | /* Power management index/data registers */ |
| 26 | #define BIOSRAM_INDEX 0xcd4 |
| 27 | #define BIOSRAM_DATA 0xcd5 |
| 28 | #define PM_INDEX 0xcd6 |
| 29 | #define PM_DATA 0xcd7 |
| 30 | #define PM2_INDEX 0xcd0 |
| 31 | #define PM2_DATA 0xcd1 |
| 32 | |
| 33 | #define HUDSON_ACPI_IO_BASE 0x800 |
| 34 | |
| 35 | #define ACPI_PM_EVT_BLK (HUDSON_ACPI_IO_BASE + 0x00) /* 4 bytes */ |
| 36 | #define ACPI_PM1_CNT_BLK (HUDSON_ACPI_IO_BASE + 0x04) /* 2 bytes */ |
| 37 | #define ACPI_PM_TMR_BLK (HUDSON_ACPI_IO_BASE + 0x18) /* 4 bytes */ |
| 38 | #define ACPI_GPE0_BLK (HUDSON_ACPI_IO_BASE + 0x10) /* 8 bytes */ |
| 39 | #define ACPI_CPU_CONTROL (HUDSON_ACPI_IO_BASE + 0x08) /* 6 bytes */ |
| 40 | |
| 41 | #define ACPI_SMI_CTL_PORT 0xb2 |
| 42 | #define ACPI_SMI_CMD_CST_CONTROL 0xde |
| 43 | #define ACPI_SMI_CMD_PST_CONTROL 0xad |
| 44 | #define ACPI_SMI_CMD_DISABLE 0xbe |
| 45 | #define ACPI_SMI_CMD_ENABLE 0xef |
| 46 | #define ACPI_SMI_CMD_S4_REQ 0xc0 |
| 47 | |
| 48 | #define REV_HUDSON_A11 0x11 |
| 49 | #define REV_HUDSON_A12 0x12 |
| 50 | |
| 51 | #define SPIROM_BASE_ADDRESS_REGISTER 0xA0 |
| 52 | #define SPI_ROM_ENABLE 0x02 |
| 53 | #define SPI_BASE_ADDRESS 0xFEC10000 |
| 54 | |
Dave Frodin | f364fc7 | 2015-03-13 08:22:17 -0600 | [diff] [blame] | 55 | #define LPC_IO_PORT_DECODE_ENABLE 0x44 |
Marshall Dawson | d8019a6 | 2017-01-29 17:22:36 -0700 | [diff] [blame^] | 56 | #define DECODE_ENABLE_PARALLEL_PORT0 BIT(0) |
| 57 | #define DECODE_ENABLE_PARALLEL_PORT1 BIT(1) |
| 58 | #define DECODE_ENABLE_PARALLEL_PORT2 BIT(2) |
| 59 | #define DECODE_ENABLE_PARALLEL_PORT3 BIT(3) |
| 60 | #define DECODE_ENABLE_PARALLEL_PORT4 BIT(4) |
| 61 | #define DECODE_ENABLE_PARALLEL_PORT5 BIT(5) |
| 62 | #define DECODE_ENABLE_SERIAL_PORT0 BIT(6) |
| 63 | #define DECODE_ENABLE_SERIAL_PORT1 BIT(7) |
| 64 | #define DECODE_ENABLE_SERIAL_PORT2 BIT(8) |
| 65 | #define DECODE_ENABLE_SERIAL_PORT3 BIT(9) |
| 66 | #define DECODE_ENABLE_SERIAL_PORT4 BIT(10) |
| 67 | #define DECODE_ENABLE_SERIAL_PORT5 BIT(11) |
| 68 | #define DECODE_ENABLE_SERIAL_PORT6 BIT(12) |
| 69 | #define DECODE_ENABLE_SERIAL_PORT7 BIT(13) |
| 70 | #define DECODE_ENABLE_AUDIO_PORT0 BIT(14) |
| 71 | #define DECODE_ENABLE_AUDIO_PORT1 BIT(15) |
| 72 | #define DECODE_ENABLE_AUDIO_PORT2 BIT(16) |
| 73 | #define DECODE_ENABLE_AUDIO_PORT3 BIT(17) |
| 74 | #define DECODE_ENABLE_MIDI_PORT0 BIT(18) |
| 75 | #define DECODE_ENABLE_MIDI_PORT1 BIT(19) |
| 76 | #define DECODE_ENABLE_MIDI_PORT2 BIT(20) |
| 77 | #define DECODE_ENABLE_MIDI_PORT3 BIT(21) |
| 78 | #define DECODE_ENABLE_MSS_PORT0 BIT(22) |
| 79 | #define DECODE_ENABLE_MSS_PORT1 BIT(23) |
| 80 | #define DECODE_ENABLE_MSS_PORT2 BIT(24) |
| 81 | #define DECODE_ENABLE_MSS_PORT3 BIT(25) |
| 82 | #define DECODE_ENABLE_FDC_PORT0 BIT(26) |
| 83 | #define DECODE_ENABLE_FDC_PORT1 BIT(27) |
| 84 | #define DECODE_ENABLE_GAME_PORT BIT(28) |
| 85 | #define DECODE_ENABLE_KBC_PORT BIT(29) |
| 86 | #define DECODE_ENABLE_ACPIUC_PORT BIT(30) |
| 87 | #define DECODE_ENABLE_ADLIB_PORT BIT(31) |
Dave Frodin | f364fc7 | 2015-03-13 08:22:17 -0600 | [diff] [blame] | 88 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 89 | static inline int hudson_sata_enable(void) |
| 90 | { |
| 91 | /* True if IDE or AHCI. */ |
| 92 | return (CONFIG_HUDSON_SATA_MODE == 0) || (CONFIG_HUDSON_SATA_MODE == 2); |
| 93 | } |
| 94 | |
| 95 | static inline int hudson_ide_enable(void) |
| 96 | { |
| 97 | /* True if IDE or LEGACY IDE. */ |
| 98 | return (CONFIG_HUDSON_SATA_MODE == 0) || (CONFIG_HUDSON_SATA_MODE == 3); |
| 99 | } |
| 100 | |
| 101 | #ifndef __SMM__ |
| 102 | |
| 103 | void pm_write8(u8 reg, u8 value); |
| 104 | u8 pm_read8(u8 reg); |
| 105 | void pm_write16(u8 reg, u16 value); |
| 106 | u16 pm_read16(u16 reg); |
| 107 | |
| 108 | #ifdef __PRE_RAM__ |
| 109 | void hudson_lpc_port80(void); |
Dave Frodin | f364fc7 | 2015-03-13 08:22:17 -0600 | [diff] [blame] | 110 | void hudson_lpc_decode(void); |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 111 | void hudson_pci_port80(void); |
| 112 | void hudson_clk_output_48Mhz(void); |
| 113 | |
| 114 | int s3_save_nvram_early(u32 dword, int size, int nvram_pos); |
| 115 | int s3_load_nvram_early(int size, u32 *old_dword, int nvram_pos); |
Zheng Bao | 2286138 | 2015-11-21 12:19:22 +0800 | [diff] [blame] | 116 | #if IS_ENABLED(CONFIG_HUDSON_UART) |
| 117 | void configure_hudson_uart(void); |
| 118 | #endif |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 119 | |
| 120 | #else |
| 121 | void hudson_enable(device_t dev); |
| 122 | void s3_resume_init_data(void *FchParams); |
| 123 | |
| 124 | #endif /* __PRE_RAM__ */ |
| 125 | #endif /* __SMM__ */ |
| 126 | |
| 127 | #endif /* HUDSON_H */ |