diff options
| author | Toomas Soome <tsoome@me.com> | 2018-09-12 11:30:40 +0300 |
|---|---|---|
| committer | Robert Mustacchi <rm@joyent.com> | 2019-01-28 02:30:08 +0000 |
| commit | b18a8f641b21ebb3d94dc00253c79fe5f777cefb (patch) | |
| tree | a84b42bebb9831afec6b056c57eb708c57135c45 /usr | |
| parent | 9e362ff653a258810887a7dd0f8edc820c89967f (diff) | |
| download | illumos-joyent-b18a8f641b21ebb3d94dc00253c79fe5f777cefb.tar.gz | |
10199 loader: vbe should use bio_alloc for edid info
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Reviewed by: Andy Fiddaman <af@citrus-it.net>
Reviewed by: John Howard <Echosoft.LLC@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr')
| -rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/common/gfx_fb.h | 10 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/efi/loader/framebuffer.c | 9 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/i386/libi386/vbe.c | 39 |
4 files changed, 35 insertions, 25 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index e360c5912a..481dda75df 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2019.01.09.1 +BOOT_VERSION = $(LOADER_VERSION)-2019.01.17.1 diff --git a/usr/src/boot/sys/boot/common/gfx_fb.h b/usr/src/boot/sys/boot/common/gfx_fb.h index 26dc2352ad..19227151f8 100644 --- a/usr/src/boot/sys/boot/common/gfx_fb.h +++ b/usr/src/boot/sys/boot/common/gfx_fb.h @@ -93,6 +93,16 @@ struct vesa_edid_info { uint8_t checksum; } __packed; +#define GET_EDID_INFO_WIDTH(edid_info, timings_num) \ + ((edid_info)->detailed_timings[(timings_num)].horizontal_active_lo | \ + (((uint_t)(edid_info)->detailed_timings[(timings_num)].horizontal_hi & \ + 0xf0) << 4)) + +#define GET_EDID_INFO_HEIGHT(edid_info, timings_num) \ + ((edid_info)->detailed_timings[(timings_num)].vertical_active_lo | \ + (((uint_t)(edid_info)->detailed_timings[(timings_num)].vertical_hi & \ + 0xf0) << 4)) + extern multiboot_tag_framebuffer_t gfx_fb; void gfx_framework_init(struct visual_ops *); diff --git a/usr/src/boot/sys/boot/efi/loader/framebuffer.c b/usr/src/boot/sys/boot/efi/loader/framebuffer.c index 9428c8dba9..dbe540a8ed 100644 --- a/usr/src/boot/sys/boot/efi/loader/framebuffer.c +++ b/usr/src/boot/sys/boot/efi/loader/framebuffer.c @@ -496,17 +496,12 @@ efifb_get_edid(UINT32 *pwidth, UINT32 *pheight) { extern EFI_GRAPHICS_OUTPUT *gop; struct vesa_edid_info *edid_info; - struct edid_detailed_timings *timings; int rv = 1; edid_info = efifb_gop_get_edid(gop); if (edid_info != NULL) { - timings = edid_info->detailed_timings; - *pwidth = timings[0].horizontal_active_lo | - (((int)(timings[0].horizontal_hi & 0xf0)) << 4); - - *pheight = timings[0].vertical_active_lo | - (((int)(timings[0].vertical_hi & 0xf0)) << 4); + *pwidth = GET_EDID_INFO_WIDTH(edid_info, 0); + *pheight = GET_EDID_INFO_HEIGHT(edid_info, 0); rv = 0; } free(edid_info); diff --git a/usr/src/boot/sys/boot/i386/libi386/vbe.c b/usr/src/boot/sys/boot/i386/libi386/vbe.c index 9908bfc209..d5c89f575e 100644 --- a/usr/src/boot/sys/boot/i386/libi386/vbe.c +++ b/usr/src/boot/sys/boot/i386/libi386/vbe.c @@ -481,34 +481,39 @@ vbe_dump_mode(int modenum, struct modeinfoblock *mi) static bool vbe_get_edid(uint_t *pwidth, uint_t *pheight) { - struct vesa_edid_info edid_info; + struct vesa_edid_info *edid_info; const uint8_t magic[] = EDID_MAGIC; - int ddc_caps, ret; + int ddc_caps; + bool ret = false; ddc_caps = biosvbe_ddc_caps(); if (ddc_caps == 0) { - return (false); + return (ret); } - ret = biosvbe_ddc_read_edid(0, &edid_info); - if (VBE_ERROR(ret)) - return (false); + edid_info = bio_alloc(sizeof (*edid_info)); + if (edid_info == NULL) + return (ret); + + if (VBE_ERROR(biosvbe_ddc_read_edid(0, edid_info))) + goto done; - if (memcmp(&edid_info, magic, sizeof (magic)) != 0) - return (false); + if (memcmp(edid_info, magic, sizeof (magic)) != 0) + goto done; - if (!(edid_info.header.version == 1 && - (edid_info.display.supported_features + if (!(edid_info->header.version == 1 && + (edid_info->display.supported_features & EDID_FEATURE_PREFERRED_TIMING_MODE) && - edid_info.detailed_timings[0].pixel_clock)) - return (false); + edid_info->detailed_timings[0].pixel_clock)) + goto done; - *pwidth = edid_info.detailed_timings[0].horizontal_active_lo | - (((uint_t)edid_info.detailed_timings[0].horizontal_hi & 0xf0) << 4); - *pheight = edid_info.detailed_timings[0].vertical_active_lo | - (((uint_t)edid_info.detailed_timings[0].vertical_hi & 0xf0) << 4); + *pwidth = GET_EDID_INFO_WIDTH(edid_info, 0); + *pheight = GET_EDID_INFO_HEIGHT(edid_info, 0); - return (true); + ret = true; +done: + bio_free(edid_info, sizeof (*edid_info)); + return (ret); } static void |
