mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-28 01:51:33 +00:00
Pull request for UEFI system for v2019.04-rc4
Fix an error with the serial communication on boards with a very small UART buffer which leads to a stalled system. Provide an X86 reset driver for the UEFI runtime. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAlyGptwACgkQxIHbvCwF GsSqfA//dksWFGNu1y2qdOjItq5wb/sEIVuL/C+5EV672KILDLgmPssJ4IgjbxG+ KfZF6xj+1uWvSH8d7Yyz9zUvNRlSijtUFE8Aze20JLuriiz51nMDuqsC37l6OFHS Yu3vtq+scIgA2+AHPgDPBLwZh0v4KrpazZfrQ8yT8cu0YK+t+xguYBGTvPhRPmYz wiOscD3xl5bGpBztEwUUiFf6A3DmoYjJLwlEeMVdjT0OaexMnQjUEkyDQZm9eivR ak352RDUtBGQZZcVwe91LlzKRKmlKgZ2Z5+3FJ1kTUVzTv3gsJnAISQJ/FE5Tj9q L1Y/69cpK+2xZiXWi48WT8V3WCMVQYOi7tG/7USfx/aGCiLx7piy4nQyXNH2H4DQ KGCTZSorl7NxLZj0OXuAB82RWBpM1EIIrHXSBbwxYNha2fCRl67DxwtkhkJfj5VH VE/SzaUs++TPbxtfsnQC60B3X3Xc1nq8ZnelCvAV80DtkUnJA6hwlluM6wXTrwXQ HuttGAcAyTvilxpU28Ali6VCYVozxVCwLpNy37b1NBcgmYJbAt+wk3uRcO67xSfY QG3H3AHchpt4eyvhJeZRiUWOtX287u6Be4liLMxZ3FXF9JWgVOtgsgQEN5BD82VP B8NiSfXI+1tj3Q6VcrMzRGKyoxJYMqGACBHFLQgjmkHyYbJiA7U= =JKJm -----END PGP SIGNATURE----- Merge tag 'efi-2019-04-rc4-2' of https://github.com/xypron2/u-boot Pull request for UEFI system for v2019.04-rc4 Fix an error with the serial communication on boards with a very small UART buffer which leads to a stalled system. Provide an X86 reset driver for the UEFI runtime.
This commit is contained in:
commit
116a3a1ae0
2 changed files with 57 additions and 28 deletions
|
@ -10,8 +10,10 @@
|
||||||
#include <sysreset.h>
|
#include <sysreset.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
#include <efi_loader.h>
|
||||||
|
|
||||||
static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
|
static __efi_runtime int x86_sysreset_request(struct udevice *dev,
|
||||||
|
enum sysreset_t type)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
|
@ -31,6 +33,25 @@ static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
|
||||||
return -EINPROGRESS;
|
return -EINPROGRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_EFI_LOADER
|
||||||
|
void __efi_runtime EFIAPI efi_reset_system(
|
||||||
|
enum efi_reset_type reset_type,
|
||||||
|
efi_status_t reset_status,
|
||||||
|
unsigned long data_size, void *reset_data)
|
||||||
|
{
|
||||||
|
if (reset_type == EFI_RESET_COLD ||
|
||||||
|
reset_type == EFI_RESET_PLATFORM_SPECIFIC)
|
||||||
|
x86_sysreset_request(NULL, SYSRESET_COLD);
|
||||||
|
else if (reset_type == EFI_RESET_WARM)
|
||||||
|
x86_sysreset_request(NULL, SYSRESET_WARM);
|
||||||
|
|
||||||
|
/* TODO EFI_RESET_SHUTDOWN */
|
||||||
|
|
||||||
|
while (1) { }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static const struct udevice_id x86_sysreset_ids[] = {
|
static const struct udevice_id x86_sysreset_ids[] = {
|
||||||
{ .compatible = "x86,reset" },
|
{ .compatible = "x86,reset" },
|
||||||
{ }
|
{ }
|
||||||
|
|
|
@ -62,6 +62,21 @@ static struct simple_text_output_mode efi_con_mode = {
|
||||||
.cursor_visible = 1,
|
.cursor_visible = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int term_get_char(s32 *c)
|
||||||
|
{
|
||||||
|
u64 timeout;
|
||||||
|
|
||||||
|
/* Wait up to 100 ms for a character */
|
||||||
|
timeout = timer_get_us() + 100000;
|
||||||
|
|
||||||
|
while (!tstc())
|
||||||
|
if (timer_get_us() > timeout)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
*c = getc();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Receive and parse a reply from the terminal.
|
* Receive and parse a reply from the terminal.
|
||||||
*
|
*
|
||||||
|
@ -72,34 +87,36 @@ static struct simple_text_output_mode efi_con_mode = {
|
||||||
*/
|
*/
|
||||||
static int term_read_reply(int *n, int num, char end_char)
|
static int term_read_reply(int *n, int num, char end_char)
|
||||||
{
|
{
|
||||||
char c;
|
s32 c;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
c = getc();
|
if (term_get_char(&c) || c != cESC)
|
||||||
if (c != cESC)
|
|
||||||
return -1;
|
return -1;
|
||||||
c = getc();
|
|
||||||
if (c != '[')
|
if (term_get_char(&c) || c != '[')
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n[0] = 0;
|
n[0] = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
c = getc();
|
if (!term_get_char(&c)) {
|
||||||
if (c == ';') {
|
if (c == ';') {
|
||||||
i++;
|
i++;
|
||||||
if (i >= num)
|
if (i >= num)
|
||||||
|
return -1;
|
||||||
|
n[i] = 0;
|
||||||
|
continue;
|
||||||
|
} else if (c == end_char) {
|
||||||
|
break;
|
||||||
|
} else if (c > '9' || c < '0') {
|
||||||
return -1;
|
return -1;
|
||||||
n[i] = 0;
|
}
|
||||||
continue;
|
|
||||||
} else if (c == end_char) {
|
/* Read one more decimal position */
|
||||||
break;
|
n[i] *= 10;
|
||||||
} else if (c > '9' || c < '0') {
|
n[i] += c - '0';
|
||||||
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read one more decimal position */
|
|
||||||
n[i] *= 10;
|
|
||||||
n[i] += c - '0';
|
|
||||||
}
|
}
|
||||||
if (i != num - 1)
|
if (i != num - 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -196,7 +213,6 @@ static int query_console_serial(int *rows, int *cols)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int n[2];
|
int n[2];
|
||||||
u64 timeout;
|
|
||||||
|
|
||||||
/* Empty input buffer */
|
/* Empty input buffer */
|
||||||
while (tstc())
|
while (tstc())
|
||||||
|
@ -216,14 +232,6 @@ static int query_console_serial(int *rows, int *cols)
|
||||||
ESC "[999;999H" /* Move to bottom right corner */
|
ESC "[999;999H" /* Move to bottom right corner */
|
||||||
ESC "[6n"); /* Query cursor position */
|
ESC "[6n"); /* Query cursor position */
|
||||||
|
|
||||||
/* Allow up to one second for a response */
|
|
||||||
timeout = timer_get_us() + 1000000;
|
|
||||||
while (!tstc())
|
|
||||||
if (timer_get_us() > timeout) {
|
|
||||||
ret = -1;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read {rows,cols} */
|
/* Read {rows,cols} */
|
||||||
if (term_read_reply(n, 2, 'R')) {
|
if (term_read_reply(n, 2, 'R')) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue