Merge pull request #14 from coreos/gnu

Merge upstream GRUB changes
This commit is contained in:
Michael Marineau 2015-08-13 13:32:56 -07:00
commit 91391dc52b
86 changed files with 1935 additions and 1034 deletions

View file

@ -180,8 +180,10 @@ grub_acpi_create_ebda (void)
struct grub_acpi_rsdp_v20 *v2;
ebda = (grub_uint8_t *) (grub_addr_t) ((*((grub_uint16_t *)0x40e)) << 4);
grub_dprintf ("acpi", "EBDA @%p\n", ebda);
if (ebda)
ebda_kb_len = *(grub_uint16_t *) ebda;
grub_dprintf ("acpi", "EBDA length 0x%x\n", ebda_kb_len);
if (ebda_kb_len > 16)
ebda_kb_len = 0;
ctx.ebda_len = (ebda_kb_len + 1) << 10;
@ -495,6 +497,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
if (! rsdp)
rsdp = grub_machine_acpi_get_rsdpv1 ();
grub_dprintf ("acpi", "RSDP @%p\n", rsdp);
if (rsdp)
{
grub_uint32_t *entry_ptr;

View file

@ -39,9 +39,17 @@ static const char *descs[] = {
[2] = "before RAM init",
[3] = "after RAM init",
[4] = "end of romstage",
[5] = "start of verified boot",
[6] = "end of verified boot",
[8] = "start of RAM copy",
[9] = "end of RAM copy",
[10] = "start of ramstage",
[11] = "start of bootblock",
[12] = "end of bootblock",
[13] = "starting to load romstage",
[14] = "finished loading romstage",
[15] = "starting LZMA decompress (ignore for x86)",
[16] = "finished LZMA decompress (ignore for x86)",
[30] = "device enumerate",
[40] = "device configure",
[50] = "device enable",

View file

@ -29,14 +29,15 @@ grub_machine_acpi_get_rsdpv1 (void)
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4);
ebda_len = * (grub_uint16_t *) ebda;
if (! ebda_len)
return 0;
if (! ebda_len) /* FIXME do we really need this check? */
goto scan_bios;
for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0)
return (struct grub_acpi_rsdp_v10 *) ptr;
scan_bios:
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
ptr += 16)
@ -56,8 +57,8 @@ grub_machine_acpi_get_rsdpv2 (void)
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4);
ebda_len = * (grub_uint16_t *) ebda;
if (! ebda_len)
return 0;
if (! ebda_len) /* FIXME do we really need this check? */
goto scan_bios;
for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
@ -67,6 +68,7 @@ grub_machine_acpi_get_rsdpv2 (void)
== 0)
return (struct grub_acpi_rsdp_v20 *) ptr;
scan_bios:
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
ptr += 16)

View file

@ -104,7 +104,10 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
pass->c = grub_strtoul (ptr, &ptr, 0);
if (grub_errno)
return grub_errno;
{
grub_free (pass);
return grub_errno;
}
if (*ptr != '.')
{
grub_free (pass);

View file

@ -251,10 +251,10 @@ try (struct search_ctx *ctx)
/* Cache entry was outdated. Remove it. */
if (!ctx->count)
{
*prev = cache_ent->next;
grub_free (cache_ent->key);
grub_free (cache_ent->value);
grub_free (cache_ent);
*prev = cache_ent->next;
}
}

View file

@ -181,7 +181,10 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
var = "root";
}
else
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
{
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
goto out;
}
if (state[SEARCH_LABEL].set)
grub_search_label (id, var, state[SEARCH_NO_FLOPPY].set,
@ -199,8 +202,10 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
grub_search_fs_file (id, var, state[SEARCH_NO_FLOPPY].set,
hints, nhints);
else
return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
out:
grub_free (hints);
return grub_errno;
}