Merge mainline into net
This commit is contained in:
commit
760a7e5aed
521 changed files with 54590 additions and 8041 deletions
|
@ -16,10 +16,11 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/memory.h>
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#include <grub/machine/biosnum.h>
|
||||
#include <grub/machine/apm.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#endif
|
||||
#include <grub/multiboot.h>
|
||||
#include <grub/cpu/relocator.h>
|
||||
|
@ -198,7 +199,12 @@ grub_multiboot_get_mbi_size (void)
|
|||
+ ALIGN_UP (sizeof(PACKAGE_STRING), 4)
|
||||
+ grub_get_multiboot_mmap_count () * sizeof (struct multiboot_mmap_entry)
|
||||
+ elf_sec_entsize * elf_sec_num
|
||||
+ 256 * sizeof (struct multiboot_color);
|
||||
+ 256 * sizeof (struct multiboot_color)
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
+ sizeof (struct grub_vbe_info_block)
|
||||
+ sizeof (struct grub_vbe_mode_info_block)
|
||||
#endif
|
||||
+ ALIGN_UP (sizeof (struct multiboot_apm_info), 4);
|
||||
|
||||
FOR_NET_NETWORK_LEVEL_INTERFACES(net)
|
||||
if (net->dhcp_ack)
|
||||
|
@ -216,28 +222,30 @@ grub_fill_multiboot_mmap (struct multiboot_mmap_entry *first_entry)
|
|||
{
|
||||
struct multiboot_mmap_entry *mmap_entry = (struct multiboot_mmap_entry *) first_entry;
|
||||
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
|
||||
grub_memory_type_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
mmap_entry->addr = addr;
|
||||
mmap_entry->len = size;
|
||||
switch (type)
|
||||
{
|
||||
case GRUB_MACHINE_MEMORY_AVAILABLE:
|
||||
case GRUB_MEMORY_AVAILABLE:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_AVAILABLE;
|
||||
break;
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_ACPI_RECLAIMABLE
|
||||
case GRUB_MACHINE_MEMORY_ACPI_RECLAIMABLE:
|
||||
case GRUB_MEMORY_ACPI:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_ACPI_RECLAIMABLE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_NVS
|
||||
case GRUB_MACHINE_MEMORY_NVS:
|
||||
case GRUB_MEMORY_NVS:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_NVS;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case GRUB_MEMORY_BADRAM:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_BADRAM;
|
||||
break;
|
||||
|
||||
default:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_RESERVED;
|
||||
|
@ -252,6 +260,77 @@ grub_fill_multiboot_mmap (struct multiboot_mmap_entry *first_entry)
|
|||
grub_mmap_iterate (hook);
|
||||
}
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
static grub_err_t
|
||||
fill_vbe_info (struct multiboot_info *mbi, grub_uint8_t *ptrorig,
|
||||
grub_uint32_t ptrdest, int fill_generic)
|
||||
{
|
||||
grub_vbe_status_t status;
|
||||
grub_uint32_t vbe_mode;
|
||||
void *scratch = (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
||||
struct grub_vbe_mode_info_block *mode_info;
|
||||
|
||||
status = grub_vbe_bios_get_controller_info (scratch);
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return grub_error (GRUB_ERR_IO, "Can't get controller info.");
|
||||
|
||||
mbi->vbe_control_info = ptrdest;
|
||||
grub_memcpy (ptrorig, scratch, sizeof (struct grub_vbe_info_block));
|
||||
ptrorig += sizeof (struct grub_vbe_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_info_block);
|
||||
|
||||
status = grub_vbe_bios_get_mode (scratch);
|
||||
vbe_mode = *(grub_uint32_t *) scratch;
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return grub_error (GRUB_ERR_IO, "can't get VBE mode");
|
||||
mbi->vbe_mode = vbe_mode;
|
||||
|
||||
mode_info = (struct grub_vbe_mode_info_block *) ptrorig;
|
||||
mbi->vbe_mode_info = ptrdest;
|
||||
/* get_mode_info isn't available for mode 3. */
|
||||
if (vbe_mode == 3)
|
||||
{
|
||||
grub_memset (mode_info, 0, sizeof (struct grub_vbe_mode_info_block));
|
||||
mode_info->memory_model = GRUB_VBE_MEMORY_MODEL_TEXT;
|
||||
mode_info->x_resolution = 80;
|
||||
mode_info->y_resolution = 25;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = grub_vbe_bios_get_mode_info (vbe_mode, scratch);
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return grub_error (GRUB_ERR_IO, "can't get mode info");
|
||||
grub_memcpy (mode_info, scratch,
|
||||
sizeof (struct grub_vbe_mode_info_block));
|
||||
}
|
||||
ptrorig += sizeof (struct grub_vbe_mode_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_mode_info_block);
|
||||
|
||||
grub_vbe_bios_get_pm_interface (&mbi->vbe_interface_seg,
|
||||
&mbi->vbe_interface_off,
|
||||
&mbi->vbe_interface_len);
|
||||
|
||||
mbi->flags |= MULTIBOOT_INFO_VBE_INFO;
|
||||
|
||||
if (fill_generic && mode_info->memory_model == GRUB_VBE_MEMORY_MODEL_TEXT)
|
||||
{
|
||||
mbi->framebuffer_addr = 0xb8000;
|
||||
|
||||
mbi->framebuffer_pitch = 2 * mode_info->x_resolution;
|
||||
mbi->framebuffer_width = mode_info->x_resolution;
|
||||
mbi->framebuffer_height = mode_info->y_resolution;
|
||||
|
||||
mbi->framebuffer_bpp = 16;
|
||||
|
||||
mbi->framebuffer_type = MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT;
|
||||
|
||||
mbi->flags |= MULTIBOOT_INFO_FRAMEBUFFER_INFO;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static grub_err_t
|
||||
retrieve_video_parameters (struct multiboot_info *mbi,
|
||||
grub_uint8_t *ptrorig, grub_uint32_t ptrdest)
|
||||
|
@ -272,8 +351,13 @@ retrieve_video_parameters (struct multiboot_info *mbi,
|
|||
grub_video_get_palette (0, ARRAY_SIZE (palette), palette);
|
||||
|
||||
driv_id = grub_video_get_driver_id ();
|
||||
#if GRUB_MACHINE_HAS_VGA_TEXT
|
||||
if (driv_id == GRUB_VIDEO_DRIVER_NONE)
|
||||
return fill_vbe_info (mbi, ptrorig, ptrdest, 1);
|
||||
#else
|
||||
if (driv_id == GRUB_VIDEO_DRIVER_NONE)
|
||||
return GRUB_ERR_NONE;
|
||||
#endif
|
||||
|
||||
err = grub_video_get_info_and_fini (&mode_info, &framebuffer);
|
||||
if (err)
|
||||
|
@ -321,6 +405,11 @@ retrieve_video_parameters (struct multiboot_info *mbi,
|
|||
|
||||
mbi->flags |= MULTIBOOT_INFO_FRAMEBUFFER_INFO;
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
if (driv_id == GRUB_VIDEO_DRIVER_VBE)
|
||||
return fill_vbe_info (mbi, ptrorig, ptrdest, 0);
|
||||
#endif
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -369,6 +458,29 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
ptrorig += ALIGN_UP (sizeof(PACKAGE_STRING), 4);
|
||||
ptrdest += ALIGN_UP (sizeof(PACKAGE_STRING), 4);
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
{
|
||||
struct grub_apm_info info;
|
||||
if (grub_apm_get_info (&info))
|
||||
{
|
||||
struct multiboot_apm_info *mbinfo = (void *) ptrorig;
|
||||
|
||||
mbinfo->cseg = info.cseg;
|
||||
mbinfo->offset = info.offset;
|
||||
mbinfo->cseg_16 = info.cseg_16;
|
||||
mbinfo->dseg = info.dseg;
|
||||
mbinfo->flags = info.flags;
|
||||
mbinfo->cseg_len = info.cseg_len;
|
||||
mbinfo->dseg_len = info.dseg_len;
|
||||
mbinfo->cseg_16_len = info.cseg_16_len;
|
||||
mbinfo->version = info.version;
|
||||
|
||||
ptrorig += ALIGN_UP (sizeof (struct multiboot_apm_info), 4);
|
||||
ptrdest += ALIGN_UP (sizeof (struct multiboot_apm_info), 4);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (modcnt)
|
||||
{
|
||||
mbi->flags |= MULTIBOOT_INFO_MODS;
|
||||
|
@ -445,6 +557,12 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
ptrorig += sizeof (struct grub_vbe_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_info_block);
|
||||
ptrorig += sizeof (struct grub_vbe_mode_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_mode_info_block);
|
||||
#endif
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue