Hi,

we currently have a config variable SYSTEM_TYPE in AMD based boards'
romstage.c, which defines if the board is "server", "desktop" or
"mobile". Among other things, the AMD code expects "server" to do ECC.

I broke that out to Kconfig, but extended the categories to the ACPI set
(which the OS can use for tuning the power management profile
accordingly). Now, it's declared in Kconfig with ACPI categories (which
provides a couple more values, like "SOHO Server" and "Performance
Server"), and based on these, the AMD value is chosen.

The Kconfig selection is also used to set the preferred PM profile in
ACPI (on the modified boards only for now).

The upside of this approach is that we only set the board type once, and
have it trickle down to whoever cares for it - so consistency is
implicitely ensured through the build system.
We also won't have to worry about this field should we ever get to the
point that the fadt is handled by unified code instead of per-board code
(and I hope we'll get there eventually).

The downside is that some things can't be modelled quite right (eg. one
AMD board was marked "server" for the AMD code, but "workstation" for
ACPI - I made that a "SOHO Server" instead in this patch).

If this patch is accepted, I'd build another patch that adapts those
boards which provide an FADT (which contains the PM profile field) to
this new config option. All others are of "unspecified" type by default
if they're ever made ACPI aware.


Signed-off-by: Patrick Georgi <patr...@georgi-clan.de>
Index: src/cpu/amd/Kconfig
===================================================================
--- src/cpu/amd/Kconfig (Revision 6029)
+++ src/cpu/amd/Kconfig (Arbeitskopie)
@@ -20,3 +20,10 @@
 source src/cpu/amd/model_lx/Kconfig
 
 source src/cpu/amd/sc520/Kconfig
+
+config SYSTEM_TYPE_AMD
+       int
+       default 0 if SYSTEM_TYPE_UNSPECIFIED | SYSTEM_TYPE_ENTERPRISE_SERVER | 
SYSTEM_TYPE_SOHO_SERVER | SYSTEM_TYPE_PERFORMANCE_SERVER
+       default 1 if SYSTEM_TYPE_DESKTOP | SYSTEM_TYPE_WORKSTATION
+       default 2 if SYSTEM_TYPE_LAPTOP | SYSTEM_TYPE_APPLIANCE_PC
+
Index: src/cpu/amd/model_10xxx/init_cpus.c
===================================================================
--- src/cpu/amd/model_10xxx/init_cpus.c (Revision 6029)
+++ src/cpu/amd/model_10xxx/init_cpus.c (Arbeitskopie)
@@ -582,7 +582,7 @@
 {
        u32 ret = 0;
 
-       switch (SYSTEM_TYPE) {
+       switch (CONFIG_SYSTEM_TYPE_AMD) {
        case 1:
                ret |= AMD_PTYPE_DSK;
                break;
Index: src/mainboard/Kconfig
===================================================================
--- src/mainboard/Kconfig       (Revision 6029)
+++ src/mainboard/Kconfig       (Arbeitskopie)
@@ -247,6 +247,50 @@
        default 0x200000 if COREBOOT_ROMSIZE_KB_2048
        default 0x400000 if COREBOOT_ROMSIZE_KB_4096
 
+choice
+       prompt "System Type"
+       default SYSTEM_TYPE_UNSPECIFIED
+       help
+         Chipset configuration and OS behaviour can be tuned for several
+          use cases.
+
+config SYSTEM_TYPE_UNSPECIFIED
+       bool "Unspecified"
+
+config SYSTEM_TYPE_DESKTOP
+       bool "Desktop"
+
+config SYSTEM_TYPE_MOBILE
+       bool "Mobile"
+
+config SYSTEM_TYPE_WORKSTATION
+       bool "Workstation"
+
+config SYSTEM_TYPE_ENTERPRISE_SERVER
+       bool "Enterprise Server"
+
+config SYSTEM_TYPE_SOHO_SERVER
+       bool "SOHO Server"
+
+config SYSTEM_TYPE_APPLIANCE_PC
+       bool "Appliance PC"
+
+config SYSTEM_TYPE_PERFORMANCE_SERVER
+       bool "Performance Server"
+
+endchoice
+
+config SYSTEM_TYPE_FADT
+       int
+       default 0 if SYSTEM_TYPE_UNSPECIFIED
+       default 1 if SYSTEM_TYPE_DESKTOP
+       default 2 if SYSTEM_TYPE_MOBILE
+       default 3 if SYSTEM_TYPE_WORKSTATION
+       default 4 if SYSTEM_TYPE_ENTERPRISE_SERVER
+       default 5 if SYSTEM_TYPE_SOHO_SERVER
+       default 6 if SYSTEM_TYPE_APPLIANCE_PC
+       default 7 if SYSTEM_TYPE_PERFORMANCE_SERVER
+
 config ENABLE_POWER_BUTTON
        bool "Enable the power button" if POWER_BUTTON_IS_OPTIONAL
        default y if POWER_BUTTON_DEFAULT_ENABLE
Index: src/mainboard/gigabyte/ma78gm/fadt.c
===================================================================
--- src/mainboard/gigabyte/ma78gm/fadt.c        (Revision 6029)
+++ src/mainboard/gigabyte/ma78gm/fadt.c        (Arbeitskopie)
@@ -60,8 +60,7 @@
 
        fadt->firmware_ctrl = (u32) facs;
        fadt->dsdt = (u32) dsdt;
-       /* 3=Workstation,4=Enterprise Server, 7=Performance Server */
-       fadt->preferred_pm_profile = 0x03;
+       fadt->preferred_pm_profile = CONFIG_SYSTEM_TYPE_FADT;
        fadt->sci_int = 9;
        /* disable system management mode by setting to 0: */
        fadt->smi_cmd = 0;
Index: src/mainboard/gigabyte/ma78gm/Kconfig
===================================================================
--- src/mainboard/gigabyte/ma78gm/Kconfig       (Revision 6029)
+++ src/mainboard/gigabyte/ma78gm/Kconfig       (Arbeitskopie)
@@ -29,6 +29,7 @@
        select GFXUMA
        select RAMINIT_SYSINFO
        select QRANK_DIMM_SUPPORT
+       select SYSTEM_TYPE_WORKSTATION
 
 config MAINBOARD_DIR
        string
Index: src/mainboard/gigabyte/ma78gm/romstage.c
===================================================================
--- src/mainboard/gigabyte/ma78gm/romstage.c    (Revision 6029)
+++ src/mainboard/gigabyte/ma78gm/romstage.c    (Arbeitskopie)
@@ -17,10 +17,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-//#define SYSTEM_TYPE 0        /* SERVER */
-#define SYSTEM_TYPE 1  /* DESKTOP */
-//#define SYSTEM_TYPE 2        /* MOBILE */
-
 #define SET_NB_CFG_54 1
 
 //used by incoherent_ht
Index: src/mainboard/gigabyte/ma785gmt/fadt.c
===================================================================
--- src/mainboard/gigabyte/ma785gmt/fadt.c      (Revision 6029)
+++ src/mainboard/gigabyte/ma785gmt/fadt.c      (Arbeitskopie)
@@ -60,8 +60,7 @@
 
        fadt->firmware_ctrl = (u32) facs;
        fadt->dsdt = (u32) dsdt;
-       /* 3=Workstation,4=Enterprise Server, 7=Performance Server */
-       fadt->preferred_pm_profile = 0x03;
+       fadt->preferred_pm_profile = CONFIG_SYSTEM_TYPE_FADT;
        fadt->sci_int = 9;
        /* disable system management mode by setting to 0: */
        fadt->smi_cmd = 0;
Index: src/mainboard/gigabyte/ma785gmt/Kconfig
===================================================================
--- src/mainboard/gigabyte/ma785gmt/Kconfig     (Revision 6029)
+++ src/mainboard/gigabyte/ma785gmt/Kconfig     (Arbeitskopie)
@@ -29,6 +29,7 @@
        select GFXUMA
        select RAMINIT_SYSINFO
        select QRANK_DIMM_SUPPORT
+       select SYSTEM_TYPE_WORKSTATION
 
 config MAINBOARD_DIR
        string
Index: src/mainboard/gigabyte/ma785gmt/romstage.c
===================================================================
--- src/mainboard/gigabyte/ma785gmt/romstage.c  (Revision 6029)
+++ src/mainboard/gigabyte/ma785gmt/romstage.c  (Arbeitskopie)
@@ -17,10 +17,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-//#define SYSTEM_TYPE 0        /* SERVER */
-#define SYSTEM_TYPE 1  /* DESKTOP */
-//#define SYSTEM_TYPE 2        /* MOBILE */
-
 #define SET_NB_CFG_54 1
 
 //used by init_cpus and fidvid
Index: src/mainboard/amd/mahogany_fam10/Kconfig
===================================================================
--- src/mainboard/amd/mahogany_fam10/Kconfig    (Revision 6029)
+++ src/mainboard/amd/mahogany_fam10/Kconfig    (Arbeitskopie)
@@ -29,6 +29,7 @@
        select TINY_BOOTBLOCK
        select GFXUMA
        select QRANK_DIMM_SUPPORT
+       select SYSTEM_TYPE_WORKSTATION
 
 config MAINBOARD_DIR
        string
Index: src/mainboard/amd/mahogany_fam10/fadt.c
===================================================================
--- src/mainboard/amd/mahogany_fam10/fadt.c     (Revision 6029)
+++ src/mainboard/amd/mahogany_fam10/fadt.c     (Arbeitskopie)
@@ -60,8 +60,7 @@
 
        fadt->firmware_ctrl = (u32) facs;
        fadt->dsdt = (u32) dsdt;
-       /* 3=Workstation,4=Enterprise Server, 7=Performance Server */
-       fadt->preferred_pm_profile = 0x03;
+       fadt->preferred_pm_profile = CONFIG_SYSTEM_TYPE_FADT;
        fadt->sci_int = 9;
        /* disable system management mode by setting to 0: */
        fadt->smi_cmd = 0;
Index: src/mainboard/amd/mahogany_fam10/romstage.c
===================================================================
--- src/mainboard/amd/mahogany_fam10/romstage.c (Revision 6029)
+++ src/mainboard/amd/mahogany_fam10/romstage.c (Arbeitskopie)
@@ -17,10 +17,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-//#define SYSTEM_TYPE 0        /* SERVER */
-#define SYSTEM_TYPE 1  /* DESKTOP */
-//#define SYSTEM_TYPE 2        /* MOBILE */
-
 #define SET_NB_CFG_54 1
 
 //used by incoherent_ht
Index: src/mainboard/amd/tilapia_fam10/Kconfig
===================================================================
--- src/mainboard/amd/tilapia_fam10/Kconfig     (Revision 6029)
+++ src/mainboard/amd/tilapia_fam10/Kconfig     (Arbeitskopie)
@@ -29,6 +29,7 @@
        select TINY_BOOTBLOCK
        select GFXUMA
        select QRANK_DIMM_SUPPORT
+       select SYSTEM_TYPE_WORKSTATION
 
 config MAINBOARD_DIR
        string
Index: src/mainboard/amd/tilapia_fam10/fadt.c
===================================================================
--- src/mainboard/amd/tilapia_fam10/fadt.c      (Revision 6029)
+++ src/mainboard/amd/tilapia_fam10/fadt.c      (Arbeitskopie)
@@ -60,8 +60,7 @@
 
        fadt->firmware_ctrl = (u32) facs;
        fadt->dsdt = (u32) dsdt;
-       /* 3=Workstation,4=Enterprise Server, 7=Performance Server */
-       fadt->preferred_pm_profile = 0x03;
+       fadt->preferred_pm_profile = CONFIG_SYSTEM_TYPE_FADT;
        fadt->sci_int = 9;
        /* disable system management mode by setting to 0: */
        fadt->smi_cmd = 0;
Index: src/mainboard/amd/tilapia_fam10/romstage.c
===================================================================
--- src/mainboard/amd/tilapia_fam10/romstage.c  (Revision 6029)
+++ src/mainboard/amd/tilapia_fam10/romstage.c  (Arbeitskopie)
@@ -17,10 +17,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-//#define SYSTEM_TYPE 0        /* SERVER */
-#define SYSTEM_TYPE 1  /* DESKTOP */
-//#define SYSTEM_TYPE 2        /* MOBILE */
-
 #define SET_NB_CFG_54 1
 
 //used by incoherent_ht
Index: src/mainboard/amd/serengeti_cheetah_fam10/Kconfig
===================================================================
--- src/mainboard/amd/serengeti_cheetah_fam10/Kconfig   (Revision 6029)
+++ src/mainboard/amd/serengeti_cheetah_fam10/Kconfig   (Arbeitskopie)
@@ -27,6 +27,7 @@
        select LIFT_BSP_APIC_ID
        select TINY_BOOTBLOCK
        select QRANK_DIMM_SUPPORT
+       select SYSTEM_TYPE_SOHO_SERVER
 
 config MAINBOARD_DIR
        string
Index: src/mainboard/amd/serengeti_cheetah_fam10/fadt.c
===================================================================
--- src/mainboard/amd/serengeti_cheetah_fam10/fadt.c    (Revision 6029)
+++ src/mainboard/amd/serengeti_cheetah_fam10/fadt.c    (Arbeitskopie)
@@ -48,8 +48,7 @@
 
        fadt->firmware_ctrl=(u32)facs;
        fadt->dsdt= (u32)dsdt;
-       // 3=Workstation,4=Enterprise Server, 7=Performance Server
-       fadt->preferred_pm_profile=0x03;
+       fadt->preferred_pm_profile=CONFIG_SYSTEM_TYPE_FADT;
        fadt->sci_int=9;
        // disable system management mode by setting to 0:
        fadt->smi_cmd = 0;//pm_base+0x2f;
Index: src/mainboard/amd/serengeti_cheetah_fam10/romstage.c
===================================================================
--- src/mainboard/amd/serengeti_cheetah_fam10/romstage.c        (Revision 6029)
+++ src/mainboard/amd/serengeti_cheetah_fam10/romstage.c        (Arbeitskopie)
@@ -17,10 +17,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#define SYSTEM_TYPE 0  /* SERVER */
-//#define SYSTEM_TYPE 1        /* DESKTOP */
-//#define SYSTEM_TYPE 2        /* MOBILE */
-
 #define SET_NB_CFG_54 1
 
 //used by incoherent_ht
Index: src/mainboard/iei/kino-780am2-fam10/Kconfig
===================================================================
--- src/mainboard/iei/kino-780am2-fam10/Kconfig (Revision 6029)
+++ src/mainboard/iei/kino-780am2-fam10/Kconfig (Arbeitskopie)
@@ -29,6 +29,7 @@
        select TINY_BOOTBLOCK
        select GFXUMA
        select QRANK_DIMM_SUPPORT
+       select SYSTEM_TYPE_WORKSTATION
 
 config MAINBOARD_DIR
        string
Index: src/mainboard/iei/kino-780am2-fam10/fadt.c
===================================================================
--- src/mainboard/iei/kino-780am2-fam10/fadt.c  (Revision 6029)
+++ src/mainboard/iei/kino-780am2-fam10/fadt.c  (Arbeitskopie)
@@ -60,8 +60,7 @@
 
        fadt->firmware_ctrl = (u32) facs;
        fadt->dsdt = (u32) dsdt;
-       /* 3=Workstation,4=Enterprise Server, 7=Performance Server */
-       fadt->preferred_pm_profile = 0x03;
+       fadt->preferred_pm_profile = CONFIG_SYSTEM_TYPE_FADT;
        fadt->sci_int = 9;
        /* disable system management mode by setting to 0: */
        fadt->smi_cmd = 0;
Index: src/mainboard/iei/kino-780am2-fam10/romstage.c
===================================================================
--- src/mainboard/iei/kino-780am2-fam10/romstage.c      (Revision 6029)
+++ src/mainboard/iei/kino-780am2-fam10/romstage.c      (Arbeitskopie)
@@ -17,10 +17,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-//#define SYSTEM_TYPE 0        /* SERVER */
-#define SYSTEM_TYPE 1  /* DESKTOP */
-//#define SYSTEM_TYPE 2        /* MOBILE */
-
 #define SET_NB_CFG_54 1
 
 //used by raminit
Index: src/mainboard/jetway/pa78vm5/fadt.c
===================================================================
--- src/mainboard/jetway/pa78vm5/fadt.c (Revision 6029)
+++ src/mainboard/jetway/pa78vm5/fadt.c (Arbeitskopie)
@@ -60,8 +60,7 @@
 
        fadt->firmware_ctrl = (u32) facs;
        fadt->dsdt = (u32) dsdt;
-       /* 3=Workstation,4=Enterprise Server, 7=Performance Server */
-       fadt->preferred_pm_profile = 0x03;
+       fadt->preferred_pm_profile = CONFIG_SYSTEM_TYPE_FADT;
        fadt->sci_int = 9;
        /* disable system management mode by setting to 0: */
        fadt->smi_cmd = 0;
Index: src/mainboard/jetway/pa78vm5/Kconfig
===================================================================
--- src/mainboard/jetway/pa78vm5/Kconfig        (Revision 6029)
+++ src/mainboard/jetway/pa78vm5/Kconfig        (Arbeitskopie)
@@ -29,6 +29,7 @@
        select TINY_BOOTBLOCK
        select GFXUMA
        select QRANK_DIMM_SUPPORT
+       select SYSTEM_TYPE_WORKSTATION
 
 config MAINBOARD_DIR
        string
Index: src/mainboard/jetway/pa78vm5/romstage.c
===================================================================
--- src/mainboard/jetway/pa78vm5/romstage.c     (Revision 6029)
+++ src/mainboard/jetway/pa78vm5/romstage.c     (Arbeitskopie)
@@ -18,10 +18,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-//#define SYSTEM_TYPE 0        /* SERVER */
-#define SYSTEM_TYPE 1  /* DESKTOP */
-//#define SYSTEM_TYPE 2        /* MOBILE */
-
 #define SET_NB_CFG_54 1
 
 //used by incoherent_ht
Index: src/mainboard/asus/m4a785-m/Kconfig
===================================================================
--- src/mainboard/asus/m4a785-m/Kconfig (Revision 6029)
+++ src/mainboard/asus/m4a785-m/Kconfig (Arbeitskopie)
@@ -28,6 +28,7 @@
        select TINY_BOOTBLOCK
        select GFXUMA
        select QRANK_DIMM_SUPPORT
+       select SYSTEM_TYPE_WORKSTATION
 
 config MAINBOARD_DIR
        string
Index: src/mainboard/asus/m4a785-m/fadt.c
===================================================================
--- src/mainboard/asus/m4a785-m/fadt.c  (Revision 6029)
+++ src/mainboard/asus/m4a785-m/fadt.c  (Arbeitskopie)
@@ -60,8 +60,7 @@
 
        fadt->firmware_ctrl = (u32) facs;
        fadt->dsdt = (u32) dsdt;
-       /* 3=Workstation,4=Enterprise Server, 7=Performance Server */
-       fadt->preferred_pm_profile = 0x03;
+       fadt->preferred_pm_profile = CONFIG_SYSTEM_TYPE_FADT;
        fadt->sci_int = 9;
        /* disable system management mode by setting to 0: */
        fadt->smi_cmd = 0;
Index: src/mainboard/asus/m4a785-m/romstage.c
===================================================================
--- src/mainboard/asus/m4a785-m/romstage.c      (Revision 6029)
+++ src/mainboard/asus/m4a785-m/romstage.c      (Arbeitskopie)
@@ -17,10 +17,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-//#define SYSTEM_TYPE 0        /* SERVER */
-#define SYSTEM_TYPE 1  /* DESKTOP */
-//#define SYSTEM_TYPE 2        /* MOBILE */
-
 #define SET_NB_CFG_54 1
 
 //used by incoherent_ht
Index: src/northbridge/amd/amdmct/wrappers/mcti_d.c
===================================================================
--- src/northbridge/amd/amdmct/wrappers/mcti_d.c        (Revision 6029)
+++ src/northbridge/amd/amdmct/wrappers/mcti_d.c        (Arbeitskopie)
@@ -32,7 +32,7 @@
                val = 1;
 #elif CONFIG_CPU_SOCKET_TYPE == 0x13   /* ASB2 */
                val = 4;
-//#elif SYSTEM_TYPE == MOBILE
+//#elif CONFIG_SYSTEM_TYPE_AMD == MOBILE
 //             val = 2;
 #endif
                break;
@@ -51,7 +51,7 @@
                val =  400;     /* 400MHz(DDR800) */
                break;
        case NV_ECC_CAP:
-#if SYSTEM_TYPE == SERVER
+#if CONFIG_SYSTEM_TYPE_AMD == SERVER
                val = 1;        /* memory bus ECC capable */
 #else
                val = 0;        /* memory bus ECC not capable */
@@ -142,21 +142,21 @@
 #endif
                break;
        case NV_ECC:
-#if (SYSTEM_TYPE == SERVER)
+#if (CONFIG_SYSTEM_TYPE_AMD == SERVER)
                val = 1;        /* Enable */
 #else
                val = 0;        /* Disable */
 #endif
                break;
        case NV_NBECC:
-#if (SYSTEM_TYPE == SERVER)
+#if (CONFIG_SYSTEM_TYPE_AMD == SERVER)
                val = 1;        /* Enable */
 #else
                val = 0;        /* Disable */
 #endif
                break;
        case NV_ChipKill:
-#if (SYSTEM_TYPE == SERVER)
+#if (CONFIG_SYSTEM_TYPE_AMD == SERVER)
                val = 1;        /* Enable */
 #else
                val = 0;        /* Disable */
Index: src/northbridge/amd/amdmct/wrappers/mcti.h
===================================================================
--- src/northbridge/amd/amdmct/wrappers/mcti.h  (Revision 6029)
+++ src/northbridge/amd/amdmct/wrappers/mcti.h  (Arbeitskopie)
@@ -36,15 +36,6 @@
 /*----------------------------------------------------------------------------
 COMMENT OUT ALL BUT 1
 ----------------------------------------------------------------------------*/
-#ifndef SYSTEM_TYPE
-#define    SYSTEM_TYPE     SERVER
-//#define    SYSTEM_TYPE     DESKTOP
-//#define    SYSTEM_TYPE     MOBILE
-#endif
-
-/*----------------------------------------------------------------------------
-COMMENT OUT ALL BUT 1
-----------------------------------------------------------------------------*/
 #define UMA_SUPPORT    0       /*Not supported */
 //#define UMA_SUPPORT  1       /*Supported */
 
Index: src/northbridge/amd/amdfam10/raminit_amdmct.c
===================================================================
--- src/northbridge/amd/amdfam10/raminit_amdmct.c       (Revision 6029)
+++ src/northbridge/amd/amdfam10/raminit_amdmct.c       (Arbeitskopie)
@@ -109,7 +109,7 @@
 #elif CONFIG_CPU_SOCKET_TYPE == 0x11
 //AM2
 #include "../amdmct/mct/mctardk4.c"
-//#elif SYSTEM_TYPE == MOBILE
+//#elif CONFIG_SYSTEM_TYPE_AMD == MOBILE
 //s1g1
 //#include "../amdmct/mct/mctardk5.c"
 #endif
-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to