diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2018-12-04 12:33:09 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2018-12-04 12:33:09 +0000 |
commit | dec8379487a0500584e43bf6bc6426e47d2b6eb0 (patch) | |
tree | 4303108f3241d269d382409f65c0d286f1f2e3b6 /usr | |
parent | 09d9ee89aec409242d50a5e168d8d883fc7539e8 (diff) | |
parent | 3e90f8d31de34a9f1efdf9484f999cca7149860d (diff) | |
download | illumos-joyent-dec8379487a0500584e43bf6bc6426e47d2b6eb0.tar.gz |
[illumos-gate merge]
commit 3e90f8d31de34a9f1efdf9484f999cca7149860d
9998 uts: font rendering should support 16/24/32bit depths
commit fbbcb43d3dc65baeb851d4b368f233970b5b7098
9937 uts: use smallest font as fallback default
commit 135ec7c89feffe489942d5c5a37e69f4efb7d7bb
10014 bootadm: menu_free() is accessing freed memory
commit 9dded1d9015db0b91278731dfec380891ea0eb14
10013 bootadm: list_menu_entry() is missing else
commit 8421bc58f13e94e818fb7374158f5450f9c4931d
10010 libsmbns: macro expands to multiple statements
commit 7d1eae8c55720848a7a807e8b76f4b8c7e339af3
9987 loader.efi: add version support
commit 2b811402e28c1eea57dd7a5e98c7f1c72637ffd9
9975 loader.efi: unused variable 'err'
commit f111a354011b4b6a93d3b8d94aa06a982d8c7686
10002 librcm: bitwise comparison always evaluates to false
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/boot/sys/boot/efi/libefi/env.c | 30 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/efi/loader/Makefile.com | 46 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd64 | 1 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i386 | 1 | ||||
-rw-r--r-- | usr/src/cmd/boot/bootadm/bootadm_loader.c | 6 | ||||
-rw-r--r-- | usr/src/cmd/boot/common/mboot_extra.h | 4 | ||||
-rw-r--r-- | usr/src/lib/librcm/librcm.c | 8 | ||||
-rw-r--r-- | usr/src/lib/smbsrv/libsmbns/common/smbns_netbios_cache.c | 9 | ||||
-rw-r--r-- | usr/src/uts/common/font/font.c | 130 | ||||
-rw-r--r-- | usr/src/uts/common/io/tem_safe.c | 27 | ||||
-rw-r--r-- | usr/src/uts/common/sys/font.h | 8 |
11 files changed, 234 insertions, 36 deletions
diff --git a/usr/src/boot/sys/boot/efi/libefi/env.c b/usr/src/boot/sys/boot/efi/libefi/env.c index a1f1e812d2..231e90d5a1 100644 --- a/usr/src/boot/sys/boot/efi/libefi/env.c +++ b/usr/src/boot/sys/boot/efi/libefi/env.c @@ -42,6 +42,24 @@ #include "bootstrap.h" #include "ficl.h" +/* + * About ENABLE_UPDATES + * + * The UEFI variables are identified only by GUID and name, there is no + * way to (auto)detect the type for the value, so we need to process the + * variables case by case, as we do learn about them. + * + * While showing the variable name and the value is safe, we must not store + * random values nor allow removing (random) variables. + * + * Since we do have stub code to set/unset the variables, I do want to keep + * it to make the future development a bit easier, but the updates are disabled + * by default till: + * a) the validation and data translation to values is properly implemented + * b) We have established which variables we do allow to be updated. + * Therefore the set/unset code is included only for developers aid. + */ + static struct efi_uuid_mapping { const char *efi_guid_name; EFI_GUID efi_guid; @@ -763,7 +781,7 @@ command_efi_show(int argc, char *argv[]) case 'v': vflag = 1; if (strlen(optarg) >= nitems(varnamearg)) { - printf("Variable %s is longer than %zd " + printf("Variable %s is longer than %zu " "characters\n", optarg, nitems(varnamearg)); return (CMD_ERROR); } @@ -802,7 +820,7 @@ command_efi_show(int argc, char *argv[]) if (argc == 2) { optarg = argv[0]; if (strlen(optarg) >= nitems(varnamearg)) { - printf("Variable %s is longer than %zd characters\n", + printf("Variable %s is longer than %zu characters\n", optarg, nitems(varnamearg)); pager_close(); return (CMD_ERROR); @@ -914,7 +932,9 @@ command_efi_set(int argc, char *argv[]) char *uuid, *var, *val; CHAR16 wvar[128]; EFI_GUID guid; +#if defined(ENABLE_UPDATES) EFI_STATUS err; +#endif if (argc != 4) { printf("efi-set uuid var new-value\n"); @@ -928,7 +948,7 @@ command_efi_set(int argc, char *argv[]) return (CMD_ERROR); } cpy8to16(var, wvar, nitems(wvar)); -#if 0 +#if defined(ENABLE_UPDATES) err = RS->SetVariable(wvar, &guid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS, strlen(val) + 1, val); @@ -951,7 +971,9 @@ command_efi_unset(int argc, char *argv[]) char *uuid, *var; CHAR16 wvar[128]; EFI_GUID guid; +#if defined(ENABLE_UPDATES) EFI_STATUS err; +#endif if (argc != 3) { printf("efi-unset uuid var\n"); @@ -964,7 +986,7 @@ command_efi_unset(int argc, char *argv[]) return (CMD_ERROR); } cpy8to16(var, wvar, nitems(wvar)); -#if 0 +#if defined(ENABLE_UPDATES) err = RS->SetVariable(wvar, &guid, 0, 0, NULL); if (EFI_ERROR(err)) { printf("Failed to unset variable: error %lu\n", diff --git a/usr/src/boot/sys/boot/efi/loader/Makefile.com b/usr/src/boot/sys/boot/efi/loader/Makefile.com index d5cac11b54..7674305b5c 100644 --- a/usr/src/boot/sys/boot/efi/loader/Makefile.com +++ b/usr/src/boot/sys/boot/efi/loader/Makefile.com @@ -24,11 +24,35 @@ OBJDUMP= $(GNU_ROOT)/bin/gobjdump PROG= loader.sym # architecture-specific loader code -SRCS= autoload.c bootinfo.c conf.c copy.c efi_main.c framebuffer.c main.c \ - self_reloc.c smbios.c acpi.c vers.c memmap.c multiboot2.c - -OBJS= autoload.o bootinfo.o conf.o copy.o efi_main.o framebuffer.o main.o \ - self_reloc.o smbios.o acpi.o vers.o memmap.o multiboot2.o +SRCS= acpi.c \ + autoload.c \ + bootinfo.c \ + conf.c \ + copy.c \ + efi_main.c \ + framebuffer.c \ + main.c \ + memmap.c \ + multiboot.S \ + multiboot2.c \ + self_reloc.c \ + smbios.c \ + vers.c + +OBJS= acpi.o \ + autoload.o \ + bootinfo.o \ + conf.o \ + copy.o \ + efi_main.o \ + framebuffer.o \ + main.o \ + memmap.o \ + multiboot.o \ + multiboot2.o \ + self_reloc.o \ + smbios.o \ + vers.o CFLAGS= -Os CPPFLAGS= -nostdinc -I../../../../../include -I../../..../ @@ -85,7 +109,7 @@ LDFLAGS = -nostdlib --eh-frame-hdr LDFLAGS += -shared --hash-style=both --enable-new-dtags LDFLAGS += -T$(LDSCRIPT) -Bsymbolic -CLEANFILES= 8x16.c vers.c +CLEANFILES= loader.sym loader.bin vers.c NEWVERSWHAT= "EFI loader" $(MACHINE) @@ -94,7 +118,10 @@ install: all $(ROOTBOOTFILES) vers.c: ../../../common/newvers.sh $(SRC)/boot/Makefile.version $(SH) ../../../common/newvers.sh $(LOADER_VERSION) $(NEWVERSWHAT) -$(EFIPROG): loader.sym +$(EFIPROG): loader.bin + $(BTXLD) -V $(BOOT_VERSION) -o $@ loader.bin + +loader.bin: loader.sym if [ `$(OBJDUMP) -t loader.sym | fgrep '*UND*' | wc -l` != 0 ]; then \ $(OBJDUMP) -t loader.sym | fgrep '*UND*'; \ exit 1; \ @@ -123,7 +150,7 @@ x86: $(SYMLINK) ../../../../x86/include x86 clean clobber: - $(RM) $(CLEANFILES) $(OBJS) loader.sym + $(RM) $(CLEANFILES) $(OBJS) %.o: ../%.c $(COMPILE.c) $< @@ -138,6 +165,9 @@ clean clobber: %.o: ../arch/$(MACHINE)/%.S $(COMPILE.S) -Wa,-W $< +%.o: ../../../common/%.S + $(COMPILE.S) $< + %.o: ../../../common/%.c $(COMPILE.c) $< diff --git a/usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd64 b/usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd64 index a1f2bd1529..bf3f69706e 100644 --- a/usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd64 +++ b/usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd64 @@ -14,6 +14,7 @@ SECTIONS } . = ALIGN(4096); .text : { + multiboot.o(.text) *(.text .stub .text.* .gnu.linkonce.t.*) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) diff --git a/usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i386 b/usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i386 index 4920a319a4..1e68826ed7 100644 --- a/usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i386 +++ b/usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i386 @@ -9,6 +9,7 @@ SECTIONS . = SIZEOF_HEADERS; . = ALIGN(4096); .text : { + multiboot.o(.text) *(.text .stub .text.* .gnu.linkonce.t.*) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) diff --git a/usr/src/cmd/boot/bootadm/bootadm_loader.c b/usr/src/cmd/boot/bootadm/bootadm_loader.c index 6f96f4b053..3920355930 100644 --- a/usr/src/cmd/boot/bootadm/bootadm_loader.c +++ b/usr/src/cmd/boot/bootadm/bootadm_loader.c @@ -354,7 +354,9 @@ void menu_free(struct menu_lst *menu) { menu_entry_t *entry; - STAILQ_FOREACH(entry, menu, me_next) { + + while (!STAILQ_EMPTY(menu)) { + entry = STAILQ_FIRST(menu); STAILQ_REMOVE_HEAD(menu, me_next); free(entry->me_title); free(entry->me_type); @@ -907,7 +909,7 @@ list_menu_entry(menu_entry_t *entry, char *setting) if (*setting == '\0') { (void) printf("Kernel: %s\n", getenv("bootfile")); - } if (strcasecmp(setting, "kernel") == 0) { + } else if (strcasecmp(setting, "kernel") == 0) { (void) printf("%s\n", getenv("bootfile")); goto done; } diff --git a/usr/src/cmd/boot/common/mboot_extra.h b/usr/src/cmd/boot/common/mboot_extra.h index bd5af890a7..4d966d0eac 100644 --- a/usr/src/cmd/boot/common/mboot_extra.h +++ b/usr/src/cmd/boot/common/mboot_extra.h @@ -34,8 +34,8 @@ extern "C" { #include <sys/types.h> #include "bblk_einfo.h" -/* multiboot header needs to be located in the first 32KB. */ -#define MBOOT_SCAN_SIZE (32 * 1024) +/* multiboot header needs to be located in the first 64KB. */ +#define MBOOT_SCAN_SIZE (64 * 1024) /* multiboot header AOUT_KLUDGE flag. */ #define BB_MBOOT_AOUT_FLAG (0x00010000) diff --git a/usr/src/lib/librcm/librcm.c b/usr/src/lib/librcm/librcm.c index d3f7666495..0c25033066 100644 --- a/usr/src/lib/librcm/librcm.c +++ b/usr/src/lib/librcm/librcm.c @@ -72,7 +72,7 @@ rcm_alloc_handle(char *modname, uint_t flag, void *arg, rcm_handle_t **hdp) if (modname) { (void) snprintf(namebuf, MAXPATHLEN, "%s%s", modname, - RCM_MODULE_SUFFIX); + RCM_MODULE_SUFFIX); if ((hd->modname = strdup(namebuf)) == NULL) { free(hd); @@ -135,8 +135,8 @@ rcm_get_info(rcm_handle_t *hd, char *rsrcname, uint_t flag, rcm_info_t **infop) /* * rsrcname may be NULL if requesting dr operations or modinfo */ - if ((rsrcname == NULL) && - ((flag & RCM_DR_OPERATION|RCM_MOD_INFO) == 0)) { + if (rsrcname == NULL && + (flag & (RCM_DR_OPERATION | RCM_MOD_INFO)) == 0) { errno = EINVAL; return (RCM_FAILURE); } @@ -897,7 +897,7 @@ rcm_is_script(char *filename) char *tmp; if (((tmp = strstr(filename, RCM_MODULE_SUFFIX)) != NULL) && - (tmp[strlen(RCM_MODULE_SUFFIX)] == '\0')) + (tmp[strlen(RCM_MODULE_SUFFIX)] == '\0')) return (0); else return (1); diff --git a/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios_cache.c b/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios_cache.c index b938851c78..56fdca3455 100644 --- a/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios_cache.c +++ b/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios_cache.c @@ -484,8 +484,9 @@ smb_netbios_cache_insrefq(name_queue_t *refq, HT_ITEM *item) if (IS_LOCAL(name->attributes)) { if (IS_UNIQUE(name->attributes)) { refent = smb_netbios_name_dup(name, 1); - if (refent) + if (refent) { QUEUE_INSERT_TAIL(&refq->head, refent) + } /* next name */ return (B_TRUE); @@ -493,8 +494,9 @@ smb_netbios_cache_insrefq(name_queue_t *refq, HT_ITEM *item) } else { ht_mark_delete(smb_netbios_cache, item); refent = smb_netbios_name_dup(name, 0); - if (refent) + if (refent) { QUEUE_INSERT_TAIL(&refq->head, refent) + } /* next name */ return (B_TRUE); @@ -589,8 +591,9 @@ smb_netbios_cache_delete_locals(name_queue_t *delq) if (IS_LOCAL(entry->attributes)) { ht_mark_delete(smb_netbios_cache, item); delent = smb_netbios_name_dup(entry, 1); - if (delent) + if (delent) { QUEUE_INSERT_TAIL(&delq->head, delent) + } } (void) mutex_unlock(&entry->mtx); diff --git a/usr/src/uts/common/font/font.c b/usr/src/uts/common/font/font.c index b386bf91bc..3b2525ca3b 100644 --- a/usr/src/uts/common/font/font.c +++ b/usr/src/uts/common/font/font.c @@ -60,7 +60,7 @@ struct fontlist fonts[] = { void set_font(struct font *f, short *rows, short *cols, short height, short width) { - bitmap_data_t *font_selected = NULL; + bitmap_data_t *default_font = NULL, *font_selected = NULL; struct fontlist *fl; int i; @@ -84,18 +84,22 @@ set_font(struct font *f, short *rows, short *cols, short height, short width) font_selected->width; break; } + default_font = fl->data; } /* * The minus 2 is to make sure we have at least a 1 pixel * border around the entire screen. */ if (font_selected == NULL) { - if (((*rows * DEFAULT_FONT_DATA.height) > height) || - ((*cols * DEFAULT_FONT_DATA.width) > width)) { - *rows = (height - 2) / DEFAULT_FONT_DATA.height; - *cols = (width - 2) / DEFAULT_FONT_DATA.width; + if (default_font == NULL) + default_font = &DEFAULT_FONT_DATA; + + if (((*rows * default_font->height) > height) || + ((*cols * default_font->width) > width)) { + *rows = (height - 2) / default_font->height; + *cols = (width - 2) / default_font->width; } - font_selected = &DEFAULT_FONT_DATA; + font_selected = default_font; } f->width = font_selected->width; @@ -207,7 +211,117 @@ font_bit_to_pix8( } /* - * bit_to_pix24 is for 24-bit frame buffers. It will write four output bytes + * bit_to_pix16 is for 16-bit frame buffers. It will write two output bytes + * for each bit of input bitmap. It inverts the input bits before + * doing the output translation, for reverse video. + * + * Assuming foreground is 11111111 11111111 + * and background is 00000000 00000000 + * An input data byte of 0x53 will output the bit pattern + * + * 00000000 00000000 + * 11111111 11111111 + * 00000000 00000000 + * 11111111 11111111 + * 00000000 00000000 + * 00000000 00000000 + * 11111111 11111111 + * 11111111 11111111 + * + */ + +void +font_bit_to_pix16( + struct font *f, + uint16_t *dest, + uint8_t c, + uint16_t fg_color16, + uint16_t bg_color16) +{ + int row; + int byte; + int i; + uint8_t *cp; + uint16_t data, d; + int bytes_wide; + int bitsleft, nbits; + + cp = f->char_ptr[c]; + bytes_wide = (f->width + 7) / 8; + + for (row = 0; row < f->height; row++) { + bitsleft = f->width; + for (byte = 0; byte < bytes_wide; byte++) { + data = *cp++; + nbits = MIN(8, bitsleft); + bitsleft -= nbits; + for (i = 0; i < nbits; i++) { + d = ((data << i) & 0x80 ? + fg_color16 : bg_color16); + *dest++ = d; + } + } + } +} + +/* + * bit_to_pix24 is for 24-bit frame buffers. It will write three output bytes + * for each bit of input bitmap. It inverts the input bits before + * doing the output translation, for reverse video. + * + * Assuming foreground is 11111111 11111111 11111111 + * and background is 00000000 00000000 00000000 + * An input data byte of 0x53 will output the bit pattern + * + * 00000000 00000000 00000000 + * 11111111 11111111 11111111 + * 00000000 00000000 00000000 + * 11111111 11111111 11111111 + * 00000000 00000000 00000000 + * 00000000 00000000 00000000 + * 11111111 11111111 11111111 + * 11111111 11111111 11111111 + * + */ + +void +font_bit_to_pix24( + struct font *f, + uint8_t *dest, + uint8_t c, + uint32_t fg_color32, + uint32_t bg_color32) +{ + int row; + int byte; + int i; + uint8_t *cp; + uint32_t data, d; + int bytes_wide; + int bitsleft, nbits; + + cp = f->char_ptr[c]; + bytes_wide = (f->width + 7) / 8; + + for (row = 0; row < f->height; row++) { + bitsleft = f->width; + for (byte = 0; byte < bytes_wide; byte++) { + data = *cp++; + nbits = MIN(8, bitsleft); + bitsleft -= nbits; + for (i = 0; i < nbits; i++) { + d = ((data << i) & 0x80 ? + fg_color32 : bg_color32); + *dest++ = d & 0xff; + *dest++ = (d >> 8) & 0xff; + *dest++ = (d >> 16) & 0xff; + } + } + } +} + +/* + * bit_to_pix32 is for 32-bit frame buffers. It will write four output bytes * for each bit of input bitmap. It inverts the input bits before * doing the output translation, for reverse video. Note that each * 24-bit RGB value is finally stored in a 32-bit unsigned int, with the @@ -229,7 +343,7 @@ font_bit_to_pix8( */ void -font_bit_to_pix24( +font_bit_to_pix32( struct font *f, uint32_t *dest, uint8_t c, diff --git a/usr/src/uts/common/io/tem_safe.c b/usr/src/uts/common/io/tem_safe.c index 0312884465..60ff789fb3 100644 --- a/usr/src/uts/common/io/tem_safe.c +++ b/usr/src/uts/common/io/tem_safe.c @@ -153,6 +153,8 @@ static void bit_to_pix8(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color, text_color_t bg_color); static void bit_to_pix24(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color, text_color_t bg_color); +static void bit_to_pix32(struct tem_vt_state *tem, uchar_t c, + text_color_t fg_color, text_color_t bg_color); /* BEGIN CSTYLED */ /* Bk Rd Gr Br Bl Mg Cy Wh */ @@ -1601,8 +1603,13 @@ tem_safe_pix_bit2pix(struct tem_vt_state *tem, unsigned char c, fp = bit_to_pix8; break; case 24: - case 32: fp = bit_to_pix24; + break; + case 32: + fp = bit_to_pix32; + break; + default: + return; } fp(tem, c, fg, bg); @@ -2067,6 +2074,22 @@ static void bit_to_pix24(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color4, text_color_t bg_color4) { + uint32_t fg_color32, bg_color32; + uint8_t *dest; + + ASSERT(fg_color4 < 16 && bg_color4 < 16); + + fg_color32 = PIX4TO32(fg_color4); + bg_color32 = PIX4TO32(bg_color4); + + dest = (uint8_t *)tem->tvs_pix_data; + font_bit_to_pix24(&tems.ts_font, dest, c, fg_color32, bg_color32); +} + +static void +bit_to_pix32(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color4, + text_color_t bg_color4) +{ uint32_t fg_color32, bg_color32, *dest; ASSERT(fg_color4 < 16 && bg_color4 < 16); @@ -2075,7 +2098,7 @@ bit_to_pix24(struct tem_vt_state *tem, uchar_t c, text_color_t fg_color4, bg_color32 = PIX4TO32(bg_color4); dest = (uint32_t *)tem->tvs_pix_data; - font_bit_to_pix24(&tems.ts_font, dest, c, fg_color32, bg_color32); + font_bit_to_pix32(&tems.ts_font, dest, c, fg_color32, bg_color32); } static text_color_t diff --git a/usr/src/uts/common/sys/font.h b/usr/src/uts/common/sys/font.h index c4de4e9ddf..3467af6796 100644 --- a/usr/src/uts/common/sys/font.h +++ b/usr/src/uts/common/sys/font.h @@ -71,9 +71,11 @@ extern bitmap_data_t font_data_7x14; extern bitmap_data_t font_data_6x10; void set_font(struct font *, short *, short *, short, short); -void font_bit_to_pix4(struct font *, uint8_t *, uchar_t, uint8_t, uint8_t); -void font_bit_to_pix8(struct font *, uint8_t *, uchar_t, uint8_t, uint8_t); -void font_bit_to_pix24(struct font *, uint32_t *, uchar_t, uint32_t, uint32_t); +void font_bit_to_pix4(struct font *, uint8_t *, uint8_t, uint8_t, uint8_t); +void font_bit_to_pix8(struct font *, uint8_t *, uint8_t, uint8_t, uint8_t); +void font_bit_to_pix16(struct font *, uint16_t *, uint8_t, uint16_t, uint16_t); +void font_bit_to_pix24(struct font *, uint8_t *, uint8_t, uint32_t, uint32_t); +void font_bit_to_pix32(struct font *, uint32_t *, uint8_t, uint32_t, uint32_t); #ifdef __cplusplus } |