Merge mainline into arm

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-07-16 18:43:43 +02:00
commit ae27e4d323
111 changed files with 5383 additions and 3002 deletions

View file

@ -40,7 +40,7 @@ grub_core_cmd_set (struct grub_command *cmd __attribute__ ((unused)),
{
struct grub_env_var *env;
FOR_SORTED_ENV (env)
grub_printf ("%s=%s\n", env->name, env->value);
grub_printf ("%s=%s\n", env->name, grub_env_get (env->name));
return 0;
}
@ -139,13 +139,13 @@ grub_core_cmd_ls (struct grub_command *cmd __attribute__ ((unused)),
else
path++;
if (! path && ! device_name)
if (! *path && ! device_name)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
goto fail;
}
if (! path)
if (! *path)
{
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
grub_errno = GRUB_ERR_NONE;

View file

@ -0,0 +1,83 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008,2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/i386/coreboot/memory.h>
#include <grub/i386/coreboot/lbio.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/misc.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* Helper for grub_linuxbios_table_iterate. */
static int
check_signature (grub_linuxbios_table_header_t tbl_header)
{
if (! grub_memcmp (tbl_header->signature, "LBIO", 4))
return 1;
return 0;
}
grub_err_t
grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t,
void *),
void *hook_data)
{
grub_linuxbios_table_header_t table_header;
grub_linuxbios_table_item_t table_item;
/* Assuming table_header is aligned to its size (8 bytes). */
for (table_header = (grub_linuxbios_table_header_t) 0x500;
table_header < (grub_linuxbios_table_header_t) 0x1000; table_header++)
if (check_signature (table_header))
goto signature_found;
for (table_header = (grub_linuxbios_table_header_t) 0xf0000;
table_header < (grub_linuxbios_table_header_t) 0x100000; table_header++)
if (check_signature (table_header))
goto signature_found;
grub_fatal ("Could not find coreboot table\n");
signature_found:
table_item =
(grub_linuxbios_table_item_t) ((long) table_header +
(long) table_header->header_size);
for (; table_item < (grub_linuxbios_table_item_t) ((long) table_header
+ (long) table_header->header_size
+ (long) table_header->table_size);
table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
{
if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK
&& check_signature ((grub_linuxbios_table_header_t) (grub_addr_t)
*(grub_uint64_t *) (table_item + 1)))
{
table_header = (grub_linuxbios_table_header_t) (grub_addr_t)
*(grub_uint64_t *) (table_item + 1);
goto signature_found;
}
if (hook (table_item, hook_data))
return 1;
}
return 0;
}

View file

@ -34,6 +34,7 @@
#include <grub/cpu/io.h>
#include <grub/cpu/floppy.h>
#include <grub/cpu/tsc.h>
#include <grub/video.h>
extern grub_uint8_t _start[];
extern grub_uint8_t _end[];
@ -89,6 +90,8 @@ grub_machine_init (void)
{
modend = grub_modules_get_end ();
grub_video_coreboot_fb_early_init ();
grub_vga_text_init ();
#ifdef GRUB_MACHINE_MULTIBOOT
@ -96,6 +99,11 @@ grub_machine_init (void)
#endif
grub_machine_mmap_iterate (heap_init, NULL);
grub_video_coreboot_fb_late_init ();
grub_font_init ();
grub_gfxterm_init ();
grub_tsc_init ();
}

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2007,2008,2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,63 +22,6 @@
#include <grub/err.h>
#include <grub/misc.h>
/* Helper for grub_linuxbios_table_iterate. */
static int
check_signature (grub_linuxbios_table_header_t tbl_header)
{
if (! grub_memcmp (tbl_header->signature, "LBIO", 4))
return 1;
return 0;
}
grub_err_t
grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t,
void *),
void *hook_data)
{
grub_linuxbios_table_header_t table_header;
grub_linuxbios_table_item_t table_item;
/* Assuming table_header is aligned to its size (8 bytes). */
for (table_header = (grub_linuxbios_table_header_t) 0x500;
table_header < (grub_linuxbios_table_header_t) 0x1000; table_header++)
if (check_signature (table_header))
goto signature_found;
for (table_header = (grub_linuxbios_table_header_t) 0xf0000;
table_header < (grub_linuxbios_table_header_t) 0x100000; table_header++)
if (check_signature (table_header))
goto signature_found;
grub_fatal ("Could not find coreboot table\n");
signature_found:
table_item =
(grub_linuxbios_table_item_t) ((long) table_header +
(long) table_header->header_size);
for (; table_item < (grub_linuxbios_table_item_t) ((long) table_header
+ (long) table_header->header_size
+ (long) table_header->table_size);
table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
{
if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK
&& check_signature ((grub_linuxbios_table_header_t) (grub_addr_t)
*(grub_uint64_t *) (table_item + 1)))
{
table_header = (grub_linuxbios_table_header_t) (grub_addr_t)
*(grub_uint64_t *) (table_item + 1);
goto signature_found;
}
if (hook (table_item, hook_data))
return 1;
}
return 0;
}
/* Context for grub_machine_mmap_iterate. */
struct grub_machine_mmap_iterate_ctx
{

View file

@ -69,8 +69,6 @@ grub_machine_init (void)
grub_serial_init ();
grub_boot_init ();
grub_gfxterm_init ();
}
void

View file

@ -34,14 +34,31 @@ _start:
/* Stage1 won't zero BSS for us. In other cases, why not do it again? */
lis 6, (__bss_start - 4)@h
ori 6, 6, (__bss_start - 4)@l
2: stb 2, 4(6)
addi 6, 6, 1
andi. 7, 6, 3
cmpi 0, 1, 7, 0
bne 2b
lis 7, (_end - 4)@h
ori 7, 7, (_end - 4)@l
subf 7, 6, 7
subi 8, 7, 1
andi. 8, 8, 3
addi 8, 8, 1
sub 7, 7, 8
srwi 7, 7, 2 /* We store 4 bytes at a time. */
mtctr 7
2: stwu 2, 4(6) /* We know r2 is already 0 from above. */
bdnz 2b
mtctr 8
2: stb 2, 4(6) /* We know r2 is already 0 from above. */
addi 6, 6, 1
bdnz 2b
/* Store r5 in grub_ieee1275_entry_fn. */
lis 9, grub_ieee1275_entry_fn@ha
stw 5, grub_ieee1275_entry_fn@l(9)