Siyuan Wang | 8ff97b2 | 2012-10-28 18:19:38 +0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 - 2012 Advanced Micro Devices, Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
Paul Menzel | a46a712 | 2013-02-23 18:37:27 +0100 | [diff] [blame] | 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Siyuan Wang | 8ff97b2 | 2012-10-28 18:19:38 +0800 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | |
| 21 | #include <string.h> |
| 22 | #include <console/console.h> /* printk */ |
| 23 | #include "Platform.h" |
| 24 | #include "sb700_cfg.h" |
| 25 | |
| 26 | |
| 27 | /** |
| 28 | * @brief South Bridge CIMx configuration |
| 29 | * |
| 30 | * should be called before exeucte CIMx function. |
| 31 | * this function will be called in romstage and ramstage. |
| 32 | */ |
| 33 | void sb700_cimx_config(AMDSBCFG *sb_config) |
| 34 | { |
| 35 | if (!sb_config) { |
| 36 | printk(BIOS_DEBUG, "SB700 - Cfg.c - sb700_cimx_config - No sb_config.\n"); |
| 37 | return; |
| 38 | } |
| 39 | printk(BIOS_DEBUG, "SB700 - Cfg.c - sb700_cimx_config - Start.\n"); |
| 40 | memset(sb_config, 0, sizeof(AMDSBCFG)); |
| 41 | |
| 42 | /* SB_POWERON_INIT */ |
| 43 | sb_config->StdHeader.Func = SB_POWERON_INIT; |
| 44 | |
| 45 | /* header */ |
| 46 | sb_config->StdHeader.pPcieBase = PCIEX_BASE_ADDRESS; |
| 47 | |
| 48 | /* static Build Parameters */ |
| 49 | sb_config->BuildParameters.BiosSize = BIOS_SIZE; |
| 50 | sb_config->BuildParameters.LegacyFree = LEGACY_FREE; |
| 51 | sb_config->BuildParameters.EcKbd = 0; |
| 52 | sb_config->BuildParameters.EcChannel0 = 0; |
| 53 | sb_config->BuildParameters.Smbus0BaseAddress = SMBUS0_BASE_ADDRESS; |
| 54 | sb_config->BuildParameters.Smbus1BaseAddress = SMBUS1_BASE_ADDRESS; |
| 55 | sb_config->BuildParameters.SioPmeBaseAddress = SIO_PME_BASE_ADDRESS; |
| 56 | sb_config->BuildParameters.WatchDogTimerBase = WATCHDOG_TIMER_BASE_ADDRESS; |
| 57 | sb_config->BuildParameters.SpiRomBaseAddress = SPI_BASE_ADDRESS; |
| 58 | |
| 59 | sb_config->BuildParameters.AcpiPm1EvtBlkAddr = PM1_EVT_BLK_ADDRESS; |
| 60 | sb_config->BuildParameters.AcpiPm1CntBlkAddr = PM1_CNT_BLK_ADDRESS; |
| 61 | sb_config->BuildParameters.AcpiPmTmrBlkAddr = PM1_TMR_BLK_ADDRESS; |
| 62 | sb_config->BuildParameters.CpuControlBlkAddr = CPU_CNT_BLK_ADDRESS; |
| 63 | sb_config->BuildParameters.AcpiGpe0BlkAddr = GPE0_BLK_ADDRESS; |
| 64 | sb_config->BuildParameters.SmiCmdPortAddr = SMI_CMD_PORT; |
| 65 | sb_config->BuildParameters.AcpiPmaCntBlkAddr = ACPI_PMA_CNT_BLK_ADDRESS; |
| 66 | |
| 67 | sb_config->BuildParameters.SataIDESsid = SATA_IDE_MODE_SSID; |
| 68 | sb_config->BuildParameters.SataRAIDSsid = SATA_RAID_MODE_SSID; |
| 69 | sb_config->BuildParameters.SataRAID5Ssid = SATA_RAID5_MODE_SSID; |
| 70 | sb_config->BuildParameters.SataAHCISsid = SATA_AHCI_SSID; |
| 71 | sb_config->BuildParameters.Ohci0Ssid = OHCI0_SSID; |
| 72 | sb_config->BuildParameters.Ohci1Ssid = OHCI1_SSID; |
| 73 | sb_config->BuildParameters.Ohci2Ssid = OHCI2_SSID; |
| 74 | sb_config->BuildParameters.Ohci3Ssid = OHCI3_SSID; |
| 75 | sb_config->BuildParameters.Ohci4Ssid = OHCI4_SSID; |
| 76 | sb_config->BuildParameters.Ehci0Ssid = EHCI0_SSID; |
| 77 | sb_config->BuildParameters.Ehci1Ssid = EHCI1_SSID; |
| 78 | sb_config->BuildParameters.SmbusSsid = SMBUS_SSID; |
| 79 | sb_config->BuildParameters.IdeSsid = IDE_SSID; |
| 80 | sb_config->BuildParameters.AzaliaSsid = AZALIA_SSID; |
| 81 | sb_config->BuildParameters.LpcSsid = LPC_SSID; |
| 82 | |
| 83 | sb_config->BuildParameters.HpetBase = HPET_BASE_ADDRESS; |
| 84 | |
| 85 | /* General */ |
| 86 | sb_config->Spi33Mhz = 1; |
| 87 | sb_config->SpreadSpectrum = 0; |
| 88 | sb_config->PciClk5 = 1; |
| 89 | sb_config->PciClks = 0x1F; |
| 90 | sb_config->ResetCpuOnSyncFlood = 1; // Do not reset CPU on sync flood |
| 91 | sb_config->TimerClockSource = 2; // Auto |
| 92 | sb_config->S3Resume = 0; |
| 93 | sb_config->RebootRequired = 0; |
| 94 | |
| 95 | /* HPET */ |
| 96 | sb_config->HpetTimer = HPET_TIMER; |
| 97 | |
| 98 | /* USB */ |
| 99 | sb_config->UsbIntClock = 0; // Use external clock |
| 100 | sb_config->Usb1Ohci0 = 1; //0:disable 1:enable Bus 0 Dev 18 Func0 |
| 101 | sb_config->Usb1Ohci1 = 1; //0:disable 1:enable Bus 0 Dev 18 Func1 |
| 102 | sb_config->Usb1Ehci = 1; //0:disable 1:enable Bus 0 Dev 18 Func2 |
| 103 | sb_config->Usb2Ohci0 = 1; //0:disable 1:enable Bus 0 Dev 19 Func0 |
| 104 | sb_config->Usb2Ohci1 = 1; //0:disable 1:enable Bus 0 Dev 19 Func1 |
| 105 | sb_config->Usb2Ehci = 1; //0:disable 1:enable Bus 0 Dev 19 Func2 |
| 106 | sb_config->Usb3Ohci = 1; //0:disable 1:enable Bus 0 Dev 20 Func5 |
| 107 | sb_config->UsbOhciLegacyEmulation = 1; //0:Enable 1:Disable |
| 108 | |
| 109 | sb_config->AcpiS1Supported = 1; |
| 110 | |
| 111 | /* SATA */ |
| 112 | sb_config->SataController = 1; |
| 113 | sb_config->SataClass = CONFIG_SATA_CONTROLLER_MODE; //0 native, 1 raid, 2 ahci |
| 114 | sb_config->SataSmbus = 0; |
| 115 | sb_config->SataAggrLinkPmCap = 1; |
| 116 | sb_config->SataPortMultCap = 1; |
| 117 | sb_config->SataClkAutoOff = 1; |
| 118 | sb_config->SataIdeCombMdPriSecOpt = 0; //0 -IDE as primary, 1 -IDE as secondary. |
| 119 | //TODO: set to secondary not take effect. |
| 120 | sb_config->SataIdeCombinedMode = 0; //1 IDE controlor exposed and combined mode enabled, 0 disabled |
| 121 | sb_config->SataEspPort = 0; |
| 122 | sb_config->SataClkAutoOffAhciMode = 1; |
| 123 | sb_config->SataHpcpButNonESP = 0; |
| 124 | sb_config->SataHideUnusedPort = 0; |
| 125 | |
| 126 | /* Azalia HDA */ |
| 127 | sb_config->AzaliaController = AZALIA_CONTROLLER; |
| 128 | sb_config->AzaliaPinCfg = AZALIA_PIN_CONFIG; |
Bruce Griffith | 21d6fd9 | 2013-06-25 14:01:21 -0600 | [diff] [blame^] | 129 | sb_config->AzaliaSdin0 = AZALIA_SDIN_PIN_0; |
| 130 | sb_config->AzaliaSdin1 = AZALIA_SDIN_PIN_1; |
| 131 | sb_config->AzaliaSdin2 = AZALIA_SDIN_PIN_2; |
| 132 | sb_config->AzaliaSdin3 = AZALIA_SDIN_PIN_3; |
Siyuan Wang | 8ff97b2 | 2012-10-28 18:19:38 +0800 | [diff] [blame] | 133 | sb_config->pAzaliaOemCodecTablePtr = NULL; |
| 134 | |
| 135 | #ifndef __PRE_RAM__ |
| 136 | /* ramstage cimx config here */ |
| 137 | if (!sb_config->StdHeader.pCallBack) { |
| 138 | sb_config->StdHeader.pCallBack = sb700_callout_entry; |
| 139 | } |
| 140 | |
| 141 | //sb_config-> |
| 142 | #endif //!__PRE_RAM__ |
| 143 | printk(BIOS_DEBUG, "SB700 - Cfg.c - sb700_cimx_config - End.\n"); |
| 144 | } |
| 145 | |