Request a framebuffer in the multiboot2 header and record any
available frame buffer in the boot_info.
---
 i386/i386/multiboot2_hdr_asm.h |  9 +++++++++
 i386/i386at/model_dep.c        | 17 +++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/i386/i386/multiboot2_hdr_asm.h b/i386/i386/multiboot2_hdr_asm.h
index b2ecb21c..ccb2a448 100644
--- a/i386/i386/multiboot2_hdr_asm.h
+++ b/i386/i386/multiboot2_hdr_asm.h
@@ -42,6 +42,15 @@ multiboot2_hdr:
        .short MULTIBOOT2_HEADER_TAG_MODULE_ALIGN
        .short 0
        .long  8
+       /* Frame buffer specified with no preference for width, height
+          and depth. */
+       .short MULTIBOOT2_HEADER_TAG_FRAMEBUFFER
+       .short 0
+       .long  20
+       .long  0 /* No preference. */
+       .long  0 /* No preference. */
+       .long  0 /* No preference. */
+       .long  0 /* Padding */
        /* There must always be an 'end' (empty) tag */
        .short MULTIBOOT2_HEADER_TAG_END
        .short 0
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index be4f737b..ffbfa2d4 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -644,6 +644,23 @@ finalise_mb2_boot_info(const struct multiboot2_raw_info 
*mb2_info)
          }
          break;
 
+       case MULTIBOOT2_TAG_TYPE_FRAMEBUFFER:
+         {
+           const struct multiboot2_tag_framebuffer *fb_tag =
+             (const struct multiboot2_tag_framebuffer *)tag;
+
+           boot_info.fb_info.framebuffer_addr = 
fb_tag->common.framebuffer_addr;
+           boot_info.fb_info.framebuffer_pitch = 
fb_tag->common.framebuffer_pitch;
+           boot_info.fb_info.framebuffer_width = 
fb_tag->common.framebuffer_width;
+           boot_info.fb_info.framebuffer_height = 
fb_tag->common.framebuffer_height;
+           boot_info.fb_info.framebuffer_bpp = fb_tag->common.framebuffer_bpp;
+           /* framebuffer_type values are the same in mb1 and mb2. */
+           boot_info.fb_info.framebuffer_type = 
fb_tag->common.framebuffer_type;
+
+           boot_info.flags |= MULTIBOOT_FRAMEBUFFER;
+         }
+         break;
+
        default:
          break;
        }
-- 
2.47.3


Reply via email to