AGESA: Refactor HUDSON_SATA_MODE

Expose one CONFIG_ variable instead of seven to C preprocessor.

Change-Id: Ib815127561d320a5e8f8e6ef168933d81809521e
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/7494
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Kyösti Mälkki 2014-11-14 20:56:43 +02:00
parent 3bff5d9064
commit 84693d3dd4
4 changed files with 53 additions and 60 deletions

View File

@ -28,6 +28,7 @@
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
#include "imc.h"
#endif
#include "hudson.h"
#include <stdlib.h>
static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr);
@ -268,8 +269,8 @@ static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr)
printk(BIOS_DEBUG, "\nFch OEM config in INIT RESET\n");
//FchParams_reset->EcChannel0 = TRUE; /* logical devicd 3 */
FchParams->LegacyFree = CONFIG_HUDSON_LEGACY_FREE;
FchParams->FchReset.SataEnable = CONFIG_HUDSON_SATA_IDE || CONFIG_HUDSON_SATA_AHCI;
FchParams->FchReset.IdeEnable = CONFIG_HUDSON_SATA_IDE || CONFIG_HUDSON_SATA_LEGACY_IDE;
FchParams->FchReset.SataEnable = hudson_sata_enable();
FchParams->FchReset.IdeEnable = hudson_ide_enable();
FchParams->FchReset.Xhci0Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE);
FchParams->FchReset.Xhci1Enable = FALSE;
} else if (StdHeader->Func == AMD_INIT_ENV) {

View File

@ -140,67 +140,49 @@ config AMD_PUBKEY_FILE
string "AMD public Key"
default "3rdparty/southbridge/amd/avalon/PSP/AmdPubKey.bin" if CPU_AMD_AGESA_00730F01
choice
prompt "SATA Mode"
default HUDSON_SATA_IDE
config HUDSON_SATA_MODE
int "SATA Mode"
default 0
range 0 6
help
Select the mode in which SATA should be driven. NATIVE AHCI, or RAID.
The default is NATIVE.
config HUDSON_SATA_IDE
bool "NATIVE"
help
NATIVE is the default mode and does not require a ROM.
config HUDSON_SATA_RAID
bool "RAID"
help
HUDSON RAID mode must have the two required ROM files.
config HUDSON_SATA_AHCI
bool "AHCI"
help
AHCI may work with or without AHCI ROM. It depends on the payload support.
0: NATIVE mode does not require a ROM.
1: RAID mode must have the two ROM files.
2: AHCI may work with or without AHCI ROM. It depends on the payload support.
For example, seabios does not require the AHCI ROM.
3: LEGACY IDE
4: IDE to AHCI
5: AHCI7804: ROM Required, and AMD driver required in the OS.
6: IDE to AHCI7804: ROM Required, and AMD driver required in the OS.
config HUDSON_SATA_LEGACY_IDE
bool "LEGACY IDE"
help
TODO
comment "NATIVE"
depends on HUDSON_SATA_MODE = 0
config HUDSON_SATA_IDE2AHCI
bool "IDE to AHCI"
help
TODO
comment "RAID"
depends on HUDSON_SATA_MODE = 1
config HUDSON_SATA_AHCI7804
bool "AHCI7804"
help
AHCI ROM Required, and AMD driver required in the OS.
comment "AHCI"
depends on HUDSON_SATA_MODE = 2
config HUDSON_SATA_IDE2AHCI7804
bool "IDE to AHCI7804"
help
AHCI ROM Required, and AMD driver required in the OS.
comment "LEGACY IDE"
depends on HUDSON_SATA_MODE = 3
endchoice
comment "IDE to AHCI"
depends on HUDSON_SATA_MODE = 4
config HUDSON_SATA_MODE
hex
depends on (HUDSON_SATA_IDE || HUDSON_SATA_RAID || HUDSON_SATA_AHCI)
default "0x0" if HUDSON_SATA_IDE
default "0x1" if HUDSON_SATA_RAID
default "0x2" if HUDSON_SATA_AHCI
default "0x3" if HUDSON_SATA_LEGACY_IDE
default "0x4" if HUDSON_SATA_IDE2AHCI
default "0x5" if HUDSON_SATA_AHCI7804
default "0x6" if HUDSON_SATA_IDE2AHCI7804
comment "AHCI7804"
depends on HUDSON_SATA_MODE = 5
comment "IDE to AHCI7804"
depends on HUDSON_SATA_MODE = 6
if HUDSON_SATA_MODE = 2 || HUDSON_SATA_MODE = 5
if HUDSON_SATA_AHCI || HUDSON_SATA_AHCI7804
config AHCI_ROM_ID
string "AHCI device PCI IDs"
default "1022,7801" if HUDSON_SATA_AHCI
default "1022,7804" if HUDSON_SATA_AHCI7804
default "1022,7801" if HUDSON_SATA_MODE = 2
default "1022,7804" if HUDSON_SATA_MODE = 5
config HUDSON_AHCI_ROM
bool "Add a AHCI ROM"
@ -209,9 +191,11 @@ config AHCI_ROM_FILE
string "AHCI ROM path and filename"
depends on HUDSON_AHCI_ROM
default "src/southbridge/amd/agesa/hudson/ahci.bin"
endif # HUDSON_SATA_AHCI || HUDSON_SATA_AHCI7804
if HUDSON_SATA_RAID
endif
if HUDSON_SATA_MODE = 1
config RAID_ROM_ID
string "RAID device PCI IDs"
default "1022,7802"
@ -220,23 +204,21 @@ config RAID_ROM_ID
config RAID_ROM_FILE
string "RAID ROM path and filename"
depends on HUDSON_SATA_RAID
default "src/southbridge/amd/agesa/hudson/raid.bin"
config RAID_MISC_ROM_FILE
string "RAID Misc ROM path and filename"
default "src/southbridge/amd/agesa/hudson/misc.bin"
depends on HUDSON_SATA_RAID
config RAID_MISC_ROM_POSITION
hex "RAID Misc ROM Position"
default 0xFFF00000
depends on HUDSON_SATA_RAID
help
The RAID ROM requires that the MISC ROM is located between the range
0xFFF0_0000 to 0xFFF0_FFFF. Also, it must 1K bytes aligned.
The CONFIG_ROM_SIZE must be larger than 0x100000.
endif # HUDSON_SATA_RAID
endif
config HUDSON_LEGACY_FREE
bool "System is legacy free"

View File

@ -149,14 +149,12 @@ hudson/gec-type := raw
hudson/gec-required := Hudson Gigabit Ethernet Controller Firmware (Contact your AMD representative)
endif
#ifeq ($(CONFIG_HUDSON_SATA_AHCI), y)
ifdef CONFIG_HUDSON_AHCI_ROM
stripped_ahci_rom_id = $(call strip_quotes,$(CONFIG_AHCI_ROM_ID))
cbfs-files-y += pci$(stripped_ahci_rom_id).rom
pci$(stripped_ahci_rom_id).rom-file := $(call strip_quotes,$(CONFIG_AHCI_ROM_FILE))
pci$(stripped_ahci_rom_id).rom-type := optionrom
pci$(stripped_ahci_rom_id).rom-required := Hudson AHCI Option ROM (Contact your AMD representative)
#endif
endif
ifeq ($(CONFIG_HUDSON_PSP), y)

View File

@ -55,6 +55,18 @@
#define SPI_ROM_ENABLE 0x02
#define SPI_BASE_ADDRESS 0xFEC10000
static inline int hudson_sata_enable(void)
{
/* True if IDE or AHCI. */
return (CONFIG_HUDSON_SATA_MODE == 0) || (CONFIG_HUDSON_SATA_MODE == 2);
}
static inline int hudson_ide_enable(void)
{
/* True if IDE or LEGACY IDE. */
return (CONFIG_HUDSON_SATA_MODE == 0) || (CONFIG_HUDSON_SATA_MODE == 3);
}
#ifndef __SMM__
void pm_write8(u8 reg, u8 value);