[coreboot-gerrit] New patch to review for coreboot: 3f674ed AGESA: Refactor HUDSON_SATA_MODE

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Mon Nov 17 05:50:13 CET 2014


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7494

-gerrit

commit 3f674edaeb2c4885c7c972112568a9d80346be98
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Fri Nov 14 20:56:43 2014 +0200

    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 at gmail.com>
---
 src/mainboard/amd/olivehillplus/BiosCallOuts.c |  5 +-
 src/southbridge/amd/agesa/hudson/Kconfig       | 94 +++++++++++---------------
 src/southbridge/amd/agesa/hudson/Makefile.inc  |  2 -
 src/southbridge/amd/agesa/hudson/hudson.h      | 12 ++++
 4 files changed, 53 insertions(+), 60 deletions(-)

diff --git a/src/mainboard/amd/olivehillplus/BiosCallOuts.c b/src/mainboard/amd/olivehillplus/BiosCallOuts.c
index 5720250..cc41ec8 100644
--- a/src/mainboard/amd/olivehillplus/BiosCallOuts.c
+++ b/src/mainboard/amd/olivehillplus/BiosCallOuts.c
@@ -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) {
diff --git a/src/southbridge/amd/agesa/hudson/Kconfig b/src/southbridge/amd/agesa/hudson/Kconfig
index a2a43a4..df7d76f 100644
--- a/src/southbridge/amd/agesa/hudson/Kconfig
+++ b/src/southbridge/amd/agesa/hudson/Kconfig
@@ -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.
+	  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_IDE
-	bool "NATIVE"
-	help
-	  NATIVE is the default mode and does not require a ROM.
+comment "NATIVE"
+	depends on HUDSON_SATA_MODE = 0
 
-config HUDSON_SATA_RAID
-	bool "RAID"
-	help
-	  HUDSON RAID mode must have the two required ROM files.
+comment "RAID"
+	depends on HUDSON_SATA_MODE = 1
 
-config HUDSON_SATA_AHCI
-	bool "AHCI"
-	help
-	  AHCI may work with or without AHCI ROM. It depends on the payload support.
-	  For example, seabios does not require the AHCI ROM.
+comment "AHCI"
+	depends on HUDSON_SATA_MODE = 2
 
-config HUDSON_SATA_LEGACY_IDE
-	bool "LEGACY IDE"
-	help
-	  TODO
+comment "LEGACY IDE"
+	depends on HUDSON_SATA_MODE = 3
 
-config HUDSON_SATA_IDE2AHCI
-	bool "IDE to AHCI"
-	help
-	  TODO
+comment "IDE to AHCI"
+	depends on HUDSON_SATA_MODE = 4
 
-config HUDSON_SATA_AHCI7804
-	bool "AHCI7804"
-	help
-	  AHCI ROM Required, and AMD driver required in the OS.
+comment "AHCI7804"
+	depends on HUDSON_SATA_MODE = 5
 
-config HUDSON_SATA_IDE2AHCI7804
-	bool "IDE to AHCI7804"
-	help
-	  AHCI ROM Required, and AMD driver required in the OS.
+comment "IDE to AHCI7804"
+	depends on HUDSON_SATA_MODE = 6
 
-endchoice
+if HUDSON_SATA_MODE = 2 || HUDSON_SATA_MODE = 5
 
-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
-
-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
+	string  "AHCI device PCI IDs"
+	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
+	string "RAID Misc ROM path and filename"
+	default "src/southbridge/amd/agesa/hudson/misc.bin"
 
 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"
diff --git a/src/southbridge/amd/agesa/hudson/Makefile.inc b/src/southbridge/amd/agesa/hudson/Makefile.inc
index 5fab10f..4b1eed6 100644
--- a/src/southbridge/amd/agesa/hudson/Makefile.inc
+++ b/src/southbridge/amd/agesa/hudson/Makefile.inc
@@ -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)
diff --git a/src/southbridge/amd/agesa/hudson/hudson.h b/src/southbridge/amd/agesa/hudson/hudson.h
index 286e11c..90c3205 100644
--- a/src/southbridge/amd/agesa/hudson/hudson.h
+++ b/src/southbridge/amd/agesa/hudson/hudson.h
@@ -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);



More information about the coreboot-gerrit mailing list