diff options
author | Dan McDonald <danmcd@joyent.com> | 2020-10-28 10:20:42 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2020-10-28 10:20:42 -0400 |
commit | 25224c29e0bd70ec85db1db89171523a472a3ee2 (patch) | |
tree | 1816b24ae8f5ebf6e6a9b7c6118d0b7a15c548e6 | |
parent | b22c63f8903e5745ca5e75e3368d252cecc948cc (diff) | |
parent | 94cc9d8febd5c99331fd191291b3b54435a1ef18 (diff) | |
download | illumos-joyent-25224c29e0bd70ec85db1db89171523a472a3ee2.tar.gz |
[illumos-gate merge]
commit 94cc9d8febd5c99331fd191291b3b54435a1ef18
13118 Very slow reaping, possible deadlock in zfs_delmap
commit 7cbbb9b50e91b71fbcb3cde98921fc7fbcbe83ea
13241 mlxcx sending wrong length SET_FLOW_TABLE_ROOT on some parts
commit 91061836e6d66992af6a50374729f8ef6a6263ae
13204 loader: 8-bit depth can draw 256 colors
-rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/common/gfx_fb.c | 13 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/common/multiboot2.c | 8 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/common/tem.c | 45 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/i386/libi386/vbe.c | 109 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/i386/libi386/vbe.h | 7 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/i386/libi386/vidconsole.c | 70 | ||||
-rw-r--r-- | usr/src/common/font/font.c | 8 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/zfs_vnops.c | 21 | ||||
-rw-r--r-- | usr/src/uts/common/io/mlxcx/mlxcx_cmd.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/io/mlxcx/mlxcx_reg.h | 4 |
11 files changed, 177 insertions, 116 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index eb0c6464c4..2740ae8932 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)-2020.10.15.1 +BOOT_VERSION = $(LOADER_VERSION)-2020.10.16.1 diff --git a/usr/src/boot/sys/boot/common/gfx_fb.c b/usr/src/boot/sys/boot/common/gfx_fb.c index 78d3910e39..be50d384f7 100644 --- a/usr/src/boot/sys/boot/common/gfx_fb.c +++ b/usr/src/boot/sys/boot/common/gfx_fb.c @@ -247,10 +247,7 @@ gfx_set_colors(struct env_var *ev, int flags, const void *value) if (value == NULL) return (CMD_OK); - if (gfx_fb.framebuffer_common.framebuffer_bpp < 24) - limit = 7; - else - limit = 255; + limit = 255; if (color_name_to_ansi(value, &val)) { snprintf(buf, sizeof (buf), "%d", val); @@ -262,18 +259,16 @@ gfx_set_colors(struct env_var *ev, int flags, const void *value) val = (int)strtol(value, &end, 0); if (errno != 0 || *end != '\0') { printf("Allowed values are either ansi color name or " - "number from range [0-7]%s.\n", - limit == 7 ? "" : " or [16-255]"); + "number from range [0-255].\n"); return (CMD_OK); } evalue = value; } /* invalid value? */ - if ((val < 0 || val > limit) || (val > 7 && val < 16)) { + if ((val < 0 || val > limit)) { printf("Allowed values are either ansi color name or " - "number from range [0-7]%s.\n", - limit == 7 ? "" : " or [16-255]"); + "number from range [0-255].\n"); return (CMD_OK); } diff --git a/usr/src/boot/sys/boot/common/multiboot2.c b/usr/src/boot/sys/boot/common/multiboot2.c index 1139258200..75b3e350b4 100644 --- a/usr/src/boot/sys/boot/common/multiboot2.c +++ b/usr/src/boot/sys/boot/common/multiboot2.c @@ -774,8 +774,7 @@ mbi_size(struct preloaded_file *fp, char *cmdline) if (gfx_fb.framebuffer_common.framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED) { size += sizeof (struct multiboot_tag_framebuffer_common); - size += gfx_fb.u.fb1.framebuffer_palette_num_colors * - sizeof (multiboot_color_t); + size += CMAP_SIZE * sizeof (multiboot_color_t); } else { size += sizeof (multiboot_tag_framebuffer_t); } @@ -1177,9 +1176,10 @@ multiboot2_exec(struct preloaded_file *fp) if (gfx_fb.framebuffer_common.framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED) { + gfx_fb.u.fb1.framebuffer_palette_num_colors = CMAP_SIZE; + memcpy(tag->u.fb1.framebuffer_palette, cmap, - sizeof (multiboot_color_t) * - gfx_fb.u.fb1.framebuffer_palette_num_colors); + sizeof (multiboot_color_t) * CMAP_SIZE); } #endif /* EFI */ } diff --git a/usr/src/boot/sys/boot/common/tem.c b/usr/src/boot/sys/boot/common/tem.c index 97a7745285..561be4e28d 100644 --- a/usr/src/boot/sys/boot/common/tem.c +++ b/usr/src/boot/sys/boot/common/tem.c @@ -1159,32 +1159,41 @@ tem_setparam(struct tem_vt_state *tem, int count, int newparam) } } +/* + * For colors 0-15 the tem is using color code translation + * from sun colors to vga (dim_xlate and brt_xlate tables, see tem_get_color). + * Colors 16-255 are used without translation. + */ static void tem_select_color(struct tem_vt_state *tem, text_color_t color, bool fg) { - if (tems.ts_pdepth >= 24 || - (color < 8 && tems.ts_pdepth < 24)) { - if (fg == true) { - tem->tvs_fg_color = color; + if (fg == true) + tem->tvs_fg_color = color; + else + tem->tvs_bg_color = color; + + /* + * For colors 0-7, make sure the BRIGHT attribute is not set. + */ + if (color < 8) { + if (fg == true) tem->tvs_flags &= ~TEM_ATTR_BRIGHT_FG; - } else { - tem->tvs_bg_color = color; + else tem->tvs_flags &= ~TEM_ATTR_BRIGHT_BG; - } return; } - if (color > 15) - return; - - /* Bright color and depth < 24 */ - color -= 8; - if (fg == true) { - tem->tvs_fg_color = color; - tem->tvs_flags |= TEM_ATTR_BRIGHT_FG; - } else { - tem->tvs_bg_color = color; - tem->tvs_flags |= TEM_ATTR_BRIGHT_BG; + /* + * For colors 8-15, we use color codes 0-7 and set BRIGHT attribute. + */ + if (color < 16) { + if (fg == true) { + tem->tvs_fg_color -= 8; + tem->tvs_flags |= TEM_ATTR_BRIGHT_FG; + } else { + tem->tvs_bg_color -= 8; + tem->tvs_flags |= TEM_ATTR_BRIGHT_BG; + } } } diff --git a/usr/src/boot/sys/boot/i386/libi386/vbe.c b/usr/src/boot/sys/boot/i386/libi386/vbe.c index d0831d1599..c4d059bf1f 100644 --- a/usr/src/boot/sys/boot/i386/libi386/vbe.c +++ b/usr/src/boot/sys/boot/i386/libi386/vbe.c @@ -47,7 +47,9 @@ static struct vbeinfoblock *vbe = (struct vbeinfoblock *)&vbestate.vbe_control_info; static struct modeinfoblock *vbe_mode = (struct modeinfoblock *)&vbestate.vbe_mode_info; -multiboot_color_t cmap[16]; +multiboot_color_t *cmap; +/* The default VGA color palette format is 6 bits per primary color. */ +int palette_format = 6; /* Actually assuming mode 3. */ void @@ -55,6 +57,18 @@ bios_set_text_mode(int mode) { int atr; + if (vbe->Capabilities & VBE_CAP_DAC8) { + int m; + + /* + * The mode change should reset the palette format to + * 6 bits, but apparently some systems do fail with 8-bit + * palette, so we switch to 6-bit here. + */ + m = 0x0600; + (void) biosvbe_palette_format(&m); + palette_format = m; + } v86.ctl = V86_FLAGS; v86.addr = 0x10; v86.eax = mode; /* set VGA text mode */ @@ -107,6 +121,20 @@ biosvbe_get_mode_info(int mode, struct modeinfoblock *mi) static int biosvbe_set_mode(int mode, struct crtciinfoblock *ci) { + int rv; + + if (vbe->Capabilities & VBE_CAP_DAC8) { + int m; + + /* + * The mode change should reset the palette format to + * 6 bits, but apparently some systems do fail with 8-bit + * palette, so we switch to 6-bit here. + */ + m = 0x0600; + if (biosvbe_palette_format(&m) == VBE_SUCCESS) + palette_format = m; + } v86.ctl = V86_FLAGS; v86.addr = 0x10; v86.eax = 0x4f02; @@ -114,7 +142,16 @@ biosvbe_set_mode(int mode, struct crtciinfoblock *ci) v86.es = VTOPSEG(ci); v86.edi = VTOPOFF(ci); v86int(); - return (v86.eax & 0xffff); + rv = v86.eax & 0xffff; + if (vbe->Capabilities & VBE_CAP_DAC8) { + int m; + + /* Switch to 8-bits per primary color. */ + m = 0x0800; + if (biosvbe_palette_format(&m) == VBE_SUCCESS) + palette_format = m; + } + return (rv); } /* Function 03h - Get VBE Mode */ @@ -138,7 +175,7 @@ biosvbe_palette_format(int *format) v86.eax = 0x4f08; v86.ebx = *format; v86int(); - *format = v86.ebx & 0xffff; + *format = (v86.ebx >> 8) & 0xff; return (v86.eax & 0xffff); } @@ -276,9 +313,9 @@ int vbe_set_palette(const struct paletteentry *entry, size_t slot) { struct paletteentry pe; - int ret; + int mode, ret; - if (!vbe_check()) + if (!vbe_check() || (vbe->Capabilities & VBE_CAP_DAC8) == 0) return (1); if (gfx_fb.framebuffer_common.framebuffer_type != @@ -286,13 +323,21 @@ vbe_set_palette(const struct paletteentry *entry, size_t slot) return (1); } + if (cmap == NULL) + cmap = calloc(CMAP_SIZE, sizeof (*cmap)); + pe.Blue = entry->Blue; pe.Green = entry->Green; pe.Red = entry->Red; pe.Alignment = entry->Alignment; - ret = biosvbe_palette_data(0x00, slot, &pe); - if (ret == VBE_SUCCESS && slot < sizeof (cmap)) { + if (vbe->Capabilities & VBE_CAP_SNOW) + mode = 0x80; + else + mode = 0; + + ret = biosvbe_palette_data(mode, slot, &pe); + if (cmap != NULL && slot < CMAP_SIZE) { cmap[slot].mb_red = entry->Red; cmap[slot].mb_green = entry->Green; cmap[slot].mb_blue = entry->Blue; @@ -361,15 +406,7 @@ vbe_set_mode(int modenum) case 0x4: gfx_fb.framebuffer_common.framebuffer_type = MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED; - if (vbe->VbeVersion >= 0x300) { - gfx_fb.framebuffer_common.framebuffer_pitch = - mi.LinBytesPerScanLine; - } else { - gfx_fb.framebuffer_common.framebuffer_pitch = - mi.BytesPerScanLine; - } - gfx_fb.u.fb1.framebuffer_palette_num_colors = 16; - return (0); /* done */ + break; case 0x6: gfx_fb.framebuffer_common.framebuffer_type = MULTIBOOT_FRAMEBUFFER_TYPE_RGB; @@ -671,10 +708,14 @@ done: } static void -vbe_print_mode(void) +vbe_print_mode(bool verbose) { - int mode, i, rc; - struct paletteentry pe; + int nc, mode, i, rc; + + if (verbose) + nc = 256; + else + nc = 16; memset(vbe, 0, sizeof (vbe)); memcpy(vbe->VbeSignature, "VBE2", 4); @@ -728,15 +769,18 @@ vbe_print_mode(void) if (rc != VBE_SUCCESS) return; - printf(" palette format: %x bits per primary\n", mode >> 8); - for (i = 0; i < 16; i++) { - rc = biosvbe_palette_data(1, i, &pe); - if (rc != VBE_SUCCESS) - break; + printf(" palette format: %x bits per primary\n", mode); + if (cmap == NULL) + return; - printf("%d: R=%02x, G=%02x, B=%02x\n", i, - pe.Red, pe.Green, pe.Blue); + pager_open(); + for (i = 0; i < nc; i++) { + printf("%d: R=%02x, G=%02x, B=%02x", i, + cmap[i].mb_red, cmap[i].mb_green, cmap[i].mb_blue); + if (pager_output("\n") != 0) + break; } + pager_close(); } /* @@ -812,10 +856,15 @@ command_vesa(int argc, char *argv[]) } if (strcmp(argv[1], "get") == 0) { - if (argc != 2) - goto usage; + bool verbose = false; + + if (argc > 2) { + if (argc > 3 || strcmp(argv[2], "-v") != 0) + goto usage; + verbose = true; + } - vbe_print_mode(); + vbe_print_mode(verbose); return (CMD_OK); } @@ -888,7 +937,7 @@ command_vesa(int argc, char *argv[]) usage: snprintf(command_errbuf, sizeof (command_errbuf), - "usage: %s on | off | get | list [depth] | " + "usage: %s on | off | get [-v] | list [depth] | " "set <display or VBE mode number>", argv[0]); return (CMD_ERROR); } diff --git a/usr/src/boot/sys/boot/i386/libi386/vbe.h b/usr/src/boot/sys/boot/i386/libi386/vbe.h index dc732a05bc..1a9ff770d1 100644 --- a/usr/src/boot/sys/boot/i386/libi386/vbe.h +++ b/usr/src/boot/sys/boot/i386/libi386/vbe.h @@ -43,6 +43,9 @@ struct vbeinfoblock { uint16_t VbeVersion; uint32_t OemStringPtr; uint32_t Capabilities; +#define VBE_CAP_DAC8 (1 << 0) /* Can switch DAC */ +#define VBE_CAP_NONVGA (1 << 1) /* Controller is not VGA comp. */ +#define VBE_CAP_SNOW (1 << 2) /* Set data during Vertical Reterace */ uint32_t VideoModePtr; uint16_t TotalMemory; uint16_t OemSoftwareRev; @@ -137,6 +140,10 @@ struct flatpanelinfo #define TEXT_ROWS (25) /* VGATEXT rows */ #define TEXT_COLS (80) /* VGATEXT columns */ +#define CMAP_SIZE 256 /* Number of colors in palette */ + +extern int palette_format; + /* high-level VBE helpers, from vbe.c */ void bios_set_text_mode(int); int biosvbe_palette_format(int *); diff --git a/usr/src/boot/sys/boot/i386/libi386/vidconsole.c b/usr/src/boot/sys/boot/i386/libi386/vidconsole.c index e6a1f62a8e..a1eb1b37c9 100644 --- a/usr/src/boot/sys/boot/i386/libi386/vidconsole.c +++ b/usr/src/boot/sys/boot/i386/libi386/vidconsole.c @@ -538,42 +538,54 @@ vidc_cons_cursor(struct vis_conscursor *cc) } } -static uint8_t -c24_to_vga(uint8_t c, uint8_t mask) -{ - switch (c) { - case 0x40: - return (0x15 & mask); - case 0x80: - return (0x2A & mask); - case 0xFF: - return (c & mask); - default: - return (0); - } -} - static int vidc_vbe_cons_put_cmap(struct vis_cmap *cm) { - int i, bits, rc = 0; + int i, rc; struct paletteentry pe; + rgb_t rgb; + uint32_t c; + + rc = 0; + + /* + * we need to set position and size for rgb_color_map() + * to be able to work. + */ + gfx_fb.u.fb2.framebuffer_red_field_position = 16; + gfx_fb.u.fb2.framebuffer_green_field_position = 8; + gfx_fb.u.fb2.framebuffer_blue_field_position = 0; + gfx_fb.u.fb2.framebuffer_red_mask_size = palette_format; + gfx_fb.u.fb2.framebuffer_green_mask_size = palette_format; + gfx_fb.u.fb2.framebuffer_blue_mask_size = palette_format; + + rgb.red.pos = gfx_fb.u.fb2.framebuffer_red_field_position; + rgb.red.size = gfx_fb.u.fb2.framebuffer_red_mask_size; - bits = 1; /* get DAC palette width */ - rc = biosvbe_palette_format(&bits); - if (rc != VBE_SUCCESS) - return (rc); + rgb.green.pos = gfx_fb.u.fb2.framebuffer_green_field_position; + rgb.green.size = gfx_fb.u.fb2.framebuffer_green_mask_size; + + rgb.blue.pos = gfx_fb.u.fb2.framebuffer_blue_field_position; + rgb.blue.size = gfx_fb.u.fb2.framebuffer_blue_mask_size; - bits = 0xFF >> (8 - (bits >> 8)); pe.Alignment = 0; - for (i = 0; i < cm->count; i++) { - pe.Red = c24_to_vga(cm->red[i], bits); - pe.Green = c24_to_vga(cm->green[i], bits); - pe.Blue = c24_to_vga(cm->blue[i], bits); - rc = vbe_set_palette(&pe, - solaris_color_to_pc_color[cm->index + i]); - if (rc != 0) - break; + + /* + * The first 16 colors need to be in VGA color order. + */ + for (i = cm->index; i < 256 && rc == 0; i++) { + if (i < 16) { + if (i < 15) + c = rgb_color_map(&rgb, i + 1); + else + c = rgb_color_map(&rgb, 0); + } else { + c = rgb_color_map(&rgb, i); + } + pe.Red = (c >> rgb.red.pos) & ((1 << rgb.red.size) - 1); + pe.Green = (c >> rgb.green.pos) & ((1 << rgb.green.size) - 1); + pe.Blue = (c >> rgb.blue.pos) & ((1 << rgb.blue.size) - 1); + rc = vbe_set_palette(&pe, i); } return (rc); } diff --git a/usr/src/common/font/font.c b/usr/src/common/font/font.c index f46c34a988..81d5b4ae53 100644 --- a/usr/src/common/font/font.c +++ b/usr/src/common/font/font.c @@ -88,22 +88,22 @@ const text_cmap_t cmap4_to_24 = { /* END CSTYLED */ static uint32_t -rgb_to_color(const rgb_t *rgb, uint8_t r, uint8_t g, uint8_t b) +rgb_to_color(const rgb_t *rgb, uint32_t r, uint32_t g, uint32_t b) { uint32_t color; int pos, size; pos = rgb->red.pos; size = rgb->red.size; - color = ((r >> (8 - size)) & ((1 << size) - 1)) << pos; + color = ((r * ((1 << size) - 1)) / 0xff) << pos; pos = rgb->green.pos; size = rgb->green.size; - color |= ((g >> (8 - size)) & ((1 << size) - 1)) << pos; + color |= (((g * ((1 << size) - 1)) / 0xff) << pos); pos = rgb->blue.pos; size = rgb->blue.size; - color |= ((b >> (8 - size)) & ((1 << size) - 1)) << pos; + color |= (((b * ((1 << size) - 1)) / 0xff) << pos); return (color); } diff --git a/usr/src/uts/common/fs/zfs/zfs_vnops.c b/usr/src/uts/common/fs/zfs/zfs_vnops.c index c016b5c1ea..6672d85702 100644 --- a/usr/src/uts/common/fs/zfs/zfs_vnops.c +++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c @@ -5147,27 +5147,6 @@ zfs_addmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr, return (0); } -/* - * The reason we push dirty pages as part of zfs_delmap() is so that we get a - * more accurate mtime for the associated file. Since we don't have a way of - * detecting when the data was actually modified, we have to resort to - * heuristics. If an explicit msync() is done, then we mark the mtime when the - * last page is pushed. The problem occurs when the msync() call is omitted, - * which by far the most common case: - * - * open() - * mmap() - * <modify memory> - * munmap() - * close() - * <time lapse> - * putpage() via fsflush - * - * If we wait until fsflush to come along, we can have a modification time that - * is some arbitrary point in the future. In order to prevent this in the - * common case, we flush pages whenever a (MAP_SHARED, PROT_WRITE) mapping is - * torn down. - */ /* ARGSUSED */ static int zfs_delmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr, diff --git a/usr/src/uts/common/io/mlxcx/mlxcx_cmd.c b/usr/src/uts/common/io/mlxcx/mlxcx_cmd.c index 32c40ec3ea..7ea0de4dab 100644 --- a/usr/src/uts/common/io/mlxcx/mlxcx_cmd.c +++ b/usr/src/uts/common/io/mlxcx/mlxcx_cmd.c @@ -3738,3 +3738,9 @@ CTASSERT(offsetof(mlxcx_cmd_access_register_in_t, CTASSERT(offsetof(mlxcx_cmd_access_register_out_t, mlxo_access_register_data) == 0x10); + +CTASSERT(sizeof (mlxcx_cmd_set_flow_table_root_in_t) == 64); +CTASSERT(offsetof(mlxcx_cmd_set_flow_table_root_in_t, + mlxi_set_flow_table_root_table_id) == 0x15); +CTASSERT(offsetof(mlxcx_cmd_set_flow_table_root_in_t, + mlxi_set_flow_table_root_esw_owner_vhca_id_valid) == 0x1C); diff --git a/usr/src/uts/common/io/mlxcx/mlxcx_reg.h b/usr/src/uts/common/io/mlxcx/mlxcx_reg.h index 4b92de92b8..24435a22ab 100644 --- a/usr/src/uts/common/io/mlxcx/mlxcx_reg.h +++ b/usr/src/uts/common/io/mlxcx/mlxcx_reg.h @@ -2082,6 +2082,10 @@ typedef struct { uint8_t mlxi_set_flow_table_root_rsvd3[4]; uint24be_t mlxi_set_flow_table_root_table_id; uint8_t mlxi_set_flow_table_root_rsvd4[4]; + uint8_t mlxi_set_flow_table_root_esw_owner_vhca_id_valid; + uint8_t mlxi_set_flow_table_root_rsvd5; + uint16be_t mlxi_set_flow_table_root_esw_owner_vhca_id; + uint8_t mlxi_set_flow_table_root_rsvd6[32]; } mlxcx_cmd_set_flow_table_root_in_t; typedef struct { |