diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2016-12-05 13:18:56 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2016-12-05 13:18:56 +0000 |
commit | 36a2e5c9487f73d4774971e047aebcd34e913fb7 (patch) | |
tree | aa6a20e0c5e3b3e2232a2e647195aba7674f4619 | |
parent | c180fecb1d3e6f21a8453964dd4f3b5e4acce56c (diff) | |
parent | 502b33a50609aec2d2a1f0465da1ad3bac47d74a (diff) | |
download | illumos-joyent-36a2e5c9487f73d4774971e047aebcd34e913fb7.tar.gz |
[illumos-gate merge]
commit 502b33a50609aec2d2a1f0465da1ad3bac47d74a
7593 lsdev device name section headers should be printed by dv_print callback.
commit 5b5a71c445cf6577e9376190edd57004a2b09522
6964 mkfs_pcfs should detect GPT partition size and fat type for it
commit 55a424cb69d5e44a32d26e1c9fe02288d09a1663
7404 rootpool_007_neg, bootfs_006_pos and bootfs_008_neg tests fail with the loader project bits
commit 4ba5b9616327ef64e8abc737d29b3faabc6ae68c
7586 remove #ifdef __lint hack from dmu.h
commit 719d176126cc1c689a469d4c3553d770d1c4e94e
6723 etc/skel needs cleanup
2931 PS1 prompt in default user .profile is incorrect
commit 9c31cf024c08128fce3fce725716f43a0286b787
7623 Move agpmaster to graphics-agpgart, and set noincorp
commit a727ef706f18aacc81c5d9981e121205e149f8bc
7622 Separate DRM+AGP devlinks stuff into its own module
commit 01d41e6dacd6f26957b16899a553d152ff46ec0c
7621 Ship devfsadm.h to allow externally-built devlinks modules
commit c4d05ea67a6a84b9d56cd84ce2a6e1f572b51966
7620 Update gfx_private for new AGP+DRM code
commit dc1b26915530081df6e78d0ada403a1b920a7b58
7619 Promote gfx_private.h to sys/gfx_private.h
68 files changed, 988 insertions, 498 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.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/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/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/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/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/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/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/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/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 |