diff options
author | Josh Wilsdon <jwilsdon@joyent.com> | 2016-12-06 11:24:57 -0800 |
---|---|---|
committer | Josh Wilsdon <jwilsdon@joyent.com> | 2016-12-06 11:24:57 -0800 |
commit | 745e41d14668d8cf1f368877339539189160ba8f (patch) | |
tree | 3396d44d6ebd165587d7cbb31a9a66934253524a | |
parent | f44f59dde7be918b195c0ddda03e2e248b478839 (diff) | |
parent | eb3642a63a4b76721d1d3857654137d69aee122e (diff) | |
download | illumos-joyent-745e41d14668d8cf1f368877339539189160ba8f.tar.gz |
Merge branch 'master' into OS-5783
109 files changed, 1580 insertions, 763 deletions
@@ -484,9 +484,7 @@ f etc/security/prof_attr.d/SUNWcs 0644 root sys s etc/services=inet/services d etc/skel 0755 root sys f etc/skel/.profile 0644 root other -f etc/skel/local.cshrc 0644 root sys -f etc/skel/local.login 0644 root sys -f etc/skel/local.profile 0644 root sys +f etc/skel/.kshrc 0644 root other d etc/sock2path.d 0755 root sys f etc/sock2path.d/driver%2Fnetwork%2Fbpf 0644 root sys f etc/sock2path.d/driver%2Fnetwork%2Fsdp 0644 root sys @@ -2653,6 +2651,7 @@ f usr/include/device_info.h 0644 root bin f usr/include/devid.h 0644 root bin f usr/include/devmgmt.h 0644 root bin f usr/include/devpoll.h 0644 root bin +f usr/include/devfsadm.h 0644 root bin f usr/include/dial.h 0644 root bin f usr/include/directory.h 0644 root bin f usr/include/dirent.h 0644 root bin @@ -3716,6 +3715,7 @@ f usr/include/sys/ftrace.h 0644 root bin f usr/include/sys/fx.h 0644 root bin f usr/include/sys/fxpriocntl.h 0644 root bin f usr/include/sys/gfs.h 0644 root bin +f usr/include/sys/gfx_private.h 0644 root bin f usr/include/sys/gld.h 0644 root bin f usr/include/sys/gldpriv.h 0644 root bin f usr/include/sys/group.h 0644 root bin @@ -5176,6 +5176,7 @@ d usr/lib/devfsadm/linkmod 0755 root sys f usr/lib/devfsadm/linkmod/SUNW_audio_link.so 0755 root sys f usr/lib/devfsadm/linkmod/SUNW_cfg_link.so 0755 root sys f usr/lib/devfsadm/linkmod/SUNW_dcam1394_link.so 0755 root sys +f usr/lib/devfsadm/linkmod/SUNW_drm_link_i386.so 0755 root sys f usr/lib/devfsadm/linkmod/SUNW_disk_link.so 0755 root sys f usr/lib/devfsadm/linkmod/SUNW_dtrace_link.so 0755 root sys f usr/lib/devfsadm/linkmod/SUNW_fssnap_link.so 0755 root sys diff --git a/usr/src/boot/sys/boot/common/commands.c b/usr/src/boot/sys/boot/common/commands.c index cf16d83e8c..65941a2f2b 100644 --- a/usr/src/boot/sys/boot/common/commands.c +++ b/usr/src/boot/sys/boot/common/commands.c @@ -509,9 +509,6 @@ command_lsdev(int argc, char *argv[]) pager_open(); for (i = 0; devsw[i] != NULL; i++) { if (devsw[i]->dv_print != NULL){ - sprintf(line, "%s devices:\n", devsw[i]->dv_name); - if (pager_output(line)) - break; if (devsw[i]->dv_print(verbose)) break; } else { diff --git a/usr/src/boot/sys/boot/common/dev_net.c b/usr/src/boot/sys/boot/common/dev_net.c index 98ae42b33f..0e54e7e6e8 100644 --- a/usr/src/boot/sys/boot/common/dev_net.c +++ b/usr/src/boot/sys/boot/common/dev_net.c @@ -334,28 +334,30 @@ static int net_print(int verbose) { struct netif_driver *drv; - char line[80]; int i, d, cnt; int ret = 0; + if (netif_drivers[0] == NULL) + return (ret); + + printf("%s devices:", netdev.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + cnt = 0; for (d = 0; netif_drivers[d]; d++) { drv = netif_drivers[d]; for (i = 0; i < drv->netif_nifs; i++) { - snprintf(line, 80, "\t%s%d:", "net", cnt++); - ret = pager_output(line); - if (ret != 0) - break; + printf("\t%s%d:", netdev.dv_name, cnt++); if (verbose) { - snprintf(line, 80, " (%s%d)", drv->netif_bname, + printf(" (%s%d)", drv->netif_bname, drv->netif_ifs[i].dif_unit); - ret = pager_output(line); - if (ret != 0) - break; } + if ((ret = pager_output("\n")) != 0) + return (ret); } } - return (ret |= pager_output("\n")); + return (ret); } /* diff --git a/usr/src/boot/sys/boot/common/md.c b/usr/src/boot/sys/boot/common/md.c index a8f092b92b..c9bc52b1d2 100644 --- a/usr/src/boot/sys/boot/common/md.c +++ b/usr/src/boot/sys/boot/common/md.c @@ -63,7 +63,7 @@ static int md_init(void); static int md_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int md_open(struct open_file *, ...); static int md_close(struct open_file *); -static void md_print(int); +static int md_print(int); struct devsw md_dev = { "md", @@ -143,9 +143,14 @@ md_close(struct open_file *f) return ((dev->d_unit != 0) ? ENXIO : 0); } -static void +static int md_print(int verbose) { - printf("MD (%u bytes)\n", MD_IMAGE_SIZE); + printf("%s devices:", md_dev.dv_name); + if (pager_output("\n") != 0) + return (1); + + printf("MD (%u bytes)", MD_IMAGE_SIZE); + return (pager_output("\n")); } diff --git a/usr/src/boot/sys/boot/efi/libefi/efinet.c b/usr/src/boot/sys/boot/efi/libefi/efinet.c index e48b4a4b72..5afa5ffa86 100644 --- a/usr/src/boot/sys/boot/efi/libefi/efinet.c +++ b/usr/src/boot/sys/boot/efi/libefi/efinet.c @@ -329,6 +329,10 @@ efinet_dev_print(int verbose) EFI_HANDLE h; int unit, ret; + printf("%s devices:", efinet_dev.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (unit = 0, h = efi_find_handle(&efinet_dev, 0); h != NULL; h = efi_find_handle(&efinet_dev, ++unit)) { sprintf(line, " %s%d:\n", efinet_dev.dv_name, unit); diff --git a/usr/src/boot/sys/boot/efi/libefi/efipart.c b/usr/src/boot/sys/boot/efi/libefi/efipart.c index c97eb6694a..9ba52bb626 100644 --- a/usr/src/boot/sys/boot/efi/libefi/efipart.c +++ b/usr/src/boot/sys/boot/efi/libefi/efipart.c @@ -182,6 +182,10 @@ efipart_print(int verbose) u_int unit; int ret = 0; + printf("%s devices:", efipart_dev.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (unit = 0, h = efi_find_handle(&efipart_dev, 0); h != NULL; h = efi_find_handle(&efipart_dev, ++unit)) { sprintf(line, " %s%d:", efipart_dev.dv_name, unit); diff --git a/usr/src/boot/sys/boot/i386/libfirewire/firewire.c b/usr/src/boot/sys/boot/i386/libfirewire/firewire.c index 8191a63d8b..4c62145ef2 100644 --- a/usr/src/boot/sys/boot/i386/libfirewire/firewire.c +++ b/usr/src/boot/sys/boot/i386/libfirewire/firewire.c @@ -69,7 +69,7 @@ static int fw_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, size_t *rsize); static int fw_open(struct open_file *f, ...); static int fw_close(struct open_file *f); -static void fw_print(int verbose); +static int fw_print(int verbose); static void fw_cleanup(void); void fw_enable(void); @@ -148,21 +148,28 @@ fw_init(void) /* * Print information about OHCI chips */ -static void +static int fw_print(int verbose) { - int i; + int i, ret; struct fwohci_softc *sc; + printf("%s devices:", fwohci.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < MAX_OHCI; i ++) { sc = &fwinfo[i]; if (sc->state == FWOHCI_STATE_DEAD) break; printf("%d: locator=0x%04x devid=0x%08x" - " base_addr=0x%08x handle=0x%08x bus_id=0x%08x\n", + " base_addr=0x%08x handle=0x%08x bus_id=0x%08x", i, sc->locator, sc->devid, sc->base_addr, sc->handle, sc->bus_id); + if ((ret = pager_output("\n")) != 0) + break; } + return (ret); } static int diff --git a/usr/src/boot/sys/boot/i386/libi386/bioscd.c b/usr/src/boot/sys/boot/i386/libi386/bioscd.c index 764fdc7c2e..0d51bd29db 100644 --- a/usr/src/boot/sys/boot/i386/libi386/bioscd.c +++ b/usr/src/boot/sys/boot/i386/libi386/bioscd.c @@ -183,6 +183,13 @@ bc_print(int verbose) char line[80]; int i, ret = 0; + if (nbcinfo == 0) + return (0); + + printf("%s devices:", bioscd.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < nbcinfo; i++) { sprintf(line, " cd%d: Device 0x%x\n", i, bcinfo[i].bc_sp.sp_devicespec); diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c index bf11f27e0c..1165facb08 100644 --- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c +++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c @@ -287,6 +287,13 @@ bd_print(int verbose) struct disk_devdesc dev; int i, ret = 0; + if (nbdinfo == 0) + return (0); + + printf("%s devices:", biosdisk.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < nbdinfo; i++) { snprintf(line, sizeof (line), " disk%d: BIOS drive %c (%ju X %u):\n", i, diff --git a/usr/src/boot/sys/boot/i386/libi386/pxe.c b/usr/src/boot/sys/boot/i386/libi386/pxe.c index cddf8d244e..873b78e8f6 100644 --- a/usr/src/boot/sys/boot/i386/libi386/pxe.c +++ b/usr/src/boot/sys/boot/i386/libi386/pxe.c @@ -377,6 +377,9 @@ pxe_print(int verbose) if (pxe_call == NULL) return (0); + printf("%s devices:", pxedisk.dv_name); + if (pager_output("\n") != 0) + return (1); snprintf(line, sizeof (line), " pxe0: %s:%s\n", inet_ntoa(rootip), rootpath); return (pager_output(line)); diff --git a/usr/src/boot/sys/boot/uboot/lib/disk.c b/usr/src/boot/sys/boot/uboot/lib/disk.c index a8b7853198..22bec208a1 100644 --- a/usr/src/boot/sys/boot/uboot/lib/disk.c +++ b/usr/src/boot/sys/boot/uboot/lib/disk.c @@ -77,7 +77,7 @@ static int stor_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int stor_open(struct open_file *, ...); static int stor_close(struct open_file *); static int stor_ioctl(struct open_file *f, u_long cmd, void *data); -static void stor_print(int); +static int stor_print(int); static void stor_cleanup(void); struct devsw uboot_storage = { @@ -237,13 +237,20 @@ stor_readdev(struct disk_devdesc *dev, daddr_t blk, size_t size, char *buf) return (err); } -static void +static int stor_print(int verbose) { struct disk_devdesc dev; static char line[80]; int i; + if (stor_info_no == 0) + return (ret); + + printf("%s devices:", uboot_storage.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < stor_info_no; i++) { dev.d_dev = &uboot_storage; dev.d_unit = i; diff --git a/usr/src/boot/sys/boot/usb/storage/umass_loader.c b/usr/src/boot/sys/boot/usb/storage/umass_loader.c index 4311b2b65e..889c779c92 100644 --- a/usr/src/boot/sys/boot/usb/storage/umass_loader.c +++ b/usr/src/boot/sys/boot/usb/storage/umass_loader.c @@ -49,7 +49,7 @@ static int umass_disk_close(struct open_file *); static void umass_disk_cleanup(void); static int umass_disk_ioctl(struct open_file *, u_long, void *); static int umass_disk_strategy(void *, int, daddr_t, size_t, char *, size_t *); -static void umass_disk_print(int); +static int umass_disk_print(int); struct devsw umass_disk = { .dv_name = "umass", @@ -169,11 +169,15 @@ umass_disk_close(struct open_file *f) return (disk_close(dev)); } -static void +static int umass_disk_print(int verbose) { struct disk_devdesc dev; + printf("%s devices:", umass_disk.dv_name); + if (pager_output("\n") != 0) + return (1); + memset(&dev, 0, sizeof(dev)); pager_output(" umass0 UMASS device\n"); diff --git a/usr/src/boot/sys/boot/userboot/userboot/host.c b/usr/src/boot/sys/boot/userboot/userboot/host.c index 81858a989f..db88c61eca 100644 --- a/usr/src/boot/sys/boot/userboot/userboot/host.c +++ b/usr/src/boot/sys/boot/userboot/userboot/host.c @@ -134,11 +134,15 @@ host_dev_init(void) return (0); } -static void +static int host_dev_print(int verbose) { char line[80]; + printf("%s devices:", host_dev.dv_name); + if (pager_output("\n") != 0) + return (1); + sprintf(line, " host%d: Host filesystem\n", 0); pager_output(line); } diff --git a/usr/src/boot/sys/boot/userboot/userboot/userboot_disk.c b/usr/src/boot/sys/boot/userboot/userboot/userboot_disk.c index bbd9efcc03..156df63878 100644 --- a/usr/src/boot/sys/boot/userboot/userboot/userboot_disk.c +++ b/usr/src/boot/sys/boot/userboot/userboot/userboot_disk.c @@ -56,7 +56,7 @@ static int userdisk_strategy(void *devdata, int flag, daddr_t dblk, static int userdisk_open(struct open_file *f, ...); static int userdisk_close(struct open_file *f); static int userdisk_ioctl(struct open_file *f, u_long cmd, void *data); -static void userdisk_print(int verbose); +static int userdisk_print(int verbose); struct devsw userboot_disk = { "disk", @@ -110,13 +110,20 @@ userdisk_cleanup(void) /* * Print information about disks */ -static void +static int userdisk_print(int verbose) { struct disk_devdesc dev; char line[80]; int i; + if (userdisk_maxunit == 0) + return (0); + + printf("%s devices:", userboot_disk.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < userdisk_maxunit; i++) { sprintf(line, " disk%d: Guest drive image\n", i); pager_output(line); diff --git a/usr/src/boot/sys/boot/zfs/zfs.c b/usr/src/boot/sys/boot/zfs/zfs.c index f8d95662b5..ea6734ff5e 100644 --- a/usr/src/boot/sys/boot/zfs/zfs.c +++ b/usr/src/boot/sys/boot/zfs/zfs.c @@ -525,6 +525,13 @@ zfs_dev_print(int verbose) char line[80]; int ret = 0; + if (STAILQ_EMPTY(&zfs_pools)) + return (0); + + printf("%s devices:", zfs_dev.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + if (verbose) { return (spa_all_status()); } diff --git a/usr/src/cmd/devfsadm/Makefile b/usr/src/cmd/devfsadm/Makefile index e008e8fffb..7b2409d131 100644 --- a/usr/src/cmd/devfsadm/Makefile +++ b/usr/src/cmd/devfsadm/Makefile @@ -47,6 +47,11 @@ ROOTETCDEVFILES=$(ETCDEVFILES:%=$(ROOTETCDEV)/%) $(ROOTETCDEV) := DIRMODE= 755 $(ROOTETCDEVFILES) := FILEMODE = 0644 +USRINCLUDEFILES=devfsadm.h +ROOTUSRINCLUDE= $(ROOT)/usr/include +ROOTUSRINCLUDEFILES=$(USRINCLUDEFILES:%=$(ROOTUSRINCLUDE)/%) +$(ROOTUSRINCLUDEFILES) := FILEMODE = 0644 + .KEEP_STATE: all: $(SUBDIRS) $(ETCDEVFILES) @@ -56,7 +61,8 @@ clean lint _msg: $(SUBDIRS) clobber: $(SUBDIRS) $(RM) $(ROOTETCDEVFILES) -install: $(SUBDIRS) $(ROOTETCDEFAULTFILES) $(ROOTETCDEVFILES) +install: $(SUBDIRS) $(ROOTETCDEFAULTFILES) $(ROOTETCDEVFILES) \ + $(ROOTUSRINCLUDEFILES) $(ROOTETCDEV): $(INS.dir) @@ -64,6 +70,9 @@ $(ROOTETCDEV): $(ROOTETCDEV)/% : % $(ROOTETCDEV) $(INS.file) +$(ROOTUSRINCLUDE)/% : % + $(INS.file) + $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/cmd/devfsadm/i386/Makefile b/usr/src/cmd/devfsadm/i386/Makefile index 75f2da3436..8bd5a45401 100644 --- a/usr/src/cmd/devfsadm/i386/Makefile +++ b/usr/src/cmd/devfsadm/i386/Makefile @@ -23,6 +23,7 @@ # LINK_OBJS_i386 = \ + drm_link_i386.o \ misc_link_i386.o \ lx_link_i386.o \ xen_link.o diff --git a/usr/src/cmd/devfsadm/i386/drm_link_i386.c b/usr/src/cmd/devfsadm/i386/drm_link_i386.c new file mode 100644 index 0000000000..ab29ab7899 --- /dev/null +++ b/usr/src/cmd/devfsadm/i386/drm_link_i386.c @@ -0,0 +1,318 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * Copyright 2012 Joyent, Inc. All rights reserved. + */ + +#include <regex.h> +#include <devfsadm.h> +#include <stdio.h> +#include <strings.h> +#include <stdlib.h> +#include <limits.h> +#include <ctype.h> + +/* + * Note: separate from misc_link_i386.c because this will later + * move to the gfx-drm gate. + */ + +static int agp_process(di_minor_t minor, di_node_t node); +static int drm_node(di_minor_t minor, di_node_t node); + +static devfsadm_create_t drm_cbt[] = { + { "drm", "ddi_display:drm", NULL, + TYPE_EXACT, ILEVEL_0, drm_node + }, + { "agp", "ddi_agp:pseudo", NULL, + TYPE_EXACT, ILEVEL_0, agp_process + }, + { "agp", "ddi_agp:target", NULL, + TYPE_EXACT, ILEVEL_0, agp_process + }, + { "agp", "ddi_agp:cpugart", NULL, + TYPE_EXACT, ILEVEL_0, agp_process + }, + { "agp", "ddi_agp:master", NULL, + TYPE_EXACT, ILEVEL_0, agp_process + }, +}; + +DEVFSADM_CREATE_INIT_V0(drm_cbt); + +/* + * For debugging, run devfsadm like this: + * devfsadm -V drm_mid -V devfsadm:enum -c drm + */ +static char *debug_mid = "drm_mid"; + +typedef enum { + DRIVER_AGPPSEUDO = 0, + DRIVER_AGPTARGET, + DRIVER_CPUGART, + DRIVER_AGPMASTER_DRM_I915, + DRIVER_AGPMASTER_DRM_RADEON, + DRIVER_AGPMASTER_VGATEXT, + DRIVER_UNKNOWN +} driver_defs_t; + +typedef struct { + char *driver_name; + int index; +} driver_name_table_entry_t; + +static driver_name_table_entry_t driver_name_table[] = { + { "agpgart", DRIVER_AGPPSEUDO }, + { "agptarget", DRIVER_AGPTARGET }, + { "amd64_gart", DRIVER_CPUGART }, + /* AGP master device managed by drm driver */ + { "i915", DRIVER_AGPMASTER_DRM_I915 }, + { "radeon", DRIVER_AGPMASTER_DRM_RADEON }, + { "vgatext", DRIVER_AGPMASTER_VGATEXT }, + { NULL, DRIVER_UNKNOWN } +}; + +static devfsadm_enumerate_t agptarget_rules[1] = + { "^agp$/^agptarget([0-9]+)$", 1, MATCH_ALL }; +static devfsadm_enumerate_t cpugart_rules[1] = + { "^agp$/^cpugart([0-9]+)$", 1, MATCH_ALL }; +static devfsadm_enumerate_t agpmaster_rules[1] = + { "^agp$/^agpmaster([0-9]+)$", 1, MATCH_ALL }; +static devfsadm_enumerate_t drm_rules[1] = + { "^dri$/^card([0-9]+)$", 1, MATCH_ALL }; + + +/* + * HOT auto cleanup of drm+agp links not desired. + */ +static devfsadm_remove_t drm_remove_cbt[] = { + { "agp", "^agpgart$", RM_POST, + ILEVEL_0, devfsadm_rm_all + }, + { "agp", "^agp/agpmaster[0-9]+$", RM_POST, + ILEVEL_0, devfsadm_rm_all + }, + { "agp", "^agp/agptarget[0-9]+$", RM_POST, + ILEVEL_0, devfsadm_rm_all + }, + { "agp", "^agp/cpugart[0-9]+$", RM_POST, + ILEVEL_0, devfsadm_rm_all + }, + { "drm", "^dri/card[0-9]+$", RM_POST, + ILEVEL_0, devfsadm_rm_all + }, +}; + +DEVFSADM_REMOVE_INIT_V0(drm_remove_cbt); + +static int +agp_process(di_minor_t minor, di_node_t node) +{ + char *minor_nm, *drv_nm; + char *devfspath; + char *I_path, *p_path, *buf; + char *name = (char *)NULL; + int i, index; + devfsadm_enumerate_t rules[1]; + + minor_nm = di_minor_name(minor); + drv_nm = di_driver_name(node); + + if ((minor_nm == NULL) || (drv_nm == NULL)) { + return (DEVFSADM_CONTINUE); + } + + devfsadm_print(debug_mid, "agp_process: minor=%s node=%s\n", + minor_nm, di_node_name(node)); + + devfspath = di_devfs_path(node); + if (devfspath == NULL) { + devfsadm_print(debug_mid, "agp_process: devfspath is NULL\n"); + return (DEVFSADM_CONTINUE); + } + + I_path = (char *)malloc(PATH_MAX); + + if (I_path == NULL) { + di_devfs_path_free(devfspath); + devfsadm_print(debug_mid, "agp_process: malloc failed\n"); + return (DEVFSADM_CONTINUE); + } + + p_path = (char *)malloc(PATH_MAX); + + if (p_path == NULL) { + devfsadm_print(debug_mid, "agp_process: malloc failed\n"); + di_devfs_path_free(devfspath); + free(I_path); + return (DEVFSADM_CONTINUE); + } + + (void) strlcpy(p_path, devfspath, PATH_MAX); + (void) strlcat(p_path, ":", PATH_MAX); + (void) strlcat(p_path, minor_nm, PATH_MAX); + di_devfs_path_free(devfspath); + + devfsadm_print(debug_mid, "agp_process: path %s\n", p_path); + + for (i = 0; ; i++) { + if ((driver_name_table[i].driver_name == NULL) || + (strcmp(drv_nm, driver_name_table[i].driver_name) == 0)) { + index = driver_name_table[i].index; + break; + } + } + switch (index) { + case DRIVER_AGPPSEUDO: + devfsadm_print(debug_mid, + "agp_process: psdeudo driver name\n"); + name = "agpgart"; + (void) snprintf(I_path, PATH_MAX, "%s", name); + devfsadm_print(debug_mid, + "mklink %s -> %s\n", I_path, p_path); + + (void) devfsadm_mklink(I_path, node, minor, 0); + + free(I_path); + free(p_path); + return (DEVFSADM_CONTINUE); + case DRIVER_AGPTARGET: + devfsadm_print(debug_mid, + "agp_process: target driver name\n"); + rules[0] = agptarget_rules[0]; + name = "agptarget"; + break; + case DRIVER_CPUGART: + devfsadm_print(debug_mid, + "agp_process: cpugart driver name\n"); + rules[0] = cpugart_rules[0]; + name = "cpugart"; + break; + case DRIVER_AGPMASTER_DRM_I915: + case DRIVER_AGPMASTER_DRM_RADEON: + case DRIVER_AGPMASTER_VGATEXT: + devfsadm_print(debug_mid, + "agp_process: agpmaster driver name\n"); + rules[0] = agpmaster_rules[0]; + name = "agpmaster"; + break; + case DRIVER_UNKNOWN: + devfsadm_print(debug_mid, + "agp_process: unknown driver name=%s\n", drv_nm); + free(I_path); + free(p_path); + return (DEVFSADM_CONTINUE); + } + + if (devfsadm_enumerate_int(p_path, 0, &buf, rules, 1)) { + devfsadm_print(debug_mid, "agp_process: exit/coninue\n"); + free(I_path); + free(p_path); + return (DEVFSADM_CONTINUE); + } + + + (void) snprintf(I_path, PATH_MAX, "agp/%s%s", name, buf); + + devfsadm_print(debug_mid, "agp_process: p_path=%s buf=%s\n", + p_path, buf); + + free(buf); + + devfsadm_print(debug_mid, "mklink %s -> %s\n", I_path, p_path); + + (void) devfsadm_mklink(I_path, node, minor, 0); + + free(p_path); + free(I_path); + + return (DEVFSADM_CONTINUE); +} + +static int +drm_node(di_minor_t minor, di_node_t node) +{ + char *minor_nm, *drv_nm; + char *devfspath; + char *I_path, *p_path, *buf; + char *name = "card"; + + minor_nm = di_minor_name(minor); + drv_nm = di_driver_name(node); + if ((minor_nm == NULL) || (drv_nm == NULL)) { + return (DEVFSADM_CONTINUE); + } + + devfsadm_print(debug_mid, "drm_node: minor=%s node=%s type=%s\n", + minor_nm, di_node_name(node), di_minor_nodetype(minor)); + + devfspath = di_devfs_path(node); + if (devfspath == NULL) { + devfsadm_print(debug_mid, "drm_node: devfspath is NULL\n"); + return (DEVFSADM_CONTINUE); + } + + I_path = (char *)malloc(PATH_MAX); + + if (I_path == NULL) { + di_devfs_path_free(devfspath); + devfsadm_print(debug_mid, "drm_node: malloc failed\n"); + return (DEVFSADM_CONTINUE); + } + + p_path = (char *)malloc(PATH_MAX); + + if (p_path == NULL) { + devfsadm_print(debug_mid, "drm_node: malloc failed\n"); + di_devfs_path_free(devfspath); + free(I_path); + return (DEVFSADM_CONTINUE); + } + + (void) strlcpy(p_path, devfspath, PATH_MAX); + (void) strlcat(p_path, ":", PATH_MAX); + (void) strlcat(p_path, minor_nm, PATH_MAX); + di_devfs_path_free(devfspath); + + devfsadm_print(debug_mid, "drm_node: p_path %s\n", p_path); + + if (devfsadm_enumerate_int(p_path, 0, &buf, drm_rules, 1)) { + free(p_path); + devfsadm_print(debug_mid, "drm_node: exit/coninue\n"); + return (DEVFSADM_CONTINUE); + } + (void) snprintf(I_path, PATH_MAX, "dri/%s%s", name, buf); + + devfsadm_print(debug_mid, "drm_node: p_path=%s buf=%s\n", + p_path, buf); + + free(buf); + + devfsadm_print(debug_mid, "mklink %s -> %s\n", I_path, p_path); + (void) devfsadm_mklink(I_path, node, minor, 0); + + free(p_path); + free(I_path); + + return (0); +} diff --git a/usr/src/cmd/devfsadm/i386/misc_link_i386.c b/usr/src/cmd/devfsadm/i386/misc_link_i386.c index 5d2e18ad8a..84a24b1092 100644 --- a/usr/src/cmd/devfsadm/i386/misc_link_i386.c +++ b/usr/src/cmd/devfsadm/i386/misc_link_i386.c @@ -44,8 +44,6 @@ static int vt00(di_minor_t minor, di_node_t node); static int kdmouse(di_minor_t minor, di_node_t node); static int ipmi(di_minor_t minor, di_node_t node); static int smbios(di_minor_t minor, di_node_t node); -static int agp_process(di_minor_t minor, di_node_t node); -static int drm_node(di_minor_t minor, di_node_t node); static int mc_node(di_minor_t minor, di_node_t node); static int xsvc(di_minor_t minor, di_node_t node); static int srn(di_minor_t minor, di_node_t node); @@ -57,9 +55,6 @@ static devfsadm_create_t misc_cbt[] = { { "vt00", "ddi_display", NULL, TYPE_EXACT, ILEVEL_0, vt00 }, - { "drm", "ddi_display:drm", NULL, - TYPE_EXACT, ILEVEL_0, drm_node - }, { "mouse", "ddi_mouse", "mouse8042", TYPE_EXACT | DRV_EXACT, ILEVEL_0, kdmouse }, @@ -82,18 +77,6 @@ static devfsadm_create_t misc_cbt[] = { { "serial", "ddi_serial:dialout,mb", NULL, TYPE_EXACT, ILEVEL_1, serial_dialout }, - { "agp", "ddi_agp:pseudo", NULL, - TYPE_EXACT, ILEVEL_0, agp_process - }, - { "agp", "ddi_agp:target", NULL, - TYPE_EXACT, ILEVEL_0, agp_process - }, - { "agp", "ddi_agp:cpugart", NULL, - TYPE_EXACT, ILEVEL_0, agp_process - }, - { "agp", "ddi_agp:master", NULL, - TYPE_EXACT, ILEVEL_0, agp_process - }, { "pseudo", "ddi_pseudo", NULL, TYPE_EXACT, ILEVEL_0, xsvc }, @@ -113,41 +96,6 @@ static devfsadm_create_t misc_cbt[] = { DEVFSADM_CREATE_INIT_V0(misc_cbt); -static char *debug_mid = "misc_mid"; - -typedef enum { - DRIVER_AGPPSEUDO = 0, - DRIVER_AGPTARGET, - DRIVER_CPUGART, - DRIVER_AGPMASTER_DRM_I915, - DRIVER_AGPMASTER_DRM_RADEON, - DRIVER_AGPMASTER_VGATEXT, - DRIVER_UNKNOWN -} driver_defs_t; - -typedef struct { - char *driver_name; - int index; -} driver_name_table_entry_t; - -static driver_name_table_entry_t driver_name_table[] = { - { "agpgart", DRIVER_AGPPSEUDO }, - { "agptarget", DRIVER_AGPTARGET }, - { "amd64_gart", DRIVER_CPUGART }, - /* AGP master device managed by drm driver */ - { "i915", DRIVER_AGPMASTER_DRM_I915 }, - { "radeon", DRIVER_AGPMASTER_DRM_RADEON }, - { "vgatext", DRIVER_AGPMASTER_VGATEXT }, - { NULL, DRIVER_UNKNOWN } -}; - -static devfsadm_enumerate_t agptarget_rules[1] = - { "^agp$/^agptarget([0-9]+)$", 1, MATCH_ALL }; -static devfsadm_enumerate_t cpugart_rules[1] = - { "^agp$/^cpugart([0-9]+)$", 1, MATCH_ALL }; -static devfsadm_enumerate_t agpmaster_rules[1] = - { "^agp$/^agpmaster([0-9]+)$", 1, MATCH_ALL }; - static devfsadm_remove_t misc_remove_cbt[] = { { "vt", "vt[0-9][0-9]", RM_PRE|RM_ALWAYS, ILEVEL_0, devfsadm_rm_all @@ -368,202 +316,6 @@ smbios(di_minor_t minor, di_node_t node) return (DEVFSADM_CONTINUE); } -static int -agp_process(di_minor_t minor, di_node_t node) -{ - char *minor_nm, *drv_nm; - char *devfspath; - char *I_path, *p_path, *buf; - char *name = (char *)NULL; - int i, index; - devfsadm_enumerate_t rules[1]; - - minor_nm = di_minor_name(minor); - drv_nm = di_driver_name(node); - - if ((minor_nm == NULL) || (drv_nm == NULL)) { - return (DEVFSADM_CONTINUE); - } - - devfsadm_print(debug_mid, "agp_process: minor=%s node=%s\n", - minor_nm, di_node_name(node)); - - devfspath = di_devfs_path(node); - if (devfspath == NULL) { - devfsadm_print(debug_mid, "agp_process: devfspath is NULL\n"); - return (DEVFSADM_CONTINUE); - } - - I_path = (char *)malloc(PATH_MAX); - - if (I_path == NULL) { - di_devfs_path_free(devfspath); - devfsadm_print(debug_mid, "agp_process: malloc failed\n"); - return (DEVFSADM_CONTINUE); - } - - p_path = (char *)malloc(PATH_MAX); - - if (p_path == NULL) { - devfsadm_print(debug_mid, "agp_process: malloc failed\n"); - di_devfs_path_free(devfspath); - free(I_path); - return (DEVFSADM_CONTINUE); - } - - (void) strlcpy(p_path, devfspath, PATH_MAX); - (void) strlcat(p_path, ":", PATH_MAX); - (void) strlcat(p_path, minor_nm, PATH_MAX); - di_devfs_path_free(devfspath); - - devfsadm_print(debug_mid, "agp_process: path %s\n", p_path); - - for (i = 0; ; i++) { - if ((driver_name_table[i].driver_name == NULL) || - (strcmp(drv_nm, driver_name_table[i].driver_name) == 0)) { - index = driver_name_table[i].index; - break; - } - } - switch (index) { - case DRIVER_AGPPSEUDO: - devfsadm_print(debug_mid, - "agp_process: psdeudo driver name\n"); - name = "agpgart"; - (void) snprintf(I_path, PATH_MAX, "%s", name); - devfsadm_print(debug_mid, - "mklink %s -> %s\n", I_path, p_path); - - (void) devfsadm_mklink(I_path, node, minor, 0); - - free(I_path); - free(p_path); - return (DEVFSADM_CONTINUE); - case DRIVER_AGPTARGET: - devfsadm_print(debug_mid, - "agp_process: target driver name\n"); - rules[0] = agptarget_rules[0]; - name = "agptarget"; - break; - case DRIVER_CPUGART: - devfsadm_print(debug_mid, - "agp_process: cpugart driver name\n"); - rules[0] = cpugart_rules[0]; - name = "cpugart"; - break; - case DRIVER_AGPMASTER_DRM_I915: - case DRIVER_AGPMASTER_DRM_RADEON: - case DRIVER_AGPMASTER_VGATEXT: - devfsadm_print(debug_mid, - "agp_process: agpmaster driver name\n"); - rules[0] = agpmaster_rules[0]; - name = "agpmaster"; - break; - case DRIVER_UNKNOWN: - devfsadm_print(debug_mid, - "agp_process: unknown driver name=%s\n", drv_nm); - free(I_path); - free(p_path); - return (DEVFSADM_CONTINUE); - } - - if (devfsadm_enumerate_int(p_path, 0, &buf, rules, 1)) { - devfsadm_print(debug_mid, "agp_process: exit/coninue\n"); - free(I_path); - free(p_path); - return (DEVFSADM_CONTINUE); - } - - - (void) snprintf(I_path, PATH_MAX, "agp/%s%s", name, buf); - - devfsadm_print(debug_mid, "agp_process: p_path=%s buf=%s\n", - p_path, buf); - - free(buf); - - devfsadm_print(debug_mid, "mklink %s -> %s\n", I_path, p_path); - - (void) devfsadm_mklink(I_path, node, minor, 0); - - free(p_path); - free(I_path); - - return (DEVFSADM_CONTINUE); -} - -static int -drm_node(di_minor_t minor, di_node_t node) -{ - char *minor_nm, *drv_nm; - char *devfspath; - char *I_path, *p_path, *buf; - char *name = "card"; - - devfsadm_enumerate_t drm_rules[1] = {"^dri$/^card([0-9]+)$", 1, - MATCH_ALL }; - - - minor_nm = di_minor_name(minor); - drv_nm = di_driver_name(node); - if ((minor_nm == NULL) || (drv_nm == NULL)) { - return (DEVFSADM_CONTINUE); - } - - devfsadm_print(debug_mid, "drm_node: minor=%s node=%s type=%s\n", - minor_nm, di_node_name(node), di_minor_nodetype(minor)); - - devfspath = di_devfs_path(node); - if (devfspath == NULL) { - devfsadm_print(debug_mid, "drm_node: devfspath is NULL\n"); - return (DEVFSADM_CONTINUE); - } - - I_path = (char *)malloc(PATH_MAX); - - if (I_path == NULL) { - di_devfs_path_free(devfspath); - devfsadm_print(debug_mid, "drm_node: malloc failed\n"); - return (DEVFSADM_CONTINUE); - } - - p_path = (char *)malloc(PATH_MAX); - - if (p_path == NULL) { - devfsadm_print(debug_mid, "drm_node: malloc failed\n"); - di_devfs_path_free(devfspath); - free(I_path); - return (DEVFSADM_CONTINUE); - } - - (void) strlcpy(p_path, devfspath, PATH_MAX); - (void) strlcat(p_path, ":", PATH_MAX); - (void) strlcat(p_path, minor_nm, PATH_MAX); - di_devfs_path_free(devfspath); - - devfsadm_print(debug_mid, "drm_node: p_path %s\n", p_path); - - if (devfsadm_enumerate_int(p_path, 0, &buf, drm_rules, 1)) { - free(p_path); - devfsadm_print(debug_mid, "drm_node: exit/coninue\n"); - return (DEVFSADM_CONTINUE); - } - (void) snprintf(I_path, PATH_MAX, "dri/%s%s", name, buf); - - devfsadm_print(debug_mid, "drm_node: p_path=%s buf=%s\n", - p_path, buf); - - free(buf); - - devfsadm_print(debug_mid, "mklink %s -> %s\n", I_path, p_path); - (void) devfsadm_mklink(I_path, node, minor, 0); - - free(p_path); - free(I_path); - - return (0); -} - /* * /dev/mc/mc<chipid> -> /devices/.../pci1022,1102@<chipid+24>,2:mc-amd */ diff --git a/usr/src/cmd/fs.d/pcfs/mkfs/Makefile b/usr/src/cmd/fs.d/pcfs/mkfs/Makefile index 6e9829a447..352b271eb4 100644 --- a/usr/src/cmd/fs.d/pcfs/mkfs/Makefile +++ b/usr/src/cmd/fs.d/pcfs/mkfs/Makefile @@ -32,6 +32,7 @@ include ../../Makefile.fstype OBJS= $(LIBPROG).o SRCS= $(LIBPROG).c +LDLIBS += -lefi # for messaging catalog # diff --git a/usr/src/cmd/fs.d/pcfs/mkfs/mkfs.c b/usr/src/cmd/fs.d/pcfs/mkfs/mkfs.c index f2f183bcef..96fe898b54 100644 --- a/usr/src/cmd/fs.d/pcfs/mkfs/mkfs.c +++ b/usr/src/cmd/fs.d/pcfs/mkfs/mkfs.c @@ -38,6 +38,8 @@ #include <sys/fdio.h> #include <sys/dktp/fdisk.h> #include <sys/dkio.h> +#include <sys/vtoc.h> +#include <sys/efi_partition.h> #include <sys/sysmacros.h> #include "mkfs_pcfs.h" #include <sys/fs/pc_fs.h> @@ -2217,6 +2219,151 @@ open_and_examine(char *dn, bpb_t *wbpb) } /* + * getdiskinfo + * + * Extracts information about disk path in dn. We need to return both a + * file descriptor and the device's suffix. + * Secondarily, we need to detect the FAT type and size when dealing with + * GPT partitions. + */ +static int +getdiskinfo(char *dn, char **suffix) +{ + struct dk_minfo dkminfo; + struct stat di; + int rv, fd, reserved; + char *actualdisk = NULL; + dk_gpt_t *gpt = NULL; + + actualdisk = stat_actual_disk(dn, &di, suffix); + + /* + * Destination exists, now find more about it. + */ + if (!(S_ISCHR(di.st_mode))) { + (void) fprintf(stderr, + gettext("Device name must indicate a " + "character special device: %s\n"), actualdisk); + exit(2); + } else if ((fd = open(actualdisk, O_RDWR)) < 0) { + perror(actualdisk); + exit(2); + } + + /* + * Check the media sector size + */ + if (ioctl(fd, DKIOCGMEDIAINFO, &dkminfo) != -1) { + if (dkminfo.dki_lbsize != 0 && + ISP2(dkminfo.dki_lbsize / DEV_BSIZE) && + dkminfo.dki_lbsize != DEV_BSIZE) { + (void) fprintf(stderr, + gettext("The device sector size %u is not " + "supported by pcfs!\n"), dkminfo.dki_lbsize); + (void) close(fd); + exit(2); + } + } + + rv = efi_alloc_and_read(fd, &gpt); + /* + * We should see only VT_EINVAL, VT_EIO and VT_ERROR. + * VT_EINVAL is for the case there is no GPT label. + * VT_ERROR will happen if device does no support the ioctl, so + * we will exit only in case of VT_EIO and unknown value of rv. + */ + if (rv < 0 && rv != VT_EINVAL && rv != VT_ERROR) { + switch (rv) { + case VT_EIO: + (void) fprintf(stderr, + gettext("IO Error reading EFI label\n")); + break; + default: + (void) fprintf(stderr, + gettext("Unknown Error %d reading EFI label\n"), + rv); + break; + } + (void) close(fd); + exit(2); + } + if (rv >= 0) { + DontUseFdisk = 1; + if (*suffix != NULL) { + (void) fprintf(stderr, + gettext("Can not use drive specifier \"%s\" with " + "GPT partitioning.\n"), *suffix); + efi_free(gpt); + (void) close(fd); + exit(2); + } + /* Can not use whole disk, 7 is GPT minor node "wd" */ + if (rv == 7) { + (void) fprintf(stderr, + gettext("Device name must indicate a " + "partition: %s\n"), actualdisk); + efi_free(gpt); + (void) close(fd); + exit(2); + } + + if (GetSize == 1) { + TotSize = gpt->efi_parts[rv].p_size; + GetSize = 0; + } + + if (GetBPF == 1) { + if (GetResrvd == 1) { + /* FAT32 has 32 reserved sectors */ + reserved = 32; + } else { + reserved = Resrvd; + } + /* + * The type of FAT is determined by the size of + * the partition - reserved sectors. + * The calculation is based on logic used in + * compute_cluster_size() and therefore we will not + * get into error situation when + * compute_cluster_size() will be called. + */ + if (TotSize - reserved < FAT16_MAX_CLUSTERS) { + if (GetResrvd == 1) + reserved = 1; + + if (TotSize - reserved < FAT12_MAX_CLUSTERS) { + int spc; + MakeFAT32 = 0; + Fatentsize = 12; + /* + * compute sectors per cluster + * for fat12 + */ + for (spc = 1; spc <= 64; + spc = spc * 2) { + if (TotSize - reserved < + spc * FAT12_MAX_CLUSTERS) + break; + } + if (GetSPC == 1) { + GetSPC = 0; + SecPerClust = spc; + } + } else { + MakeFAT32 = 0; + Fatentsize = 16; + } + } else { + MakeFAT32 = 1; + Fatentsize = 32; + } + } + efi_free(gpt); + } + return (fd); +} + +/* * open_and_seek * * Open the requested 'dev_name'. Seek to point where @@ -2232,8 +2379,6 @@ open_and_seek(char *dn, bpb_t *wbpb, off64_t *seekto) { struct fd_char fdchar; struct dk_geom dg; - struct stat di; - struct dk_minfo dkminfo; char *actualdisk = NULL; char *suffix = NULL; int fd; @@ -2271,9 +2416,10 @@ open_and_seek(char *dn, bpb_t *wbpb, off64_t *seekto) * that scenario. Otherwise, try to find the device. */ if (Outputtofile) - return (fd = prepare_image_file(dn, wbpb)); + return (prepare_image_file(dn, wbpb)); - actualdisk = stat_actual_disk(dn, &di, &suffix); + /* Collect info about device */ + fd = getdiskinfo(dn, &suffix); /* * Sanity check. If we've been provided a partition-specifying @@ -2285,44 +2431,14 @@ open_and_seek(char *dn, bpb_t *wbpb, off64_t *seekto) gettext("Using 'nofdisk' option precludes " "appending logical drive\nspecifier " "to the device name.\n")); - exit(2); - } - - /* - * Destination exists, now find more about it. - */ - if (!(S_ISCHR(di.st_mode))) { - (void) fprintf(stderr, - gettext("\n%s: device name must indicate a " - "character special device.\n"), actualdisk); - exit(2); - } else if ((fd = open(actualdisk, O_RDWR)) < 0) { - perror(actualdisk); - exit(2); - } - - /* - * Check the media sector size - */ - if (ioctl(fd, DKIOCGMEDIAINFO, &dkminfo) != -1) { - if (dkminfo.dki_lbsize != 0 && - ISP2(dkminfo.dki_lbsize / DEV_BSIZE) && - dkminfo.dki_lbsize != DEV_BSIZE) { - (void) fprintf(stderr, - gettext("The device sector size %u is not " - "supported by pcfs!\n"), dkminfo.dki_lbsize); - (void) close(fd); - exit(1); - } + goto err_out; } /* * Find appropriate partition if we were requested to do so. */ - if (suffix && !(seek_partn(fd, suffix, wbpb, seekto))) { - (void) close(fd); - exit(2); - } + if (suffix && !(seek_partn(fd, suffix, wbpb, seekto))) + goto err_out; if (!suffix) { /* @@ -2338,10 +2454,9 @@ open_and_seek(char *dn, bpb_t *wbpb, off64_t *seekto) * case, they should have given us a partition specifier. */ if (DontUseFdisk) { - if (!(seek_nofdisk(fd, wbpb, seekto))) { - (void) close(fd); - exit(2); - } + if (!(seek_nofdisk(fd, wbpb, seekto))) + goto err_out; + find_fixed_details(fd, wbpb); } else if (ioctl(fd, FDIOGCHAR, &fdchar) == -1) { /* @@ -2368,8 +2483,7 @@ open_and_seek(char *dn, bpb_t *wbpb, off64_t *seekto) lookup_floppy(&fdchar, wbpb); } else { partn_lecture(actualdisk); - (void) close(fd); - exit(2); + goto err_out; } } } else { @@ -2383,6 +2497,10 @@ open_and_seek(char *dn, bpb_t *wbpb, off64_t *seekto) } return (fd); + +err_out: + (void) close(fd); + exit(2); } /* @@ -2967,7 +3085,7 @@ write_rest(bpb_t *wbpb, char *efn, int dfd, int sfd, int remaining) static void write_fat32_bootstuff(int fd, boot_sector_t *bsp, - struct fat_od_fsi *fsinfop, off64_t seekto) + struct fat_od_fsi *fsinfop, off64_t seekto) { if (Verbose) { (void) printf(gettext("Dump of the fs info sector")); @@ -3018,7 +3136,7 @@ write_fat32_bootstuff(int fd, boot_sector_t *bsp, static void write_bootsects(int fd, boot_sector_t *bsp, bpb_t *wbpb, - struct fat_od_fsi *fsinfop, off64_t seekto) + struct fat_od_fsi *fsinfop, off64_t seekto) { if (MakeFAT32) { /* Copy our BPB into bootsec structure */ diff --git a/usr/src/cmd/login/login.dfl b/usr/src/cmd/login/login.dfl index 4b11830230..13ecd51113 100644 --- a/usr/src/cmd/login/login.dfl +++ b/usr/src/cmd/login/login.dfl @@ -47,12 +47,15 @@ PASSREQ=YES ALTSHELL=YES # PATH sets the initial shell PATH variable -# -#PATH=/usr/bin: +# sample with GNU tools in front of the path +# PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin +# sample with XPG4 tools in front of the path +# PATH=/usr/xpg4/bin:/usr/bin:/usr/sbin:/sbin +PATH=/usr/bin:/usr/sbin:/sbin:/usr/gnu/bin # SUPATH sets the initial shell PATH variable for root # -#SUPATH=/usr/sbin:/usr/bin +SUPATH=/usr/sbin:/sbin:/usr/bin # TIMEOUT sets the number of seconds (between 0 and 900) to wait before # abandoning a login session. diff --git a/usr/src/cmd/nsadmin/Makefile b/usr/src/cmd/nsadmin/Makefile index 620aa978e4..c87810e767 100644 --- a/usr/src/cmd/nsadmin/Makefile +++ b/usr/src/cmd/nsadmin/Makefile @@ -24,7 +24,7 @@ # PROG= profile .login ksh.kshrc system -PROGSKEL= local.login local.profile local.cshrc .profile +PROGSKEL= .profile .kshrc PROGROOT= .profile .bashrc include ../Makefile.cmd @@ -35,10 +35,10 @@ ROOTETCSKELPROG= $(PROGSKEL:%=$(ROOTETCSKEL)/%) ROOTROOTPROG= $(PROGROOT:%=$(ROOTROOT)/%) FILEMODE= 0644 -CLOBBERFILES = profile .bashrc .profile .login +CLOBBERFILES = profile .bashrc .profile .login .kshrc .login: login.csh - $(RM) .login; + $(RM) .login $(CP) login.csh .login profile: etc-profile.sh @@ -49,6 +49,10 @@ profile: etc-profile.sh $(RM) .profile $(CP) dot-profile.sh $@ +.kshrc: dot-kshrc.sh + $(RM) .kshrc + $(CP) dot-kshrc.sh $@ + .bashrc: bashrc.sh $(RM) .bashrc $(CP) bashrc.sh $@ diff --git a/usr/src/cmd/nsadmin/bashrc.sh b/usr/src/cmd/nsadmin/bashrc.sh index 128f6b79d7..938b0da67e 100644 --- a/usr/src/cmd/nsadmin/bashrc.sh +++ b/usr/src/cmd/nsadmin/bashrc.sh @@ -2,6 +2,4 @@ # Define default prompt to <username>@<hostname>:<path><"($|#) "> # and print '#' for user "root" and '$' for normal users. # -PS1='${LOGNAME}@$(/usr/bin/hostname):$( - [[ "${LOGNAME}" == "root" ]] && printf "%s" "${PWD/${HOME}/~}# " || - printf "%s" "${PWD/${HOME}/~}\$ ")' +typeset +x PS1="\u@\h:\w\\$ " diff --git a/usr/src/cmd/nsadmin/dot-kshrc.sh b/usr/src/cmd/nsadmin/dot-kshrc.sh new file mode 100644 index 0000000000..0ba420ac58 --- /dev/null +++ b/usr/src/cmd/nsadmin/dot-kshrc.sh @@ -0,0 +1,11 @@ +# +# Sample kshrc. Used by ksh for interactive invocations, processed after +# /etc/ksh.kshrc +# + +# alias h='fc -l | more' # View history nicely +# alias logout=exit # Another way to exit +# alias rm='rm -i' # Confirm file removal +# alias del='rm -i' # Confirm file removal +# alias lsf='ls -CF' # List files in nice format +# alias ll='ls -l' # List files in long format diff --git a/usr/src/cmd/nsadmin/dot-profile.sh b/usr/src/cmd/nsadmin/dot-profile.sh index 33a79c97b2..a45e47b58d 100644 --- a/usr/src/cmd/nsadmin/dot-profile.sh +++ b/usr/src/cmd/nsadmin/dot-profile.sh @@ -1,16 +1,14 @@ # -# Simple profile places /usr/gnu/bin at front, -# adds /usr/X11/bin, /usr/sbin and /sbin to the end. +# Uncommenting PATH below will place /usr/gnu/bin at front, +# adds /usr/sbin and /sbin to the end. # -# Use less(1) as the default pager for the man(1) command. -# -export PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin -export PAGER="/usr/bin/less -ins" - +# export PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin # # Define default prompt to <username>@<hostname>:<path><"($|#) "> # and print '#' for user "root" and '$' for normal users. # -PS1='${LOGNAME}@$(/usr/bin/hostname):$( - [[ "${LOGNAME}" == "root" ]] && printf "%s" "${PWD/${HOME}/~}# " || - printf "%s" "${PWD/${HOME}/~}\$ ")' +# override default prompt for bash +# case "$0" in +# -bash) +# export PS1="\u@\h:\w\\$ " +# esac diff --git a/usr/src/cmd/nsadmin/etc-profile.sh b/usr/src/cmd/nsadmin/etc-profile.sh index a74965d21a..035e8a3025 100644 --- a/usr/src/cmd/nsadmin/etc-profile.sh +++ b/usr/src/cmd/nsadmin/etc-profile.sh @@ -37,10 +37,24 @@ then export TERM fi +# +# use less(1) as the default pager for the man(1) command. +# +PAGER="/usr/bin/less -ins" +export PAGER + # Login and -su shells get /etc/profile services. # -rsh is given its environment in its .profile. case "$0" in +-bash) + # set prompt for bash + PS1="\u@\h:\w\\$ " + export PS1 + ;; +esac + +case "$0" in -sh | -ksh | -ksh93 | -jsh | -bash | -zsh) if [ ! -f .hushlogin ] @@ -53,12 +67,12 @@ case "$0" in /bin/mail -E case $? in - 0) + 0) echo "You have new mail." - ;; - 2) + ;; + 2) echo "You have mail." - ;; + ;; esac fi esac diff --git a/usr/src/cmd/nsadmin/local.cshrc b/usr/src/cmd/nsadmin/local.cshrc deleted file mode 100644 index 38894ca5b9..0000000000 --- a/usr/src/cmd/nsadmin/local.cshrc +++ /dev/null @@ -1,29 +0,0 @@ -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2000 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -umask 022 -set path=(/bin /usr/bin /usr/ucb /etc .) -if ( $?prompt ) then - set history=32 -endif diff --git a/usr/src/cmd/nsadmin/local.login b/usr/src/cmd/nsadmin/local.login deleted file mode 100644 index d636b45594..0000000000 --- a/usr/src/cmd/nsadmin/local.login +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# ident "%Z%%M% %I% %E% SMI" -stty -istrip -# setenv TERM `tset -Q -` diff --git a/usr/src/cmd/nsadmin/local.profile b/usr/src/cmd/nsadmin/local.profile deleted file mode 100644 index a85bb9ace1..0000000000 --- a/usr/src/cmd/nsadmin/local.profile +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# ident "%Z%%M% %I% %E% SMI" -stty istrip -PATH=/usr/bin:/usr/ucb:/etc:. -export PATH diff --git a/usr/src/cmd/nsadmin/login.csh b/usr/src/cmd/nsadmin/login.csh index 4409bf2e09..a63823c5c6 100644 --- a/usr/src/cmd/nsadmin/login.csh +++ b/usr/src/cmd/nsadmin/login.csh @@ -41,6 +41,11 @@ else endif endif +# +# use less(1) as the default pager for the man(1) command. +# +setenv PAGER "/usr/bin/less -ins" + if (! -e .hushlogin ) then /usr/sbin/quota /bin/cat -s /etc/motd diff --git a/usr/src/cmd/sgs/Makefile b/usr/src/cmd/sgs/Makefile index f2128aaaa2..6dfa9f91d9 100644 --- a/usr/src/cmd/sgs/Makefile +++ b/usr/src/cmd/sgs/Makefile @@ -159,7 +159,7 @@ $(SUBDIRS): FRC # itself and ld.so.1. Once this new functionality appears in the standard ld # this target can be disabled. -native-add: native-proto FRC +native-add: FRC @ cd tools/$(MACH); pwd; $(MAKE) native @ cd libconv/$(MACH); pwd; $(MAKE) @ cd libelf/$(MACH); pwd; $(MAKE) native @@ -172,12 +172,6 @@ native-clobber: @ cd tools; pwd; $(MAKE) $(TARGET) $(RM) -r proto/$(MACH) -native-proto: - -@mkdir -p proto/$(MACH) - -@mkdir -p proto/$(MACH)/lib - -@mkdir -p proto/$(MACH)/usr - -@mkdir -p proto/$(MACH)/usr/bin - FRC: # diff --git a/usr/src/cmd/sgs/Makefile.targ b/usr/src/cmd/sgs/Makefile.targ index 7d70c71b85..4940367e99 100644 --- a/usr/src/cmd/sgs/Makefile.targ +++ b/usr/src/cmd/sgs/Makefile.targ @@ -21,6 +21,7 @@ # # Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2016 RackTop Systems. # # Standard install rules @@ -231,4 +232,19 @@ $(ROOTFS_LIBDIR)/$(LIBLINKSCCC): $(ROOTFS_LIBDIR)/$(LIBLINKSCCC)$(VERS) $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC): $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC)$(VERS) $(INS.liblinkccc64) +# +# For those that install into the SGSPROTO directory. +# +$(SGSPROTO): + $(INS.dir) + +$(SGSBINDIR): $(SGSPROTO) + $(INS.dir) + +$(SGSPREFIX): $(SGSPROTO) + $(INS.dir) + +$(SGSLIBDIR): $(SGSPREFIX) + $(INS.dir) + FRC: diff --git a/usr/src/cmd/sgs/ld/Makefile.targ b/usr/src/cmd/sgs/ld/Makefile.targ index 42ee9938d6..8b1131d9e3 100644 --- a/usr/src/cmd/sgs/ld/Makefile.targ +++ b/usr/src/cmd/sgs/ld/Makefile.targ @@ -35,7 +35,9 @@ install: all $(VAR_SGSBINPROG) $(VAR_SGSCCSLINK) $(COMPILE.c) $< $(POST_PROCESS_O) -$(PROG): $(MAPFILES) +$(PROG): $(OBJS) $(MAPFILES) + $(LINK.c) $(OBJS) -o $@ $(LDLIBS) + $(POST_PROCESS) clean: $(RM) $(OBJS) $(CLEANFILES) @@ -53,8 +55,7 @@ include $(SRC)/cmd/sgs/Makefile.targ native: $(SGSBINDIR)/$(PROG) -$(SGSBINDIR)/$(PROG) \ -$(PROG): $$(OBJS) +$(SGSBINDIR)/$(PROG): $(OBJS) $(SGSBINDIR) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) diff --git a/usr/src/cmd/sgs/libelf/Makefile.targ b/usr/src/cmd/sgs/libelf/Makefile.targ index 3c70014e0e..22f6c261e8 100644 --- a/usr/src/cmd/sgs/libelf/Makefile.targ +++ b/usr/src/cmd/sgs/libelf/Makefile.targ @@ -134,7 +134,9 @@ pics/xlate.o: xlate.c native: $(SGSLIBDIR)/$(LIBLINKS) -$(SGSLIBDIR)/$(DYNLIB): pics .WAIT $$(PICS) +$(PICS): pics + +$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR) $(BUILD.SO) $(POST_PROCESS_SO) diff --git a/usr/src/cmd/sgs/libld/Makefile.targ b/usr/src/cmd/sgs/libld/Makefile.targ index 85f71e63c7..c8f514cd2f 100644 --- a/usr/src/cmd/sgs/libld/Makefile.targ +++ b/usr/src/cmd/sgs/libld/Makefile.targ @@ -103,7 +103,9 @@ lint: $(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \ native: $(SGSLIBDIR)/$(LIBLINKS) -$(SGSLIBDIR)/$(DYNLIB): pics .WAIT $$(PICS) +$(PICS): pics + +$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR) $(BUILD.SO) $(POST_PROCESS_SO) diff --git a/usr/src/cmd/sgs/liblddbg/Makefile.targ b/usr/src/cmd/sgs/liblddbg/Makefile.targ index d5a7e8f6dd..68978ceefa 100644 --- a/usr/src/cmd/sgs/liblddbg/Makefile.targ +++ b/usr/src/cmd/sgs/liblddbg/Makefile.targ @@ -57,7 +57,9 @@ lint: $(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \ native: $(SGSLIBDIR)/$(LIBLINKS) -$(SGSLIBDIR)/$(DYNLIB): pics .WAIT $$(PICS) +$(PICS): pics + +$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR) $(BUILD.SO) $(POST_PROCESS_SO) diff --git a/usr/src/cmd/sgs/libldstab/Makefile.targ b/usr/src/cmd/sgs/libldstab/Makefile.targ index 6b47b4ae2b..c9ba1b7467 100644 --- a/usr/src/cmd/sgs/libldstab/Makefile.targ +++ b/usr/src/cmd/sgs/libldstab/Makefile.targ @@ -43,7 +43,9 @@ delete: native: $(SGSLIBDIR)/$(DYNLIB) -$(SGSLIBDIR)/$(DYNLIB): pics .WAIT $$(PICS) +$(PICS): pics + +$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR) $(BUILD.SO) $(POST_PROCESS_SO) diff --git a/usr/src/cmd/sgs/librtld/Makefile.targ b/usr/src/cmd/sgs/librtld/Makefile.targ index 71a73947c8..30e03221a5 100644 --- a/usr/src/cmd/sgs/librtld/Makefile.targ +++ b/usr/src/cmd/sgs/librtld/Makefile.targ @@ -40,7 +40,9 @@ delete: native: $(SGSLIBDIR)/$(LIBLINKS) -$(SGSLIBDIR)/$(DYNLIB): pics .WAIT $$(PICS) +$(PICS): pics + +$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR) $(BUILD.SO) $(POST_PROCESS_SO) diff --git a/usr/src/cmd/smbios/smbios.c b/usr/src/cmd/smbios/smbios.c index 68455016ab..a61db53331 100644 --- a/usr/src/cmd/smbios/smbios.c +++ b/usr/src/cmd/smbios/smbios.c @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -239,7 +239,7 @@ print_bios(smbios_hdl_t *shp, FILE *fp) oprintf(fp, " Version String: %s\n", b.smbb_version); oprintf(fp, " Release Date: %s\n", b.smbb_reldate); oprintf(fp, " Address Segment: 0x%x\n", b.smbb_segment); - oprintf(fp, " ROM Size: %u bytes\n", b.smbb_romsize); + oprintf(fp, " ROM Size: %" PRIu64 " bytes\n", b.smbb_extromsize); oprintf(fp, " Image Size: %u bytes\n", b.smbb_runsize); flag64_printf(fp, "Characteristics", @@ -508,12 +508,15 @@ print_cache(smbios_hdl_t *shp, id_t id, FILE *fp) (void) smbios_info_cache(shp, id, &c); oprintf(fp, " Level: %u\n", c.smba_level); - oprintf(fp, " Maximum Installed Size: %u bytes\n", c.smba_maxsize); + oprintf(fp, " Maximum Installed Size: %" PRIu64 " bytes\n", + c.smba_maxsize2); - if (c.smba_size != 0) - oprintf(fp, " Installed Size: %u bytes\n", c.smba_size); - else + if (c.smba_size2 != 0) { + oprintf(fp, " Installed Size: %" PRIu64 " bytes\n", + c.smba_size2); + } else { oprintf(fp, " Installed Size: Not Installed\n"); + } if (c.smba_speed != 0) oprintf(fp, " Speed: %uns\n", c.smba_speed); @@ -841,12 +844,12 @@ print_memdevice(smbios_hdl_t *shp, id_t id, FILE *fp) smbios_memdevice_flag_name, smbios_memdevice_flag_desc); if (md.smbmd_speed != 0) - oprintf(fp, " Speed: %u MHz\n", md.smbmd_speed); + oprintf(fp, " Speed: %u MT/s\n", md.smbmd_speed); else oprintf(fp, " Speed: Unknown\n"); if (md.smbmd_clkspeed != 0) - oprintf(fp, " Configured Speed: %u MHz\n", md.smbmd_clkspeed); + oprintf(fp, " Configured Speed: %u MT/s\n", md.smbmd_clkspeed); else oprintf(fp, " Configured Speed: Unknown\n"); diff --git a/usr/src/cmd/truss/Makefile.com b/usr/src/cmd/truss/Makefile.com index b500283399..0ed14909e4 100644 --- a/usr/src/cmd/truss/Makefile.com +++ b/usr/src/cmd/truss/Makefile.com @@ -20,6 +20,7 @@ # # # Copyright 2012 Nexenta Systems, Inc. All rights reserved. +# Copyright (c) 2016 by Delphix. All rights reserved. # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -47,6 +48,11 @@ LDLIBS += -lproc -lrtld_db -lc_db -lnsl -lsocket -ltsol -lnvpair CPPFLAGS += -D_REENTRANT -D_LARGEFILE64_SOURCE=1 CPPFLAGS += -I$(SRC)/uts/common/fs/zfs +LINTFLAGS += -erroff=E_STATIC_UNUSED +LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2 +LINTFLAGS64 += -erroff=E_STATIC_UNUSED +LINTFLAGS64 += -erroff=E_NAME_USED_NOT_DEF2 + .KEEP_STATE: %.o: ../%.c diff --git a/usr/src/cmd/zhack/Makefile.com b/usr/src/cmd/zhack/Makefile.com index 67927083c4..4f42a0e276 100644 --- a/usr/src/cmd/zhack/Makefile.com +++ b/usr/src/cmd/zhack/Makefile.com @@ -25,7 +25,7 @@ # # -# Copyright (c) 2012 by Delphix. All rights reserved. +# Copyright (c) 2012, 2016 by Delphix. All rights reserved. # PROG= zhack @@ -48,6 +48,9 @@ CFLAGS += $(CCVERBOSE) CFLAGS64 += $(CCVERBOSE) CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT -DDEBUG $(INCS) +LINTFLAGS += -erroff=E_STATIC_UNUSED +LINTFLAGS64 += -erroff=E_STATIC_UNUSED + .KEEP_STATE: all: $(PROG) diff --git a/usr/src/cmd/zinject/Makefile.com b/usr/src/cmd/zinject/Makefile.com index 76d297937f..6f21815fa8 100644 --- a/usr/src/cmd/zinject/Makefile.com +++ b/usr/src/cmd/zinject/Makefile.com @@ -22,6 +22,8 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2016 by Delphix. All rights reserved. +# PROG:sh= cd ..; basename `pwd` OBJS= $(PROG).o translate.o @@ -42,6 +44,9 @@ CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS) CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-switch +LINTFLAGS += -erroff=E_STATIC_UNUSED +LINTFLAGS64 += -erroff=E_STATIC_UNUSED + .KEEP_STATE: all: $(PROG) diff --git a/usr/src/common/ficl/loader.c b/usr/src/common/ficl/loader.c index 4000e5aabc..054beba91a 100644 --- a/usr/src/common/ficl/loader.c +++ b/usr/src/common/ficl/loader.c @@ -48,6 +48,11 @@ #endif #include "bootstrap.h" #endif +#ifdef STAND +#include <uuid.h> +#else +#include <uuid/uuid.h> +#endif #include <string.h> #include "ficl.h" @@ -71,6 +76,8 @@ extern uint32_t biospci_locator(uint8_t, uint8_t, uint8_t); * pnpdevices ( -- addr ) * pnphandlers ( -- addr ) * ccall ( [[...[p10] p9] ... p1] n addr -- result ) + * uuid-from-string ( addr n -- addr' ) + * uuid-to-string ( addr' -- addr n | -1 ) * .# ( value -- ) */ @@ -324,6 +331,78 @@ ficlCcall(ficlVm *pVM) ficlStackPushInteger(ficlVmGetDataStack(pVM), result); } +void +ficlUuidFromString(ficlVm *pVM) +{ + char *uuid; + char *uuid_ptr; + int uuid_size; + uuid_t *u; +#ifdef STAND + uint32_t status; +#else + int status; +#endif + + FICL_STACK_CHECK(ficlVmGetDataStack(pVM), 2, 0); + + uuid_size = ficlStackPopInteger(ficlVmGetDataStack(pVM)); + uuid_ptr = ficlStackPopPointer(ficlVmGetDataStack(pVM)); + + uuid = ficlMalloc(uuid_size + 1); + if (!uuid) + ficlVmThrowError(pVM, "Error: out of memory"); + (void) memcpy(uuid, uuid_ptr, uuid_size); + uuid[uuid_size] = '\0'; + + u = ficlMalloc(sizeof (*u)); +#ifdef STAND + uuid_from_string(uuid, u, &status); + ficlFree(uuid); + if (status != uuid_s_ok) { + ficlFree(u); + u = NULL; + } +#else + status = uuid_parse(uuid, *u); + ficlFree(uuid); + if (status != 0) { + ficlFree(u); + u = NULL; + } +#endif + ficlStackPushPointer(ficlVmGetDataStack(pVM), u); +} + +void +ficlUuidToString(ficlVm *pVM) +{ + char *uuid; + uuid_t *u; +#ifdef STAND + uint32_t status; +#endif + + FICL_STACK_CHECK(ficlVmGetDataStack(pVM), 1, 0); + + u = ficlStackPopPointer(ficlVmGetDataStack(pVM)); +#ifdef STAND + uuid_to_string(u, &uuid, &status); + if (status == uuid_s_ok) { + ficlStackPushPointer(ficlVmGetDataStack(pVM), uuid); + ficlStackPushInteger(ficlVmGetDataStack(pVM), strlen(uuid)); + } else +#else + uuid = ficlMalloc(UUID_PRINTABLE_STRING_LENGTH); + if (uuid != NULL) { + uuid_unparse(*u, uuid); + ficlStackPushPointer(ficlVmGetDataStack(pVM), uuid); + ficlStackPushInteger(ficlVmGetDataStack(pVM), strlen(uuid)); + } else +#endif + ficlStackPushInteger(ficlVmGetDataStack(pVM), -1); +} + /* * f i c l E x e c F D * reads in text from file fd and passes it to ficlExec() @@ -1038,6 +1117,10 @@ ficlSystemCompilePlatform(ficlSystem *pSys) ficlDictionarySetPrimitive(dp, "findfile", ficlFindfile, FICL_WORD_DEFAULT); ficlDictionarySetPrimitive(dp, "ccall", ficlCcall, FICL_WORD_DEFAULT); + ficlDictionarySetPrimitive(dp, "uuid-from-string", ficlUuidFromString, + FICL_WORD_DEFAULT); + ficlDictionarySetPrimitive(dp, "uuid-to-string", ficlUuidToString, + FICL_WORD_DEFAULT); #ifdef STAND #ifdef __i386__ ficlDictionarySetPrimitive(dp, "outb", ficlOutb, FICL_WORD_DEFAULT); diff --git a/usr/src/common/smbios/smb_info.c b/usr/src/common/smbios/smb_info.c index 2eb9d8351b..ea8caaed97 100644 --- a/usr/src/common/smbios/smb_info.c +++ b/usr/src/common/smbios/smb_info.c @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -66,6 +66,7 @@ */ #include <sys/smbios_impl.h> +#include <sys/byteorder.h> #ifdef _KERNEL #include <sys/sunddi.h> @@ -347,7 +348,10 @@ smbios_info_bios(smbios_hdl_t *shp, smbios_bios_t *bp) return (smb_set_errno(shp, ESMB_CORRUPT)); bip = (smb_bios_t *)(uintptr_t)stp->smbst_hdr; - bzero(bp, sizeof (smbios_bios_t)); + bzero(bp, sizeof (smb_base_bios_t)); + if (smb_libgteq(shp, SMB_VERSION_31)) { + bp->smbb_extromsize = 0; + } bp->smbb_vendor = smb_strptr(stp, bip->smbbi_vendor); bp->smbb_version = smb_strptr(stp, bip->smbbi_version); @@ -377,6 +381,50 @@ smbios_info_bios(smbios_hdl_t *shp, smbios_bios_t *bp) bp->smbb_ecfwv.smbv_minor = bip->smbbi_xcflags[SMB_BIOSXB_ECFW_MIN]; } + + if (bp->smbb_nxcflags > SMB_BIOSXB_EXTROM + 1 && + smb_gteq(shp, SMB_VERSION_31)) { + uint16_t val; + uint64_t rs; + + /* + * Because of the fact that the extended size is a + * uint16_t and we'd need to define an explicit + * endian-aware way to access it, we don't include it in + * the number of extended flags below and thus subtract + * its size. + */ + bp->smbb_nxcflags -= sizeof (uint16_t); + bcopy(&bip->smbbi_xcflags[SMB_BIOSXB_EXTROM], &val, + sizeof (val)); + val = LE_16(val); + + /* + * The upper two bits of the extended rom size are used + * to indicate whether the other 14 bits are in MB or + * GB. + */ + rs = SMB_BIOS_EXTROM_VALUE_MASK(val); + switch (SMB_BIOS_EXTROM_SHIFT_MASK(val)) { + case 0: + rs *= 1024ULL * 1024ULL; + break; + case 1: + rs *= 1024ULL * 1024ULL * 1024ULL; + break; + default: + rs = 0; + break; + } + + if (smb_libgteq(shp, SMB_VERSION_31)) { + bp->smbb_extromsize = rs; + } + } + } + + if (smb_libgteq(shp, SMB_VERSION_31) && bp->smbb_extromsize == 0) { + bp->smbb_extromsize = bp->smbb_romsize; } return (stp->smbst_hdr->smbh_hdl); @@ -442,7 +490,7 @@ smbios_info_chassis(smbios_hdl_t *shp, id_t id, smbios_chassis_t *chp) smb_info_bcopy(stp->smbst_hdr, ch, sizeof (buf)); bzero(chp, sizeof (smb_base_chassis_t)); - if (shp->sh_libvers >= SMB_VERSION_27) { + if (smb_libgteq(shp, SMB_VERSION_27)) { bzero(chp->smbc_sku, sizeof (chp->smbc_sku)); } @@ -458,7 +506,7 @@ smbios_info_chassis(smbios_hdl_t *shp, id_t id, smbios_chassis_t *chp) chp->smbc_elems = ch->smbch_cn; chp->smbc_elemlen = ch->smbch_cm; - if (shp->sh_libvers >= SMB_VERSION_27) { + if (smb_libgteq(shp, SMB_VERSION_27)) { (void) strlcpy(chp->smbc_sku, SMB_CH_SKU(ch), sizeof (chp->smbc_sku)); } @@ -493,17 +541,18 @@ smbios_info_processor(smbios_hdl_t *shp, id_t id, smbios_processor_t *pp) pp->smbp_l2cache = p.smbpr_l2cache; pp->smbp_l3cache = p.smbpr_l3cache; - if (shp->sh_libvers >= SMB_VERSION_25) { + if (smb_libgteq(shp, SMB_VERSION_25)) { pp->smbp_corecount = p.smbpr_corecount; pp->smbp_coresenabled = p.smbpr_coresenabled; pp->smbp_threadcount = p.smbpr_threadcount; pp->smbp_cflags = p.smbpr_cflags; } - if (shp->sh_libvers >= SMB_VERSION_26) + if (smb_libgteq(shp, SMB_VERSION_26)) { pp->smbp_family2 = p.smbpr_family2; + } - if (shp->sh_libvers >= SMB_VERSION_30) { + if (smb_libgteq(shp, SMB_VERSION_30)) { pp->smbp_corecount2 = p.smbpr_corecount2; pp->smbp_coresenabled2 = p.smbpr_coresenabled2; pp->smbp_threadcount2 = p.smbpr_threadcount2; @@ -525,7 +574,7 @@ smbios_info_cache(smbios_hdl_t *shp, id_t id, smbios_cache_t *cap) return (smb_set_errno(shp, ESMB_TYPE)); smb_info_bcopy(stp->smbst_hdr, &c, sizeof (c)); - bzero(cap, sizeof (smbios_cache_t)); + bzero(cap, sizeof (smb_base_cache_t)); cap->smba_maxsize = SMB_CACHE_SIZE(c.smbca_maxsize); cap->smba_size = SMB_CACHE_SIZE(c.smbca_size); @@ -545,6 +594,17 @@ smbios_info_cache(smbios_hdl_t *shp, id_t id, smbios_cache_t *cap) if (SMB_CACHE_CFG_SOCKETED(c.smbca_config)) cap->smba_flags |= SMB_CAF_SOCKETED; + if (smb_libgteq(shp, SMB_VERSION_31)) { + if (smb_gteq(shp, SMB_VERSION_31)) { + cap->smba_maxsize2 = + SMB_CACHE_EXT_SIZE(c.smbca_maxsize2); + cap->smba_size2 = SMB_CACHE_EXT_SIZE(c.smbca_size2); + } else { + cap->smba_maxsize2 = cap->smba_maxsize; + cap->smba_size2 = cap->smba_size; + } + } + return (0); } @@ -841,13 +901,15 @@ smbios_info_memdevice(smbios_hdl_t *shp, id_t id, smbios_memdevice_t *mdp) mdp->smbmd_dloc = smb_strptr(stp, m.smbmdev_dloc); mdp->smbmd_bloc = smb_strptr(stp, m.smbmdev_bloc); - if (shp->sh_libvers >= SMB_VERSION_26) + if (smb_libgteq(shp, SMB_VERSION_26)) { mdp->smbmd_rank = m.smbmdev_attrs & 0x0F; + } - if (shp->sh_libvers >= SMB_VERSION_27) + if (smb_libgteq(shp, SMB_VERSION_27)) { mdp->smbmd_clkspeed = m.smbmdev_clkspeed; + } - if (shp->sh_libvers >= SMB_VERSION_28) { + if (smb_libgteq(shp, SMB_VERSION_28)) { mdp->smbmd_minvolt = m.smbmdev_minvolt; mdp->smbmd_maxvolt = m.smbmdev_maxvolt; mdp->smbmd_confvolt = m.smbmdev_confvolt; diff --git a/usr/src/common/smbios/smb_open.c b/usr/src/common/smbios/smb_open.c index c5417e0c0f..23d4a0aaca 100644 --- a/usr/src/common/smbios/smb_open.c +++ b/usr/src/common/smbios/smb_open.c @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -89,6 +89,7 @@ smbios_bufopen(const smbios_entry_t *ep, const void *buf, size_t len, case SMB_VERSION_27: case SMB_VERSION_28: case SMB_VERSION_30: + case SMB_VERSION_31: break; default: return (smb_open_error(shp, errp, ESMB_VERSION)); @@ -398,6 +399,14 @@ smb_strptr(const smb_struct_t *stp, uint_t i) } int +smb_libgteq(smbios_hdl_t *shp, int version) +{ + return (SMB_MAJOR(shp->sh_libvers) > SMB_MAJOR(version) || ( + SMB_MAJOR(shp->sh_libvers) == SMB_MAJOR(version) && + SMB_MINOR(shp->sh_libvers) >= SMB_MINOR(version))); +} + +int smb_gteq(smbios_hdl_t *shp, int version) { return (SMB_MAJOR(shp->sh_smbvers) > SMB_MAJOR(version) || ( diff --git a/usr/src/lib/brand/lx/lx_brand/sys/lx_mount.h b/usr/src/lib/brand/lx/lx_brand/sys/lx_mount.h index 074a6017c6..f9b239150d 100644 --- a/usr/src/lib/brand/lx/lx_brand/sys/lx_mount.h +++ b/usr/src/lib/brand/lx/lx_brand/sys/lx_mount.h @@ -78,7 +78,7 @@ extern int lx_nfs_mount(char *, char *, char *, int, char *); LX_MS_RDONLY | LX_MS_NOSUID | \ LX_MS_NODEV | LX_MS_NOEXEC | \ LX_MS_REMOUNT | LX_MS_NOATIME | \ - LX_MS_BIND | LX_MS_SILENT | \ + LX_MS_NODIRATIME | LX_MS_BIND | LX_MS_SILENT | \ LX_MS_STRICTATIME | LX_MS_NOSEC | \ LX_MS_BORN | LX_MS_ACTIVE | LX_MS_NOUSER) diff --git a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com index 022b31b4e7..9b721953e8 100644 --- a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com +++ b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com @@ -20,6 +20,7 @@ # # # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016 by Delphix. All rights reserved. # LIBRARY = s10_brand.a @@ -52,7 +53,7 @@ SRCS = $(CSRCS) # normally stable, there are examples, such as with the solaris8 brand, where # we could not combine the brand's libc with the native linker. Since we want # to run in a known configuration, we use the S10 libc/linker combination. -# +# # There is one more non-obvious side effect of using the s10 linker that # should be mentioned. Since the linker is used to setup processes before # libc is loaded, it makes system calls directly (ie avoiding libc), and @@ -82,6 +83,8 @@ C99LMODE= -Xc99=%all DYNFLAGS += $(DYNFLAGS_$(CLASS)) DYNFLAGS += $(BLOCAL) $(ZNOVERSION) -Wl,-e_start LDLIBS += -lc -lmapmalloc +LINTFLAGS += -erroff=E_STATIC_UNUSED +LINTFLAGS64 += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-uninitialized diff --git a/usr/src/lib/libficl/Makefile.com b/usr/src/lib/libficl/Makefile.com index a2c37d27c2..505e0d27f4 100644 --- a/usr/src/lib/libficl/Makefile.com +++ b/usr/src/lib/libficl/Makefile.com @@ -31,7 +31,7 @@ FICLDIR= $(SRC)/common/ficl C99MODE= $(C99_ENABLE) CPPFLAGS += -I.. -I$(FICLDIR) -D_LARGEFILE64_SOURCE=1 -LDLIBS += -lc -lm -lumem +LDLIBS += -luuid -lc -lm -lumem HEADERS= $(FICLDIR)/ficl.h $(FICLDIR)/ficltokens.h ../ficllocal.h \ $(FICLDIR)/ficlplatform/unix.h diff --git a/usr/src/lib/libscf/common/lowlevel.c b/usr/src/lib/libscf/common/lowlevel.c index 2c6a3d3c84..a348f50db0 100644 --- a/usr/src/lib/libscf/common/lowlevel.c +++ b/usr/src/lib/libscf/common/lowlevel.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2013, Joyent, Inc. All rights reserved. + * Copyright 2016 RackTop Systems. */ /* @@ -292,22 +293,34 @@ static const struct { rep_protocol_value_type_t ti_proto_type; const char *ti_name; } scf_type_info[] = { - {SCF_TYPE_BOOLEAN, REP_PROTOCOL_TYPE_BOOLEAN, "boolean"}, - {SCF_TYPE_COUNT, REP_PROTOCOL_TYPE_COUNT, "count"}, - {SCF_TYPE_INTEGER, REP_PROTOCOL_TYPE_INTEGER, "integer"}, - {SCF_TYPE_TIME, REP_PROTOCOL_TYPE_TIME, "time"}, - {SCF_TYPE_ASTRING, REP_PROTOCOL_TYPE_STRING, "astring"}, - {SCF_TYPE_OPAQUE, REP_PROTOCOL_TYPE_OPAQUE, "opaque"}, - {SCF_TYPE_USTRING, REP_PROTOCOL_SUBTYPE_USTRING, "ustring"}, - {SCF_TYPE_URI, REP_PROTOCOL_SUBTYPE_URI, "uri"}, - {SCF_TYPE_FMRI, REP_PROTOCOL_SUBTYPE_FMRI, "fmri"}, - {SCF_TYPE_HOST, REP_PROTOCOL_SUBTYPE_HOST, "host"}, - {SCF_TYPE_HOSTNAME, REP_PROTOCOL_SUBTYPE_HOSTNAME, "hostname"}, - {SCF_TYPE_NET_ADDR, REP_PROTOCOL_SUBTYPE_NETADDR, "net_address"}, + {SCF_TYPE_BOOLEAN, REP_PROTOCOL_TYPE_BOOLEAN, + SCF_TYPE_STRING_BOOLEAN}, + {SCF_TYPE_COUNT, REP_PROTOCOL_TYPE_COUNT, + SCF_TYPE_STRING_COUNT}, + {SCF_TYPE_INTEGER, REP_PROTOCOL_TYPE_INTEGER, + SCF_TYPE_STRING_INTEGER}, + {SCF_TYPE_TIME, REP_PROTOCOL_TYPE_TIME, + SCF_TYPE_STRING_TIME}, + {SCF_TYPE_ASTRING, REP_PROTOCOL_TYPE_STRING, + SCF_TYPE_STRING_ASTRING}, + {SCF_TYPE_OPAQUE, REP_PROTOCOL_TYPE_OPAQUE, + SCF_TYPE_STRING_OPAQUE}, + {SCF_TYPE_USTRING, REP_PROTOCOL_SUBTYPE_USTRING, + SCF_TYPE_STRING_USTRING}, + {SCF_TYPE_URI, REP_PROTOCOL_SUBTYPE_URI, + SCF_TYPE_STRING_URI}, + {SCF_TYPE_FMRI, REP_PROTOCOL_SUBTYPE_FMRI, + SCF_TYPE_STRING_FMRI}, + {SCF_TYPE_HOST, REP_PROTOCOL_SUBTYPE_HOST, + SCF_TYPE_STRING_HOST}, + {SCF_TYPE_HOSTNAME, REP_PROTOCOL_SUBTYPE_HOSTNAME, + SCF_TYPE_STRING_HOSTNAME}, + {SCF_TYPE_NET_ADDR, REP_PROTOCOL_SUBTYPE_NETADDR, + SCF_TYPE_STRING_NET_ADDR}, {SCF_TYPE_NET_ADDR_V4, REP_PROTOCOL_SUBTYPE_NETADDR_V4, - "net_address_v4"}, + SCF_TYPE_STRING_NET_ADDR_V4}, {SCF_TYPE_NET_ADDR_V6, REP_PROTOCOL_SUBTYPE_NETADDR_V6, - "net_address_v6"} + SCF_TYPE_STRING_NET_ADDR_V6} }; #define SCF_TYPE_INFO_COUNT (sizeof (scf_type_info) / sizeof (*scf_type_info)) diff --git a/usr/src/lib/libscf/inc/libscf.h b/usr/src/lib/libscf/inc/libscf.h index a3fa5b344c..f4502b7f14 100644 --- a/usr/src/lib/libscf/inc/libscf.h +++ b/usr/src/lib/libscf/inc/libscf.h @@ -95,6 +95,24 @@ typedef enum { SCF_TYPE_NET_ADDR } scf_type_t; +/* + * Values returned by scf_type_to_string + */ +#define SCF_TYPE_STRING_BOOLEAN "boolean" +#define SCF_TYPE_STRING_COUNT "count" +#define SCF_TYPE_STRING_INTEGER "integer" +#define SCF_TYPE_STRING_TIME "time" +#define SCF_TYPE_STRING_ASTRING "astring" +#define SCF_TYPE_STRING_OPAQUE "opaque" +#define SCF_TYPE_STRING_USTRING "ustring" +#define SCF_TYPE_STRING_URI "uri" +#define SCF_TYPE_STRING_FMRI "fmri" +#define SCF_TYPE_STRING_HOST "host" +#define SCF_TYPE_STRING_HOSTNAME "hostname" +#define SCF_TYPE_STRING_NET_ADDR "net_address" +#define SCF_TYPE_STRING_NET_ADDR_V4 "net_address_v4" +#define SCF_TYPE_STRING_NET_ADDR_V6 "net_address_v6" + typedef struct scf_time { int64_t t_seconds; int32_t t_ns; diff --git a/usr/src/lib/libzfs/Makefile.com b/usr/src/lib/libzfs/Makefile.com index 4c8ed5d57a..c80f481d6d 100644 --- a/usr/src/lib/libzfs/Makefile.com +++ b/usr/src/lib/libzfs/Makefile.com @@ -20,8 +20,8 @@ # # # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2011, 2015 by Delphix. All rights reserved. # Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com> +# Copyright (c) 2011, 2016 by Delphix. All rights reserved. # LIBRARY= libzfs.a @@ -76,6 +76,9 @@ CPPFLAGS += $(INCS) -D_LARGEFILE64_SOURCE=1 -D_REENTRANT # There's no lint library for zlib, so only include this when building $(DYNLIB) := LDLIBS += -lz +LINTFLAGS += -erroff=E_STATIC_UNUSED +LINTFLAGS64 += -erroff=E_STATIC_UNUSED + SRCS= $(OBJS_COMMON:%.o=$(SRCDIR)/%.c) \ $(OBJS_SHARED:%.o=$(SRC)/common/zfs/%.c) $(LINTLIB) := SRCS= $(SRCDIR)/$(LINTSRC) diff --git a/usr/src/man/man1m/zfs.1m b/usr/src/man/man1m/zfs.1m index ee49174cb4..c0edc2e780 100644 --- a/usr/src/man/man1m/zfs.1m +++ b/usr/src/man/man1m/zfs.1m @@ -748,7 +748,7 @@ or a user who has been granted the privilege with .Nm zfs Cm allow , can access all groups' usage. -.It Sy volblocksize Ns = Ns Em blocksize +.It Sy volblocksize For volumes, specifies the block size of the volume. The .Sy blocksize cannot be changed once the volume has been written, so it should be set at @@ -3047,7 +3047,7 @@ Recursively remove the permissions from this file system and all descendents. .Nm .Cm unallow .Op Fl r -.Fl s @ Ns Ar setname +.Fl s No @ Ns Ar setname .Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns .Ar setname Oc Ns ... Oc .Ar filesystem Ns | Ns Ar volume diff --git a/usr/src/pkg/manifests/SUNWcs.mf b/usr/src/pkg/manifests/SUNWcs.mf index 9e808ad541..758312b5ae 100644 --- a/usr/src/pkg/manifests/SUNWcs.mf +++ b/usr/src/pkg/manifests/SUNWcs.mf @@ -433,10 +433,8 @@ file path=etc/security/prof_attr group=sys preserve=true \ timestamp=19700101T000000Z file path=etc/security/prof_attr.d/SUNWcs group=sys file path=etc/shadow group=sys mode=0400 preserve=true +file path=etc/skel/.kshrc group=other preserve=true file path=etc/skel/.profile group=other preserve=true -file path=etc/skel/local.cshrc group=sys preserve=true -file path=etc/skel/local.login group=sys preserve=true -file path=etc/skel/local.profile group=sys preserve=true file path=etc/svc/profile/generic_limited_net.xml group=sys mode=0444 file path=etc/svc/profile/generic_open.xml group=sys mode=0444 file path=etc/svc/profile/inetd_generic.xml group=sys mode=0444 diff --git a/usr/src/pkg/manifests/driver-graphics-agpgart.mf b/usr/src/pkg/manifests/driver-graphics-agpgart.mf index 59b2deb4ee..d159eff659 100644 --- a/usr/src/pkg/manifests/driver-graphics-agpgart.mf +++ b/usr/src/pkg/manifests/driver-graphics-agpgart.mf @@ -34,13 +34,15 @@ set name=pkg.description value="AGP GART driver for x86 workstations" set name=pkg.summary value="AGP GART Driver" set name=info.classification \ value=org.opensolaris.category.2008:Drivers/Display +set name=org.opensolaris.noincorp value=true set name=variant.arch value=i386 dir path=kernel group=sys dir path=kernel/drv group=sys dir path=kernel/drv/$(ARCH64) group=sys +dir path=kernel/misc group=sys +dir path=kernel/misc/$(ARCH64) group=sys dir path=usr/share/man dir path=usr/share/man/man7i -driver name=$(ARCH64)_gart alias=pci1022,1103 perms="* 0644 root sys" driver name=agpgart perms="* 0644 root sys" driver name=agptarget perms="* 0644 root sys" \ alias=pci1022,7454 \ @@ -76,6 +78,8 @@ driver name=agptarget perms="* 0644 root sys" \ alias=pci8086,7120 \ alias=pci8086,7122 \ alias=pci8086,7124 +# Note: the name of this driver _really_is_ amd64_gart... +driver name=amd64_gart alias=pci1022,1103 perms="* 0644 root sys" file path=kernel/drv/$(ARCH64)/$(ARCH64)_gart group=sys file path=kernel/drv/$(ARCH64)/agpgart group=sys file path=kernel/drv/$(ARCH64)/agptarget group=sys @@ -83,6 +87,8 @@ file path=kernel/drv/$(ARCH64)_gart group=sys file path=kernel/drv/agpgart group=sys file path=kernel/drv/agpgart.conf group=sys file path=kernel/drv/agptarget group=sys +file path=kernel/misc/$(ARCH64)/agpmaster group=sys mode=0755 +file path=kernel/misc/agpmaster group=sys mode=0755 file path=usr/share/man/man7i/agpgart_io.7i legacy pkg=SUNWagp desc="AGP GART driver for x86 workstations" \ name="AGP GART Driver" diff --git a/usr/src/pkg/manifests/driver-graphics-drm.mf b/usr/src/pkg/manifests/driver-graphics-drm.mf index a1c3a94e78..9291f9c989 100644 --- a/usr/src/pkg/manifests/driver-graphics-drm.mf +++ b/usr/src/pkg/manifests/driver-graphics-drm.mf @@ -35,12 +35,16 @@ set name=pkg.description \ set name=pkg.summary value="DRM Kernel Drivers" set name=info.classification \ value=org.opensolaris.category.2008:Drivers/Display +set name=org.opensolaris.noincorp value=true set name=variant.arch value=i386 dir path=kernel group=sys dir path=kernel/drv group=sys dir path=kernel/drv/$(ARCH64) group=sys dir path=kernel/misc group=sys dir path=kernel/misc/$(ARCH64) group=sys +dir path=usr/lib +dir path=usr/lib/devfsadm group=sys +dir path=usr/lib/devfsadm/linkmod group=sys dir path=usr/share/man dir path=usr/share/man/man7d driver name=i915 perms="* 0644 root sys" \ @@ -74,6 +78,7 @@ file path=kernel/drv/i915 group=sys file path=kernel/drv/radeon group=sys file path=kernel/misc/$(ARCH64)/drm group=sys mode=0755 file path=kernel/misc/drm group=sys mode=0755 +file path=usr/lib/devfsadm/linkmod/SUNW_drm_link_i386.so group=sys file path=usr/share/man/man7d/i915.7d file path=usr/share/man/man7d/radeon.7d legacy pkg=SUNWdrmr desc="Direct Rendering Manager kernel drivers and modules" \ @@ -81,3 +86,4 @@ legacy pkg=SUNWdrmr desc="Direct Rendering Manager kernel drivers and modules" \ license cr_Sun license=cr_Sun license usr/src/uts/common/io/drm/THIRDPARTYLICENSE \ license=usr/src/uts/common/io/drm/THIRDPARTYLICENSE +depend fmri=pkg:/driver/graphics/agpgart type=require diff --git a/usr/src/pkg/manifests/system-header-header-agp.mf b/usr/src/pkg/manifests/system-header-header-agp.mf index bfc6bbd86a..b270266ccf 100644 --- a/usr/src/pkg/manifests/system-header-header-agp.mf +++ b/usr/src/pkg/manifests/system-header-header-agp.mf @@ -28,6 +28,7 @@ set name=pkg.description value="AGP GART Header Files for x86 Workstations" set name=pkg.summary value="AGP GART Driver Header Files" set name=info.classification \ value=org.opensolaris.category.2008:Development/System +set name=org.opensolaris.noincorp value=true set name=variant.arch value=i386 dir path=usr group=sys dir path=usr/include diff --git a/usr/src/pkg/manifests/system-header.mf b/usr/src/pkg/manifests/system-header.mf index e1bf69f00c..658ed3a1b5 100644 --- a/usr/src/pkg/manifests/system-header.mf +++ b/usr/src/pkg/manifests/system-header.mf @@ -355,6 +355,7 @@ file path=usr/include/deflt.h file path=usr/include/des/des.h file path=usr/include/des/desdata.h file path=usr/include/des/softdes.h +file path=usr/include/devfsadm.h file path=usr/include/device_info.h file path=usr/include/devid.h file path=usr/include/devmgmt.h @@ -1073,6 +1074,7 @@ file path=usr/include/sys/ftrace.h file path=usr/include/sys/fx.h file path=usr/include/sys/fxpriocntl.h file path=usr/include/sys/gfs.h +file path=usr/include/sys/gfx_private.h file path=usr/include/sys/gld.h file path=usr/include/sys/gldpriv.h file path=usr/include/sys/group.h diff --git a/usr/src/pkg/manifests/system-kernel.mf b/usr/src/pkg/manifests/system-kernel.mf index 9a2c454757..df7912ebf3 100644 --- a/usr/src/pkg/manifests/system-kernel.mf +++ b/usr/src/pkg/manifests/system-kernel.mf @@ -652,7 +652,6 @@ $(i386_ONLY)file path=kernel/mac/mac_ipv4 group=sys mode=0755 $(i386_ONLY)file path=kernel/mac/mac_ipv6 group=sys mode=0755 $(i386_ONLY)file path=kernel/mac/mac_wifi group=sys mode=0755 $(i386_ONLY)file path=kernel/misc/$(ARCH64)/acpica group=sys mode=0755 -$(i386_ONLY)file path=kernel/misc/$(ARCH64)/agpmaster group=sys mode=0755 file path=kernel/misc/$(ARCH64)/bignum group=sys mode=0755 $(i386_ONLY)file path=kernel/misc/$(ARCH64)/bootdev group=sys mode=0755 file path=kernel/misc/$(ARCH64)/busra group=sys mode=0755 @@ -690,7 +689,6 @@ $(sparc_ONLY)file path=kernel/misc/$(ARCH64)/swapgeneric group=sys mode=0755 file path=kernel/misc/$(ARCH64)/tem group=sys mode=0755 file path=kernel/misc/$(ARCH64)/tlimod group=sys mode=0755 $(i386_ONLY)file path=kernel/misc/acpica group=sys mode=0755 -$(i386_ONLY)file path=kernel/misc/agpmaster group=sys mode=0755 $(i386_ONLY)file path=kernel/misc/bignum group=sys mode=0755 $(i386_ONLY)file path=kernel/misc/bootdev group=sys mode=0755 $(i386_ONLY)file path=kernel/misc/busra group=sys mode=0755 diff --git a/usr/src/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf index 6a0ad9b813..4ab04a24b6 100644 --- a/usr/src/pkg/manifests/system-test-zfstest.mf +++ b/usr/src/pkg/manifests/system-test-zfstest.mf @@ -316,7 +316,7 @@ file path=opt/zfs-tests/tests/functional/bootfs/bootfs_004_neg mode=0555 file path=opt/zfs-tests/tests/functional/bootfs/bootfs_005_neg mode=0555 file path=opt/zfs-tests/tests/functional/bootfs/bootfs_006_pos mode=0555 file path=opt/zfs-tests/tests/functional/bootfs/bootfs_007_pos mode=0555 -file path=opt/zfs-tests/tests/functional/bootfs/bootfs_008_neg mode=0555 +file path=opt/zfs-tests/tests/functional/bootfs/bootfs_008_pos mode=0555 file path=opt/zfs-tests/tests/functional/cache/cache.cfg mode=0555 file path=opt/zfs-tests/tests/functional/cache/cache.kshlib mode=0555 file path=opt/zfs-tests/tests/functional/cache/cache_001_pos mode=0555 @@ -2034,7 +2034,7 @@ file path=opt/zfs-tests/tests/functional/reservation/setup mode=0555 file path=opt/zfs-tests/tests/functional/rootpool/cleanup mode=0555 file path=opt/zfs-tests/tests/functional/rootpool/rootpool_002_neg mode=0555 file path=opt/zfs-tests/tests/functional/rootpool/rootpool_003_neg mode=0555 -file path=opt/zfs-tests/tests/functional/rootpool/rootpool_007_neg mode=0555 +file path=opt/zfs-tests/tests/functional/rootpool/rootpool_007_pos mode=0555 file path=opt/zfs-tests/tests/functional/rootpool/setup mode=0555 file path=opt/zfs-tests/tests/functional/rsend/cleanup mode=0555 file path=opt/zfs-tests/tests/functional/rsend/rsend.cfg mode=0555 diff --git a/usr/src/test/zfs-tests/runfiles/delphix.run b/usr/src/test/zfs-tests/runfiles/delphix.run index 7f6afe6451..3067f09138 100644 --- a/usr/src/test/zfs-tests/runfiles/delphix.run +++ b/usr/src/test/zfs-tests/runfiles/delphix.run @@ -58,7 +58,7 @@ tests = ['atime_001_pos', 'atime_002_neg'] [/opt/zfs-tests/tests/functional/bootfs] tests = ['bootfs_001_pos', 'bootfs_002_neg', 'bootfs_003_pos', 'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_006_pos', 'bootfs_007_pos', - 'bootfs_008_neg'] + 'bootfs_008_pos'] pre = post = @@ -471,7 +471,7 @@ tests = ['reservation_001_pos', 'reservation_002_pos', 'reservation_003_pos', 'reservation_016_pos', 'reservation_017_pos', 'reservation_018_pos'] [/opt/zfs-tests/tests/functional/rootpool] -tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_neg'] +tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_pos'] [/opt/zfs-tests/tests/functional/rsend] tests = ['rsend_001_pos', 'rsend_002_pos', 'rsend_003_pos', 'rsend_004_pos', diff --git a/usr/src/test/zfs-tests/runfiles/omnios.run b/usr/src/test/zfs-tests/runfiles/omnios.run index f66317cd6d..4f8f0d7787 100644 --- a/usr/src/test/zfs-tests/runfiles/omnios.run +++ b/usr/src/test/zfs-tests/runfiles/omnios.run @@ -58,7 +58,7 @@ tests = ['atime_001_pos', 'atime_002_neg'] [/opt/zfs-tests/tests/functional/bootfs] tests = ['bootfs_001_pos', 'bootfs_002_neg', 'bootfs_003_pos', 'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_006_pos', 'bootfs_007_pos', - 'bootfs_008_neg'] + 'bootfs_008_pos'] pre = post = @@ -467,7 +467,7 @@ tests = ['reservation_001_pos', 'reservation_002_pos', 'reservation_003_pos', 'reservation_016_pos', 'reservation_017_pos', 'reservation_018_pos'] [/opt/zfs-tests/tests/functional/rootpool] -tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_neg'] +tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_pos'] [/opt/zfs-tests/tests/functional/rsend] tests = ['rsend_001_pos', 'rsend_002_pos', 'rsend_003_pos', 'rsend_004_pos', diff --git a/usr/src/test/zfs-tests/runfiles/openindiana.run b/usr/src/test/zfs-tests/runfiles/openindiana.run index 7293eb949c..4e6ac6d29d 100644 --- a/usr/src/test/zfs-tests/runfiles/openindiana.run +++ b/usr/src/test/zfs-tests/runfiles/openindiana.run @@ -58,7 +58,7 @@ tests = ['atime_001_pos', 'atime_002_neg'] [/opt/zfs-tests/tests/functional/bootfs] tests = ['bootfs_001_pos', 'bootfs_002_neg', 'bootfs_003_pos', 'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_006_pos', 'bootfs_007_pos', - 'bootfs_008_neg'] + 'bootfs_008_pos'] pre = post = @@ -467,7 +467,7 @@ tests = ['reservation_001_pos', 'reservation_002_pos', 'reservation_003_pos', 'reservation_016_pos', 'reservation_017_pos', 'reservation_018_pos'] [/opt/zfs-tests/tests/functional/rootpool] -tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_neg'] +tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_pos'] [/opt/zfs-tests/tests/functional/rsend] tests = ['rsend_001_pos', 'rsend_002_pos', 'rsend_003_pos', 'rsend_004_pos', diff --git a/usr/src/test/zfs-tests/tests/functional/bootfs/Makefile b/usr/src/test/zfs-tests/tests/functional/bootfs/Makefile index c6ca6e8d95..821c182352 100644 --- a/usr/src/test/zfs-tests/tests/functional/bootfs/Makefile +++ b/usr/src/test/zfs-tests/tests/functional/bootfs/Makefile @@ -26,7 +26,7 @@ PROGS = bootfs_001_pos \ bootfs_005_neg \ bootfs_006_pos \ bootfs_007_pos \ - bootfs_008_neg + bootfs_008_pos CMDS = $(PROGS:%=$(TESTDIR)/%) $(CMDS) := FILEMODE = 0555 diff --git a/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh b/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh index 327c98fd65..cefcb3f30f 100644 --- a/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh @@ -129,18 +129,18 @@ verify_no_bootfs $TESTPOOL # raidz log_must zpool create $TESTPOOL raidz $VDEV1 $VDEV2 -verify_no_bootfs $TESTPOOL +verify_bootfs $TESTPOOL # raidz + hotspare log_must zpool create $TESTPOOL raidz $VDEV1 $VDEV2 spare $VDEV3 -verify_no_bootfs $TESTPOOL +verify_bootfs $TESTPOOL # raidz2 log_must zpool create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3 -verify_no_bootfs $TESTPOOL +verify_bootfs $TESTPOOL # raidz2 + hotspare log_must zpool create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3 spare $VDEV4 -verify_no_bootfs $TESTPOOL +verify_bootfs $TESTPOOL log_pass "Pools of correct vdev types accept boot property" diff --git a/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_008_neg.ksh b/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_008_pos.ksh index c62fcb0ed5..d3ceee5a71 100644 --- a/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_008_neg.ksh +++ b/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_008_pos.ksh @@ -34,13 +34,13 @@ # # DESCRIPTION: # -# setting bootfs on a dataset which has gzip compression enabled will fail +# setting bootfs on a dataset which has gzip compression enabled will not fail # # STRATEGY: # 1. create pools based on a valid vdev # 2. create a filesytem on this pool and set the compression property to gzip1-9 # 3. set the pool's bootfs property to filesystem we just configured which -# should fail +# should not fail # verify_runnable "global" @@ -56,9 +56,9 @@ function cleanup { } typeset assert_msg="setting bootfs on a dataset which has gzip \ - compression enabled will fail" + compression enabled will not fail" -typeset VDEV=/bootfs_008_neg_a.$$.dat +typeset VDEV=/bootfs_008_pos_a.$$.dat typeset COMP_FS=$TESTPOOL/COMP_FS log_onexit cleanup @@ -74,7 +74,7 @@ set -A gtype "gzip" "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" \ while (( i < ${#gtype[@]} )); do log_must zfs set compression=${gtype[i]} $COMP_FS - log_mustnot zpool set bootfs=$COMP_FS $TESTPOOL + log_must zpool set bootfs=$COMP_FS $TESTPOOL log_must zfs set compression=off $COMP_FS (( i += 1 )) done diff --git a/usr/src/test/zfs-tests/tests/functional/rootpool/Makefile b/usr/src/test/zfs-tests/tests/functional/rootpool/Makefile index a752186cbd..e0fdc2b686 100644 --- a/usr/src/test/zfs-tests/tests/functional/rootpool/Makefile +++ b/usr/src/test/zfs-tests/tests/functional/rootpool/Makefile @@ -21,7 +21,7 @@ TESTDIR = $(ROOTOPTPKG)/tests/functional/rootpool PROGS = cleanup \ rootpool_002_neg \ rootpool_003_neg \ - rootpool_007_neg \ + rootpool_007_pos \ setup CMDS = $(PROGS:%=$(TESTDIR)/%) diff --git a/usr/src/test/zfs-tests/tests/functional/rootpool/rootpool_007_neg.ksh b/usr/src/test/zfs-tests/tests/functional/rootpool/rootpool_007_pos.ksh index c7a7651610..7e96c34ce2 100644 --- a/usr/src/test/zfs-tests/tests/functional/rootpool/rootpool_007_neg.ksh +++ b/usr/src/test/zfs-tests/tests/functional/rootpool/rootpool_007_pos.ksh @@ -34,12 +34,12 @@ # # DESCRIPTION: # -# the zfs rootfilesystem's compression property can not set to gzip[1-9] +# the zfs rootfilesystem's compression property can be set to gzip[1-9] # # STRATEGY: # 1) check if the current system is installed as zfs root # 2) get the rootfs -# 3) set the rootfs's compression to gzip 1-9 which should fail. +# 3) set the rootfs's compression to gzip 1-9 which should not fail. # verify_runnable "global" @@ -55,7 +55,7 @@ typeset rootpool=$(get_rootpool) typeset rootfs=$(get_pool_prop bootfs $rootpool) typeset orig_compress=$(get_prop compression $rootfs) -typeset assert_msg="the zfs rootfs's compression property can not set to \ +typeset assert_msg="the zfs rootfs's compression property can be set to \ gzip and gzip[1-9]" set -A gtype "gzip" "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" \ @@ -63,7 +63,7 @@ set -A gtype "gzip" "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" \ typeset -i i=0 while (( i < ${#gtype[@]} )); do - log_mustnot zfs set compression=${gtype[i]} $rootfs + log_must zfs set compression=${gtype[i]} $rootfs (( i += 1 )) done diff --git a/usr/src/uts/common/brand/lx/cgroups/cgrps_vnops.c b/usr/src/uts/common/brand/lx/cgroups/cgrps_vnops.c index 27d1715e1b..0078ad7876 100644 --- a/usr/src/uts/common/brand/lx/cgroups/cgrps_vnops.c +++ b/usr/src/uts/common/brand/lx/cgroups/cgrps_vnops.c @@ -444,86 +444,6 @@ cgrp_wr(cgrp_mnt_t *cgm, cgrp_node_t *cn, struct uio *uio) } /* - * pidlock is held on entry but dropped on exit. Because we might have to drop - * locks and loop if the process is already P_PR_LOCKed, it is possible that - * the process might be gone when we return from this function. - */ -static proc_t * -cgrp_p_lock(proc_t *p) -{ - kmutex_t *mp; - pid_t pid; - - ASSERT(MUTEX_HELD(&pidlock)); - - /* first try the fast path */ - mutex_enter(&p->p_lock); - if (p->p_flag & SEXITING) { - mutex_exit(&p->p_lock); - mutex_exit(&pidlock); - return (NULL); - } - - if (!(p->p_proc_flag & P_PR_LOCK)) { - p->p_proc_flag |= P_PR_LOCK; - mutex_exit(&p->p_lock); - mutex_exit(&pidlock); - THREAD_KPRI_REQUEST(); - return (p); - } - mutex_exit(&p->p_lock); - - pid = p->p_pid; - for (;;) { - /* - * p_lock is persistent, but p itself is not -- it could - * vanish during cv_wait(). Load p->p_lock now so we can - * drop it after cv_wait() without referencing p. - */ - mp = &p->p_lock; - mutex_enter(mp); - mutex_exit(&pidlock); - - if (p->p_flag & SEXITING) { - mutex_exit(mp); - return (NULL); - } - - if (!(p->p_proc_flag & P_PR_LOCK)) - break; - - cv_wait(&pr_pid_cv[p->p_slot], mp); - mutex_exit(mp); - - mutex_enter(&pidlock); - p = prfind(pid); - if (p == NULL || p->p_stat == SIDL) { - mutex_exit(&pidlock); - return (NULL); - } - } - - p->p_proc_flag |= P_PR_LOCK; - mutex_exit(mp); - ASSERT(!MUTEX_HELD(&pidlock)); - THREAD_KPRI_REQUEST(); - return (p); -} - -static void -cgrp_p_unlock(proc_t *p) -{ - ASSERT(p->p_proc_flag & P_PR_LOCK); - ASSERT(MUTEX_HELD(&p->p_lock)); - ASSERT(!MUTEX_HELD(&pidlock)); - - p->p_proc_flag &= ~P_PR_LOCK; - cv_signal(&pr_pid_cv[p->p_slot]); - mutex_exit(&p->p_lock); - THREAD_KPRI_RELEASE(); -} - -/* * Read value from the notify_on_release pseudo file on the parent node * (which is the actual cgroup node). We don't bother taking the cg_contents * lock since it's a single instruction so an empty group action/read will @@ -769,13 +689,15 @@ cgrp_rd_proc_tasks(uint_t cg_id, proc_t *p, pid_t initpid, ssize_t *offset, } /* - * Read pids from the tasks pseudo file. We have to look at all of the - * processes to find applicable ones, then report pids for any thread in the - * cgroup. We return the emulated lx thread pid here, not the internal thread - * ID. Because we're possibly doing IO for each taskid we lock the process - * so that the threads don't change while we're working on it (although threads - * can change if we fill up the read buffer and come back later for a - * subsequent read). + * Read PIDs from the tasks pseudo file. In order to do this, the process + * table is walked, searching for entries which are in the correct state and + * match this zone. The LX emulated PIDs will be reported from branded entries + * which fulfill the criteria. Since records are being emulated for every task + * in the process, PR_LOCK is acquired to prevent changes during output. + * + * Note: If the buffer is filled and the accessing process is forced into a + * subsequent read, the reported threads may changes while locks are dropped in + * the mean time. */ static int cgrp_rd_tasks(cgrp_mnt_t *cgm, cgrp_node_t *cn, struct uio *uio) @@ -783,9 +705,9 @@ cgrp_rd_tasks(cgrp_mnt_t *cgm, cgrp_node_t *cn, struct uio *uio) int i; ssize_t offset = 0; zoneid_t zoneid = curproc->p_zone->zone_id; + cred_t *cred = CRED(); int error = 0; pid_t initpid = curproc->p_zone->zone_proc_initpid; - pid_t schedpid = curproc->p_zone->zone_zsched->p_pid; /* the cgroup ID is on the containing dir */ uint_t cg_id = cn->cgn_parent->cgn_id; @@ -794,45 +716,75 @@ cgrp_rd_tasks(cgrp_mnt_t *cgm, cgrp_node_t *cn, struct uio *uio) proc_t *p; mutex_enter(&pidlock); - /* - * Skip indices for which there is no pid_entry, PIDs for - * which there is no corresponding process, system processes, - * a PID of 0, the pid for our zsched process, anything the - * security policy doesn't allow us to look at, its not an - * lx-branded process and processes that are not in the zone. - */ - if ((p = pid_entry(i)) == NULL || - p->p_stat == SIDL || - (p->p_flag & SSYS) != 0 || - p->p_pid == 0 || - p->p_pid == schedpid || - secpolicy_basic_procinfo(CRED(), p, curproc) != 0 || - p->p_brand != &lx_brand || - p->p_zone->zone_id != zoneid) { - mutex_exit(&pidlock); - continue; - } + for (;;) { + if ((p = pid_entry(i)) == NULL) { + /* Quickly move onto the next slot */ + if (++i < v.v_proc) { + continue; + } else { + mutex_exit(&pidlock); + break; + } + } - if (p->p_tlist == NULL) { - /* no threads, skip it */ + /* + * Check if this process would even be of interest to + * cgroupfs before attempting to acquire its PR_LOCK. + */ + mutex_enter(&p->p_lock); mutex_exit(&pidlock); - continue; + if (p->p_brand != &lx_brand || + p->p_zone->zone_id != zoneid) { + mutex_exit(&p->p_lock); + p = NULL; + break; + } + + /* Attempt to grab P_PR_LOCK. */ + error = sprtrylock_proc(p); + if (error == 0) { + /* Success */ + break; + } else if (error < 0) { + /* + * This process is not in a state where + * P_PR_LOCK can be acquired. It either + * belongs to the system or is a zombie. + * Regardless, give up and move on. + */ + mutex_exit(&p->p_lock); + p = NULL; + break; + } else { + /* + * Wait until P_PR_LOCK is no longer contended + * and attempt to acquire it again. Since the + * process may have changed state, the entry + * lookup must be repeated. + */ + sprwaitlock_proc(p); + mutex_enter(&pidlock); + } } - p = cgrp_p_lock(p); - ASSERT(!MUTEX_HELD(&pidlock)); - if (p == NULL) + if (p == NULL) { continue; + } else if (secpolicy_basic_procinfo(cred, p, curproc) != 0) { + sprunlock(p); + continue; + } + /* Shuffle locks and output the entry. */ + mutex_exit(&p->p_lock); mutex_enter(&cgm->cg_contents); error = cgrp_rd_proc_tasks(cg_id, p, initpid, &offset, uio); mutex_exit(&cgm->cg_contents); - mutex_enter(&p->p_lock); - cgrp_p_unlock(p); - if (error != 0) + sprunlock(p); + if (error != 0) { return (error); + } } return (0); diff --git a/usr/src/uts/common/brand/lx/procfs/lx_proc.h b/usr/src/uts/common/brand/lx/procfs/lx_proc.h index b4665a484a..67988e4aab 100644 --- a/usr/src/uts/common/brand/lx/procfs/lx_proc.h +++ b/usr/src/uts/common/brand/lx/procfs/lx_proc.h @@ -70,7 +70,6 @@ extern "C" { #include <sys/atomic.h> #include <sys/sunddi.h> #include <sys/sunldi.h> -#include <sys/zfs_ioctl.h> #include <sys/nvpair.h> #include <vm/as.h> #include <vm/anon.h> diff --git a/usr/src/uts/common/brand/lx/procfs/lx_prsubr.c b/usr/src/uts/common/brand/lx/procfs/lx_prsubr.c index 45ee361e26..25824af541 100644 --- a/usr/src/uts/common/brand/lx/procfs/lx_prsubr.c +++ b/usr/src/uts/common/brand/lx/procfs/lx_prsubr.c @@ -34,7 +34,6 @@ #include <sys/mman.h> #include <sys/vmsystm.h> #include <sys/prsystm.h> -#include <sys/zfs_ioctl.h> #include <sys/brand.h> #include <sys/lx_brand.h> diff --git a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c index fb06882064..edfada483c 100644 --- a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c +++ b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c @@ -3624,6 +3624,8 @@ lxpr_read_meminfo(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf) } else { total_mem = zone->zone_phys_mem_ctl; free_mem = zone->zone_phys_mem_ctl - zone->zone_phys_mem; + if (free_mem < 0) + free_mem = 0; } if (global || zone->zone_max_swap_ctl == UINT64_MAX) { diff --git a/usr/src/uts/common/brand/lx/sys/lx_brand.h b/usr/src/uts/common/brand/lx/sys/lx_brand.h index 30d576044f..9be10aff98 100644 --- a/usr/src/uts/common/brand/lx/sys/lx_brand.h +++ b/usr/src/uts/common/brand/lx/sys/lx_brand.h @@ -39,6 +39,7 @@ #include <sys/sunddi.h> #include <sys/sunldi.h> #include <sys/cpuvar.h> +#include <sys/lx_futex.h> #endif #ifdef __cplusplus @@ -563,6 +564,8 @@ struct lx_lwp_data { uint64_t br_schd_runtime; /* emulated DEADLINE */ uint64_t br_schd_deadline; /* emulated DEADLINE */ uint64_t br_schd_period; /* emulated DEADLINE */ + + fwaiter_t br_fwaiter; /* futex upon which we're waiting */ }; /* diff --git a/usr/src/uts/common/brand/lx/sys/lx_futex.h b/usr/src/uts/common/brand/lx/sys/lx_futex.h index a400b3bd83..6e4f6ee4a0 100644 --- a/usr/src/uts/common/brand/lx/sys/lx_futex.h +++ b/usr/src/uts/common/brand/lx/sys/lx_futex.h @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2014, Joyent, Inc. All rights reserved. + * Copyright (c) 2016, Joyent, Inc. All rights reserved. */ #ifndef _SYS_LX_FUTEX_H @@ -97,6 +97,25 @@ extern "C" { #ifdef _KERNEL +/* + * This structure is used to track all the threads currently waiting on a + * futex. There is one fwaiter_t for each blocked thread. We store all + * fwaiter_t's in a hash structure, indexed by the memid_t of the integer + * containing the futex's value. + * + * At the moment, all fwaiter_t's for a single futex are simply dumped into + * the hash bucket. If futex contention ever becomes a hot path, we can + * chain a single futex's waiters together. + */ +typedef struct fwaiter { + memid_t fw_memid; /* memid of the user-space futex */ + kcondvar_t fw_cv; /* cond var */ + struct fwaiter *fw_next; /* hash queue */ + struct fwaiter *fw_prev; /* hash queue */ + uint32_t fw_bits; /* bits waiting on */ + volatile int fw_woken; +} fwaiter_t; + #define FUTEX_WAITERS 0x80000000 #define FUTEX_OWNER_DIED 0x40000000 #define FUTEX_TID_MASK 0x3fffffff diff --git a/usr/src/uts/common/brand/lx/syscall/lx_brk.c b/usr/src/uts/common/brand/lx/syscall/lx_brk.c index 19a7577ac0..d46e442759 100644 --- a/usr/src/uts/common/brand/lx/syscall/lx_brk.c +++ b/usr/src/uts/common/brand/lx/syscall/lx_brk.c @@ -21,37 +21,35 @@ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2016 Joyent, Inc. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/systm.h> +#include <sys/thread.h> #include <sys/errno.h> -/* - * The brk() system call needs to be in-kernel because Linux expects a call to - * brk(0) to return the current breakpoint. In Solaris, the process breakpoint - * is setup and managed by libc. Due to the way we link our libraries and the - * need for Linux to manage its own breakpoint, this has to remain in the - * kernel. - */ -extern int brk(caddr_t); +/* From usr/src/uts/common/os/grow.c */ +extern intptr_t brk(caddr_t); long lx_brk(caddr_t nva) { - proc_t *p = curproc; - klwp_t *lwp = ttolwp(curthread); - if (nva != 0) { (void) brk(nva); /* - * Despite claims to the contrary in the manpage, when Linux - * brk() fails, errno is left unchanged. + * Despite claims to the contrary in the man page, when Linux + * brk(2) fails, errno is left unchanged. */ - lwp->lwp_errno = 0; + ttolwp(curthread)->lwp_errno = 0; } - return ((long)(p->p_brkbase + p->p_brksize)); + + /* + * When ASLR was integrated, our internal brk(2) was updated to emit + * the current brk when arg0 == 0. Using the function yields an + * equivalent result to manually calculating the brk, but also + * serializes with changes to the process AS. + */ + return ((long)brk((caddr_t)0)); } diff --git a/usr/src/uts/common/brand/lx/syscall/lx_futex.c b/usr/src/uts/common/brand/lx/syscall/lx_futex.c index 94c215fedc..b3f9848ff5 100644 --- a/usr/src/uts/common/brand/lx/syscall/lx_futex.c +++ b/usr/src/uts/common/brand/lx/syscall/lx_futex.c @@ -189,25 +189,6 @@ */ /* - * This structure is used to track all the threads currently waiting on a - * futex. There is one fwaiter_t for each blocked thread. We store all - * fwaiter_t's in a hash structure, indexed by the memid_t of the integer - * containing the futex's value. - * - * At the moment, all fwaiter_t's for a single futex are simply dumped into - * the hash bucket. If futex contention ever becomes a hot path, we can - * chain a single futex's waiters together. - */ -typedef struct fwaiter { - memid_t fw_memid; /* memid of the user-space futex */ - kcondvar_t fw_cv; /* cond var */ - struct fwaiter *fw_next; /* hash queue */ - struct fwaiter *fw_prev; /* hash queue */ - uint32_t fw_bits; /* bits waiting on */ - volatile int fw_woken; -} fwaiter_t; - -/* * The structure of the robust_list, as set with the set_robust_list() system * call. See lx_futex_robust_exit(), below, for details. */ @@ -309,9 +290,10 @@ futex_wait(memid_t *memid, caddr_t addr, int val, timespec_t *timeout, uint32_t bits) { kthread_t *t = curthread; + lx_lwp_data_t *lwpd = ttolxlwp(t); + fwaiter_t *fwp = &lwpd->br_fwaiter; int err, ret; int32_t curval; - fwaiter_t fw; int index; /* @@ -322,13 +304,13 @@ futex_wait(memid_t *memid, caddr_t addr, */ (void) new_mstate(t, LMS_USER_LOCK); - fw.fw_woken = 0; - fw.fw_bits = bits; + fwp->fw_woken = 0; + fwp->fw_bits = bits; - MEMID_COPY(memid, &fw.fw_memid); - cv_init(&fw.fw_cv, NULL, CV_DEFAULT, NULL); + MEMID_COPY(memid, &fwp->fw_memid); + cv_init(&fwp->fw_cv, NULL, CV_DEFAULT, NULL); - index = HASH_FUNC(&fw.fw_memid); + index = HASH_FUNC(&fwp->fw_memid); mutex_enter(&futex_hash[index].fh_lock); if (fuword32(addr, (uint32_t *)&curval)) { @@ -340,11 +322,11 @@ futex_wait(memid_t *memid, caddr_t addr, goto out; } - futex_hashin(&fw); + futex_hashin(fwp); err = 0; - while ((fw.fw_woken == 0) && (err == 0)) { - ret = cv_waituntil_sig(&fw.fw_cv, &futex_hash[index].fh_lock, + while ((fwp->fw_woken == 0) && (err == 0)) { + ret = cv_waituntil_sig(&fwp->fw_cv, &futex_hash[index].fh_lock, timeout, timechanged); if (ret < 0) { err = set_errno(ETIMEDOUT); @@ -362,8 +344,8 @@ futex_wait(memid_t *memid, caddr_t addr, * The futex is normally hashed out in wakeup. If we timed out or * got a signal, we need to hash it out here instead. */ - if (fw.fw_woken == 0) - futex_hashout(&fw); + if (fwp->fw_woken == 0) + futex_hashout(fwp); out: mutex_exit(&futex_hash[index].fh_lock); diff --git a/usr/src/uts/common/brand/lx/syscall/lx_sysinfo.c b/usr/src/uts/common/brand/lx/syscall/lx_sysinfo.c index 449d5882d4..387471c0f5 100644 --- a/usr/src/uts/common/brand/lx/syscall/lx_sysinfo.c +++ b/usr/src/uts/common/brand/lx/syscall/lx_sysinfo.c @@ -21,7 +21,7 @@ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. */ #include <vm/anon.h> @@ -100,8 +100,15 @@ lx_sysinfo_common(lx_sysinfo_t *si) zphysmem = physmem; zfreemem = freemem; } else { + int64_t freemem; + zphysmem = btop(zone->zone_phys_mem_ctl); - zfreemem = btop(zone->zone_phys_mem_ctl - zone->zone_phys_mem); + freemem = zone->zone_phys_mem_ctl - zone->zone_phys_mem; + if (freemem > 0) { + zfreemem = btop(freemem); + } else { + zfreemem = 0; + } } if (zone->zone_max_swap_ctl == UINT64_MAX) { diff --git a/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c b/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c index a2064dfa1f..f3dd7f6654 100644 --- a/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c +++ b/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2015 Joyent, Inc. All rights reserved. + * Copyright 2016 Joyent, Inc. */ #include <sys/types.h> @@ -134,8 +134,8 @@ static int hyprlofs_ioctl(vnode_t *vp, int cmd, intptr_t data, int flag, cred_t *cr, int *rvalp, caller_context_t *ct) { - int len, cnt, error; - int i; + uint_t len, cnt; + int i, error; model_t model; char path[MAXPATHLEN]; char nm[MAXPATHLEN]; @@ -172,7 +172,7 @@ hyprlofs_ioctl(vnode_t *vp, int cmd, intptr_t data, int flag, for (i = 0; i < cnt; i++) { if (e[i].hle_nlen == 0 || - e[i].hle_nlen > MAXPATHLEN) + e[i].hle_nlen >= sizeof (nm)) return (EINVAL); if (copyin(e[i].hle_name, nm, e[i].hle_nlen) @@ -184,7 +184,7 @@ hyprlofs_ioctl(vnode_t *vp, int cmd, intptr_t data, int flag, if (cmd == HYPRLOFS_ADD_ENTRIES) { if (e[i].hle_plen == 0 || - e[i].hle_plen > MAXPATHLEN) + e[i].hle_plen >= sizeof (path)) return (EINVAL); if (copyin(e[i].hle_path, path, @@ -232,7 +232,7 @@ hyprlofs_ioctl(vnode_t *vp, int cmd, intptr_t data, int flag, for (i = 0; i < cnt; i++) { if (e32[i].hle_nlen == 0 || - e32[i].hle_nlen > MAXPATHLEN) + e32[i].hle_nlen >= sizeof (nm)) return (EINVAL); if (copyin((void *)(unsigned long) @@ -245,7 +245,7 @@ hyprlofs_ioctl(vnode_t *vp, int cmd, intptr_t data, int flag, if (cmd == HYPRLOFS_ADD_ENTRIES) { if (e32[i].hle_plen == 0 || - e32[i].hle_plen > MAXPATHLEN) + e32[i].hle_plen >= sizeof (path)) return (EINVAL); if (copyin((void *)(unsigned long) @@ -781,13 +781,13 @@ done: */ static int hyprlofs_get_all_entries(vnode_t *dvp, hyprlofs_curr_entry_t *hcp, - char *prefix, int *pcnt, int n_max, + char *prefix, uint_t *pcnt, uint_t n_max, cred_t *cr, caller_context_t *ct, int flags) { int error = 0; int too_big = 0; - int cnt; - int len; + uint_t cnt; + uint_t len; hlnode_t *hp = (hlnode_t *)VTOHLN(dvp); hldirent_t *hdp; char *path; @@ -907,7 +907,8 @@ static int hyprlofs_get_all(vnode_t *dvp, intptr_t data, cred_t *cr, caller_context_t *ct, int flags) { - int limit, cnt, error; + uint_t limit, cnt; + int error; model_t model; hyprlofs_curr_entry_t *e; @@ -1094,9 +1095,9 @@ hyprlofs_readdir(vnode_t *vp, struct uio *uiop, cred_t *cr, int *eofp, struct dirent64 *dp; ulong_t offset; ulong_t total_bytes_wanted; - long outcount = 0; - long bufsize; - int reclen; + ulong_t outcount = 0; + ulong_t bufsize; + size_t reclen; caddr_t outbuf; if (VTOHLN(vp)->hln_looped == 1) @@ -1142,7 +1143,7 @@ hyprlofs_readdir(vnode_t *vp, struct uio *uiop, cred_t *cr, int *eofp, namelen = strlen(hdp->hld_name); /* no +1 needed */ offset = hdp->hld_offset; if (offset >= uiop->uio_offset) { - reclen = (int)DIRENT64_RECLEN(namelen); + reclen = DIRENT64_RECLEN(namelen); if (outcount + reclen > total_bytes_wanted) { if (!outcount) /* Buffer too small for any entries. */ diff --git a/usr/src/uts/common/fs/lxproc/lxpr_vnops.c b/usr/src/uts/common/fs/lxproc/lxpr_vnops.c index 9c996891f3..9b02fea244 100644 --- a/usr/src/uts/common/fs/lxproc/lxpr_vnops.c +++ b/usr/src/uts/common/fs/lxproc/lxpr_vnops.c @@ -1454,6 +1454,8 @@ lxpr_read_meminfo(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf) } else { total_mem = zone->zone_phys_mem_ctl; free_mem = zone->zone_phys_mem_ctl - zone->zone_phys_mem; + if (free_mem < 0) + free_mem = 0; } if (global || zone->zone_max_swap_ctl == UINT64_MAX) { diff --git a/usr/src/uts/common/fs/zfs/dbuf.c b/usr/src/uts/common/fs/zfs/dbuf.c index 08d1cca1d9..7bfcdc3233 100644 --- a/usr/src/uts/common/fs/zfs/dbuf.c +++ b/usr/src/uts/common/fs/zfs/dbuf.c @@ -3324,13 +3324,13 @@ dbuf_write_children_ready(zio_t *zio, arc_buf_t *buf, void *vdb) dmu_buf_impl_t *db = vdb; dnode_t *dn; blkptr_t *bp; - uint64_t i; - int epbs; + unsigned int epbs, i; ASSERT3U(db->db_level, >, 0); DB_DNODE_ENTER(db); dn = DB_DNODE(db); epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; + ASSERT3U(epbs, <, 31); /* Determine if all our children are holes */ for (i = 0, bp = db->db.db_data; i < 1 << epbs; i++, bp++) { @@ -3343,8 +3343,14 @@ dbuf_write_children_ready(zio_t *zio, arc_buf_t *buf, void *vdb) * we may get compressed away. */ if (i == 1 << epbs) { - /* didn't find any non-holes */ + /* + * We only found holes. Grab the rwlock to prevent + * anybody from reading the blocks we're about to + * zero out. + */ + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); bzero(db->db.db_data, db->db.db_size); + rw_exit(&dn->dn_struct_rwlock); } DB_DNODE_EXIT(db); } diff --git a/usr/src/uts/common/fs/zfs/dmu_objset.c b/usr/src/uts/common/fs/zfs/dmu_objset.c index 3ed68f7133..b71a43f7b5 100644 --- a/usr/src/uts/common/fs/zfs/dmu_objset.c +++ b/usr/src/uts/common/fs/zfs/dmu_objset.c @@ -1705,6 +1705,7 @@ typedef struct dmu_objset_find_ctx { taskq_t *dc_tq; dsl_pool_t *dc_dp; uint64_t dc_ddobj; + char *dc_ddname; /* last component of ddobj's name */ int (*dc_func)(dsl_pool_t *, dsl_dataset_t *, void *); void *dc_arg; int dc_flags; @@ -1716,7 +1717,6 @@ static void dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp) { dsl_pool_t *dp = dcp->dc_dp; - dmu_objset_find_ctx_t *child_dcp; dsl_dir_t *dd; dsl_dataset_t *ds; zap_cursor_t zc; @@ -1728,7 +1728,12 @@ dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp) if (*dcp->dc_error != 0) goto out; - err = dsl_dir_hold_obj(dp, dcp->dc_ddobj, NULL, FTAG, &dd); + /* + * Note: passing the name (dc_ddname) here is optional, but it + * improves performance because we don't need to call + * zap_value_search() to determine the name. + */ + err = dsl_dir_hold_obj(dp, dcp->dc_ddobj, dcp->dc_ddname, FTAG, &dd); if (err != 0) goto out; @@ -1753,9 +1758,11 @@ dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp) sizeof (uint64_t)); ASSERT3U(attr->za_num_integers, ==, 1); - child_dcp = kmem_alloc(sizeof (*child_dcp), KM_SLEEP); + dmu_objset_find_ctx_t *child_dcp = + kmem_alloc(sizeof (*child_dcp), KM_SLEEP); *child_dcp = *dcp; child_dcp->dc_ddobj = attr->za_first_integer; + child_dcp->dc_ddname = spa_strdup(attr->za_name); if (dcp->dc_tq != NULL) (void) taskq_dispatch(dcp->dc_tq, dmu_objset_find_dp_cb, child_dcp, TQ_SLEEP); @@ -1798,16 +1805,25 @@ dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp) } } - dsl_dir_rele(dd, FTAG); kmem_free(attr, sizeof (zap_attribute_t)); - if (err != 0) + if (err != 0) { + dsl_dir_rele(dd, FTAG); goto out; + } /* * Apply to self. */ err = dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds); + + /* + * Note: we hold the dir while calling dsl_dataset_hold_obj() so + * that the dir will remain cached, and we won't have to re-instantiate + * it (which could be expensive due to finding its name via + * zap_value_search()). + */ + dsl_dir_rele(dd, FTAG); if (err != 0) goto out; err = dcp->dc_func(dp, ds, dcp->dc_arg); @@ -1822,6 +1838,8 @@ out: mutex_exit(dcp->dc_error_lock); } + if (dcp->dc_ddname != NULL) + spa_strfree(dcp->dc_ddname); kmem_free(dcp, sizeof (*dcp)); } @@ -1866,6 +1884,7 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint64_t ddobj, dcp->dc_tq = NULL; dcp->dc_dp = dp; dcp->dc_ddobj = ddobj; + dcp->dc_ddname = NULL; dcp->dc_func = func; dcp->dc_arg = arg; dcp->dc_flags = flags; diff --git a/usr/src/uts/common/fs/zfs/dnode_sync.c b/usr/src/uts/common/fs/zfs/dnode_sync.c index 760915d8f3..a17414c0d4 100644 --- a/usr/src/uts/common/fs/zfs/dnode_sync.c +++ b/usr/src/uts/common/fs/zfs/dnode_sync.c @@ -236,8 +236,8 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, dnode_t *dn; blkptr_t *bp; dmu_buf_impl_t *subdb; - uint64_t start, end, dbstart, dbend, i; - int epbs, shift; + uint64_t start, end, dbstart, dbend; + unsigned int epbs, shift, i; /* * There is a small possibility that this block will not be cached: @@ -254,6 +254,7 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, DB_DNODE_ENTER(db); dn = DB_DNODE(db); epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; + ASSERT3U(epbs, <, 31); shift = (db->db_level - 1) * epbs; dbstart = db->db_blkid << epbs; start = blkid >> shift; @@ -273,12 +274,12 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, FREE_VERIFY(db, start, end, tx); free_blocks(dn, bp, end-start+1, tx); } else { - for (i = start; i <= end; i++, bp++) { + for (uint64_t id = start; id <= end; id++, bp++) { if (BP_IS_HOLE(bp)) continue; rw_enter(&dn->dn_struct_rwlock, RW_READER); VERIFY0(dbuf_hold_impl(dn, db->db_level - 1, - i, TRUE, FALSE, FTAG, &subdb)); + id, TRUE, FALSE, FTAG, &subdb)); rw_exit(&dn->dn_struct_rwlock); ASSERT3P(bp, ==, subdb->db_blkptr); @@ -293,8 +294,14 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, break; } if (i == 1 << epbs) { - /* didn't find any non-holes */ + /* + * We only found holes. Grab the rwlock to prevent + * anybody from reading the blocks we're about to + * zero out. + */ + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); bzero(db->db.db_data, db->db.db_size); + rw_exit(&dn->dn_struct_rwlock); free_blocks(dn, db->db_blkptr, 1, tx); } else { /* diff --git a/usr/src/uts/common/fs/zfs/sys/dmu.h b/usr/src/uts/common/fs/zfs/sys/dmu.h index 3304027ccc..1e68c8e217 100644 --- a/usr/src/uts/common/fs/zfs/sys/dmu.h +++ b/usr/src/uts/common/fs/zfs/sys/dmu.h @@ -565,12 +565,7 @@ typedef struct dmu_buf_user { * NOTE: This function should only be called once on a given dmu_buf_user_t. * To allow enforcement of this, dbu must already be zeroed on entry. */ -#ifdef __lint -/* Very ugly, but it beats issuing suppression directives in many Makefiles. */ -extern void -dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func, - dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp); -#else /* __lint */ +/*ARGSUSED*/ inline void dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func_sync, dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp) @@ -586,7 +581,6 @@ dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func_sync, dbu->dbu_clear_on_evict_dbufp = clear_on_evict_dbufp; #endif } -#endif /* __lint */ /* * Attach user data to a dbuf and mark it for normal (when the dbuf's diff --git a/usr/src/uts/common/fs/zfs/sys/spa.h b/usr/src/uts/common/fs/zfs/sys/spa.h index da63812831..f7ec240ef3 100644 --- a/usr/src/uts/common/fs/zfs/sys/spa.h +++ b/usr/src/uts/common/fs/zfs/sys/spa.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. @@ -36,6 +36,7 @@ #include <sys/sysmacros.h> #include <sys/types.h> #include <sys/fs/zfs.h> +#include <sys/dmu.h> #ifdef __cplusplus extern "C" { @@ -595,8 +596,6 @@ _NOTE(CONSTCOND) } while (0) ASSERT(len < size); \ } -#include <sys/dmu.h> - #define BP_GET_BUFC_TYPE(bp) \ (((BP_GET_LEVEL(bp) > 0) || (DMU_OT_IS_METADATA(BP_GET_TYPE(bp)))) ? \ ARC_BUFC_METADATA : ARC_BUFC_DATA) diff --git a/usr/src/uts/common/io/drm/drm_bufs.c b/usr/src/uts/common/io/drm/drm_bufs.c index ec01d37dab..f51d85978f 100644 --- a/usr/src/uts/common/io/drm/drm_bufs.c +++ b/usr/src/uts/common/io/drm/drm_bufs.c @@ -39,7 +39,7 @@ */ #include "drmP.h" -#include <gfx_private.h> +#include <sys/gfx_private.h> #include "drm_io32.h" diff --git a/usr/src/uts/common/io/drm/drm_gem.c b/usr/src/uts/common/io/drm/drm_gem.c index 69c5fc1c46..7fa5c29779 100644 --- a/usr/src/uts/common/io/drm/drm_gem.c +++ b/usr/src/uts/common/io/drm/drm_gem.c @@ -41,7 +41,7 @@ #include <sys/bitmap.h> #include <sys/ddi.h> #include <sys/sunddi.h> -#include <gfx_private.h> +#include <sys/gfx_private.h> #include "drmP.h" #include "drm.h" diff --git a/usr/src/uts/common/io/drm/drm_scatter.c b/usr/src/uts/common/io/drm/drm_scatter.c index b1d1076af2..4d1b54e862 100644 --- a/usr/src/uts/common/io/drm/drm_scatter.c +++ b/usr/src/uts/common/io/drm/drm_scatter.c @@ -37,10 +37,8 @@ */ /* END CSTYLED */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "drmP.h" -#include <gfx_private.h> +#include <sys/gfx_private.h> #include "drm_io32.h" #define DEBUG_SCATTER 0 diff --git a/usr/src/uts/common/io/drm/drm_sunmod.h b/usr/src/uts/common/io/drm/drm_sunmod.h index 32cd5c0927..30d126fc4b 100644 --- a/usr/src/uts/common/io/drm/drm_sunmod.h +++ b/usr/src/uts/common/io/drm/drm_sunmod.h @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Common misc module interfaces of DRM under Solaris */ @@ -72,7 +70,7 @@ extern "C" { #include <sys/ddi_impldefs.h> #include <sys/sunldi.h> #include <sys/mkdev.h> -#include <gfx_private.h> +#include <sys/gfx_private.h> #include <sys/agpgart.h> #include <sys/agp/agpdefs.h> #include <sys/agp/agpmaster_io.h> diff --git a/usr/src/uts/common/io/iwn/if_iwn.c b/usr/src/uts/common/io/iwn/if_iwn.c index fc60627899..716794b20d 100644 --- a/usr/src/uts/common/io/iwn/if_iwn.c +++ b/usr/src/uts/common/io/iwn/if_iwn.c @@ -4299,8 +4299,10 @@ iwn_abort_scan(void *arg) ieee80211com_t *ic = &sc->sc_ic; mutex_enter(&sc->sc_mtx); - if ((sc->sc_flags & IWN_FLAG_SCANNING) == 0) + if ((sc->sc_flags & IWN_FLAG_SCANNING) == 0) { + mutex_exit(&sc->sc_mtx); return; + } dev_err(sc->sc_dip, CE_WARN, "!aborting scan, flags = %x, state = %s", diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c index 0e97d9125b..90a5d95f59 100644 --- a/usr/src/uts/common/io/scsi/targets/sd.c +++ b/usr/src/uts/common/io/scsi/targets/sd.c @@ -6693,7 +6693,7 @@ sdpower(dev_info_t *devi, int component, int level) time_t intvlp; struct pm_trans_data sd_pm_tran_data; uchar_t save_state; - int sval; + int sval, tursval; uchar_t state_before_pm; int got_semaphore_here; sd_ssc_t *ssc; @@ -7010,9 +7010,9 @@ sdpower(dev_info_t *devi, int component, int level) * a deadlock on un_pm_busy_cv will occur. */ if (SD_PM_IS_IO_CAPABLE(un, level)) { - sval = sd_send_scsi_TEST_UNIT_READY(ssc, + tursval = sd_send_scsi_TEST_UNIT_READY(ssc, SD_DONT_RETRY_TUR | SD_BYPASS_PM); - if (sval != 0) + if (tursval != 0) sd_ssc_assessment(ssc, SD_FMT_IGNORE); } @@ -7036,6 +7036,21 @@ sdpower(dev_info_t *devi, int component, int level) sd_ssc_assessment(ssc, SD_FMT_STATUS_CHECK); else sd_ssc_assessment(ssc, SD_FMT_IGNORE); + + } + + /* + * We've encountered certain classes of drives that pass a TUR, but fail + * the START STOP UNIT when using power conditions. Strictly speaking, + * for SPC-4 or greater, no additional actions are required to make the + * drive operational when a TUR passes. If we have something that + * matches this condition, we continue on and presume the drive is + * successfully powered on. + */ + if (un->un_f_power_condition_supported && sval == ENOTSUP && + SD_SCSI_VERS_IS_GE_SPC_4(un) && SD_PM_IS_IO_CAPABLE(un, level) && + level == SD_SPINDLE_ACTIVE && tursval == 0) { + sval = 0; } /* Command failed, check for media present. */ @@ -31031,7 +31046,7 @@ sd_set_unit_attributes(struct sd_lun *un, dev_info_t *devi) if (SD_PM_CAPABLE_IS_UNDEFINED(pm_cap)) { un->un_f_log_sense_supported = TRUE; if (!un->un_f_power_condition_disabled && - SD_INQUIRY(un)->inq_ansi == 6) { + SD_SCSI_VERS_IS_GE_SPC_4(un)) { un->un_f_power_condition_supported = TRUE; } } else { @@ -31049,7 +31064,7 @@ sd_set_unit_attributes(struct sd_lun *un, dev_info_t *devi) /* SD_PM_CAPABLE_IS_TRUE case */ un->un_f_pm_supported = TRUE; if (!un->un_f_power_condition_disabled && - SD_PM_CAPABLE_IS_SPC_4(pm_cap)) { + (SD_PM_CAPABLE_IS_GE_SPC_4(pm_cap))) { un->un_f_power_condition_supported = TRUE; } diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile index 91b1cf722e..c7cafb68f2 100644 --- a/usr/src/uts/common/sys/Makefile +++ b/usr/src/uts/common/sys/Makefile @@ -53,6 +53,7 @@ i386_HDRS= \ fdc.h \ fdmedia.h \ firmload.h \ + gfx_private.h \ mouse.h \ ucode.h diff --git a/usr/src/uts/i86pc/io/gfx_private/gfx_private.h b/usr/src/uts/common/sys/gfx_private.h index 5c85d89320..ddd91e5758 100644 --- a/usr/src/uts/i86pc/io/gfx_private/gfx_private.h +++ b/usr/src/uts/common/sys/gfx_private.h @@ -23,11 +23,16 @@ * Use is subject to license terms. */ +/* + * This file defines interfaces consumed by the AGP kernel modules, + * and indirectly by the DRM system. Please consider everything in + * this file to be a "contract private interface", and keep in sync + * with the consumers in the "DRM" gate. + */ + #ifndef _GFX_PRIVATE_H #define _GFX_PRIVATE_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -96,6 +101,63 @@ extern int gfxp_munlock_user_memory(caddr_t address, size_t length); extern int gfxp_vgatext_devmap(dev_t dev, devmap_cookie_t dhp, offset_t off, size_t len, size_t *maplen, uint_t model, void *ptr); + +/* + * Updated "glue" for newer libdrm code. + * See: kernel/drm/src/drm_fb_helper.c + */ + +/* Same as: gfxp_vgatext_softc_ptr_t; */ +typedef char *gfxp_fb_softc_ptr_t; + +/* + * Used by drm_register_fbops(). + * Note: only setmode is supplied. + */ +struct gfxp_blt_ops { + int (*blt)(void *); + int (*copy) (void *); + int (*clear) (void *); + int (*setmode) (int); +}; + +extern void gfxp_bm_register_fbops(gfxp_fb_softc_ptr_t, + struct gfxp_blt_ops *); + +/* See: kernel/drm/src/drm_fb_helper.c */ + +struct gfxp_bm_fb_info { + uint16_t xres; + uint16_t yres; + uint8_t bpp; + uint8_t depth; +}; + +void gfxp_bm_getfb_info(gfxp_fb_softc_ptr_t, struct gfxp_bm_fb_info *); + +/* See: kernel/drm/src/drm_bufs.c etc */ + +caddr_t gfxp_alloc_kernel_space(size_t size); /* vmem_alloc heap_arena */ +void gfxp_free_kernel_space(caddr_t address, size_t size); + +void gfxp_load_kernel_space(uint64_t start, size_t size, + uint32_t mode, caddr_t cvaddr); +void gfxp_unload_kernel_space(caddr_t address, size_t size); + +/* + * Note that "mempool" is optional and normally disabled in drm_gem.c + * (see HAS_MEM_POOL). Let's just stub these out so we can reduce + * changes from the upstream in the DRM driver code. + */ +struct gfxp_pmem_cookie { + ulong_t a, b, c; +}; +void gfxp_mempool_init(void); +void gfxp_mempool_destroy(void); +int gfxp_alloc_from_mempool(struct gfxp_pmem_cookie *, caddr_t *, + pfn_t *, pgcnt_t, int); +void gfxp_free_mempool(struct gfxp_pmem_cookie *, caddr_t, size_t); + #ifdef __cplusplus } #endif diff --git a/usr/src/uts/common/sys/scsi/generic/inquiry.h b/usr/src/uts/common/sys/scsi/generic/inquiry.h index ddfd683169..fcbf00d5dc 100644 --- a/usr/src/uts/common/sys/scsi/generic/inquiry.h +++ b/usr/src/uts/common/sys/scsi/generic/inquiry.h @@ -362,7 +362,8 @@ struct scsi_inquiry { #define DTYPE_NOTPRESENT (DPQ_NEVER | DTYPE_UNKNOWN) /* - * Defined Response Data Formats: + * Defined Versions for inquiry data. These represent the base version that a + * device supports. */ #define RDF_LEVEL0 0x00 /* no conformance claim (SCSI-1) */ #define RDF_CCS 0x01 /* Obsolete (pseudo-spec) */ @@ -370,7 +371,8 @@ struct scsi_inquiry { #define RDF_SCSI_SPC 0x03 /* ANSI INCITS 301-1997 (SPC) */ #define RDF_SCSI_SPC2 0x04 /* ANSI INCITS 351-2001 (SPC-2) */ #define RDF_SCSI_SPC3 0x05 /* ANSI INCITS 408-2005 (SPC-3) */ -#define RDF_SCSI_SPC4 0x06 /* t10 (SPC-4) */ +#define RDF_SCSI_SPC4 0x06 /* ANSI INCITS 513-2015 (SPC-4) */ +#define RDF_SCSI_SPC5 0x07 /* t10 (SPC-5) */ /* * Defined Target Port Group Select values: @@ -436,6 +438,7 @@ struct vpd_desc { #define PM_CAPABLE_SPC2 RDF_SCSI_SPC2 #define PM_CAPABLE_SPC3 RDF_SCSI_SPC3 #define PM_CAPABLE_SPC4 RDF_SCSI_SPC4 +#define PM_CAPABLE_SPC5 RDF_SCSI_SPC5 #define PM_CAPABLE_LOG_MASK 0xffff0000 /* use upper 16 bit to */ /* indicate log specifics */ #define PM_CAPABLE_LOG_SUPPORTED 0x10000 /* Log page 0xE might be */ diff --git a/usr/src/uts/common/sys/scsi/targets/sddef.h b/usr/src/uts/common/sys/scsi/targets/sddef.h index 39c0ed9d0f..d3040d0df8 100644 --- a/usr/src/uts/common/sys/scsi/targets/sddef.h +++ b/usr/src/uts/common/sys/scsi/targets/sddef.h @@ -735,6 +735,12 @@ _NOTE(MUTEX_PROTECTS_DATA(sd_lun::un_fi_mutex, #define SD_FM_LOG(un) (((struct sd_fm_internal *)\ ((un)->un_fm_private))->fm_log_level) +/* + * Version Related Macros + */ +#define SD_SCSI_VERS_IS_GE_SPC_4(un) \ + (SD_INQUIRY(un)->inq_ansi == RDF_SCSI_SPC4 || \ + SD_INQUIRY(un)->inq_ansi == RDF_SCSI_SPC5) /* * Values for un_ctype @@ -1828,6 +1834,10 @@ struct sd_fm_internal { #define SD_PM_CAPABLE_IS_SPC_4(pm_cap) \ ((pm_cap & PM_CAPABLE_PM_MASK) == PM_CAPABLE_SPC4) +#define SD_PM_CAPABLE_IS_GE_SPC_4(pm_cap) \ + (((pm_cap & PM_CAPABLE_PM_MASK) == PM_CAPABLE_SPC4) || \ + ((pm_cap & PM_CAPABLE_PM_MASK) == PM_CAPABLE_SPC5)) + #define SD_PM_CAP_LOG_SUPPORTED(pm_cap) \ ((pm_cap & PM_CAPABLE_LOG_SUPPORTED) ? TRUE : FALSE) diff --git a/usr/src/uts/common/sys/smbios.h b/usr/src/uts/common/sys/smbios.h index 6f0f795af5..86780e68dd 100644 --- a/usr/src/uts/common/sys/smbios.h +++ b/usr/src/uts/common/sys/smbios.h @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -125,6 +125,7 @@ typedef struct smbios_entry { #define SMB_TYPE_ADDINFO 40 /* additional information */ #define SMB_TYPE_OBDEVEXT 41 /* on-board device extended info */ #define SMB_TYPE_MCHI 42 /* mgmt controller host interface */ +#define SMB_TYPE_TPM 43 /* TPM device */ #define SMB_TYPE_INACTIVE 126 /* inactive table entry */ #define SMB_TYPE_EOT 127 /* end of table */ @@ -174,7 +175,9 @@ typedef struct smbios_version { /* * SMBIOS Bios Information. See DSP0134 Section 7.1 for more information. - * smbb_romsize is converted from the implementation format into bytes. + * smbb_romsize is converted from the implementation format into bytes. Note, if + * we do not have an extended BIOS ROM size, it is filled in with the default + * BIOS ROM size. */ typedef struct smbios_bios { const char *smbb_vendor; /* bios vendor string */ @@ -188,6 +191,7 @@ typedef struct smbios_bios { size_t smbb_nxcflags; /* number of smbb_xcflags[] bytes */ smbios_version_t smbb_biosv; /* bios version */ smbios_version_t smbb_ecfwv; /* bios embedded ctrl f/w version */ + uint64_t smbb_extromsize; /* Extended bios ROM Size */ } smbios_bios_t; #define SMB_BIOSFL_RSV0 0x00000001 /* reserved bit zero */ @@ -223,6 +227,11 @@ typedef struct smbios_bios { #define SMB_BIOSFL_I10_CGA 0x40000000 /* int 0x10 CGA svcs */ #define SMB_BIOSFL_NEC_PC98 0x80000000 /* NEC PC-98 */ +/* + * These values are used to allow consumers to have raw access to the extended + * characteristic flags. We explicitly don't include the extended BIOS + * information from section 3.1 as part of this as it has its own member. + */ #define SMB_BIOSXB_1 0 /* bios extension byte 1 (7.1.2.1) */ #define SMB_BIOSXB_2 1 /* bios extension byte 2 (7.1.2.2) */ #define SMB_BIOSXB_BIOS_MAJ 2 /* bios major version */ @@ -349,6 +358,10 @@ typedef struct smbios_chassis { #define SMB_CHT_TABLET 0x1E /* tablet */ #define SMB_CHT_CONVERTIBLE 0x1F /* convertible */ #define SMB_CHT_DETACHABLE 0x20 /* detachable */ +#define SMB_CHT_IOTGW 0x21 /* IoT Gateway */ +#define SMB_CHT_EMBEDPC 0x22 /* Embedded PC */ +#define SMB_CHT_MINIPC 0x23 /* Mini PC */ +#define SMB_CHT_STICKPC 0x24 /* Stick PC */ #define SMB_CHST_OTHER 0x01 /* other */ #define SMB_CHST_UNKNOWN 0x02 /* unknown */ @@ -474,6 +487,13 @@ typedef struct smbios_processor { #define SMB_PRU_BGA1168 0x2E /* BGA1168 */ #define SMB_PRU_BGA1234 0x2F /* BGA1234 */ #define SMB_PRU_BGA1364 0x30 /* BGA1364 */ +#define SMB_PRU_AM4 0x31 /* socket AM4 */ +#define SMB_PRU_LGA1151 0x32 /* LGA1151 */ +#define SMB_PRU_BGA1356 0x33 /* BGA1356 */ +#define SMB_PRU_BGA1440 0x34 /* BGA1440 */ +#define SMB_PRU_BGA1515 0x35 /* BGA1515 */ +#define SMB_PRU_LGA36471 0x36 /* LGA3647-1 */ +#define SMB_PRU_SP3 0x37 /* socket SP3 */ #define SMB_PRC_RESERVED 0x0001 /* reserved */ #define SMB_PRC_UNKNOWN 0x0002 /* unknown */ @@ -526,6 +546,9 @@ typedef struct smbios_processor { #define SMB_PRF_CORE_SOLO_M 0x2A /* Core Solo mobile */ #define SMB_PRF_ATOM 0x2B /* Intel Atom */ #define SMB_PRF_CORE_M 0x2C /* Intel Core M */ +#define SMB_PRF_CORE_M3 0x2D /* Intel Core m3 */ +#define SMB_PRF_CORE_M5 0x2E /* Intel Core m5 */ +#define SMB_PRF_CORE_M7 0x2F /* Intel Core m7 */ #define SMB_PRF_ALPHA 0x30 /* Alpha */ #define SMB_PRF_ALPHA_21064 0x31 /* Alpha 21064 */ #define SMB_PRF_ALPHA_21066 0x32 /* Alpha 21066 */ @@ -577,6 +600,8 @@ typedef struct smbios_processor { #define SMB_PRF_ATHLON_X4 0x66 /* AMD Athlon X4 Quad-Core */ #define SMB_PRF_OPTERON_X1K 0x67 /* AMD Opteron X1000 */ #define SMB_PRF_OPTERON_X2K 0x68 /* AMD Opteron X2000 APU */ +#define SMB_PRF_OPTERON_A 0x69 /* AMD Opteron A Series */ +#define SMB_PRF_OPERTON_X3K 0x6A /* AMD Opteron X3000 APU */ #define SMB_PRF_HOBBIT 0x70 /* Hobbit */ #define SMB_PRF_TM5000 0x78 /* Crusoe TM5000 */ #define SMB_PRF_TM3000 0x79 /* Crusoe TM3000 */ @@ -677,6 +702,8 @@ typedef struct smbios_processor { #define SMB_PRF_SEMPRON_M 0xEF /* AMD Sempron M */ #define SMB_PRF_I860 0xFA /* i860 */ #define SMB_PRF_I960 0xFB /* i960 */ +#define SMB_PRF_ARMv7 0x100 /* ARMv7 */ +#define SMB_PRF_ARMv8 0x101 /* ARMv8 */ #define SMB_PRF_SH3 0x104 /* SH-3 */ #define SMB_PRF_SH4 0x105 /* SH-4 */ #define SMB_PRF_ARM 0x118 /* ARM */ @@ -691,6 +718,12 @@ typedef struct smbios_processor { /* * SMBIOS Cache Information. See DSP0134 Section 7.8 for more information. * If smba_size is zero, this indicates the specified cache is not present. + * + * SMBIOS 3.1 added extended cache sizes. Unfortunately, we had already baked in + * the uint32_t sizes, so we added extended uint64_t's that correspond to the + * new fields. To make life easier for consumers, we always make sure that the + * _maxsize2 and _size2 members are filled in with the old value if no other + * value is present. */ typedef struct smbios_cache { uint32_t smba_maxsize; /* maximum installed size in bytes */ @@ -705,6 +738,8 @@ typedef struct smbios_cache { uint8_t smba_mode; /* cache mode (SMB_CAM_*) */ uint8_t smba_location; /* cache location (SMB_CAL_*) */ uint8_t smba_flags; /* cache flags (SMB_CAF_*) */ + uint64_t smba_maxsize2; /* maximum installed size in bytes */ + uint64_t smba_size2; /* installed size in bytes */ } smbios_cache_t; #define SMB_CAT_OTHER 0x0001 /* other */ @@ -899,6 +934,14 @@ typedef struct smbios_slot { #define SMB_SLT_MXM3_B 0x1E /* MXM 3.0 Type B */ #define SMB_SLT_PCIEG2_SFF 0x1F /* PCI Express Gen 2 SFF-8639 */ #define SMB_SLT_PCIEG3_SFF 0x20 /* PCI Express Gen 3 SFF-8639 */ +/* + * These lines must be on one line for the string generating code. + */ +/* BEGIN CSTYLED */ +#define SMB_SLT_PCIE_M52_WBSKO 0x21 /* PCI Express Mini 52-pin with bottom-side keep-outs */ +#define SMB_SLT_PCIE_M52_WOBSKO 0x22 /* PCI Express Mini 52-pin without bottom-side keep-outs */ +/* END CSTYLED */ +#define SMB_SLT_PCIE_M76 0x23 /* PCI Express Mini 72-pin */ #define SMB_SLT_PC98_C20 0xA0 /* PC-98/C20 */ #define SMB_SLT_PC98_C24 0xA1 /* PC-98/C24 */ #define SMB_SLT_PC98_E 0xA2 /* PC-98/E */ @@ -1105,7 +1148,7 @@ typedef struct smbios_memdevice { uint8_t smbmd_type; /* memory type */ uint8_t smbmd_pad; /* padding */ uint32_t smbmd_flags; /* flags (see below) */ - uint32_t smbmd_speed; /* speed in MHz */ + uint32_t smbmd_speed; /* speed in MT/s */ const char *smbmd_dloc; /* physical device locator string */ const char *smbmd_bloc; /* physical bank locator string */ uint8_t smbmd_rank; /* rank */ @@ -1355,7 +1398,8 @@ typedef struct smbios_memdevice_ext { #define SMB_VERSION_27 0x0207 /* SMBIOS encoding for DMTF spec 2.7 */ #define SMB_VERSION_28 0x0208 /* SMBIOS encoding for DMTF spec 2.8 */ #define SMB_VERSION_30 0x0300 /* SMBIOS encoding for DMTF spec 3.0 */ -#define SMB_VERSION SMB_VERSION_30 /* SMBIOS latest version definitions */ +#define SMB_VERSION_31 0x0301 /* SMBIOS encoding for DMTF spec 3.1 */ +#define SMB_VERSION SMB_VERSION_31 /* SMBIOS latest version definitions */ #define SMB_O_NOCKSUM 0x1 /* do not verify header checksums */ #define SMB_O_NOVERS 0x2 /* do not verify header versions */ diff --git a/usr/src/uts/common/sys/smbios_impl.h b/usr/src/uts/common/sys/smbios_impl.h index 94c107bb63..24ba461620 100644 --- a/usr/src/uts/common/sys/smbios_impl.h +++ b/usr/src/uts/common/sys/smbios_impl.h @@ -21,7 +21,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright 2015 Joyent, Inc. + * Copyright 2016 Joyent, Inc. * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -51,6 +51,14 @@ extern "C" { #endif +/* + * Definitions required to interpret the BIOS type information. + */ +#define SMB_BIOSXB_EXTROM 6 + +#define SMB_BIOS_EXTROM_VALUE_MASK(x) ((x) & 0x3fff) +#define SMB_BIOS_EXTROM_SHIFT_MASK(x) (((x) & 0xc000) >> 14) + #pragma pack(1) typedef struct smb_header { @@ -163,6 +171,8 @@ typedef struct smb_cache { uint8_t smbca_etype; /* error correction type */ uint8_t smbca_ltype; /* logical cache type */ uint8_t smbca_assoc; /* associativity */ + uint32_t smbca_maxsize2; /* maximum installed size 2 */ + uint32_t smbca_size2; /* installed size 2 */ } smb_cache_t; /* @@ -173,6 +183,10 @@ typedef struct smb_cache { #define SMB_CACHE_SIZE(s) (((s) & 0x8000) ? \ ((uint32_t)((s) & 0x7FFF) * 64 * 1024) : ((uint32_t)(s) * 1024)) +#define SMB_CACHE_EXT_SIZE(s) (((s) & 0x80000000U) ? \ + ((uint64_t)((s) & 0x7FFFFFFFULL) * 64ULL * 1024ULL) : \ + ((uint64_t)(s) * 1024ULL)) + #define SMB_CACHE_CFG_MODE(c) (((c) >> 8) & 3) #define SMB_CACHE_CFG_ENABLED(c) (((c) >> 7) & 1) #define SMB_CACHE_CFG_LOCATION(c) (((c) >> 5) & 3) @@ -272,7 +286,7 @@ typedef struct smb_memdevice { uint8_t smbmdev_bloc; /* bank locator */ uint8_t smbmdev_type; /* memory type */ uint16_t smbmdev_flags; /* detail flags */ - uint16_t smbmdev_speed; /* speed in MHz */ + uint16_t smbmdev_speed; /* speed in MT/s */ uint8_t smbmdev_manufacturer; /* manufacturer */ uint8_t smbmdev_serial; /* serial number */ uint8_t smbmdev_asset; /* asset tag */ @@ -498,6 +512,7 @@ extern const smb_struct_t *smb_lookup_type(smbios_hdl_t *, uint_t); extern const smb_struct_t *smb_lookup_id(smbios_hdl_t *, uint_t); extern const char *smb_strptr(const smb_struct_t *, uint_t); extern int smb_gteq(smbios_hdl_t *, int); +extern int smb_libgteq(smbios_hdl_t *, int); extern int smb_set_errno(smbios_hdl_t *, int); extern smbios_hdl_t *smb_open_error(smbios_hdl_t *, int *, int); @@ -566,6 +581,34 @@ typedef struct smb_base_memdevice { uint8_t smbbmd_rank; /* rank */ } smb_base_memdevice_t; +typedef struct smb_base_bios { + const char *smbbb_vendor; /* bios vendor string */ + const char *smbbb_version; /* bios version string */ + const char *smbbb_reldate; /* bios release date */ + uint32_t smbbb_segment; /* bios address segment location */ + uint32_t smbbb_romsize; /* bios rom size in bytes */ + uint32_t smbbb_runsize; /* bios image size in bytes */ + uint64_t smbbb_cflags; /* bios characteristics */ + const uint8_t *smbbb_xcflags; /* bios characteristics extensions */ + size_t smbbb_nxcflags; /* number of smbb_xcflags[] bytes */ + smbios_version_t smbbb_biosv; /* bios version */ + smbios_version_t smbbb_ecfwv; /* bios embedded ctrl f/w version */ +} smb_base_bios_t; + +typedef struct smb_base_cache { + uint32_t smbba_maxsize; /* maximum installed size in bytes */ + uint32_t smbba_size; /* installed size in bytes */ + uint16_t smbba_stype; /* supported SRAM types (SMB_CAT_*) */ + uint16_t smbba_ctype; /* current SRAM type (SMB_CAT_*) */ + uint8_t smbba_speed; /* speed in nanoseconds */ + uint8_t smbba_etype; /* error correction type (SMB_CAE_*) */ + uint8_t smbba_ltype; /* logical cache type (SMB_CAG_*) */ + uint8_t smbba_assoc; /* associativity (SMB_CAA_*) */ + uint8_t smbba_level; /* cache level */ + uint8_t smbba_mode; /* cache mode (SMB_CAM_*) */ + uint8_t smbba_location; /* cache location (SMB_CAL_*) */ + uint8_t smbba_flags; /* cache flags (SMB_CAF_*) */ +} smb_base_cache_t; #ifdef __cplusplus } diff --git a/usr/src/uts/i86pc/io/gfx_private/gfx_private.c b/usr/src/uts/i86pc/io/gfx_private/gfx_private.c index 72eb423ec0..9a7c0e41af 100644 --- a/usr/src/uts/i86pc/io/gfx_private/gfx_private.c +++ b/usr/src/uts/i86pc/io/gfx_private/gfx_private.c @@ -38,7 +38,7 @@ #include <sys/modctl.h> #include <sys/errno.h> #include <sys/reboot.h> -#include "gfx_private.h" +#include <sys/gfx_private.h> static struct modlmisc modlmisc = { &mod_miscops, "gfx private interfaces" diff --git a/usr/src/uts/i86pc/io/gfx_private/gfxp_devmap.c b/usr/src/uts/i86pc/io/gfx_private/gfxp_devmap.c index 495b17377f..2a91253fb1 100644 --- a/usr/src/uts/i86pc/io/gfx_private/gfxp_devmap.c +++ b/usr/src/uts/i86pc/io/gfx_private/gfxp_devmap.c @@ -47,7 +47,7 @@ #include <sys/pci.h> #include <sys/vmsystm.h> #include <sys/int_fmtio.h> -#include "gfx_private.h" +#include <sys/gfx_private.h> #ifdef __xpv #include <sys/hypervisor.h> diff --git a/usr/src/uts/i86pc/io/gfx_private/gfxp_pci.c b/usr/src/uts/i86pc/io/gfx_private/gfxp_pci.c index 51ba47834d..9694e25ead 100644 --- a/usr/src/uts/i86pc/io/gfx_private/gfxp_pci.c +++ b/usr/src/uts/i86pc/io/gfx_private/gfxp_pci.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/debug.h> #include <sys/types.h> #include <sys/param.h> @@ -68,7 +66,7 @@ #include <sys/kstat.h> #include <sys/callb.h> #include <sys/pci_cfgspace.h> -#include "gfx_private.h" +#include <sys/gfx_private.h> typedef struct gfxp_pci_bsf { uint16_t vendor; diff --git a/usr/src/uts/i86pc/io/gfx_private/gfxp_segmap.c b/usr/src/uts/i86pc/io/gfx_private/gfxp_segmap.c index 093a15513b..1c4c849b51 100644 --- a/usr/src/uts/i86pc/io/gfx_private/gfxp_segmap.c +++ b/usr/src/uts/i86pc/io/gfx_private/gfxp_segmap.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/debug.h> #include <sys/types.h> #include <sys/param.h> @@ -47,7 +45,7 @@ #include <sys/fs/snode.h> #include <sys/pci.h> #include <sys/vmsystm.h> -#include "gfx_private.h" +#include <sys/gfx_private.h> /* * clone of ddi_segmap_setup(). Respects the requested cache diff --git a/usr/src/uts/i86pc/io/gfx_private/gfxp_vgatext.c b/usr/src/uts/i86pc/io/gfx_private/gfxp_vgatext.c index c1aeda647a..c445062abd 100644 --- a/usr/src/uts/i86pc/io/gfx_private/gfxp_vgatext.c +++ b/usr/src/uts/i86pc/io/gfx_private/gfxp_vgatext.c @@ -46,8 +46,7 @@ #include <sys/pci.h> #include <sys/kd.h> #include <sys/ddi_impldefs.h> - -#include "gfx_private.h" +#include <sys/gfx_private.h> #define MYNAME "gfxp_vgatext" @@ -1387,3 +1386,54 @@ vgatext_return_pointers(struct vgatext_softc *softc, struct vgaregmap *fbs, regss->handle = softc->regs.handle; regss->mapped = softc->regs.mapped; } + + +/* + * **************************************************************** + * If we had a "bitmap" console implementation, it could + * use the functions below to cooperate with DRM. + */ + + +/* + * If we had "bitmap" console support, this would + * register call-back functions: drm_gfxp_setmode, + * (and maybe others for blt, copy, clear) for the + * "bitmap" console to use. + * + * The current (text) console doesn't need it. + */ +/* ARGSUSED */ +void +gfxp_bm_register_fbops(gfxp_fb_softc_ptr_t softc, + struct gfxp_blt_ops *ops) +{ +} + +/* + * This is patchable with mdb, i.e.: + * $ mdb -w /platform/i86pc/kernel/misc/amd64/gfx_private + * > gfxp_fb_info?ddVV + * 1024 768 32 24 + */ +struct gfxp_bm_fb_info gfxp_fb_info = { + .xres = 1024, + .yres = 768, + .bpp = 32, + .depth = 24, +}; + +/* + * If we had "bitmap" console support, this would + * ask the size of it. (how is TBD) + * + * Just guess (for now) + */ +void +gfxp_bm_getfb_info(gfxp_fb_softc_ptr_t softc, + struct gfxp_bm_fb_info *fbip) +{ + _NOTE(ARGUNUSED(softc)) + + *fbip = gfxp_fb_info; +} diff --git a/usr/src/uts/i86pc/io/gfx_private/gfxp_vm.c b/usr/src/uts/i86pc/io/gfx_private/gfxp_vm.c index ca6a36cb5d..4934de54e6 100644 --- a/usr/src/uts/i86pc/io/gfx_private/gfxp_vm.c +++ b/usr/src/uts/i86pc/io/gfx_private/gfxp_vm.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/debug.h> #include <sys/types.h> #include <sys/param.h> @@ -72,7 +70,7 @@ #include <sys/callb.h> #include <sys/promif.h> #include <sys/atomic.h> -#include "gfx_private.h" +#include <sys/gfx_private.h> #ifdef __xpv #include <sys/hypervisor.h> @@ -256,3 +254,143 @@ gfxp_convert_addr(paddr_t paddr) return ((gfx_maddr_t)paddr); #endif } + +/* + * Support getting VA space separately from pages + */ + +/* + * A little like gfxp_map_kernel_space, but + * just the vmem_alloc part. + */ +caddr_t +gfxp_alloc_kernel_space(size_t size) +{ + caddr_t cvaddr; + pgcnt_t npages; + + npages = btopr(size); + cvaddr = vmem_alloc(heap_arena, ptob(npages), VM_NOSLEEP); + return (cvaddr); +} + +/* + * Like gfxp_unmap_kernel_space, but + * just the vmem_free part. + */ +void +gfxp_free_kernel_space(caddr_t address, size_t size) +{ + + uint_t pgoffset; + caddr_t base; + pgcnt_t npages; + + if (size == 0 || address == NULL) + return; + + pgoffset = (uintptr_t)address & PAGEOFFSET; + base = (caddr_t)address - pgoffset; + npages = btopr(size + pgoffset); + vmem_free(heap_arena, base, ptob(npages)); +} + +/* + * Like gfxp_map_kernel_space, but + * just the hat_devload part. + */ +void +gfxp_load_kernel_space(uint64_t start, size_t size, + uint32_t mode, caddr_t cvaddr) +{ + uint_t pgoffset; + uint64_t base; + pgcnt_t npages; + int hat_flags; + uint_t hat_attr; + pfn_t pfn; + + if (size == 0) + return; + +#ifdef __xpv + /* + * The hypervisor doesn't allow r/w mappings to some pages, such as + * page tables, gdt, etc. Detect %cr3 to notify users of this interface. + */ + if (start == mmu_ptob(mmu_btop(getcr3()))) + return; +#endif + + if (mode == GFXP_MEMORY_CACHED) + hat_attr = HAT_STORECACHING_OK; + else if (mode == GFXP_MEMORY_WRITECOMBINED) + hat_attr = HAT_MERGING_OK | HAT_PLAT_NOCACHE; + else /* GFXP_MEMORY_UNCACHED */ + hat_attr = HAT_STRICTORDER | HAT_PLAT_NOCACHE; + hat_flags = HAT_LOAD_LOCK; + + pgoffset = start & PAGEOFFSET; + base = start - pgoffset; + npages = btopr(size + pgoffset); + +#ifdef __xpv + ASSERT(DOMAIN_IS_INITDOMAIN(xen_info)); + pfn = xen_assign_pfn(mmu_btop(base)); +#else + pfn = btop(base); +#endif + + hat_devload(kas.a_hat, cvaddr, ptob(npages), pfn, + PROT_READ|PROT_WRITE|hat_attr, hat_flags); +} + +/* + * Like gfxp_unmap_kernel_space, but + * just the had_unload part. + */ +void +gfxp_unload_kernel_space(caddr_t address, size_t size) +{ + uint_t pgoffset; + caddr_t base; + pgcnt_t npages; + + if (size == 0 || address == NULL) + return; + + pgoffset = (uintptr_t)address & PAGEOFFSET; + base = (caddr_t)address - pgoffset; + npages = btopr(size + pgoffset); + hat_unload(kas.a_hat, base, ptob(npages), HAT_UNLOAD_UNLOCK); +} + +/* + * Note that "mempool" is optional and normally disabled in drm_gem.c + * (see HAS_MEM_POOL). Let's just stub these out so we can reduce + * changes from the upstream in the DRM driver code. + */ + +void +gfxp_mempool_init(void) +{ +} + +void +gfxp_mempool_destroy(void) +{ +} + +/* ARGSUSED */ +int +gfxp_alloc_from_mempool(struct gfxp_pmem_cookie *cookie, caddr_t *kva, + pfn_t *pgarray, pgcnt_t alen, int flags) +{ + return (-1); +} + +/* ARGSUSED */ +void +gfxp_free_mempool(struct gfxp_pmem_cookie *cookie, caddr_t kva, size_t len) +{ +} diff --git a/usr/src/uts/intel/brand/common/brand_asm.h b/usr/src/uts/intel/brand/common/brand_asm.h index c820d8e187..1d540db2a9 100644 --- a/usr/src/uts/intel/brand/common/brand_asm.h +++ b/usr/src/uts/intel/brand/common/brand_asm.h @@ -161,7 +161,7 @@ extern "C" { #define GET_P_BRAND_DATA(sp, pcnt, reg) \ GET_PROCP(sp, pcnt, reg); \ - mov __P_BRAND_DATA(reg), reg /* get p_brand_data */ + mov P_BRAND_DATA(reg), reg /* get p_brand_data */ /* * Each of the following macros returns to the standard syscall codepath if diff --git a/usr/src/uts/intel/dev/Makefile b/usr/src/uts/intel/dev/Makefile index e7ae468c05..00c885fc3a 100644 --- a/usr/src/uts/intel/dev/Makefile +++ b/usr/src/uts/intel/dev/Makefile @@ -23,6 +23,8 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2016 by Delphix. All rights reserved. +# # This makefile drives the production of the dev file system # kernel module. # @@ -63,6 +65,9 @@ LDFLAGS += -dy -Nfs/devfs -Nmisc/dls INC_PATH += -I$(UTSBASE)/common/fs/zfs INC_PATH += -I$(UTSBASE)/common/io/bpf +LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +LINTTAGS += -erroff=E_STATIC_UNUSED + CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized diff --git a/usr/src/uts/intel/stmf_sbd/Makefile b/usr/src/uts/intel/stmf_sbd/Makefile index a57ccaf73d..ac64b10708 100644 --- a/usr/src/uts/intel/stmf_sbd/Makefile +++ b/usr/src/uts/intel/stmf_sbd/Makefile @@ -20,8 +20,9 @@ # # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016 by Delphix. All rights reserved. # -# This makefile drives the production of the stmf_sbd driver for +# This makefile drives the production of the stmf_sbd driver for # COMSTAR. # @@ -68,6 +69,7 @@ C99LMODE= -Xc99=%all # to investigate and remove these for maximum lint coverage. # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/sparc/dev/Makefile b/usr/src/uts/sparc/dev/Makefile index 1469b37763..e079a824c3 100644 --- a/usr/src/uts/sparc/dev/Makefile +++ b/usr/src/uts/sparc/dev/Makefile @@ -21,6 +21,8 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2016 by Delphix. All rights reserved. +# # uts/sparc/dev/Makefile # This makefile drives the production of the /dev file system # kernel module. @@ -64,6 +66,9 @@ LDFLAGS += -dy -Nfs/devfs -Nmisc/dls INC_PATH += -I$(UTSBASE)/common/fs/zfs INC_PATH += -I$(UTSBASE)/common/io/bpf +LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +LINTTAGS += -erroff=E_STATIC_UNUSED + CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized diff --git a/usr/src/uts/sparc/stmf_sbd/Makefile b/usr/src/uts/sparc/stmf_sbd/Makefile index a57ccaf73d..ac64b10708 100644 --- a/usr/src/uts/sparc/stmf_sbd/Makefile +++ b/usr/src/uts/sparc/stmf_sbd/Makefile @@ -20,8 +20,9 @@ # # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016 by Delphix. All rights reserved. # -# This makefile drives the production of the stmf_sbd driver for +# This makefile drives the production of the stmf_sbd driver for # COMSTAR. # @@ -68,6 +69,7 @@ C99LMODE= -Xc99=%all # to investigate and remove these for maximum lint coverage. # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/sun4/brand/common/brand_solaris.s b/usr/src/uts/sun4/brand/common/brand_solaris.s index 9097273036..889218bc5f 100644 --- a/usr/src/uts/sun4/brand/common/brand_solaris.s +++ b/usr/src/uts/sun4/brand/common/brand_solaris.s @@ -236,7 +236,7 @@ _emulation_check: #endif /* sun4v */ ldn [%g2 + CPU_THREAD], %g3; /* get thread ptr */ ldn [%g3 + T_PROCP], %g4; /* get proc ptr */ - ldn [%g4 + __P_BRAND_DATA], %g5; /* get brand data ptr */ + ldn [%g4 + P_BRAND_DATA], %g5; /* get brand data ptr */ ldn [%g5 + SPD_HANDLER], %g5; /* get userland brnd hdlr ptr */ brz %g5, _exit; /* has it been set? */ nop; diff --git a/usr/src/uts/sun4/ml/offsets.in b/usr/src/uts/sun4/ml/offsets.in index de214274ee..4f6d19ba01 100644 --- a/usr/src/uts/sun4/ml/offsets.in +++ b/usr/src/uts/sun4/ml/offsets.in @@ -109,7 +109,7 @@ proc PROCSIZE p_utraps p_agenttp p_brand - __p_brand_data + p_brand_data \#define P_UTRAP4 (UT_ILLTRAP_INSTRUCTION * CPTRSIZE) \#define P_UTRAP7 (UT_FP_DISABLED * CPTRSIZE) |