summaryrefslogtreecommitdiffstats
path: root/src/mainboard
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2017-05-18 16:03:26 -0700
committerJulius Werner <jwerner@chromium.org>2017-06-13 20:53:09 +0200
commit01f9aa5e54cf55ecca1b35185373835e61f10615 (patch)
tree8cd1ecb517bd948ac2dc2616de789a84a999a911 /src/mainboard
parentd9762f70acc1cc2db5b3905756f5f5a995b9a21a (diff)
downloadcoreboot-01f9aa5e54cf55ecca1b35185373835e61f10615.tar.gz
coreboot-01f9aa5e54cf55ecca1b35185373835e61f10615.tar.bz2
coreboot-01f9aa5e54cf55ecca1b35185373835e61f10615.zip
Consolidate reset API, add generic reset_prepare mechanism
There are many good reasons why we may want to run some sort of generic callback before we're executing a reset. Unfortunateley, that is really hard right now: code that wants to reset simply calls the hard_reset() function (or one of its ill-differentiated cousins) which is directly implemented by a myriad of different mainboards, northbridges, SoCs, etc. More recent x86 SoCs have tried to solve the problem in their own little corner of soc/intel/common, but it's really something that would benefit all of coreboot. This patch expands the concept onto all boards: hard_reset() and friends get implemented in a generic location where they can run hooks before calling the platform-specific implementation that is now called do_hard_reset(). The existing Intel reset_prepare() gets generalized as soc_reset_prepare() (and other hooks for arch, mainboard, etc. can now easily be added later if necessary). We will also use this central point to ensure all platforms flush their cache before reset, which is generally useful for all cases where we're trying to persist information in RAM across reboots (like the new persistent CBMEM console does). Also remove cpu_reset() completely since it's not used anywhere and doesn't seem very useful compared to the others. Change-Id: I41b89ce4a923102f0748922496e1dd9bce8a610f Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/19789 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/asus/a8v-e_deluxe/romstage.c2
-rw-r--r--src/mainboard/asus/a8v-e_se/romstage.c2
-rw-r--r--src/mainboard/asus/k8v-x/romstage.c2
-rw-r--r--src/mainboard/asus/m2v-mx_se/romstage.c2
-rw-r--r--src/mainboard/asus/m2v/romstage.c2
-rw-r--r--src/mainboard/google/foster/reset.c3
-rw-r--r--src/mainboard/google/gale/reset.c2
-rw-r--r--src/mainboard/google/gru/reset.c4
-rw-r--r--src/mainboard/google/nyan/reset.c3
-rw-r--r--src/mainboard/google/nyan_big/reset.c3
-rw-r--r--src/mainboard/google/nyan_blaze/reset.c3
-rw-r--r--src/mainboard/google/purin/reset.c4
-rw-r--r--src/mainboard/google/rotor/reset.c2
-rw-r--r--src/mainboard/google/smaug/reset.c4
-rw-r--r--src/mainboard/google/storm/reset.c5
-rw-r--r--src/mainboard/google/veyron/reset.c3
-rw-r--r--src/mainboard/google/veyron_mickey/reset.c3
-rw-r--r--src/mainboard/google/veyron_rialto/reset.c4
18 files changed, 18 insertions, 35 deletions
diff --git a/src/mainboard/asus/a8v-e_deluxe/romstage.c b/src/mainboard/asus/a8v-e_deluxe/romstage.c
index 3601e50090c2..a19b46af26e7 100644
--- a/src/mainboard/asus/a8v-e_deluxe/romstage.c
+++ b/src/mainboard/asus/a8v-e_deluxe/romstage.c
@@ -55,7 +55,7 @@ int spd_read_byte(unsigned int device, unsigned int address)
}
#include <reset.h>
-void soft_reset(void)
+void do_soft_reset(void)
{
uint8_t tmp;
diff --git a/src/mainboard/asus/a8v-e_se/romstage.c b/src/mainboard/asus/a8v-e_se/romstage.c
index fdb8577a7218..706b8592b519 100644
--- a/src/mainboard/asus/a8v-e_se/romstage.c
+++ b/src/mainboard/asus/a8v-e_se/romstage.c
@@ -55,7 +55,7 @@ int spd_read_byte(unsigned device, unsigned address)
}
#include <reset.h>
-void soft_reset(void)
+void do_soft_reset(void)
{
uint8_t tmp;
diff --git a/src/mainboard/asus/k8v-x/romstage.c b/src/mainboard/asus/k8v-x/romstage.c
index f1477c3e2e34..1df033ad9046 100644
--- a/src/mainboard/asus/k8v-x/romstage.c
+++ b/src/mainboard/asus/k8v-x/romstage.c
@@ -53,7 +53,7 @@ int spd_read_byte(unsigned device, unsigned address)
}
#include <reset.h>
-void soft_reset(void)
+void do_soft_reset(void)
{
uint8_t tmp;
diff --git a/src/mainboard/asus/m2v-mx_se/romstage.c b/src/mainboard/asus/m2v-mx_se/romstage.c
index 7864f962741e..13113b401950 100644
--- a/src/mainboard/asus/m2v-mx_se/romstage.c
+++ b/src/mainboard/asus/m2v-mx_se/romstage.c
@@ -81,7 +81,7 @@ static void ldtstop_sb(void)
#include "cpu/amd/model_fxx/fidvid.c"
#include "northbridge/amd/amdk8/resourcemap.c"
-void soft_reset(void)
+void do_soft_reset(void)
{
uint8_t tmp;
diff --git a/src/mainboard/asus/m2v/romstage.c b/src/mainboard/asus/m2v/romstage.c
index 89948b7c7f9a..61d74886536a 100644
--- a/src/mainboard/asus/m2v/romstage.c
+++ b/src/mainboard/asus/m2v/romstage.c
@@ -64,7 +64,7 @@ int spd_read_byte(unsigned device, unsigned address)
#include "cpu/amd/model_fxx/fidvid.c"
#include "northbridge/amd/amdk8/resourcemap.c"
-void soft_reset(void)
+void do_soft_reset(void)
{
uint8_t tmp;
diff --git a/src/mainboard/google/foster/reset.c b/src/mainboard/google/foster/reset.c
index df16b78dae0e..1b9e9e9a3621 100644
--- a/src/mainboard/google/foster/reset.c
+++ b/src/mainboard/google/foster/reset.c
@@ -18,8 +18,7 @@
#include <gpio.h>
#include <reset.h>
-void hard_reset(void)
+void do_hard_reset(void)
{
gpio_output(GPIO(I5), 0);
- while(1);
}
diff --git a/src/mainboard/google/gale/reset.c b/src/mainboard/google/gale/reset.c
index d37051a9cbae..23d83bfdf372 100644
--- a/src/mainboard/google/gale/reset.c
+++ b/src/mainboard/google/gale/reset.c
@@ -19,7 +19,7 @@
#include <soc/iomap.h>
#include <reset.h>
-void hard_reset(void)
+void do_hard_reset(void)
{
/*
* At boot time the boot loaders would have set a magic cookie
diff --git a/src/mainboard/google/gru/reset.c b/src/mainboard/google/gru/reset.c
index bd06923532a0..0311d587c690 100644
--- a/src/mainboard/google/gru/reset.c
+++ b/src/mainboard/google/gru/reset.c
@@ -18,9 +18,7 @@
#include "board.h"
-void hard_reset(void)
+void do_hard_reset(void)
{
gpio_output(GPIO_RESET, 1);
- while (1)
- ;
}
diff --git a/src/mainboard/google/nyan/reset.c b/src/mainboard/google/nyan/reset.c
index 9612d56b3c68..ee36292f7027 100644
--- a/src/mainboard/google/nyan/reset.c
+++ b/src/mainboard/google/nyan/reset.c
@@ -17,8 +17,7 @@
#include <gpio.h>
#include <reset.h>
-void hard_reset(void)
+void do_hard_reset(void)
{
gpio_output(GPIO(I5), 0);
- while(1);
}
diff --git a/src/mainboard/google/nyan_big/reset.c b/src/mainboard/google/nyan_big/reset.c
index 9612d56b3c68..ee36292f7027 100644
--- a/src/mainboard/google/nyan_big/reset.c
+++ b/src/mainboard/google/nyan_big/reset.c
@@ -17,8 +17,7 @@
#include <gpio.h>
#include <reset.h>
-void hard_reset(void)
+void do_hard_reset(void)
{
gpio_output(GPIO(I5), 0);
- while(1);
}
diff --git a/src/mainboard/google/nyan_blaze/reset.c b/src/mainboard/google/nyan_blaze/reset.c
index 9612d56b3c68..ee36292f7027 100644
--- a/src/mainboard/google/nyan_blaze/reset.c
+++ b/src/mainboard/google/nyan_blaze/reset.c
@@ -17,8 +17,7 @@
#include <gpio.h>
#include <reset.h>
-void hard_reset(void)
+void do_hard_reset(void)
{
gpio_output(GPIO(I5), 0);
- while(1);
}
diff --git a/src/mainboard/google/purin/reset.c b/src/mainboard/google/purin/reset.c
index 549717502214..3667bbfa0762 100644
--- a/src/mainboard/google/purin/reset.c
+++ b/src/mainboard/google/purin/reset.c
@@ -15,8 +15,6 @@
#include <reset.h>
-void hard_reset(void)
+void do_hard_reset(void)
{
- while (1)
- ;
}
diff --git a/src/mainboard/google/rotor/reset.c b/src/mainboard/google/rotor/reset.c
index 37c2db7c19c3..fc97f2df685f 100644
--- a/src/mainboard/google/rotor/reset.c
+++ b/src/mainboard/google/rotor/reset.c
@@ -16,7 +16,7 @@
#include <reset.h>
#include <soc/reset.h>
-void hard_reset(void)
+void do_hard_reset(void)
{
mvmap2315_reset();
}
diff --git a/src/mainboard/google/smaug/reset.c b/src/mainboard/google/smaug/reset.c
index f87582901a4d..fc9a0b62145a 100644
--- a/src/mainboard/google/smaug/reset.c
+++ b/src/mainboard/google/smaug/reset.c
@@ -18,9 +18,7 @@
#include "gpio.h"
-void hard_reset(void)
+void do_hard_reset(void)
{
gpio_output(AP_SYS_RESET_L, 0);
- while (1)
- ;
}
diff --git a/src/mainboard/google/storm/reset.c b/src/mainboard/google/storm/reset.c
index 94dcd4befd14..d8f25274b164 100644
--- a/src/mainboard/google/storm/reset.c
+++ b/src/mainboard/google/storm/reset.c
@@ -37,12 +37,9 @@ static void wdog_reset(void)
write32(APCS_WDT0_BITE_TIME, RESET_WDT_BITE_TIME);
write32(APCS_WDT0_EN, 1);
write32(APCS_WDT0_CPU0_WDOG_EXPIRED_ENABLE, 1);
-
- for (;;)
- ;
}
-void hard_reset(void)
+void do_hard_reset(void)
{
wdog_reset();
}
diff --git a/src/mainboard/google/veyron/reset.c b/src/mainboard/google/veyron/reset.c
index 0d11e76f707b..a937aff65e0e 100644
--- a/src/mainboard/google/veyron/reset.c
+++ b/src/mainboard/google/veyron/reset.c
@@ -19,8 +19,7 @@
#include "board.h"
-void hard_reset(void)
+void do_hard_reset(void)
{
gpio_output(GPIO_RESET, 1);
- while (1);
}
diff --git a/src/mainboard/google/veyron_mickey/reset.c b/src/mainboard/google/veyron_mickey/reset.c
index 0d11e76f707b..a937aff65e0e 100644
--- a/src/mainboard/google/veyron_mickey/reset.c
+++ b/src/mainboard/google/veyron_mickey/reset.c
@@ -19,8 +19,7 @@
#include "board.h"
-void hard_reset(void)
+void do_hard_reset(void)
{
gpio_output(GPIO_RESET, 1);
- while (1);
}
diff --git a/src/mainboard/google/veyron_rialto/reset.c b/src/mainboard/google/veyron_rialto/reset.c
index cf3a6d8a2fa5..a937aff65e0e 100644
--- a/src/mainboard/google/veyron_rialto/reset.c
+++ b/src/mainboard/google/veyron_rialto/reset.c
@@ -19,9 +19,7 @@
#include "board.h"
-void hard_reset(void)
+void do_hard_reset(void)
{
gpio_output(GPIO_RESET, 1);
- while (1)
- ;
}