diff options
author | Gordon Ross <gordon.w.ross@gmail.com> | 2016-10-09 21:32:00 -0400 |
---|---|---|
committer | Gordon Ross <gordon.w.ross@gmail.com> | 2016-11-22 21:55:24 -0500 |
commit | 34389f68da0422c10aa2f4edac7a44021b5f4cc8 (patch) | |
tree | d550d443cfc30cae3bb62ac452709ce28ff9a538 | |
parent | 3db4bae91fbc905faf0dda171b7f985f72deef99 (diff) | |
download | illumos-gfx-drm-34389f68da0422c10aa2f4edac7a44021b5f4cc8.tar.gz |
Changes to build DRM on the updated illumos AGP support
45 files changed, 1158 insertions, 1117 deletions
diff --git a/usr/src/Targetdirs b/usr/src/Targetdirs index b2b0543..dcc6ed6 100644 --- a/usr/src/Targetdirs +++ b/usr/src/Targetdirs @@ -256,6 +256,8 @@ DIRS= \ /usr/share/man/man1 \ /usr/share/man/man3x \ /usr/share/man/man7 \ + /usr/share/man/man7d \ + /usr/share/man/man7i \ /usr/share/src \ /usr/snadm \ /usr/snadm/lib \ diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile index febdcb8..a666c86 100644 --- a/usr/src/cmd/Makefile +++ b/usr/src/cmd/Makefile @@ -32,8 +32,7 @@ include ../Makefile.master FIRST_SUBDIRS= COMMON_SUBDIRS= \ - foo \ - fs.d \ + devfsadm \ mdb i386_SUBDIRS= @@ -44,8 +43,7 @@ sparc_SUBDIRS= # Commands that are messaged. Note that 'lp' and 'man' come first # (see previous comment about 'lp' and 'man'). # -MSGSUBDIRS= \ - foo +MSGSUBDIRS= sparc_MSGSUBDIRS= diff --git a/usr/src/cmd/devfsadm/Makefile b/usr/src/cmd/devfsadm/Makefile index e008e8f..0f03abc 100644 --- a/usr/src/cmd/devfsadm/Makefile +++ b/usr/src/cmd/devfsadm/Makefile @@ -24,10 +24,6 @@ # cmd/devfsadm/Makefile # -DEFAULTFILES = devfsadm.dfl - -ETCDEVFILES=reserved_devnames - include ../Makefile.cmd # @@ -42,27 +38,9 @@ clobber := TARGET= clobber _msg := TARGET= _msg lint := TARGET= lint -ROOTETCDEV= $(ROOTETC)/dev -ROOTETCDEVFILES=$(ETCDEVFILES:%=$(ROOTETCDEV)/%) -$(ROOTETCDEV) := DIRMODE= 755 -$(ROOTETCDEVFILES) := FILEMODE = 0644 - .KEEP_STATE: -all: $(SUBDIRS) $(ETCDEVFILES) - -clean lint _msg: $(SUBDIRS) - -clobber: $(SUBDIRS) - $(RM) $(ROOTETCDEVFILES) - -install: $(SUBDIRS) $(ROOTETCDEFAULTFILES) $(ROOTETCDEVFILES) - -$(ROOTETCDEV): - $(INS.dir) - -$(ROOTETCDEV)/% : % $(ROOTETCDEV) - $(INS.file) +all install clean clobber lint _msg: $(SUBDIRS) $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/cmd/devfsadm/Makefile.com b/usr/src/cmd/devfsadm/Makefile.com index 4df3b00..39c7cc6 100644 --- a/usr/src/cmd/devfsadm/Makefile.com +++ b/usr/src/cmd/devfsadm/Makefile.com @@ -22,165 +22,70 @@ # Use is subject to license terms. # -# This target builds both a command (daemon) and various shared objects. This -# isn't a typical target, and the inclusion of both library and command -# Makefiles were probably not in their original design. However, there doesn't -# presently seem to be a clash of any required definitions. -include ../../../lib/Makefile.lib -include ../../Makefile.cmd +include $(SRC)/lib/Makefile.lib COMMON = .. -UTSBASE = $(COMMON)/../../uts - -DEVFSADM_MOD = devfsadm - -DEVALLOCSRC = devalloc.c - -PLCYSRC = devpolicy.c plcysubr.c - -MODLOADDIR = $(COMMON)/../modload - -DEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) \ - $(DEVALLOCSRC:%=$(COMMON)/%) $(PLCYSRC:%=$(COMMON)/%) -DEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(DEVALLOCSRC:%.c=%.o) $(PLCYSRC:%.c=%.o) - -DEVFSADM_DAEMON = devfsadmd +UTSBASE = $(SRC)/uts LINKMOD_DIR = linkmod DEVFSADM_DIR = devfsadm -CLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON) -CLOBBERFILES += $(POFILE) $(POFILES) ../plcysubr.c - -LINK_OBJS_CMN = \ - disk_link.o \ - ieee1394_link.o \ - dcam1394_link.o \ - tape_link.o \ - usb_link.o \ - port_link.o \ - audio_link.o \ - cfg_link.o \ - misc_link.o \ - lofi_link.o \ - ramdisk_link.o \ - fssnap_link.o \ - sgen_link.o \ - smp_link.o \ - md_link.o \ - dtrace_link.o \ - vscan_link.o \ - zfs_link.o \ - zut_link.o +CLOBBERFILES = $(LINK_MODS) + +LINK_OBJS_CMN = LINK_OBJS = $(LINK_OBJS_CMN) \ $(LINK_OBJS_$(MACH)) -LINK_SRCS = $(LINK_OBJS_CMN:%.o=$(COMMON)/%.c) \ - $(LINK_OBJS_$(MACH):%.o=%.c) - -LINT_MODULES = $(LINK_SRCS:%.c=%.ln) - LINK_MODS = $(LINK_OBJS:%.o=SUNW_%.so) -DEVLINKTAB = devlink.tab -DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh - -COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig - CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ - -I$(COMMON) -I$(UTSBASE)/common -I$(MODLOADDIR) + -I$(COMMON) -I$(UTSBASE)/common CFLAGS += $(CCVERBOSE) $(C_PICFLAGS) -LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2 -LINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2 -LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2 - -CERRWARN += -_gcc=-Wno-uninitialized -CERRWARN += -_gcc=-Wno-char-subscripts -CERRWARN += -_gcc=-Wno-parentheses - # Define the dependencies required by devfsadm and all shared objects. LDLIBS += -ldevinfo -devfsadm := LDLIBS += -lgen -lsysevent -lnvpair -lzonecfg -lbsm -SUNW_md_link.so := LDLIBS += -lmeta -SUNW_disk_link.so := LDLIBS += -ldevid -SUNW_sgen_link.so := LDLIBS += -ldevid # All libraries are built from the same SUNW_%.so rule (see below), and define # their own SONAME using -h explicitly. Null the generic -h macro that gets # inherited from Makefile.lib, otherwise we'll get two -h definitions. HSONAME = -SRCS = $(DEVFSADM_SRC) $(LINK_SRCS) -OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS) -MODS = $(DEVFSADM_MOD) $(LINK_MODS) +OBJS = $(LINK_OBJS) -POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po) -POFILE = pdevfsadm.po +POFILES = +POFILE = # install specifics -ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR) +ROOTLIB_DEVFSADM = $(ROOTLIBDIR)/$(DEVFSADM_DIR) ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR) - ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%) -ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%) - -ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%) - -ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON) - -ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%) - FILEMODE= 755 -$(ROOTETC_DEVLINKTAB) := FILEMODE = 644 - all := TARGET= all install := TARGET= install clean := TARGET= clean clobber := TARGET= clobber lint := TARGET= lint - .KEEP_STATE: -all: $(MODS) $(DEVLINKTAB) +all: $(LINK_MODS) install: all \ $(ROOTLIB_DEVFSADM) \ $(ROOTLIB_DEVFSADM_LINKMOD) \ - $(ROOTUSRSBIN_DEVFSADM) \ - $(ROOTETC_DEVLINKTAB) \ - $(ROOTLIB_DEVFSADM_LINK_MODS) \ - $(ROOTUSRINCLUDE) \ - $(ROOTLIB_DEVFSADM_DAEMON) \ - $(ROOTUSRSBIN_COMPAT_LINKS) - + $(ROOTLIB_DEVFSADM_LINK_MODS) clean: $(RM) $(OBJS) - -lint: $(DEVFSADM_MOD).ln $(LINT_MODULES) - -devfsadm.ln: $(DEVFSADM_SRC) - $(LINT.c) $(DEVFSADM_SRC) $(LDLIBS) - -%.ln: $(DEVFSADM_SRC) %.c - $(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS) +lint: include ../../Makefile.targ -$(POFILE): $(POFILES) - $(RM) $@; cat $(POFILES) > $@ - -$(DEVFSADM_MOD): $(DEVFSADM_OBJ) - $(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS) - $(POST_PROCESS) - SUNW_%.so: %.o $(MAPFILES) $(CC) -o $@ $(GSHARED) $(DYNFLAGS) -h $@ $< $(LDLIBS) -lc $(POST_PROCESS_SO) @@ -189,35 +94,11 @@ SUNW_%.so: %.o $(MAPFILES) $(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK) $(POST_PROCESS_O) - -$(DEVLINKTAB): $(DEVLINKTAB_SRC) - $(RM) $(DEVLINKTAB) - /bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB) - -$(ROOTUSRSBIN): - $(INS.dir) - $(ROOTLIB_DEVFSADM): $(INS.dir) -$(ROOTUSRINCLUDE): - $(INS.dir) - $(ROOTLIB_DEVFSADM_LINKMOD): $(INS.dir) $(ROOTLIB_DEVFSADM_LINKMOD)/%: % $(INS.file) - -$(ROOTLIB_DEVFSADM_DAEMON): - $(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@ - -$(ROOTUSRSBIN_COMPAT_LINKS): $(ROOTUSRSBIN_DEVFSADM) - $(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@ - -# -# Source shared with add_drv/update_drv -# -../plcysubr.c: - rm -f $@ - ln -s ../modload/plcysubr.c .. diff --git a/usr/src/cmd/devfsadm/devfsadm.h b/usr/src/cmd/devfsadm/devfsadm.h index 3d801f6..5948ae9 100644 --- a/usr/src/cmd/devfsadm/devfsadm.h +++ b/usr/src/cmd/devfsadm/devfsadm.h @@ -22,6 +22,11 @@ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Note: This header was copied from illumos-gate as a temporary meausre + * until illumos-gate installs this header in /usr/include for us. XXX + */ + #ifndef _DEVFSADM_H #define _DEVFSADM_H diff --git a/usr/src/cmd/devfsadm/drm_link_i386.c b/usr/src/cmd/devfsadm/drm_link_i386.c new file mode 100644 index 0000000..ab29ab7 --- /dev/null +++ b/usr/src/cmd/devfsadm/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/Makefile b/usr/src/cmd/devfsadm/i386/Makefile index 1f14c93..cf819bd 100644 --- a/usr/src/cmd/devfsadm/i386/Makefile +++ b/usr/src/cmd/devfsadm/i386/Makefile @@ -23,10 +23,6 @@ # LINK_OBJS_i386 = \ - misc_link_i386.o \ - xen_link.o - -xen_link.o xen_link.ln xen_link.po := CPPFLAGS += -I$(UTSBASE)/i86xpv + drm_link_i386.o include ../Makefile.com - diff --git a/usr/src/cmd/devfsadm/i386/misc_link_i386.c b/usr/src/cmd/devfsadm/i386/misc_link_i386.c deleted file mode 100644 index 5d2e18a..0000000 --- a/usr/src/cmd/devfsadm/i386/misc_link_i386.c +++ /dev/null @@ -1,656 +0,0 @@ -/* - * 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> -#include <sys/mc_amd.h> -#include <bsm/devalloc.h> - -extern int system_labeled; - -static int lp(di_minor_t minor, di_node_t node); -static int serial_dialout(di_minor_t minor, di_node_t node); -static int serial(di_minor_t minor, di_node_t node); -static int diskette(di_minor_t minor, di_node_t node); -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); -static int ucode(di_minor_t minor, di_node_t node); -static int heci(di_minor_t minor, di_node_t node); - - -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 - }, - { "pseudo", "ddi_pseudo", "ipmi", - TYPE_EXACT | DRV_EXACT, ILEVEL_0, ipmi, - }, - { "pseudo", "ddi_pseudo", "smbios", - TYPE_EXACT | DRV_EXACT, ILEVEL_1, smbios, - }, - /* floppies share the same class, but not link regex, as hard disks */ - { "disk", "ddi_block:diskette", NULL, - TYPE_EXACT, ILEVEL_1, diskette - }, - { "parallel", "ddi_printer", NULL, - TYPE_EXACT, ILEVEL_1, lp - }, - { "serial", "ddi_serial:mb", NULL, - TYPE_EXACT, ILEVEL_1, serial - }, - { "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 - }, - { "pseudo", "ddi_pseudo", NULL, - TYPE_EXACT, ILEVEL_0, srn - }, - { "memory-controller", "ddi_mem_ctrl", NULL, - TYPE_EXACT, ILEVEL_0, mc_node - }, - { "pseudo", "ddi_pseudo", "ucode", - TYPE_EXACT | DRV_EXACT, ILEVEL_0, ucode, - }, - { "pseudo", "ddi_pseudo", "heci", - TYPE_EXACT | DRV_EXACT, ILEVEL_0, heci, - } -}; - -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 - }, - { "pseudo", "^ucode$", RM_ALWAYS | RM_PRE | RM_HOT, - ILEVEL_0, devfsadm_rm_all - }, - { "mouse", "^kdmouse$", RM_ALWAYS | RM_PRE, - ILEVEL_0, devfsadm_rm_all - }, - { "disk", "^(diskette|rdiskette)([0-9]*)$", - RM_ALWAYS | RM_PRE, ILEVEL_1, devfsadm_rm_all - }, - { "parallel", "^(lp|ecpp)([0-9]+)$", RM_ALWAYS | RM_PRE, - ILEVEL_1, devfsadm_rm_all - }, - { "serial", "^(tty|ttyd)([0-9]+)$", RM_ALWAYS | RM_PRE, - ILEVEL_1, devfsadm_rm_all - }, - { "serial", "^tty[a-z]$", RM_ALWAYS | RM_PRE, - ILEVEL_1, devfsadm_rm_all - } -}; - -DEVFSADM_REMOVE_INIT_V0(misc_remove_cbt); - -/* - * Handles minor node type "ddi_display", in addition to generic processing - * done by display(). - * - * This creates a /dev/vt00 link to /dev/fb, for backwards compatibility. - */ -/* ARGSUSED */ -int -vt00(di_minor_t minor, di_node_t node) -{ - (void) devfsadm_secondary_link("vt00", "fb", 0); - return (DEVFSADM_CONTINUE); -} - -/* - * type=ddi_block:diskette;addr=0,0;minor=c diskette - * type=ddi_block:diskette;addr=0,0;minor=c,raw rdiskette - * type=ddi_block:diskette;addr1=0;minor=c diskette\A2 - * type=ddi_block:diskette;addr1=0;minor=c,raw rdiskette\A2 - */ -static int -diskette(di_minor_t minor, di_node_t node) -{ - int flags = 0; - char *a2; - char link[PATH_MAX]; - char *addr = di_bus_addr(node); - char *mn = di_minor_name(minor); - - if (system_labeled) - flags = DA_ADD|DA_FLOPPY; - - if (strcmp(addr, "0,0") == 0) { - if (strcmp(mn, "c") == 0) { - (void) devfsadm_mklink("diskette", node, minor, flags); - } else if (strcmp(mn, "c,raw") == 0) { - (void) devfsadm_mklink("rdiskette", node, minor, flags); - } - - } - - if (addr[0] == '0') { - if ((a2 = strchr(addr, ',')) != NULL) { - a2++; - if (strcmp(mn, "c") == 0) { - (void) strcpy(link, "diskette"); - (void) strcat(link, a2); - (void) devfsadm_mklink(link, node, minor, - flags); - } else if (strcmp(mn, "c,raw") == 0) { - (void) strcpy(link, "rdiskette"); - (void) strcat(link, a2); - (void) devfsadm_mklink(link, node, minor, - flags); - } - } - } - - return (DEVFSADM_CONTINUE); -} - -/* - * type=ddi_printer;name=lp;addr=1,3bc lp0 - * type=ddi_printer;name=lp;addr=1,378 lp1 - * type=ddi_printer;name=lp;addr=1,278 lp2 - */ -static int -lp(di_minor_t minor, di_node_t node) -{ - char *addr = di_bus_addr(node); - char *buf; - char path[PATH_MAX + 1]; - devfsadm_enumerate_t rules[1] = {"^ecpp([0-9]+)$", 1, MATCH_ALL}; - - if (strcmp(addr, "1,3bc") == 0) { - (void) devfsadm_mklink("lp0", node, minor, 0); - - } else if (strcmp(addr, "1,378") == 0) { - (void) devfsadm_mklink("lp1", node, minor, 0); - - } else if (strcmp(addr, "1,278") == 0) { - (void) devfsadm_mklink("lp2", node, minor, 0); - } - - if (strcmp(di_driver_name(node), "ecpp") != 0) { - return (DEVFSADM_CONTINUE); - } - - if ((buf = di_devfs_path(node)) == NULL) { - return (DEVFSADM_CONTINUE); - } - - (void) snprintf(path, sizeof (path), "%s:%s", - buf, di_minor_name(minor)); - - di_devfs_path_free(buf); - - if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) { - return (DEVFSADM_CONTINUE); - } - - (void) snprintf(path, sizeof (path), "ecpp%s", buf); - free(buf); - (void) devfsadm_mklink(path, node, minor, 0); - return (DEVFSADM_CONTINUE); -} - -/* - * type=ddi_serial:mb;minor=a tty00 - * type=ddi_serial:mb;minor=b tty01 - * type=ddi_serial:mb;minor=c tty02 - * type=ddi_serial:mb;minor=d tty03 - */ -static int -serial(di_minor_t minor, di_node_t node) -{ - - char *mn = di_minor_name(minor); - char link[PATH_MAX]; - - (void) strcpy(link, "tty"); - (void) strcat(link, mn); - (void) devfsadm_mklink(link, node, minor, 0); - - if (strcmp(mn, "a") == 0) { - (void) devfsadm_mklink("tty00", node, minor, 0); - - } else if (strcmp(mn, "b") == 0) { - (void) devfsadm_mklink("tty01", node, minor, 0); - - } else if (strcmp(mn, "c") == 0) { - (void) devfsadm_mklink("tty02", node, minor, 0); - - } else if (strcmp(mn, "d") == 0) { - (void) devfsadm_mklink("tty03", node, minor, 0); - } - return (DEVFSADM_CONTINUE); -} - -/* - * type=ddi_serial:dialout,mb;minor=a,cu ttyd0 - * type=ddi_serial:dialout,mb;minor=b,cu ttyd1 - * type=ddi_serial:dialout,mb;minor=c,cu ttyd2 - * type=ddi_serial:dialout,mb;minor=d,cu ttyd3 - */ -static int -serial_dialout(di_minor_t minor, di_node_t node) -{ - char *mn = di_minor_name(minor); - - if (strcmp(mn, "a,cu") == 0) { - (void) devfsadm_mklink("ttyd0", node, minor, 0); - (void) devfsadm_mklink("cua0", node, minor, 0); - - } else if (strcmp(mn, "b,cu") == 0) { - (void) devfsadm_mklink("ttyd1", node, minor, 0); - (void) devfsadm_mklink("cua1", node, minor, 0); - - } else if (strcmp(mn, "c,cu") == 0) { - (void) devfsadm_mklink("ttyd2", node, minor, 0); - (void) devfsadm_mklink("cua2", node, minor, 0); - - } else if (strcmp(mn, "d,cu") == 0) { - (void) devfsadm_mklink("ttyd3", node, minor, 0); - (void) devfsadm_mklink("cua3", node, minor, 0); - } - return (DEVFSADM_CONTINUE); -} - -static int -kdmouse(di_minor_t minor, di_node_t node) -{ - (void) devfsadm_mklink("kdmouse", node, minor, 0); - return (DEVFSADM_CONTINUE); -} - -static int -ipmi(di_minor_t minor, di_node_t node) -{ - /* - * Follow convention from other systems, and include an instance#, - * even though there will only be one. - */ - (void) devfsadm_mklink("ipmi0", node, minor, 0); - return (DEVFSADM_CONTINUE); -} - -static int -smbios(di_minor_t minor, di_node_t node) -{ - (void) devfsadm_mklink("smbios", node, minor, 0); - 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 - */ -static int -mc_node(di_minor_t minor, di_node_t node) -{ - const char *minorname = di_minor_name(minor); - const char *busaddr = di_bus_addr(node); - char linkpath[PATH_MAX]; - int unitaddr; - char *c; - - if (minorname == NULL || busaddr == NULL) - return (DEVFSADM_CONTINUE); - - errno = 0; - unitaddr = strtol(busaddr, &c, 16); - - if (errno != 0) - return (DEVFSADM_CONTINUE); - - if (unitaddr == 0) { - (void) snprintf(linkpath, sizeof (linkpath), "mc/mc"); - } else if (unitaddr >= MC_AMD_DEV_OFFSET) { - (void) snprintf(linkpath, sizeof (linkpath), "mc/mc%u", - unitaddr - MC_AMD_DEV_OFFSET); - } else { - (void) snprintf(linkpath, sizeof (linkpath), "mc/mc%u", - minor->dev_minor); - } - (void) devfsadm_mklink(linkpath, node, minor, 0); - return (DEVFSADM_CONTINUE); -} - -/* - * Creates \M0 devlink for xsvc node - */ -static int -xsvc(di_minor_t minor, di_node_t node) -{ - char *mn; - - if (strcmp(di_node_name(node), "xsvc") != 0) - return (DEVFSADM_CONTINUE); - - mn = di_minor_name(minor); - if (mn == NULL) - return (DEVFSADM_CONTINUE); - - (void) devfsadm_mklink(mn, node, minor, 0); - return (DEVFSADM_CONTINUE); -} - -/* - * Creates \M0 devlink for srn device - */ -static int -srn(di_minor_t minor, di_node_t node) -{ - char *mn; - - if (strcmp(di_node_name(node), "srn") != 0) - return (DEVFSADM_CONTINUE); - - mn = di_minor_name(minor); - if (mn == NULL) - return (DEVFSADM_CONTINUE); - - (void) devfsadm_mklink(mn, node, minor, 0); - return (DEVFSADM_CONTINUE); -} - -/* - * /dev/ucode -> /devices/pseudo/ucode@0:ucode - */ -static int -ucode(di_minor_t minor, di_node_t node) -{ - (void) devfsadm_mklink("ucode", node, minor, 0); - return (DEVFSADM_CONTINUE); -} - -static int -heci(di_minor_t minor, di_node_t node) -{ - if (strcmp(di_minor_name(minor), "AMT") == 0) { - (void) devfsadm_mklink("heci", node, minor, 0); - } - return (DEVFSADM_CONTINUE); -} diff --git a/usr/src/cmd/devfsadm/mapfile-vers b/usr/src/cmd/devfsadm/mapfile-vers new file mode 100644 index 0000000..9c30e21 --- /dev/null +++ b/usr/src/cmd/devfsadm/mapfile-vers @@ -0,0 +1,64 @@ +# +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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 +# + +# +# MAPFILE HEADER START +# +# WARNING: STOP NOW. DO NOT MODIFY THIS FILE. +# Object versioning must comply with the rules detailed in +# +# usr/src/lib/README.mapfiles +# +# You should not be making modifications here until you've read the most current +# copy of that file. If you need help, contact a gatekeeper for guidance. +# +# MAPFILE HEADER END +# +$mapfile_version 2 + +# External interface requirements +SYMBOL_SCOPE { + global: + devfsadm_devlink_cache { FLAGS = EXTERN }; + devfsadm_enumerate_char_start { FLAGS = EXTERN }; + devfsadm_enumerate_int { FLAGS = EXTERN }; + devfsadm_errprint { FLAGS = EXTERN }; + devfsadm_free_dev_names { FLAGS = EXTERN }; + devfsadm_have_reserved { FLAGS = EXTERN }; + devfsadm_is_reserved { FLAGS = EXTERN }; + devfsadm_link_valid { FLAGS = EXTERN }; + devfsadm_lookup_dev_names { FLAGS = EXTERN }; + devfsadm_mklink { FLAGS = EXTERN }; + devfsadm_noupdate { FLAGS = EXTERN }; + devfsadm_print { FLAGS = EXTERN }; + devfsadm_read_link { FLAGS = EXTERN }; + devfsadm_reserve_id_cache { FLAGS = EXTERN }; + devfsadm_rm_all { FLAGS = EXTERN }; + devfsadm_rm_link { FLAGS = EXTERN }; + devfsadm_rm_stale_links { FLAGS = EXTERN }; + devfsadm_root_path { FLAGS = EXTERN }; + devfsadm_secondary_link { FLAGS = EXTERN }; + disk_enumerate_int { FLAGS = EXTERN }; + s_strdup { FLAGS = EXTERN }; + system_labeled { FLAGS = EXTERN }; +}; diff --git a/usr/src/cmd/devfsadm/sparc/Makefile b/usr/src/cmd/devfsadm/sparc/Makefile new file mode 100644 index 0000000..7cc180f --- /dev/null +++ b/usr/src/cmd/devfsadm/sparc/Makefile @@ -0,0 +1,28 @@ +# +# 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 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +LINK_OBJS_sparc = + +include ../Makefile.com diff --git a/usr/src/cmd/mdb/Makefile b/usr/src/cmd/mdb/Makefile index 9f21a5d..886647c 100644 --- a/usr/src/cmd/mdb/Makefile +++ b/usr/src/cmd/mdb/Makefile @@ -29,7 +29,9 @@ include $(SRC)/Makefile.master .KEEP_STATE: sparc_SUBDIRS = -i386_SUBDIRS = foo +i386_SUBDIRS = \ + foo \ + i915 SUBDIRS = $($(MACH)_SUBDIRS) TARGET = diff --git a/usr/src/cmd/mdb/Makefile.module b/usr/src/cmd/mdb/Makefile.module index 8020774..5737c11 100644 --- a/usr/src/cmd/mdb/Makefile.module +++ b/usr/src/cmd/mdb/Makefile.module @@ -101,7 +101,7 @@ C99MODE = $(C99_ENABLE) CFLAGS += $(CCVERBOSE) CFLAGS64 += $(CCVERBOSE) -CPPFLAGS += $($(MDBTGT)_TGTFLAGS) -I../../../common +CPPFLAGS += $($(MDBTGT)_TGTFLAGS) -I../../../uts/common LDFLAGS += $(ZTEXT) LDFLAGS64 += $(ZTEXT) ASFLAGS += -P diff --git a/usr/src/cmd/mdb/i915/Makefile b/usr/src/cmd/mdb/i915/Makefile new file mode 100644 index 0000000..732cc08 --- /dev/null +++ b/usr/src/cmd/mdb/i915/Makefile @@ -0,0 +1,19 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 <XXX Contributor> +# + +include $(SRC)/Makefile.master +SUBDIRS = ia32 +$(BUILD64)SUBDIRS += $(MACH64) +include ../Makefile.subdirs diff --git a/usr/src/cmd/mdb/i915/amd64/Makefile b/usr/src/cmd/mdb/i915/amd64/Makefile new file mode 100644 index 0000000..d8c55b1 --- /dev/null +++ b/usr/src/cmd/mdb/i915/amd64/Makefile @@ -0,0 +1,29 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 Joyent, Inc. +# + +MODULE = i915.so +MDBTGT = kvm + +MODSRCS = i915.c + +include ../../../Makefile.cmd +include ../../../Makefile.cmd.64 +include ../../Makefile.amd64 +include ../../Makefile.module + +CPPFLAGS += -I$(SRC)/uts/intel/io/i915 +CPPFLAGS += -I$(SRC)/uts/common/io/drm +CPPFLAGS += -I$(SRC)/uts/common/drm +CPPFLAGS += -I$(SRC)/uts/common diff --git a/usr/src/cmd/mdb/i915/i915.c b/usr/src/cmd/mdb/i915/i915.c index 706b937..ad094df 100644 --- a/usr/src/cmd/mdb/i915/i915.c +++ b/usr/src/cmd/mdb/i915/i915.c @@ -28,10 +28,10 @@ #include <sys/mdb_modapi.h> #include <sys/proc.h> -#include <sys/drm/drmP.h> -#include <i915/src/i915_drv.h> -#include <i915/src/i915_drm.h> -#include <i915/src/intel_drv.h> +#include <drm/drmP.h> +#include <drm/i915_drm.h> +#include "i915_drv.h" +#include "intel_drv.h" /* diff --git a/usr/src/cmd/mdb/i915/ia32/Makefile b/usr/src/cmd/mdb/i915/ia32/Makefile new file mode 100644 index 0000000..125c5b5 --- /dev/null +++ b/usr/src/cmd/mdb/i915/ia32/Makefile @@ -0,0 +1,28 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 Joyent, Inc. +# + +MODULE = i915.so +MDBTGT = kvm + +MODSRCS = i915.c + +include ../../../Makefile.cmd +include ../../Makefile.ia32 +include ../../Makefile.module + +CPPFLAGS += -I$(SRC)/uts/intel/io/i915 +CPPFLAGS += -I$(SRC)/uts/common/io/drm +CPPFLAGS += -I$(SRC)/uts/common/drm +CPPFLAGS += -I$(SRC)/uts/common diff --git a/usr/src/man/Makefile b/usr/src/man/Makefile index 8705b8c..4274db9 100644 --- a/usr/src/man/Makefile +++ b/usr/src/man/Makefile @@ -15,7 +15,9 @@ SUBDIRS= man1 \ man3x \ - man7 + man7 \ + man7d \ + man7i .PARALLEL: $(SUBDIRS) diff --git a/usr/src/man/man7d/Makefile b/usr/src/man/man7d/Makefile new file mode 100644 index 0000000..0b9bcbe --- /dev/null +++ b/usr/src/man/man7d/Makefile @@ -0,0 +1,28 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet +# at http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2011, Richard Lowe +# + +include $(SRC)/Makefile.master + +MANSECT= 7d + +MANFILES= i915.7d + +MANLINKS= + +.KEEP_STATE: + +include $(SRC)/man/Makefile.man + +install: $(ROOTMANFILES) $(ROOTMANLINKS) diff --git a/usr/src/man/man7d/i915.7d b/usr/src/man/man7d/i915.7d new file mode 100644 index 0000000..54b5b7e --- /dev/null +++ b/usr/src/man/man7d/i915.7d @@ -0,0 +1,46 @@ +'\" te +.\" Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. +.TH i915 7D "15 Dec 2015" "SunOS 5.12" "Device Drivers & /dev files" +.SH NAME +i915 \- DRI-compliant kernel driver providing graphic hardware acceleration support +.SH DESCRIPTION +.sp +.LP +The \fBi915\fR driver is a Direct Rendering Infrastructure (DRI)- compliant kernel driver that provides graphics hardware acceleration support. DRI is a framework for coordinating OS kernel, 3D graphics hardware, X window system and OpenGL applications. +.sp +.LP +The \fBi915\fR driver currently supports the Intel i845, i865, i915, i945, i965 and G33 series integrated graphics controllers. +.SH FILES +.sp +.ne 2 +.mk +.na +\fB\fB/platform/i86pc/kernel/drv/amd64/i915\fR\fR +.ad +.br +.sp .6 +.RS 4n +64-bit \fBELF\fR kernel module (x86). +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(7) for descriptions of the following attributes: +.sp +.TS +tab(
) box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPE
ATTRIBUTE VALUE +_ +Availability
driver/graphics/drm +_ +Architecture
x86 +.TE +.sp +.SH SEE ALSO +.sp +.LP +\fBXorg\fR(1), \fBXserver\fR(1), \fBattributes\fR(7) diff --git a/usr/src/man/man7i/Makefile b/usr/src/man/man7i/Makefile new file mode 100644 index 0000000..fee86ad --- /dev/null +++ b/usr/src/man/man7i/Makefile @@ -0,0 +1,28 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet +# at http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2011, Richard Lowe +# + +include $(SRC)/Makefile.master + +MANSECT= 7i + +MANFILES= agpgart_io.7i + +MANLINKS= + +.KEEP_STATE: + +include $(SRC)/man/Makefile.man + +install: $(ROOTMANFILES) $(ROOTMANLINKS) diff --git a/usr/src/pkg/Makefile b/usr/src/pkg/Makefile index 79063b7..f93829e 100644 --- a/usr/src/pkg/Makefile +++ b/usr/src/pkg/Makefile @@ -108,7 +108,7 @@ PKGMOGRIFY= pkgmogrify # # In the real ON gate, this was "redist" # -REPOS= skel +REPOS= drm # # The packages directory will contain the processed manifests as @@ -127,7 +127,7 @@ PDIR= packages.$(PKGMACH) $(PDIR)/developer-build-onbld.dep:= PKGROOT= $(TOOLSROOT) # In the real ON gate, was "on-nightly" -PKGPUBLISHER= on-skel +PKGPUBLISHER= gfx-drm # # To get these defaults, manifests should simply refer to $(PKGVERS). @@ -494,7 +494,7 @@ $(PDIR)/%.mog: manifests/%.mf $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \ $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \ $(<) $(PM_TRANSFORMS) - $(PKGDEBUG)eval REPO=skel PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \ + $(PKGDEBUG)eval REPO=$(REPOS) PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \ `$(CAT) -s $(@).vars`; \ if [ -f $(@) ]; then \ if [ "$$NODEPEND" != "false" ]; then \ @@ -562,7 +562,7 @@ $(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf) $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \ -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \ $(PM_TRANSFORMS) synthetic - $(PKGDEBUG)eval REPO=skel PKGSTAT=current `$(CAT) -s $(@).vars`; \ + $(PKGDEBUG)eval REPO=$(REPOS) PKGSTAT=current `$(CAT) -s $(@).vars`; \ if [ -f $(@) ]; then \ $(LN) -s $(@F) \ $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \ diff --git a/usr/src/pkg/manifests/app-example-foo.mf b/usr/src/pkg/manifests/app-example-foo.mf deleted file mode 100644 index 39aaafc..0000000 --- a/usr/src/pkg/manifests/app-example-foo.mf +++ /dev/null @@ -1,64 +0,0 @@ -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright 2015 Nexenta Systems, Inc. All rights reserved. -# - -set name=pkg.fmri value=pkg:/application/example/foo@$(PKGVERS) -set name=pkg.description value="application example foo" -set name=pkg.summary value="application example foo" -set name=info.classification \ - value=org.opensolaris.category.2008:Applications/Examples -set name=variant.arch value=$(ARCH) - -# dirs -dir path=kernel group=sys -dir path=kernel/drv group=sys -dir path=kernel/drv/$(ARCH64) group=sys -dir path=usr group=sys -dir path=usr/bin -dir path=usr/include -dir path=usr/include/libfoo -dir path=usr/share/man/man1 -dir path=usr/share/man/man3x -dir path=usr/share/man/man7 - -# files -file path=kernel/drv/$(ARCH64)/foo -$(i386_ONLY)file path=kernel/drv/foo -file path=kernel/drv/foo.conf -file path=kernel/kmdb/$(ARCH64)/foo -$(i386_ONLY)file path=kernel/kmdb/foo -file path=usr/bin/foo mode=0555 -file path=usr/include/libfoo/foo.h -file path=usr/lib/$(ARCH64)/libfoo.so.1 -file path=usr/lib/$(ARCH64)/llib-lfoo.ln -file path=usr/lib/libfoo.so.1 -file path=usr/lib/llib-lfoo -file path=usr/lib/llib-lfoo.ln -file path=usr/lib/mdb/kvm/amd64/foo.so -file path=usr/lib/mdb/kvm/foo.so -file path=usr/share/man/man1/foo.1 -file path=usr/share/man/man3x/foo.3x -file path=usr/share/man/man7/foo.7 - -# What licenses? -license lic_CDDL license=lic_CDDL -license usr/src/uts/common/io/foo/LICENSE \ - license=usr/src/uts/common/io/foo/LICENSE - -# links -link path=usr/lib/$(ARCH64)/libfoo.so target=libfoo.so.1 -link path=usr/lib/libfoo.so target=libfoo.so.1 -link path=usr/share/man/man3x/foo_getcnt.3x target=foo.3x -link path=usr/share/man/man3x/foo_message.3x target=foo.3x -link path=usr/share/man/man3x/libfoo.3x target=foo.3x diff --git a/usr/src/pkg/manifests/driver-graphics-drm.mf b/usr/src/pkg/manifests/driver-graphics-drm.mf index ecb4553..1a4ca44 100644 --- a/usr/src/pkg/manifests/driver-graphics-drm.mf +++ b/usr/src/pkg/manifests/driver-graphics-drm.mf @@ -1,26 +1,25 @@ # -# CDDL HEADER START +# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. # -# 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. +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: # -# 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] +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. # -# CDDL HEADER END -# - -# -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. # # @@ -35,19 +34,49 @@ 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=info.upstream value="Direct Rendering Infrastructure (DRI) project" +set name=info.upstream-url value=http://dri.freedesktop.org/ 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/kmdb group=sys +dir path=kernel/kmdb/$(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/lib/mdb group=sys +dir path=usr/lib/mdb/kvm group=sys +dir path=usr/lib/mdb/kvm/$(ARCH64) group=sys +dir path=usr/share dir path=usr/share/man dir path=usr/share/man/man7d +# Note: The authoritative list of supported PCI IDs supported by +# the i915 driver is in: i915_drv.c:pciidlist[] +# This list was generated by: uts/intel/io/i915/Make-PCI-ID-list.awk driver name=i915 perms="* 0644 root sys" \ + alias=pci8086,102 \ + alias=pci8086,106 \ + alias=pci8086,10a \ + alias=pci8086,112 \ + alias=pci8086,116 \ + alias=pci8086,122 \ + alias=pci8086,126 \ + alias=pci8086,152 \ + alias=pci8086,155 \ + alias=pci8086,156 \ + alias=pci8086,157 \ + alias=pci8086,15a \ + alias=pci8086,162 \ + alias=pci8086,166 \ + alias=pci8086,16a \ alias=pci8086,2562 \ alias=pci8086,2572 \ alias=pci8086,2582 \ + alias=pci8086,258a \ alias=pci8086,2592 \ alias=pci8086,2772 \ alias=pci8086,27a2 \ @@ -62,23 +91,100 @@ driver name=i915 perms="* 0644 root sys" \ alias=pci8086,2a02 \ alias=pci8086,2a12 \ alias=pci8086,2a42 \ - alias=pci8086,2e02.8086.2e02 \ + alias=pci8086,2e02 \ alias=pci8086,2e12 \ alias=pci8086,2e22 \ alias=pci8086,2e32 \ alias=pci8086,2e42 \ + alias=pci8086,2e92 \ + alias=pci8086,3577 \ + alias=pci8086,3582 \ + alias=pci8086,358e \ + alias=pci8086,402 \ + alias=pci8086,406 \ + alias=pci8086,40a \ + alias=pci8086,40b \ + alias=pci8086,40e \ + alias=pci8086,412 \ + alias=pci8086,416 \ + alias=pci8086,41a \ + alias=pci8086,41b \ + alias=pci8086,41e \ alias=pci8086,42 \ - alias=pci8086,46 -file path=kernel/drv/$(ARCH64)/i915 group=sys -file path=kernel/drv/$(ARCH64)/radeon group=sys -file path=kernel/drv/i915 group=sys -file path=kernel/drv/radeon group=sys + alias=pci8086,422 \ + alias=pci8086,426 \ + alias=pci8086,42a \ + alias=pci8086,42b \ + alias=pci8086,42e \ + alias=pci8086,46 \ + alias=pci8086,a001 \ + alias=pci8086,a011 \ + alias=pci8086,a02 \ + alias=pci8086,a06 \ + alias=pci8086,a0a \ + alias=pci8086,a0b \ + alias=pci8086,a0e \ + alias=pci8086,a12 \ + alias=pci8086,a16 \ + alias=pci8086,a1a \ + alias=pci8086,a1b \ + alias=pci8086,a1e \ + alias=pci8086,a22 \ + alias=pci8086,a26 \ + alias=pci8086,a2a \ + alias=pci8086,a2b \ + alias=pci8086,a2e \ + alias=pci8086,c02 \ + alias=pci8086,c06 \ + alias=pci8086,c0a \ + alias=pci8086,c0b \ + alias=pci8086,c0e \ + alias=pci8086,c12 \ + alias=pci8086,c16 \ + alias=pci8086,c1a \ + alias=pci8086,c1b \ + alias=pci8086,c1e \ + alias=pci8086,c22 \ + alias=pci8086,c26 \ + alias=pci8086,c2a \ + alias=pci8086,c2b \ + alias=pci8086,c2e \ + alias=pci8086,d02 \ + alias=pci8086,d06 \ + alias=pci8086,d0a \ + alias=pci8086,d0b \ + alias=pci8086,d0e \ + alias=pci8086,d12 \ + alias=pci8086,d16 \ + alias=pci8086,d1a \ + alias=pci8086,d1b \ + alias=pci8086,d1e \ + alias=pci8086,d22 \ + alias=pci8086,d26 \ + alias=pci8086,d2a \ + alias=pci8086,d2b \ + alias=pci8086,d2e \ + alias=pci8086,f30 \ + alias=pci8086,f31 \ + alias=pci8086,f32 \ + alias=pci8086,f33 +file path=kernel/drv/$(ARCH64)/i915 group=sys mode=0755 +#file path=kernel/drv/$(ARCH64)/radeon group=sys mode=0755 +file path=kernel/drv/i915 group=sys mode=0755 +#file path=kernel/drv/radeon group=sys mode=0755 +file path=kernel/kmdb/$(ARCH64)/i915 group=sys mode=0555 +file path=kernel/kmdb/i915 group=sys mode=0555 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 mode=0755 +file path=usr/lib/mdb/kvm/$(ARCH64)/i915.so group=sys mode=0555 +file path=usr/lib/mdb/kvm/i915.so group=sys mode=0555 file path=usr/share/man/man7d/i915.7d -file path=usr/share/man/man7d/radeon.7d +#file path=usr/share/man/man7d/radeon.7d legacy pkg=SUNWdrmr desc="Direct Rendering Manager kernel drivers and modules" \ name="DRM Kernel Drivers, (Root)" -license cr_Sun license=cr_Sun -license usr/src/uts/common/io/drm/THIRDPARTYLICENSE \ - license=usr/src/uts/common/io/drm/THIRDPARTYLICENSE +license usr/src/uts/common/io/drm/LICENSE_DRM \ + license=usr/src/uts/common/io/drm/LICENSE_DRM +license usr/src/uts/intel/io/i915/LICENSE_I915 \ + license=usr/src/uts/intel/io/i915/LICENSE_I915 +depend fmri=pkg:/driver/graphics/agpgart type=require diff --git a/usr/src/pkg/manifests/driver-graphics-drm.p5m b/usr/src/pkg/manifests/driver-graphics-drm.p5m deleted file mode 100644 index 5f011bb..0000000 --- a/usr/src/pkg/manifests/driver-graphics-drm.p5m +++ /dev/null @@ -1,145 +0,0 @@ -# -# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. -# -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# - -# -# The default for payload-bearing actions in this package is to appear in the -# global zone only. See the include file for greater detail, as well as -# information about overriding the defaults. -# -<include global_zone_only_component> -set name=pkg.fmri value=pkg:/driver/graphics/drm@$(OSPKGVERS) -set name=pkg.summary value="DRM Kernel Drivers" -set name=pkg.description \ - value="Direct Rendering Manager kernel drivers and modules. Currently supports Intel(R) integrated graphics devices with hardware acceleration, video memory management, Graphics Execution Manager (GEM), and kernel modesetting (KMS)." -set name=info.upstream value="Direct Rendering Infrastructure (DRI) project" -set name=info.upstream-url value=http://dri.freedesktop.org/ -set name=variant.arch value=i386 -file path=kernel/drv/$(ARCH64)/i915 group=sys -file path=kernel/kmdb/$(ARCH64)/i915 group=sys -file path=kernel/misc/$(ARCH64)/drm group=sys -file path=usr/lib/mdb/kvm/$(ARCH64)/i915.so group=sys -file path=usr/share/man/man4d/i915.4d -driver name=i915 perms="* 0644 root sys" \ - alias=pci8086,42 \ - alias=pci8086,46 \ - alias=pci8086,102 \ - alias=pci8086,106 \ - alias=pci8086,10a \ - alias=pci8086,112 \ - alias=pci8086,116 \ - alias=pci8086,122 \ - alias=pci8086,126 \ - alias=pci8086,152 \ - alias=pci8086,156 \ - alias=pci8086,15a \ - alias=pci8086,162 \ - alias=pci8086,166 \ - alias=pci8086,16a \ - alias=pci8086,402 \ - alias=pci8086,406 \ - alias=pci8086,40a \ - alias=pci8086,40b \ - alias=pci8086,40e \ - alias=pci8086,412 \ - alias=pci8086,416 \ - alias=pci8086,41a \ - alias=pci8086,41b \ - alias=pci8086,41e \ - alias=pci8086,422 \ - alias=pci8086,426 \ - alias=pci8086,42a \ - alias=pci8086,42b \ - alias=pci8086,42e \ - alias=pci8086,a02 \ - alias=pci8086,a06 \ - alias=pci8086,a0a \ - alias=pci8086,a0b \ - alias=pci8086,a0e \ - alias=pci8086,a12 \ - alias=pci8086,a16 \ - alias=pci8086,a1a \ - alias=pci8086,a1b \ - alias=pci8086,a1e \ - alias=pci8086,a22 \ - alias=pci8086,a26 \ - alias=pci8086,a2a \ - alias=pci8086,a2b \ - alias=pci8086,a2e \ - alias=pci8086,c02 \ - alias=pci8086,c06 \ - alias=pci8086,c0a \ - alias=pci8086,c0b \ - alias=pci8086,c0e \ - alias=pci8086,c12 \ - alias=pci8086,c16 \ - alias=pci8086,c1a \ - alias=pci8086,c1b \ - alias=pci8086,c1e \ - alias=pci8086,c22 \ - alias=pci8086,c26 \ - alias=pci8086,c2a \ - alias=pci8086,c2b \ - alias=pci8086,c2e \ - alias=pci8086,d02 \ - alias=pci8086,d06 \ - alias=pci8086,d0a \ - alias=pci8086,d0b \ - alias=pci8086,d0e \ - alias=pci8086,d12 \ - alias=pci8086,d16 \ - alias=pci8086,d1a \ - alias=pci8086,d1b \ - alias=pci8086,d1e \ - alias=pci8086,d22 \ - alias=pci8086,d26 \ - alias=pci8086,d2a \ - alias=pci8086,d2b \ - alias=pci8086,d2e \ - alias=pci8086,2562 \ - alias=pci8086,2572 \ - alias=pci8086,2582 \ - alias=pci8086,2592 \ - alias=pci8086,2772 \ - alias=pci8086,27a2 \ - alias=pci8086,27ae \ - alias=pci8086,2972 \ - alias=pci8086,2982 \ - alias=pci8086,2992 \ - alias=pci8086,29a2 \ - alias=pci8086,29b2 \ - alias=pci8086,29c2 \ - alias=pci8086,29d2 \ - alias=pci8086,2a02 \ - alias=pci8086,2a12 \ - alias=pci8086,2a42 \ - alias=pci8086,2e02.8086.2e02 \ - alias=pci8086,2e12 \ - alias=pci8086,2e22 \ - alias=pci8086,2e32 \ - alias=pci8086,2e42 \ - alias=pci8086,3582 \ - alias=pci8086,a001 \ - alias=pci8086,a011 -legacy pkg=SUNWdrmr desc="Direct Rendering Manager kernel drivers and modules" \ - name="DRM Kernel Drivers, (Root)" diff --git a/usr/src/pkg/manifests/system-header-header-drm.mf b/usr/src/pkg/manifests/system-header-header-drm.mf new file mode 100644 index 0000000..628c3c7 --- /dev/null +++ b/usr/src/pkg/manifests/system-header-header-drm.mf @@ -0,0 +1,42 @@ +# +# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +set name=pkg.fmri value=pkg:/system/header/header-drm@$(PKGVERS) +set name=pkg.description value="DRM Driver Header Files for x86 Workstations" +set name=pkg.summary value="DRM Driver Header Files" +set name=info.classification \ + value=org.opensolaris.category.2008:Development/System +set name=variant.arch value=i386 +dir path=usr group=sys +dir path=usr/include +dir path=usr/include/drm +file path=usr/include/drm/drm.h +file path=usr/include/drm/drm_fourcc.h +file path=usr/include/drm/drm_mode.h +file path=usr/include/drm/drm_os_solaris.h +file path=usr/include/drm/drm_sarea.h +file path=usr/include/drm/i915_drm.h +license usr/src/uts/common/io/drm/LICENSE_DRM \ + license=usr/src/uts/common/io/drm/LICENSE_DRM diff --git a/usr/src/uts/Makefile b/usr/src/uts/Makefile index 04f58fe..88ef315 100644 --- a/usr/src/uts/Makefile +++ b/usr/src/uts/Makefile @@ -87,6 +87,7 @@ $($(MACH)_ARCHITECTURES): $(PREREQ_TARGET) FRC # isomorphic locations. # COMMON_HDRDIRS= \ + common/drm \ common/sys # diff --git a/usr/src/uts/common/drm/Makefile b/usr/src/uts/common/drm/Makefile new file mode 100644 index 0000000..659c070 --- /dev/null +++ b/usr/src/uts/common/drm/Makefile @@ -0,0 +1,44 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 <contributor> +# + + +include ../../../Makefile.master + +HDRS= \ + drm.h \ + drm_fourcc.h \ + drm_mode.h \ + drm_os_solaris.h \ + drm_sarea.h \ + i915_drm.h + + +ROOTDIR= $(ROOT)/usr/include/drm +ROOTHDRS= $(HDRS:%=$(ROOTDIR)/%) +CHECKHDRS= $(HDRS:%.h=%.check) + +$(ROOTDIR)/%: % + $(INS.file) + +$(ROOTDIR): + $(INS.dir) + +.KEEP_STATE: + +.PARALLEL: $(CHECKHDRS) + +install_h: $(ROOTDIR) $(ROOTHDRS) + +check: $(CHECKHDRS) diff --git a/usr/src/uts/common/io/drm/Makefile.mod b/usr/src/uts/common/io/drm/Makefile.mod new file mode 100644 index 0000000..74539d8 --- /dev/null +++ b/usr/src/uts/common/io/drm/Makefile.mod @@ -0,0 +1,66 @@ +# +# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +# +############################################################################### +# +# This Makefile.mod defines DRM_OBJS +# +############################################################################### + +DRM_OBJS = ati_pcigart.o \ + drm_agpsupport.o \ + drm_auth.o \ + drm_bufs.o \ + drm_cache.o \ + drm_context.o \ + drm_crtc.o \ + drm_crtc_helper.o \ + drm_dma.o \ + drm_dp_helper.o \ + drm_dp_i2c_helper.o \ + drm_drv.o \ + drm_edid.o \ + drm_fb_helper.o \ + drm_fops.o \ + drm_gem.o \ + drm_io32.o \ + drm_ioctl.o \ + drm_irq.o \ + drm_kstat.o \ + drm_linux.o \ + drm_lock.o \ + drm_memory.o \ + drm_mm.o \ + drm_modes.o \ + drm_msg.o \ + drm_pci.o \ + drm_rect.o \ + drm_scatter.o \ + drm_stub.o \ + drm_sun_i2c.o \ + drm_sun_idr.o \ + drm_sun_pci.o \ + drm_sun_timer.o \ + drm_sun_workqueue.o \ + drm_sunmod.o \ + drm_sysfs.o diff --git a/usr/src/uts/common/io/drm/drm_agpsupport.c b/usr/src/uts/common/io/drm/drm_agpsupport.c index 272ab43..f59ab56 100644 --- a/usr/src/uts/common/io/drm/drm_agpsupport.c +++ b/usr/src/uts/common/io/drm/drm_agpsupport.c @@ -555,13 +555,13 @@ drm_agp_bind_pages(struct drm_device *dev, uint32_t gtt_offset, unsigned int agp_type) { - agp_gtt_info_t bind; + agp_bind_pages_t bind; int ret, rval; - bind.agp_pgstart = gtt_offset / AGP_PAGE_SIZE; - bind.agp_npage = num_pages; - bind.agp_phyaddr = pages; - bind.agp_flags = agp_type; + bind.agpb_pgstart = gtt_offset / AGP_PAGE_SIZE; + bind.agpb_pgcount = num_pages; + bind.agpb_pages = pages; + bind.agpb_type = agp_type; ret = ldi_ioctl(dev->agp->agpgart_lh, AGPIOC_PAGES_BIND, (intptr_t)&bind, FKIOCTL, kcred, &rval); @@ -574,20 +574,19 @@ drm_agp_bind_pages(struct drm_device *dev, int drm_agp_unbind_pages(struct drm_device *dev, - pfn_t *pages, + pfn_t *pages, /* NULL */ unsigned long num_pages, uint32_t gtt_offset, pfn_t scratch, - uint32_t type) + uint32_t ignored) /* old "VT_switch" flag */ { - agp_gtt_info_t unbind; + agp_unbind_pages_t unbind; int ret, rval; - unbind.agp_pgstart = gtt_offset / AGP_PAGE_SIZE; - unbind.agp_npage = num_pages; - unbind.agp_type = type; - unbind.agp_phyaddr = pages; - unbind.agp_scratch = scratch; + unbind.agpu_pgstart = gtt_offset / AGP_PAGE_SIZE; + unbind.agpu_pgcount = num_pages; + unbind.agpu_scratch = scratch; + unbind.agpu_flags = 0; ret = ldi_ioctl(dev->agp->agpgart_lh, AGPIOC_PAGES_UNBIND, (intptr_t)&unbind, FKIOCTL, kcred, &rval); @@ -613,18 +612,18 @@ drm_agp_rw_gtt(struct drm_device *dev, unsigned long num_pages, uint32_t gtt_offset, void *gttp, - uint32_t type) + uint32_t rw_flag) /* read = 0 write = 1 */ { - agp_rw_gtt_t gtt_info; + agp_rw_gtt_t rw; int ret, rval; - gtt_info.pgstart = gtt_offset / AGP_PAGE_SIZE; - gtt_info.pgcount = num_pages; - gtt_info.addr = gttp; - /* read = 0 write = 1 */ - gtt_info.type = type; + rw.agprw_pgstart = gtt_offset / AGP_PAGE_SIZE; + rw.agprw_pgcount = num_pages; + rw.agprw_addr = gttp; + rw.agprw_flags = rw_flag; + ret = ldi_ioctl(dev->agp->agpgart_lh, AGPIOC_RW_GTT, - (intptr_t)>t_info, FKIOCTL, kcred, &rval); + (intptr_t)&rw, FKIOCTL, kcred, &rval); if (ret) { DRM_ERROR("AGPIOC_RW_GTT failed %d", ret); return -ret; diff --git a/usr/src/uts/common/io/drm/drm_edid.c b/usr/src/uts/common/io/drm/drm_edid.c index 15fe208..f1bf41b 100644 --- a/usr/src/uts/common/io/drm/drm_edid.c +++ b/usr/src/uts/common/io/drm/drm_edid.c @@ -2102,6 +2102,7 @@ static int drm_cvt_modes(struct drm_connector *connector, height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2; switch (cvt->code[1] & 0x0c) { + default: /* else gcc says: width may be used uninitialized... */ case 0x00: width = height * 4 / 3; break; diff --git a/usr/src/uts/common/io/drm/drm_gem.c b/usr/src/uts/common/io/drm/drm_gem.c index 0c5651c..ee88602 100644 --- a/usr/src/uts/common/io/drm/drm_gem.c +++ b/usr/src/uts/common/io/drm/drm_gem.c @@ -111,7 +111,7 @@ drm_gem_object_free_internal(struct drm_gem_object *obj, int gen) static ddi_dma_attr_t old_dma_attr = { DMA_ATTR_V0, - 0xff000U, /* dma_attr_addr_lo */ + 0, /* dma_attr_addr_lo */ 0xffffffffU, /* dma_attr_addr_hi */ 0xffffffffU, /* dma_attr_count_max */ 4096, /* dma_attr_align */ diff --git a/usr/src/uts/common/io/drm/drm_stub.c b/usr/src/uts/common/io/drm/drm_stub.c index 26501ac..5663336 100644 --- a/usr/src/uts/common/io/drm/drm_stub.c +++ b/usr/src/uts/common/io/drm/drm_stub.c @@ -353,7 +353,6 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t err_g2: -err_mem: kfree(new_minor, sizeof (*new_minor)); err_idr: (void) idr_remove(&drm_minors_idr, minor_id); diff --git a/usr/src/uts/common/io/drm/drm_sunmod.c b/usr/src/uts/common/io/drm/drm_sunmod.c index 24971ba..0f4ef47 100644 --- a/usr/src/uts/common/io/drm/drm_sunmod.c +++ b/usr/src/uts/common/io/drm/drm_sunmod.c @@ -237,6 +237,7 @@ drm_gem_map_access(devmap_cookie_t dhp, void *pvt, offset_t offset, size_t len, obj = (struct drm_gem_object *)pvt; if (obj == NULL) { + dev = NULL; /* avoid "used uninitialized" warning */ goto next; } @@ -645,6 +646,9 @@ drm_sun_devmap(dev_t dev_id, devmap_cookie_t dhp, offset_t offset, case _DRM_GEM: return (__devmap_gem(dev, dhp, map, maplen)); + + default: + break; } return (ENOTSUP); @@ -745,7 +749,7 @@ static struct modlmisc modlmisc = { }; static struct modlinkage modlinkage = { - MODREV_1, (void *)&modlmisc, NULL + MODREV_1, { (void *)&modlmisc, NULL } }; int diff --git a/usr/src/uts/common/sys/gfx_private.h b/usr/src/uts/common/sys/gfx_private.h index 5c85d89..ddd91e5 100644 --- a/usr/src/uts/common/sys/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/intel/Makefile.files b/usr/src/uts/intel/Makefile.files index 60c9f65..5654c7d 100644 --- a/usr/src/uts/intel/Makefile.files +++ b/usr/src/uts/intel/Makefile.files @@ -77,6 +77,8 @@ CORE_OBJS += # Driver modules # + + # # Kernel linker # diff --git a/usr/src/uts/intel/Makefile.intel b/usr/src/uts/intel/Makefile.intel index a77fbc6..609acd9 100644 --- a/usr/src/uts/intel/Makefile.intel +++ b/usr/src/uts/intel/Makefile.intel @@ -184,7 +184,11 @@ ALL_DEFS = $(DEBUG_DEFS) $(OPTION_DEFS) # DRV_KMODS_32 are built only 32-bit # DRV_KMODS_64 are built only 64-bit # -DRV_KMODS += foo +DRV_KMODS += amd64_gart +DRV_KMODS += agpgart +DRV_KMODS += agptarget +DRV_KMODS += drm +DRV_KMODS += i915 # # Common code drivers @@ -226,7 +230,7 @@ SYS_KMODS += # MISC_KMODS_32 are built only 32-bit # MISC_KMODS_64 are built only 64-bit # -MISC_KMODS += +MISC_KMODS += agpmaster # # Software Cryptographic Providers (/kernel/crypto): diff --git a/usr/src/uts/intel/drm/Makefile b/usr/src/uts/intel/drm/Makefile index 1e48127..df5cc64 100644 --- a/usr/src/uts/intel/drm/Makefile +++ b/usr/src/uts/intel/drm/Makefile @@ -18,7 +18,7 @@ # # CDDL HEADER END # -# uts/intel/drm/Makefile + # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. @@ -39,10 +39,11 @@ MODULE = drm OBJECTS = $(DRM_OBJS:%=$(OBJS_DIR)/%) LINTS = $(DRM_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_MISC_DIR)/$(MODULE) -DRM_SRC = $(UTSBASE)/i86pc/io/drm -GFX_DIR = $(UTSBASE)/i86pc/io/gfx_private -INC_PATH += -I$(DRM_SRC) -I$(GFX_DIR) +CMN_DRM = $(UTSBASE)/common/drm + +# Includes +INC_PATH += -I$(CMN_DRM) # Dependency LDFLAGS += -dy -Nmisc/agpmaster -Nmisc/gfx_private @@ -51,9 +52,10 @@ LDFLAGS += -dy -Nmisc/agpmaster -Nmisc/gfx_private # Include common rules. # include $(UTSBASE)/intel/Makefile.intel +include $(UTSBASE)/common/io/drm/Makefile.mod CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable # @@ -84,6 +86,13 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) +$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/drm/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + +$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/drm/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) + # # Include common targets. # diff --git a/usr/src/uts/intel/i915/Makefile b/usr/src/uts/intel/i915/Makefile index e0c2a30..ae5cddb 100644 --- a/usr/src/uts/intel/i915/Makefile +++ b/usr/src/uts/intel/i915/Makefile @@ -25,8 +25,6 @@ # # -# uts/intel/drm/Makefile -# # This makefile drives the production of i915 graphics device driver, # which supports the DRI (Direct Rendering Infrastructure), with the help # of drm common misc module. @@ -35,7 +33,7 @@ # # Path to the base of the uts directory tree (usually /usr/src/uts). # -UTSBASE = ../.. +UTSBASE = ../.. # # Define the module and object file sets. @@ -45,22 +43,27 @@ OBJECTS = $(I915_OBJS:%=$(OBJS_DIR)/%) LINTS = $(I915_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) -# i915 driver depends on drm, agpmaster and gfx_private misc modules -INC_PATH += -I$(UTSBASE)/intel/io/drm -I$(UTSBASE)/common/io/drm +CMN_DRM = $(UTSBASE)/common/drm -# -# dependency -LDFLAGS += -dy -Nmisc/drm +# Includes +INC_PATH += -I$(CMN_DRM) + +# Dependency +LDFLAGS += -dy -Nmisc/drm # # Include common rules. # include $(UTSBASE)/intel/Makefile.intel +include $(UTSBASE)/intel/io/i915/Makefile.mod -CERRWARN += -_gcc=-Wno-unused-label +CERRWARN += -_gcc=-Wno-parentheses +CERRWARN += -_gcc=-Wno-unused-function +CERRWARN += -_gcc=-Wno-unused-variable +CERRWARN += -_gcc=-Wno-override-init # -# Re-define targets +# Define targets # ALL_TARGET = $(BINARY) LINT_TARGET = $(MODULE).lint @@ -87,6 +90,13 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) +$(OBJS_DIR)/%.o: $(UTSBASE)/intel/io/i915/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + +$(LINTS_DIR)/%.ln: $(UTSBASE)/intel/io/i915/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) + # # Include common targets. # diff --git a/usr/src/uts/intel/io/i915/Make-PCI-ID-list.awk b/usr/src/uts/intel/io/i915/Make-PCI-ID-list.awk new file mode 100644 index 0000000..61a14af --- /dev/null +++ b/usr/src/uts/intel/io/i915/Make-PCI-ID-list.awk @@ -0,0 +1,38 @@ +# +# Copyright 2016 Gordon W. Ross +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# +# Unix "awk" program to extract the supported list of PCI IDs from +# i915_drv.c and put in the form needed in our pkg manifest. +# Run like: nawk -f Make-PCI-ID-list.awk < i915_drv.c |sort +# +BEGIN { FS="[(,)]" } +/^\tINTEL_VGA_DEVICE/ { + id=tolower($2); + if (match(id, "^0x")) + id=substr(id,3); + while (match(id, "^0")) + id=substr(id,2); + printf(" alias=pci8086,%s \\\n", id) +} diff --git a/usr/src/uts/intel/io/i915/Makefile.mod b/usr/src/uts/intel/io/i915/Makefile.mod new file mode 100644 index 0000000..433f7cd --- /dev/null +++ b/usr/src/uts/intel/io/i915/Makefile.mod @@ -0,0 +1,55 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 Gordon W. Ross +# + +I915_OBJS = \ + dvo_ch7017.o \ + dvo_ch7xxx.o \ + dvo_ivch.o \ + dvo_ns2501.o \ + dvo_sil164.o \ + dvo_tfp410.o \ + i915_dma.o \ + i915_drv.o \ + i915_gem.o \ + i915_gem_context.o \ + i915_gem_debug.o \ + i915_gem_evict.o \ + i915_gem_execbuffer.o \ + i915_gem_gtt.o \ + i915_gem_stolen.o \ + i915_gem_tiling.o \ + i915_io32.o \ + i915_irq.o \ + i915_suspend.o \ + i915_ums.o \ + intel_bios.o \ + intel_crt.o \ + intel_ddi.o \ + intel_display.o \ + intel_dp.o \ + intel_dvo.o \ + intel_fb.o \ + intel_hdmi.o \ + intel_i2c.o \ + intel_lvds.o \ + intel_modes.o \ + intel_overlay.o \ + intel_panel.o \ + intel_pm.o \ + intel_ringbuffer.o \ + intel_sdvo.o \ + intel_sideband.o \ + intel_sprite.o \ + intel_tv.o diff --git a/usr/src/uts/intel/io/i915/i915_drv.c b/usr/src/uts/intel/io/i915/i915_drv.c index d7bb151..89ff8bb 100644 --- a/usr/src/uts/intel/io/i915/i915_drv.c +++ b/usr/src/uts/intel/io/i915/i915_drv.c @@ -110,7 +110,7 @@ static struct modldrv modldrv = { }; static struct modlinkage modlinkage = { - MODREV_1, (void *) &modldrv, NULL + MODREV_1, { (void *) &modldrv, NULL } }; #define INTEL_VGA_DEVICE(id, info) { \ @@ -969,6 +969,9 @@ i915_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) } return (i915_resume(dev)); + + default: + break; } DRM_ERROR("only supports attach or resume"); @@ -996,6 +999,9 @@ i915_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) case DDI_SUSPEND: return (i915_suspend(dev)); + + default: + break; } DRM_ERROR("only supports detach or suspend"); diff --git a/usr/src/uts/intel/io/i915/i915_gem_execbuffer.c b/usr/src/uts/intel/io/i915/i915_gem_execbuffer.c index b32278b..e862c1c 100644 --- a/usr/src/uts/intel/io/i915/i915_gem_execbuffer.c +++ b/usr/src/uts/intel/io/i915/i915_gem_execbuffer.c @@ -751,7 +751,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, struct drm_clip_rect *cliprects = NULL; struct intel_ring_buffer *ring; u32 ctx_id = i915_execbuffer2_get_context_id(*args); - struct batch_info_list *node; + struct batch_info_list *node = NULL; u32 exec_start, exec_len; u32 mask, flags; int ret, mode, i; @@ -930,7 +930,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, obj->exec_entry = &exec[i]; eb_add_object(eb, obj); - if (MDB_TRACK_ENABLE) + /* + * The condition here was: if (MDB_TRACK_ENABLE)... + * but that caused GCC warnings. This is equivalent. + */ + if (node != NULL) node->obj_list[i] = (caddr_t)obj; TRACE_GEM_OBJ_HISTORY(obj, "prepare emit"); } diff --git a/usr/src/uts/intel/io/i915/i915_gem_gtt.c b/usr/src/uts/intel/io/i915/i915_gem_gtt.c index 2d9a554..a0db09e 100644 --- a/usr/src/uts/intel/io/i915/i915_gem_gtt.c +++ b/usr/src/uts/intel/io/i915/i915_gem_gtt.c @@ -559,14 +559,14 @@ void i915_ggtt_insert_entries(struct drm_i915_gem_object *obj, { struct drm_device *dev = obj->base.dev; - unsigned int flags = (cache_level == I915_CACHE_NONE) ? + unsigned int agp_type = (cache_level == I915_CACHE_NONE) ? AGP_USER_MEMORY : AGP_USER_CACHED_MEMORY; (void) drm_agp_bind_pages(dev, obj->base.pfnarray, obj->base.size >> PAGE_SHIFT, obj->gtt_offset, - flags); + agp_type); } static void i915_ggtt_clear_range(struct drm_device *dev, diff --git a/usr/src/uts/intel/io/i915/i915_irq.c b/usr/src/uts/intel/io/i915/i915_irq.c index 518efe6..323a38f 100644 --- a/usr/src/uts/intel/io/i915/i915_irq.c +++ b/usr/src/uts/intel/io/i915/i915_irq.c @@ -1164,6 +1164,8 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS) sde_ier = I915_READ(SDEIER); I915_WRITE(SDEIER, 0); POSTING_READ(SDEIER); + } else { + sde_ier = 0; /* Fix GCC "used unitialized" warning */ } /* On Haswell, also mask ERR_INT because we don't want to risk diff --git a/usr/src/uts/intel/io/i915/intel_i2c.c b/usr/src/uts/intel/io/i915/intel_i2c.c index a3d4ca1..900f940 100644 --- a/usr/src/uts/intel/io/i915/intel_i2c.c +++ b/usr/src/uts/intel/io/i915/intel_i2c.c @@ -462,7 +462,7 @@ gmbus_xfer(struct i2c_adapter *adapter, ret = -ETIMEDOUT; } I915_WRITE(GMBUS0 + reg_offset, 0); - ret = ret ?: i; + ret = ret ? ret : i; goto out; clear_err: |