Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5688
-gerrit
commit 89955572d3bd686abb703861b392988042844564 Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Mon May 5 13:20:56 2014 +0300
AGESA: Use common GetBiosCallout()
Change-Id: I9c8f7cc98c65102486e17ec49fa2246211dffc4f Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/mainboard/amd/dinar/BiosCallOuts.c | 28 +++------------------ src/mainboard/amd/dinar/BiosCallOuts.h | 2 -- src/mainboard/amd/dinar/agesawrapper.h | 5 ---- src/mainboard/amd/inagua/BiosCallOuts.c | 22 +++------------- src/mainboard/amd/inagua/BiosCallOuts.h | 2 -- src/mainboard/amd/inagua/agesawrapper.h | 5 ---- src/mainboard/amd/olivehill/BiosCallOuts.c | 24 +++--------------- src/mainboard/amd/olivehill/BiosCallOuts.h | 2 -- src/mainboard/amd/olivehill/agesawrapper.h | 5 ---- src/mainboard/amd/parmer/BiosCallOuts.c | 24 +++--------------- src/mainboard/amd/parmer/BiosCallOuts.h | 2 -- src/mainboard/amd/parmer/agesawrapper.h | 5 ---- src/mainboard/amd/persimmon/BiosCallOuts.c | 26 +++---------------- src/mainboard/amd/persimmon/BiosCallOuts.h | 2 -- src/mainboard/amd/persimmon/agesawrapper.h | 5 ---- src/mainboard/amd/south_station/BiosCallOuts.c | 24 +++--------------- src/mainboard/amd/south_station/BiosCallOuts.h | 2 -- src/mainboard/amd/south_station/agesawrapper.h | 5 ---- src/mainboard/amd/thatcher/BiosCallOuts.c | 24 +++--------------- src/mainboard/amd/thatcher/BiosCallOuts.h | 2 -- src/mainboard/amd/thatcher/agesawrapper.h | 5 ---- src/mainboard/amd/torpedo/BiosCallOuts.c | 29 +++------------------- src/mainboard/amd/torpedo/BiosCallOuts.h | 2 -- src/mainboard/amd/torpedo/agesawrapper.h | 5 ---- src/mainboard/amd/union_station/BiosCallOuts.c | 24 +++--------------- src/mainboard/amd/union_station/BiosCallOuts.h | 2 -- src/mainboard/amd/union_station/agesawrapper.h | 5 ---- src/mainboard/asrock/e350m1/BiosCallOuts.c | 28 +++------------------ src/mainboard/asrock/e350m1/BiosCallOuts.h | 2 -- src/mainboard/asrock/e350m1/agesawrapper.h | 5 ---- src/mainboard/asrock/imb-a180/BiosCallOuts.c | 24 +++--------------- src/mainboard/asrock/imb-a180/BiosCallOuts.h | 2 -- src/mainboard/asrock/imb-a180/agesawrapper.h | 5 ---- src/mainboard/asus/f2a85-m/BiosCallOuts.c | 24 +++--------------- src/mainboard/asus/f2a85-m/BiosCallOuts.h | 2 -- src/mainboard/asus/f2a85-m/agesawrapper.h | 5 ---- src/mainboard/gizmosphere/gizmo/BiosCallOuts.c | 26 +++---------------- src/mainboard/gizmosphere/gizmo/BiosCallOuts.h | 2 -- src/mainboard/gizmosphere/gizmo/agesawrapper.h | 5 ---- src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c | 24 +++--------------- src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.h | 2 -- src/mainboard/hp/pavilion_m6_1035dx/agesawrapper.h | 5 ---- src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.c | 26 +++---------------- src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.h | 2 -- src/mainboard/jetway/nf81-t56n-lf/agesawrapper.h | 5 ---- .../lippert/frontrunner-af/BiosCallOuts.c | 26 +++---------------- .../lippert/frontrunner-af/BiosCallOuts.h | 2 -- .../lippert/frontrunner-af/agesawrapper.h | 5 ---- src/mainboard/lippert/toucan-af/BiosCallOuts.c | 26 +++---------------- src/mainboard/lippert/toucan-af/BiosCallOuts.h | 2 -- src/mainboard/lippert/toucan-af/agesawrapper.h | 5 ---- src/mainboard/supermicro/h8qgi/BiosCallOuts.c | 25 +++---------------- src/mainboard/supermicro/h8qgi/BiosCallOuts.h | 2 -- src/mainboard/supermicro/h8qgi/agesawrapper.h | 5 ---- src/mainboard/supermicro/h8scm/BiosCallOuts.c | 25 +++---------------- src/mainboard/supermicro/h8scm/BiosCallOuts.h | 2 -- src/mainboard/supermicro/h8scm/agesawrapper.h | 5 ---- src/mainboard/tyan/s8226/BiosCallOuts.c | 25 +++---------------- src/mainboard/tyan/s8226/BiosCallOuts.h | 2 -- src/mainboard/tyan/s8226/agesawrapper.h | 5 ---- src/northbridge/amd/agesa/def_callouts.c | 17 +++++++++++++ src/northbridge/amd/agesa/def_callouts.h | 11 ++++++++ 62 files changed, 88 insertions(+), 584 deletions(-)
diff --git a/src/mainboard/amd/dinar/BiosCallOuts.c b/src/mainboard/amd/dinar/BiosCallOuts.c index b3a145d..449f100 100644 --- a/src/mainboard/amd/dinar/BiosCallOuts.c +++ b/src/mainboard/amd/dinar/BiosCallOuts.c @@ -26,6 +26,7 @@ #include "SB700.h" #include <northbridge/amd/agesa/family15/dimmSpd.h> #include "OEM.h" /* SMBUS0_BASE_ADDRESS */ +#include <stdlib.h>
#ifndef SB_GPIO_REG01 #define SB_GPIO_REG01 1 @@ -88,7 +89,7 @@ static void restore_socket(void)
static AGESA_STATUS board_ReadSpd (UINT32 Func,UINT32 Data,VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -104,30 +105,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - { - break; - } - } - - if(i >= CallOutCount) - { - return AGESA_UNSUPPORTED; - } - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
static AGESA_STATUS board_ReadSpd (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/amd/dinar/BiosCallOuts.h b/src/mainboard/amd/dinar/BiosCallOuts.h index cc87813..2c86e2f 100644 --- a/src/mainboard/amd/dinar/BiosCallOuts.h +++ b/src/mainboard/amd/dinar/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family15/fam15_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#define SB_GPIO_REG02 2 #define SB_GPIO_REG09 9 diff --git a/src/mainboard/amd/dinar/agesawrapper.h b/src/mainboard/amd/dinar/agesawrapper.h index 091e015..186c9e3 100644 --- a/src/mainboard/amd/dinar/agesawrapper.h +++ b/src/mainboard/amd/dinar/agesawrapper.h @@ -99,11 +99,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/amd/inagua/BiosCallOuts.c b/src/mainboard/amd/inagua/BiosCallOuts.c index a764313..bb7c557 100644 --- a/src/mainboard/amd/inagua/BiosCallOuts.c +++ b/src/mainboard/amd/inagua/BiosCallOuts.c @@ -23,11 +23,12 @@ #include "heapManager.h" #include "SB800.h" #include <northbridge/amd/agesa/family14/dimmSpd.h> +#include <stdlib.h>
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr); static AGESA_STATUS board_GnbPcieSlotReset (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -42,24 +43,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - CalloutStatus = AGESA_UNSUPPORTED; - - for (i = 0; i < CallOutCount; i++) { - if (BiosCallouts[i].CalloutName == Func) { - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - return CalloutStatus; - } - } - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/* Call the host environment interface to provide a user hook opportunity. */ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/amd/inagua/BiosCallOuts.h b/src/mainboard/amd/inagua/BiosCallOuts.h index 6dbd4c9..0c0d4aa 100644 --- a/src/mainboard/amd/inagua/BiosCallOuts.h +++ b/src/mainboard/amd/inagua/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family14/fam14_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#define SB_GPIO_REG02 2 #define SB_GPIO_REG09 9 diff --git a/src/mainboard/amd/inagua/agesawrapper.h b/src/mainboard/amd/inagua/agesawrapper.h index 31f22c1..2055089 100644 --- a/src/mainboard/amd/inagua/agesawrapper.h +++ b/src/mainboard/amd/inagua/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/amd/olivehill/BiosCallOuts.c b/src/mainboard/amd/olivehill/BiosCallOuts.c index 373b376..ae27bc4 100644 --- a/src/mainboard/amd/olivehill/BiosCallOuts.c +++ b/src/mainboard/amd/olivehill/BiosCallOuts.c @@ -28,8 +28,9 @@ #if IS_ENABLED(CONFIG_HUDSON_IMC_FWM) #include "imc.h" #endif +#include <stdlib.h>
-STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, fam16kb_AllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, fam16kb_DeallocateBuffer }, @@ -44,26 +45,7 @@ STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config }, {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage } }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - break; - } - - if(i >= CallOutCount) - return AGESA_UNSUPPORTED; - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/** * AMD Olivehill Platform ALC272 Verb Table diff --git a/src/mainboard/amd/olivehill/BiosCallOuts.h b/src/mainboard/amd/olivehill/BiosCallOuts.h index 7490b66..2b8aae2 100644 --- a/src/mainboard/amd/olivehill/BiosCallOuts.h +++ b/src/mainboard/amd/olivehill/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family16kb/fam16kb_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
/* FCH OEM Config*/ AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr); diff --git a/src/mainboard/amd/olivehill/agesawrapper.h b/src/mainboard/amd/olivehill/agesawrapper.h index 579350f..68cb661 100644 --- a/src/mainboard/amd/olivehill/agesawrapper.h +++ b/src/mainboard/amd/olivehill/agesawrapper.h @@ -54,11 +54,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/amd/parmer/BiosCallOuts.c b/src/mainboard/amd/parmer/BiosCallOuts.c index 985daa7..1b83ae1 100644 --- a/src/mainboard/amd/parmer/BiosCallOuts.c +++ b/src/mainboard/amd/parmer/BiosCallOuts.c @@ -28,8 +28,9 @@ #if IS_ENABLED(CONFIG_HUDSON_IMC_FWM) #include "imc.h" #endif +#include <stdlib.h>
-STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, fam15tn_AllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, fam15tn_DeallocateBuffer }, @@ -44,26 +45,7 @@ STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config }, {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage } }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - break; - } - - if(i >= CallOutCount) - return AGESA_UNSUPPORTED; - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/** * AMD Parmer Platform ALC272 Verb Table diff --git a/src/mainboard/amd/parmer/BiosCallOuts.h b/src/mainboard/amd/parmer/BiosCallOuts.h index 7ccb07a..54d15cc 100644 --- a/src/mainboard/amd/parmer/BiosCallOuts.h +++ b/src/mainboard/amd/parmer/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family15tn/fam15tn_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
/* FCH OEM Config*/ AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr); diff --git a/src/mainboard/amd/parmer/agesawrapper.h b/src/mainboard/amd/parmer/agesawrapper.h index 579350f..68cb661 100644 --- a/src/mainboard/amd/parmer/agesawrapper.h +++ b/src/mainboard/amd/parmer/agesawrapper.h @@ -54,11 +54,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/amd/persimmon/BiosCallOuts.c b/src/mainboard/amd/persimmon/BiosCallOuts.c index 74e2a7e..f19fb88 100644 --- a/src/mainboard/amd/persimmon/BiosCallOuts.c +++ b/src/mainboard/amd/persimmon/BiosCallOuts.c @@ -23,11 +23,12 @@ #include "heapManager.h" #include "SB800.h" #include <northbridge/amd/agesa/family14/dimmSpd.h> +#include <stdlib.h>
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr); static AGESA_STATUS board_GnbPcieSlotReset (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -42,28 +43,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - /* - * printk(BIOS_SPEW,"%s function: %x\n", __func__, (u32) Func); - */ - - CalloutStatus = AGESA_UNSUPPORTED; - - for (i = 0; i < CallOutCount; i++) { - if (BiosCallouts[i].CalloutName == Func) { - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - return CalloutStatus; - } - } - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/* Call the host environment interface to provide a user hook opportunity. */ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/amd/persimmon/BiosCallOuts.h b/src/mainboard/amd/persimmon/BiosCallOuts.h index 27ac074..1cb5006 100644 --- a/src/mainboard/amd/persimmon/BiosCallOuts.h +++ b/src/mainboard/amd/persimmon/BiosCallOuts.h @@ -23,7 +23,5 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family14/fam14_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#endif //_BIOS_CALLOUT_H_ diff --git a/src/mainboard/amd/persimmon/agesawrapper.h b/src/mainboard/amd/persimmon/agesawrapper.h index 3764ab0..8cdb71e 100644 --- a/src/mainboard/amd/persimmon/agesawrapper.h +++ b/src/mainboard/amd/persimmon/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/amd/south_station/BiosCallOuts.c b/src/mainboard/amd/south_station/BiosCallOuts.c index 219a0a8..18985aa 100644 --- a/src/mainboard/amd/south_station/BiosCallOuts.c +++ b/src/mainboard/amd/south_station/BiosCallOuts.c @@ -23,11 +23,12 @@ #include "heapManager.h" #include "SB800.h" #include <northbridge/amd/agesa/family14/dimmSpd.h> +#include <stdlib.h>
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr); static AGESA_STATUS board_GnbPcieSlotReset (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -42,26 +43,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - CalloutStatus = AGESA_UNSUPPORTED; - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - { - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - return CalloutStatus; - } - } - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/* Call the host environment interface to provide a user hook opportunity. */ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/amd/south_station/BiosCallOuts.h b/src/mainboard/amd/south_station/BiosCallOuts.h index 6dbd4c9..0c0d4aa 100644 --- a/src/mainboard/amd/south_station/BiosCallOuts.h +++ b/src/mainboard/amd/south_station/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family14/fam14_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#define SB_GPIO_REG02 2 #define SB_GPIO_REG09 9 diff --git a/src/mainboard/amd/south_station/agesawrapper.h b/src/mainboard/amd/south_station/agesawrapper.h index b02fd5e..2d3e2f1 100644 --- a/src/mainboard/amd/south_station/agesawrapper.h +++ b/src/mainboard/amd/south_station/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/amd/thatcher/BiosCallOuts.c b/src/mainboard/amd/thatcher/BiosCallOuts.c index dfad5fb..f7aa16d 100644 --- a/src/mainboard/amd/thatcher/BiosCallOuts.c +++ b/src/mainboard/amd/thatcher/BiosCallOuts.c @@ -28,8 +28,9 @@ #if IS_ENABLED(CONFIG_HUDSON_IMC_FWM) #include "imc.h" #endif +#include <stdlib.h>
-STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, fam15tn_AllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, fam15tn_DeallocateBuffer }, @@ -44,26 +45,7 @@ STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config }, {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage } }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - break; - } - - if(i >= CallOutCount) - return AGESA_UNSUPPORTED; - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/** * AMD Thatcher Platform ALC272 Verb Table diff --git a/src/mainboard/amd/thatcher/BiosCallOuts.h b/src/mainboard/amd/thatcher/BiosCallOuts.h index 7ccb07a..54d15cc 100644 --- a/src/mainboard/amd/thatcher/BiosCallOuts.h +++ b/src/mainboard/amd/thatcher/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family15tn/fam15tn_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
/* FCH OEM Config*/ AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr); diff --git a/src/mainboard/amd/thatcher/agesawrapper.h b/src/mainboard/amd/thatcher/agesawrapper.h index 579350f..68cb661 100644 --- a/src/mainboard/amd/thatcher/agesawrapper.h +++ b/src/mainboard/amd/thatcher/agesawrapper.h @@ -54,11 +54,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/amd/torpedo/BiosCallOuts.c b/src/mainboard/amd/torpedo/BiosCallOuts.c index 6c170f3..71010ca 100644 --- a/src/mainboard/amd/torpedo/BiosCallOuts.c +++ b/src/mainboard/amd/torpedo/BiosCallOuts.c @@ -24,6 +24,7 @@ #include "OptionsIds.h" #include "heapManager.h" #include "Hudson-2.h" +#include <stdlib.h>
#ifndef SB_GPIO_REG01 #define SB_GPIO_REG01 1 @@ -40,7 +41,7 @@ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr); static AGESA_STATUS board_GnbPcieSlotReset (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -56,31 +57,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - { - break; - } - } - - if(i >= CallOutCount) - { - return AGESA_UNSUPPORTED; - } - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} - +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/* Call the host environment interface to provide a user hook opportunity. */ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/amd/torpedo/BiosCallOuts.h b/src/mainboard/amd/torpedo/BiosCallOuts.h index c1e1ed3..71d7655 100644 --- a/src/mainboard/amd/torpedo/BiosCallOuts.h +++ b/src/mainboard/amd/torpedo/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family12/fam12_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
// These registers are not defined in cimx/SB900/Hudson-2.h #define SB_GPIO_REG02 2 diff --git a/src/mainboard/amd/torpedo/agesawrapper.h b/src/mainboard/amd/torpedo/agesawrapper.h index dd79f28..58f5a98 100644 --- a/src/mainboard/amd/torpedo/agesawrapper.h +++ b/src/mainboard/amd/torpedo/agesawrapper.h @@ -98,11 +98,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/amd/union_station/BiosCallOuts.c b/src/mainboard/amd/union_station/BiosCallOuts.c index 219a0a8..18985aa 100644 --- a/src/mainboard/amd/union_station/BiosCallOuts.c +++ b/src/mainboard/amd/union_station/BiosCallOuts.c @@ -23,11 +23,12 @@ #include "heapManager.h" #include "SB800.h" #include <northbridge/amd/agesa/family14/dimmSpd.h> +#include <stdlib.h>
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr); static AGESA_STATUS board_GnbPcieSlotReset (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -42,26 +43,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - CalloutStatus = AGESA_UNSUPPORTED; - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - { - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - return CalloutStatus; - } - } - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/* Call the host environment interface to provide a user hook opportunity. */ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/amd/union_station/BiosCallOuts.h b/src/mainboard/amd/union_station/BiosCallOuts.h index 6dbd4c9..0c0d4aa 100644 --- a/src/mainboard/amd/union_station/BiosCallOuts.h +++ b/src/mainboard/amd/union_station/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family14/fam14_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#define SB_GPIO_REG02 2 #define SB_GPIO_REG09 9 diff --git a/src/mainboard/amd/union_station/agesawrapper.h b/src/mainboard/amd/union_station/agesawrapper.h index b02fd5e..2d3e2f1 100644 --- a/src/mainboard/amd/union_station/agesawrapper.h +++ b/src/mainboard/amd/union_station/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/asrock/e350m1/BiosCallOuts.c b/src/mainboard/asrock/e350m1/BiosCallOuts.c index 7525cbc..97e282b 100644 --- a/src/mainboard/asrock/e350m1/BiosCallOuts.c +++ b/src/mainboard/asrock/e350m1/BiosCallOuts.c @@ -23,6 +23,7 @@ #include "heapManager.h" #include "SB800.h" #include <northbridge/amd/agesa/family14/dimmSpd.h> +#include <stdlib.h>
/* Should AGESA_GNB_PCIE_SLOT_RESET use agesa_NoopSuccess? * @@ -32,7 +33,7 @@
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -46,30 +47,7 @@ CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, {AGESA_GNB_PCIE_SLOT_RESET, agesa_NoopUnsupported }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - { - break; - } - } - - if(i >= CallOutCount) - { - return AGESA_UNSUPPORTED; - } - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/* Call the host environment interface to provide a user hook opportunity. */ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/asrock/e350m1/BiosCallOuts.h b/src/mainboard/asrock/e350m1/BiosCallOuts.h index 27ac074..1cb5006 100644 --- a/src/mainboard/asrock/e350m1/BiosCallOuts.h +++ b/src/mainboard/asrock/e350m1/BiosCallOuts.h @@ -23,7 +23,5 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family14/fam14_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#endif //_BIOS_CALLOUT_H_ diff --git a/src/mainboard/asrock/e350m1/agesawrapper.h b/src/mainboard/asrock/e350m1/agesawrapper.h index dee4224..10158f6 100644 --- a/src/mainboard/asrock/e350m1/agesawrapper.h +++ b/src/mainboard/asrock/e350m1/agesawrapper.h @@ -57,11 +57,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/asrock/imb-a180/BiosCallOuts.c b/src/mainboard/asrock/imb-a180/BiosCallOuts.c index f262b29..43d99bc 100644 --- a/src/mainboard/asrock/imb-a180/BiosCallOuts.c +++ b/src/mainboard/asrock/imb-a180/BiosCallOuts.c @@ -26,8 +26,9 @@ #include "heapManager.h" #include "FchPlatform.h" #include "cbfs.h" +#include <stdlib.h>
-STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, fam16kb_AllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, fam16kb_DeallocateBuffer }, @@ -42,26 +43,7 @@ STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config }, {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage } }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - break; - } - - if(i >= CallOutCount) - return AGESA_UNSUPPORTED; - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/** * CODEC Initialization Table for Azalia HD Audio using Realtek ALC662 chip diff --git a/src/mainboard/asrock/imb-a180/BiosCallOuts.h b/src/mainboard/asrock/imb-a180/BiosCallOuts.h index 7490b66..2b8aae2 100644 --- a/src/mainboard/asrock/imb-a180/BiosCallOuts.h +++ b/src/mainboard/asrock/imb-a180/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family16kb/fam16kb_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
/* FCH OEM Config*/ AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr); diff --git a/src/mainboard/asrock/imb-a180/agesawrapper.h b/src/mainboard/asrock/imb-a180/agesawrapper.h index 32b24cb..8589db5 100644 --- a/src/mainboard/asrock/imb-a180/agesawrapper.h +++ b/src/mainboard/asrock/imb-a180/agesawrapper.h @@ -54,11 +54,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/asus/f2a85-m/BiosCallOuts.c b/src/mainboard/asus/f2a85-m/BiosCallOuts.c index 6bcc180..68da196 100644 --- a/src/mainboard/asus/f2a85-m/BiosCallOuts.c +++ b/src/mainboard/asus/f2a85-m/BiosCallOuts.c @@ -23,8 +23,9 @@
#include <cbfs.h> #include <vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h> +#include <stdlib.h>
-STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, fam15tn_AllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, fam15tn_DeallocateBuffer }, @@ -39,26 +40,7 @@ STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config }, {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage } }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - break; - } - - if(i >= CallOutCount) - return AGESA_UNSUPPORTED; - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/** * ASUS F2A85-M board ALC887-VD Verb Table diff --git a/src/mainboard/asus/f2a85-m/BiosCallOuts.h b/src/mainboard/asus/f2a85-m/BiosCallOuts.h index 7ccb07a..54d15cc 100644 --- a/src/mainboard/asus/f2a85-m/BiosCallOuts.h +++ b/src/mainboard/asus/f2a85-m/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family15tn/fam15tn_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
/* FCH OEM Config*/ AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr); diff --git a/src/mainboard/asus/f2a85-m/agesawrapper.h b/src/mainboard/asus/f2a85-m/agesawrapper.h index 71f0ff6..4ae226d 100644 --- a/src/mainboard/asus/f2a85-m/agesawrapper.h +++ b/src/mainboard/asus/f2a85-m/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/gizmosphere/gizmo/BiosCallOuts.c b/src/mainboard/gizmosphere/gizmo/BiosCallOuts.c index 94a3a9e..481bbf6 100755 --- a/src/mainboard/gizmosphere/gizmo/BiosCallOuts.c +++ b/src/mainboard/gizmosphere/gizmo/BiosCallOuts.c @@ -23,6 +23,7 @@ #include "BiosCallOuts.h" #include "heapManager.h" #include "SB800.h" +#include <stdlib.h> #include <cbfs.h> #include <string.h> #include <device/dram/ddr3.h> @@ -33,7 +34,7 @@
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -48,28 +49,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - /* - * printk(BIOS_SPEW,"%s function: %x\n", __func__, (u32) Func); - */ - - CalloutStatus = AGESA_UNSUPPORTED; - - for (i = 0; i < CallOutCount; i++) { - if (BiosCallouts[i].CalloutName == Func) { - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - return CalloutStatus; - } - } - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
AGESA_STATUS BiosReadSpd_from_cbfs(UINT32 Func, UINT32 Data, VOID *ConfigPtr) { diff --git a/src/mainboard/gizmosphere/gizmo/BiosCallOuts.h b/src/mainboard/gizmosphere/gizmo/BiosCallOuts.h index 62faa05..2743ae2 100755 --- a/src/mainboard/gizmosphere/gizmo/BiosCallOuts.h +++ b/src/mainboard/gizmosphere/gizmo/BiosCallOuts.h @@ -24,7 +24,5 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family14/fam14_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#endif //_BIOS_CALLOUT_H_ diff --git a/src/mainboard/gizmosphere/gizmo/agesawrapper.h b/src/mainboard/gizmosphere/gizmo/agesawrapper.h index 511df26..871982a 100755 --- a/src/mainboard/gizmosphere/gizmo/agesawrapper.h +++ b/src/mainboard/gizmosphere/gizmo/agesawrapper.h @@ -54,11 +54,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c b/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c index 79faf7b..7a7985d 100644 --- a/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c +++ b/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.c @@ -24,8 +24,9 @@ #include <cbfs.h> #include <southbridge/amd/agesa/hudson/imc.h> #include <vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h> +#include <stdlib.h>
-STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, fam15tn_AllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, fam15tn_DeallocateBuffer }, @@ -40,26 +41,7 @@ STATIC CONST BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config }, {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage } }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) - { - if (BiosCallouts[i].CalloutName == Func) - break; - } - - if(i >= CallOutCount) - return AGESA_UNSUPPORTED; - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/** * AMD Parmer Platform ALC272 Verb Table diff --git a/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.h b/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.h index 7ccb07a..54d15cc 100644 --- a/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.h +++ b/src/mainboard/hp/pavilion_m6_1035dx/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family15tn/fam15tn_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
/* FCH OEM Config*/ AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr); diff --git a/src/mainboard/hp/pavilion_m6_1035dx/agesawrapper.h b/src/mainboard/hp/pavilion_m6_1035dx/agesawrapper.h index e5f028a..317e5e8 100644 --- a/src/mainboard/hp/pavilion_m6_1035dx/agesawrapper.h +++ b/src/mainboard/hp/pavilion_m6_1035dx/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.c b/src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.c index fb0d2f0..9bc956e 100644 --- a/src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.c +++ b/src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.c @@ -25,10 +25,11 @@ #include <vendorcode/amd/agesa/f14/Proc/CPU/heapManager.h> #include <vendorcode/amd/cimx/sb800/SB800.h> #include <stdint.h> +#include <stdlib.h>
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -43,28 +44,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - size_t i; - AGESA_STATUS CalloutStatus; - size_t CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - /* - * printk(BIOS_SPEW,"%s function: %x\n", __func__, (u32) Func); - */ - - CalloutStatus = AGESA_UNSUPPORTED; - - for (i = 0; i < CallOutCount; i++) { - if (BiosCallouts[i].CalloutName == Func) { - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - return CalloutStatus; - } - } - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/* Call the host environment interface to provide a user hook opportunity. */ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.h b/src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.h index 27ac074..1cb5006 100644 --- a/src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.h +++ b/src/mainboard/jetway/nf81-t56n-lf/BiosCallOuts.h @@ -23,7 +23,5 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family14/fam14_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#endif //_BIOS_CALLOUT_H_ diff --git a/src/mainboard/jetway/nf81-t56n-lf/agesawrapper.h b/src/mainboard/jetway/nf81-t56n-lf/agesawrapper.h index 32ae13e..720f3be 100644 --- a/src/mainboard/jetway/nf81-t56n-lf/agesawrapper.h +++ b/src/mainboard/jetway/nf81-t56n-lf/agesawrapper.h @@ -41,11 +41,6 @@ enum { PICK_ALIB, /**< SACPI SSDT table with ALIB implementation */ };
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; -
AGESA_STATUS agesawrapper_amdinitreset(void); AGESA_STATUS agesawrapper_amdinitearly(void); diff --git a/src/mainboard/lippert/frontrunner-af/BiosCallOuts.c b/src/mainboard/lippert/frontrunner-af/BiosCallOuts.c index cc5043a..7485b0a 100644 --- a/src/mainboard/lippert/frontrunner-af/BiosCallOuts.c +++ b/src/mainboard/lippert/frontrunner-af/BiosCallOuts.c @@ -22,6 +22,7 @@ #include "BiosCallOuts.h" #include "heapManager.h" #include <northbridge/amd/agesa/family14/dimmSpd.h> +#include <stdlib.h>
/* Should AGESA_GNB_PCIE_SLOT_RESET use agesa_NoopSuccess? * @@ -30,7 +31,7 @@
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -45,28 +46,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - /* - * printk(BIOS_SPEW,"%s function: %x\n", __func__, (u32) Func); - */ - - CalloutStatus = AGESA_UNSUPPORTED; - - for (i = 0; i < CallOutCount; i++) { - if (BiosCallouts[i].CalloutName == Func) { - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - return CalloutStatus; - } - } - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/* Call the host environment interface to provide a user hook opportunity. */ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/lippert/frontrunner-af/BiosCallOuts.h b/src/mainboard/lippert/frontrunner-af/BiosCallOuts.h index 0e5c3b6..4135040 100644 --- a/src/mainboard/lippert/frontrunner-af/BiosCallOuts.h +++ b/src/mainboard/lippert/frontrunner-af/BiosCallOuts.h @@ -24,8 +24,6 @@ #include <northbridge/amd/agesa/family14/fam14_callouts.h> #include "SB800.h"
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
/* FCH GPIO access helpers */ #define FCH_IOMUX(gpio_nr) (*(u8*)(ACPI_MMIO_BASE+IOMUX_BASE+(gpio_nr))) diff --git a/src/mainboard/lippert/frontrunner-af/agesawrapper.h b/src/mainboard/lippert/frontrunner-af/agesawrapper.h index 3764ab0..8cdb71e 100644 --- a/src/mainboard/lippert/frontrunner-af/agesawrapper.h +++ b/src/mainboard/lippert/frontrunner-af/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/lippert/toucan-af/BiosCallOuts.c b/src/mainboard/lippert/toucan-af/BiosCallOuts.c index bd229b1..3d1a3fc 100644 --- a/src/mainboard/lippert/toucan-af/BiosCallOuts.c +++ b/src/mainboard/lippert/toucan-af/BiosCallOuts.c @@ -22,6 +22,7 @@ #include "BiosCallOuts.h" #include "heapManager.h" #include <northbridge/amd/agesa/family14/dimmSpd.h> +#include <stdlib.h>
/* Should AGESA_GNB_PCIE_SLOT_RESET use agesa_NoopSuccess? * @@ -31,7 +32,7 @@
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -46,28 +47,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - /* - * printk(BIOS_SPEW,"%s function: %x\n", __func__, (u32) Func); - */ - - CalloutStatus = AGESA_UNSUPPORTED; - - for (i = 0; i < CallOutCount; i++) { - if (BiosCallouts[i].CalloutName == Func) { - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - return CalloutStatus; - } - } - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
/* Call the host environment interface to provide a user hook opportunity. */ static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr) diff --git a/src/mainboard/lippert/toucan-af/BiosCallOuts.h b/src/mainboard/lippert/toucan-af/BiosCallOuts.h index 7065e57..c0463a8 100644 --- a/src/mainboard/lippert/toucan-af/BiosCallOuts.h +++ b/src/mainboard/lippert/toucan-af/BiosCallOuts.h @@ -24,8 +24,6 @@ #include <northbridge/amd/agesa/family14/fam14_callouts.h> #include "SB800.h"
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
/* FCH GPIO access helpers */ #define FCH_IOMUX(gpio_nr) (*(u8*)(ACPI_MMIO_BASE+IOMUX_BASE+(gpio_nr))) diff --git a/src/mainboard/lippert/toucan-af/agesawrapper.h b/src/mainboard/lippert/toucan-af/agesawrapper.h index 3764ab0..8cdb71e 100644 --- a/src/mainboard/lippert/toucan-af/agesawrapper.h +++ b/src/mainboard/lippert/toucan-af/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/supermicro/h8qgi/BiosCallOuts.c b/src/mainboard/supermicro/h8qgi/BiosCallOuts.c index 100634b..955e438 100644 --- a/src/mainboard/supermicro/h8qgi/BiosCallOuts.c +++ b/src/mainboard/supermicro/h8qgi/BiosCallOuts.c @@ -73,7 +73,8 @@ static void restore_socket(UINT8 original_value)
static AGESA_STATUS board_ReadSpd (UINT32 Func,UINT32 Data,VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +#include <stdlib.h> +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -87,27 +88,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DRAM_INIT, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) { - if (BiosCallouts[i].CalloutName == Func) { - break; - } - } - - if(i >= CallOutCount) { - return AGESA_UNSUPPORTED; - } - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
static AGESA_STATUS board_ReadSpd (UINT32 Func, UINT32 Data, VOID *ConfigPtr) { diff --git a/src/mainboard/supermicro/h8qgi/BiosCallOuts.h b/src/mainboard/supermicro/h8qgi/BiosCallOuts.h index f733c3f..c53a687 100644 --- a/src/mainboard/supermicro/h8qgi/BiosCallOuts.h +++ b/src/mainboard/supermicro/h8qgi/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family15/fam15_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#define SB_GPIO_REG02 2 #define SB_GPIO_REG09 9 diff --git a/src/mainboard/supermicro/h8qgi/agesawrapper.h b/src/mainboard/supermicro/h8qgi/agesawrapper.h index 7abf826..4f5a693 100644 --- a/src/mainboard/supermicro/h8qgi/agesawrapper.h +++ b/src/mainboard/supermicro/h8qgi/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr)(UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/supermicro/h8scm/BiosCallOuts.c b/src/mainboard/supermicro/h8scm/BiosCallOuts.c index 8e9aff5..90d7892 100644 --- a/src/mainboard/supermicro/h8scm/BiosCallOuts.c +++ b/src/mainboard/supermicro/h8scm/BiosCallOuts.c @@ -24,8 +24,9 @@ #include "OptionsIds.h" #include "heapManager.h" #include <northbridge/amd/agesa/family15/dimmSpd.h> +#include <stdlib.h>
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -39,27 +40,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DRAM_INIT, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) { - if (BiosCallouts[i].CalloutName == Func) { - break; - } - } - - if(i >= CallOutCount) { - return AGESA_UNSUPPORTED; - } - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
diff --git a/src/mainboard/supermicro/h8scm/BiosCallOuts.h b/src/mainboard/supermicro/h8scm/BiosCallOuts.h index e3935d2..30b66f4 100644 --- a/src/mainboard/supermicro/h8scm/BiosCallOuts.h +++ b/src/mainboard/supermicro/h8scm/BiosCallOuts.h @@ -23,7 +23,5 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family15/fam15_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#endif //_BIOS_CALLOUT_H_ diff --git a/src/mainboard/supermicro/h8scm/agesawrapper.h b/src/mainboard/supermicro/h8scm/agesawrapper.h index 7abf826..4f5a693 100644 --- a/src/mainboard/supermicro/h8scm/agesawrapper.h +++ b/src/mainboard/supermicro/h8scm/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr)(UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/mainboard/tyan/s8226/BiosCallOuts.c b/src/mainboard/tyan/s8226/BiosCallOuts.c index cc51280..9bb47a4 100644 --- a/src/mainboard/tyan/s8226/BiosCallOuts.c +++ b/src/mainboard/tyan/s8226/BiosCallOuts.c @@ -25,6 +25,7 @@ #include "heapManager.h" #include <northbridge/amd/agesa/family15/dimmSpd.h> #include <arch/io.h> +#include <stdlib.h>
#ifdef __PRE_RAM__ /* These defines are used to select the appropriate socket for the SPD read @@ -81,7 +82,7 @@ static void restore_socket(UINT8 original_value)
static AGESA_STATUS board_ReadSpd (UINT32 Func,UINT32 Data, VOID *ConfigPtr);
-STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = +const BIOS_CALLOUT_STRUCT BiosCallouts[] = { {AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer }, {AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer }, @@ -95,27 +96,7 @@ STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] = {AGESA_HOOKBEFORE_DRAM_INIT, agesa_NoopSuccess }, {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, }; - -AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) -{ - UINTN i; - AGESA_STATUS CalloutStatus; - UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]); - - for (i = 0; i < CallOutCount; i++) { - if (BiosCallouts[i].CalloutName == Func) { - break; - } - } - - if(i >= CallOutCount) { - return AGESA_UNSUPPORTED; - } - - CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); - - return CalloutStatus; -} +const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
static AGESA_STATUS board_ReadSpd (UINT32 Func, UINT32 Data, VOID *ConfigPtr) { diff --git a/src/mainboard/tyan/s8226/BiosCallOuts.h b/src/mainboard/tyan/s8226/BiosCallOuts.h index f733c3f..c53a687 100644 --- a/src/mainboard/tyan/s8226/BiosCallOuts.h +++ b/src/mainboard/tyan/s8226/BiosCallOuts.h @@ -23,8 +23,6 @@ #include <northbridge/amd/agesa/def_callouts.h> #include <northbridge/amd/agesa/family15/fam15_callouts.h>
-/* CALLOUT Initialization */ -AGESA_STATUS GetBiosCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr);
#define SB_GPIO_REG02 2 #define SB_GPIO_REG09 9 diff --git a/src/mainboard/tyan/s8226/agesawrapper.h b/src/mainboard/tyan/s8226/agesawrapper.h index 7abf826..4f5a693 100644 --- a/src/mainboard/tyan/s8226/agesawrapper.h +++ b/src/mainboard/tyan/s8226/agesawrapper.h @@ -53,11 +53,6 @@ enum { *---------------------------------------------------------------------------------------- */
-typedef struct { - UINT32 CalloutName; - AGESA_STATUS (*CalloutPtr)(UINT32 Func, UINT32 Data, VOID* ConfigPtr); -} BIOS_CALLOUT_STRUCT; - /*---------------------------------------------------------------------------------------- * P R O T O T Y P E S O F L O C A L F U N C T I O N S *---------------------------------------------------------------------------------------- diff --git a/src/northbridge/amd/agesa/def_callouts.c b/src/northbridge/amd/agesa/def_callouts.c index 44de4ef..2647847 100644 --- a/src/northbridge/amd/agesa/def_callouts.c +++ b/src/northbridge/amd/agesa/def_callouts.c @@ -23,6 +23,23 @@ #include <cbfs.h> #include "def_callouts.h"
+ +AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) +{ + UINTN i; + + for (i = 0; i < BiosCalloutsLen; i++) { + if (BiosCallouts[i].CalloutName == Func) + break; + } + if(i >= BiosCalloutsLen) + return AGESA_UNSUPPORTED; + + return BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr); +} + + + AGESA_STATUS agesa_NoopUnsupported (UINT32 Func, UINT32 Data, VOID *ConfigPtr) { return AGESA_UNSUPPORTED; diff --git a/src/northbridge/amd/agesa/def_callouts.h b/src/northbridge/amd/agesa/def_callouts.h index b540bdd..3b14cbf 100644 --- a/src/northbridge/amd/agesa/def_callouts.h +++ b/src/northbridge/amd/agesa/def_callouts.h @@ -21,6 +21,7 @@ #ifndef CALLOUTS_AMD_AGESA_H #define CALLOUTS_AMD_AGESA_H
+#include "agesawrapper.h" #include "Porting.h" #include "AGESA.h"
@@ -32,4 +33,14 @@ AGESA_STATUS agesa_Reset (UINT32 Func, UINT32 Data, VOID *ConfigPtr); AGESA_STATUS agesa_RunFuncOnAp (UINT32 Func, UINT32 Data, VOID *ConfigPtr); AGESA_STATUS agesa_GfxGetVbiosImage(UINT32 Func, UINT32 FchData, VOID *ConfigPrt);
+AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr); + +typedef struct { + UINT32 CalloutName; + AGESA_STATUS (*CalloutPtr) (UINT32 Func, UINT32 Data, VOID* ConfigPtr); +} BIOS_CALLOUT_STRUCT; + +extern const BIOS_CALLOUT_STRUCT BiosCallouts[]; +extern const int BiosCalloutsLen; + #endif /* CALLOUTS_AMD_AGESA_H */