diff options
author | Gordon Ross <gwr@nexenta.com> | 2011-06-05 01:40:07 -0400 |
---|---|---|
committer | Gordon Ross <gwr@nexenta.com> | 2011-06-05 01:40:07 -0400 |
commit | 6132907e261803ca6456a594bab3ce7258ecc044 (patch) | |
tree | b198ef8ef24baff8de79a5d1ec4ec0693412a24a /usr/src/uts | |
download | illumos-gfx-drm-6132907e261803ca6456a594bab3ce7258ecc044.tar.gz |
add skeleton files
Diffstat (limited to 'usr/src/uts')
30 files changed, 3847 insertions, 0 deletions
diff --git a/usr/src/uts/Makefile b/usr/src/uts/Makefile new file mode 100644 index 0000000..75aec54 --- /dev/null +++ b/usr/src/uts/Makefile @@ -0,0 +1,125 @@ +# +# 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) 1989, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# include global definitions +include ../Makefile.master + +# +# List of architectures to build as part of the standard build. +# +sparc_ARCHITECTURES = sparc # sun4v sun4u +i386_ARCHITECTURES = intel # i86pc i86xpv + +# +# Platforms defined in $(MACH)_PARALLEL are built in parallel. DUMMY is placed +# at the end in case $(MACH)_PARALLEL is empty to prevent everything going in +# parallel. +# +.PARALLEL: $($(MACH)_PARALLEL) DUMMY + +# +# For build prerequisites we use a special target which is constructed by adding +# '.prereq' suffix to the $(MACH)_PREREQ. +# +PREREQ_TARGET = + + +def := TARGET= def +all := TARGET= all +install := TARGET= install +install_h := TARGET= install_h +clean := TARGET= clean +clobber := TARGET= clobber +lint := TARGET= lint +clean.lint := TARGET= clean.lint +check := TARGET= check +modlist := TARGET= modlist +modlist := NO_STATE= -K $$MODSTATE$$$$ + +.KEEP_STATE: + +def all lint: all_h $($(MACH)_ARCHITECTURES) + +install: all_h install_dirs $($(MACH)_ARCHITECTURES) + +install_dirs: + @cd ..; pwd; $(MAKE) rootdirs + @pwd + +# +# Rule to build architecture files. Build all required prerequisites and then +# build the rest (potentially in parallel). +# +$($(MACH)_ARCHITECTURES): $(PREREQ_TARGET) FRC + @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) + +# +# The following is the list of directories which contain Makefiles with +# targets to install header file. The machine independent headers are +# installed by invoking the Makefile in the directory containing the +# header files. Machine and architecture dependent headers are installed +# by invoking the main makefile for that architecture/machine which, +# in turn, is responsible for invoking the Makefiles which install headers. +# It is done this way so as not to assume that all of the header files in +# the architecture/machine dependent subdirectories are in completely +# isomorphic locations. +# +COMMON_HDRDIRS= \ + common/sys + +# +# Subset of COMMON_HDRDIRS in which at least one header is generated +# at runtime (e.g., rpcgen). (This is a partial list; there are +# other directories that should be included and do not yet have the +# necessary Makefile support. See 6414855.) +# +DYNHDRDIRS = common/sys + +sparc_HDRDIRS= +i386_HDRDIRS= + +HDRDIRS= $(COMMON_HDRDIRS) $($(MACH)_HDRDIRS) +install_h check: $(HDRDIRS) $($(MACH)_ARCHITECTURES) + +$(HDRDIRS): FRC + @cd $@; pwd; $(MAKE) $(TARGET) + +# ensures that headers made by rpcgen and others are available in uts source +# for kernel builds to reference without building install_h +# +all_h: FRC + @cd common/sys; pwd; $(MAKE) $@ + +clean clobber: $($(MACH)_ARCHITECTURES) $(DYNHDRDIRS) + +EXTRA_CLOBBER_TARGETS= +clobber: $(EXTRA_CLOBBER_TARGETS) + + +clean.lint modlist: $($(MACH)_ARCHITECTURES) + +cscope.out tags: FRC + $(XREF) -x $@ + +FRC: diff --git a/usr/src/uts/Makefile.targ b/usr/src/uts/Makefile.targ new file mode 100644 index 0000000..121f358 --- /dev/null +++ b/usr/src/uts/Makefile.targ @@ -0,0 +1,506 @@ +# +# 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) 1991, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# This Makefiles contains the common targets and definitions for +# all kernels. It is to be included in the Makefiles for specific +# implementation architectures and processor architecture dependent +# modules: i.e.: all driving kernel Makefiles. +# + +# +# Default rule for building the lint library directory: +# +$(LINT_LIB_DIR): + -@mkdir -p $@ 2> /dev/null + +# +# All C objects depend on inline files. However, cc(1) doesn't generate +# the correct dependency info. Also, these Makefiles don't contain a +# separate list of C-derived object files (but it is light weight to +# let the assembler files think they depend upon this when they don't). +# Fortunately, the inline files won't change very often. So, for now, +# all objects depend on the inline files. Remove this when the inliner +# is fixed to drop correct dependency information. +# +$(OBJECTS): $(INLINES) + +# +# Partially link .o files to generate the kmod. The fake dependency +# on modstubs simplifies things... +# ELFSIGN_MOD is defined in the individual KCF plug-in modules Makefiles, +# and will sign the ELF objects using elfsign(1). +# +$(BINARY): $(OBJECTS) + $(LD) -r $(LDFLAGS) -o $@ $(OBJECTS) + $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) + $(POST_PROCESS) + $(ELFSIGN_MOD) + +# +# This target checks each kmod for undefined entry points. It does not +# modify the kmod in any way. +# +$(MODULE).check: FRC + @BUILD_TYPE=DBG32 $(MAKE) $(MODULE).check.targ + +$(MODULE).check.targ: $(BINARY) $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB) + $(LD) -o /dev/null $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB) + +# +# Module lint library construction targets. +# +MOD_LINT_LIB = $(LINT_LIB_DIR)/llib-l$(LINT_MODULE).ln + +$(MOD_LINT_LIB): $(LINT_LIB_DIR) $(LINTS) + @-$(ECHO) "\n$(OBJS_DIR)/$(MODULE): (library construction):" + @($(LINT) -o $(LINT_MODULE)-$(OBJS_DIR) \ + $(LINTFLAGS) $(LINTS) $(LTAIL)) + @$(MV) llib-l$(LINT_MODULE)-$(OBJS_DIR).ln $@ + +$(LINT_MODULE).lint: $(MOD_LINT_LIB) $(LINT_LIB) $(GEN_LINT_LIB) + @-$(ECHO) "\n$(OBJS_DIR)/$(LINT_MODULE): global crosschecks:" + @($(LINT) $(LINTFLAGS) $(MOD_LINT_LIB) \ + $(LINT_LIB) $(GEN_LINT_LIB) $(LTAIL)) + +# +# Since assym.h is a derived file, the dependency must be explicit for +# all files including this file. (This is only actually required in the +# instance when the .nse_depinfo file does not exist.) It may seem that +# the lint targets should also have a similar dependency, but they don't +# since only C headers are included when #defined(lint) is true. The +# actual lists are defined in */Makefile.files. +# +$(ASSYM_DEPS:%=$(OBJS_DIR)/%): $(DSF_DIR)/$(OBJS_DIR)/assym.h + +# +# Everybody need to know how to create a modstubs.o built with the +# appropriate flags and located in the appropriate location. +# +$(MODSTUBS_O): $(MODSTUBS) + $(COMPILE.s) -o $@ $(MODSTUBS) + +$(LINTS_DIR)/modstubs.ln: $(MODSTUBS) + @($(LHEAD) $(LINT.s) $(MODSTUBS) $(LTAIL)) + +# +# Build the source file which contains the kernel's utsname, +# with release, version and machine set as follows: +# +# release: contents of $(RELEASE) (Spaces replaced by '_') +# version: contents of $(PATCHID) (Spaces replaced by '_') +# machine: contents of $(UNAME_M) +# +# Build environment information is only contained in the comment section. +# +# The version string, normally the variable VERSION, is set to display +# environmental information temporarily while in development because +# it provides a little more useful information. +# +VERSION_STRING = ($(ECHO) $$LOGNAME [\`basename $$CODEMGR_WS\`] \\\c; date +%D) +$(INTERNAL_RELEASE_BUILD)VERSION_STRING = $(ECHO) $(PATCHID) + +$(OBJS_DIR)/vers.o: $(OBJECTS) + $(COMPILE.c) -DUTS_RELEASE=\"`$(ECHO) $(RELEASE) | sed -e 's/ /_/g'`\" \ + -DUTS_VERSION=\"`$(VERSION_STRING) | sed -e 's/ /_/g'`\" \ + -DUTS_PLATFORM=\"$(UNAME_M)\" -o $@ $(SRC)/uts/common/os/vers.c + $(CTFCONVERT_O) + $(POST_PROCESS_O) + +$(LINTS_DIR)/vers.ln: $(SRC)/uts/common/os/vers.c + @($(LHEAD) $(LINT.c) -DUTS_RELEASE=\"\" -DUTS_VERSION=\"\" \ + -DUTS_PLATFORM=\"\" $(SRC)/uts/common/os/vers.c $(LTAIL)) + +# +# Installation targets and rules: +# +$(ROOT_MOD_DIR) $(USR_MOD_DIR): + -$(INS.dir) + +$(ROOT_MOD_DIRS_32): $(ROOT_MOD_DIR) + -$(INS.dir) + +$(USR_MOD_DIRS_32): $(USR_MOD_DIR) + -$(INS.dir) + +$(ROOT_MOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) FRC + $(INS.file) + +$(ROOT_CPU_DIR)/%: $(OBJS_DIR)/% $(ROOT_CPU_DIR) FRC + $(INS.file) + +$(ROOT_DRV_DIR)/%: $(OBJS_DIR)/% $(ROOT_DRV_DIR) FRC + $(INS.file) + +$(ROOT_DTRACE_DIR)/%: $(OBJS_DIR)/% $(ROOT_DTRACE_DIR) FRC + $(INS.file) + +$(ROOT_EXEC_DIR)/%: $(OBJS_DIR)/% $(ROOT_EXEC_DIR) FRC + $(INS.file) + +$(ROOT_FS_DIR)/%: $(OBJS_DIR)/% $(ROOT_FS_DIR) FRC + $(INS.file) + +$(ROOT_SCHED_DIR)/%: $(OBJS_DIR)/% $(ROOT_SCHED_DIR) FRC + $(INS.file) + +$(ROOT_SOCK_DIR)/%: $(OBJS_DIR)/% $(ROOT_SOCK_DIR) FRC + $(INS.file) + +$(ROOT_STRMOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_STRMOD_DIR) FRC + $(INS.file) + +$(ROOT_IPP_DIR)/%: $(OBJS_DIR)/% $(ROOT_IPP_DIR) FRC + $(INS.file) + +$(ROOT_SYS_DIR)/%: $(OBJS_DIR)/% $(ROOT_SYS_DIR) FRC + $(INS.file) + +$(ROOT_MISC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MISC_DIR) FRC + $(INS.file) + +$(ROOT_DACF_DIR)/%: $(OBJS_DIR)/% $(ROOT_DACF_DIR) FRC + $(INS.file) + +$(ROOT_BRAND_DIR)/%: $(OBJS_DIR)/% $(ROOT_BRAND_DIR) FRC + $(INS.file) + +$(ROOT_CRYPTO_DIR)/%: $(OBJS_DIR)/% $(ROOT_CRYPTO_DIR) FRC + $(INS.file) + +$(ROOT_KGSS_DIR)/%: $(OBJS_DIR)/% $(ROOT_KGSS_DIR) FRC + $(INS.file) + +$(ROOT_SCSI_VHCI_DIR)/%: $(OBJS_DIR)/% $(ROOT_SCSI_VHCI_DIR) FRC + $(INS.file) + +$(ROOT_PMCS_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_PMCS_FW_DIR) FRC + $(INS.file) + +$(ROOT_QLC_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_QLC_FW_DIR) FRC + $(INS.file) + +$(ROOT_EMLXS_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_EMLXS_FW_DIR) FRC + $(INS.file) + +$(ROOT_MACH_DIR)/%: $(OBJS_DIR)/% $(ROOT_MACH_DIR) FRC + $(INS.file) + +$(ROOT_FONT_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_FONT_DIR) FRC + $(INS.file) + +$(ROOT_MAC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_MAC_DIR) FRC + $(INS.file) + +$(USR_DRV_DIR)/%: $(OBJS_DIR)/% $(USR_DRV_DIR) FRC + $(INS.file) + +$(USR_EXEC_DIR)/%: $(OBJS_DIR)/% $(USR_EXEC_DIR) FRC + $(INS.file) + +$(USR_FS_DIR)/%: $(OBJS_DIR)/% $(USR_FS_DIR) FRC + $(INS.file) + +$(USR_SCHED_DIR)/%: $(OBJS_DIR)/% $(USR_SCHED_DIR) FRC + $(INS.file) + +$(USR_SOCK_DIR)/%: $(OBJS_DIR)/% $(USR_SOCK_DIR) FRC + $(INS.file) + +$(USR_STRMOD_DIR)/%: $(OBJS_DIR)/% $(USR_STRMOD_DIR) FRC + $(INS.file) + +$(USR_SYS_DIR)/%: $(OBJS_DIR)/% $(USR_SYS_DIR) FRC + $(INS.file) + +$(USR_MISC_DIR)/%: $(OBJS_DIR)/% $(USR_MISC_DIR) FRC + $(INS.file) + +$(USR_DACF_DIR)/%: $(OBJS_DIR)/% $(USR_DACF_DIR) FRC + $(INS.file) + +$(USR_PCBE_DIR)/%: $(OBJS_DIR)/% $(USR_PCBE_DIR) FRC + $(INS.file) + +$(USR_DTRACE_DIR)/%: $(OBJS_DIR)/% $(USR_DTRACE_DIR) FRC + $(INS.file) + +$(USR_BRAND_DIR)/%: $(OBJS_DIR)/% $(USR_BRAND_DIR) FRC + $(INS.file) + +$(ROOT_KICONV_DIR)/%: $(OBJS_DIR)/% $(ROOT_KICONV_DIR) FRC + $(INS.file) + +#include $(SRC)/Makefile.psm.targ XXX + +# +# Target for 64b modules +# +$(ROOT_KERN_DIR_64): + -$(INS.dir) + +$(ROOT_KERN_DIR_64)/%: $(OBJS_DIR)/% $(ROOT_KERN_DIR_64) FRC + $(INS.file) + +%/$(SUBDIR64): % + -$(INS.dir) + +# +# Targets for '.conf' file installation. +# +$(ROOT_CONFFILE): $(SRC_CONFFILE) $(ROOT_CONFFILE:%/$(CONFFILE)=%) + $(INS.conffile) + +# +# Targets for creating links between common platforms. ROOT_PLAT_LINKS +# are are the /platform level while ROOT_PLAT_LINKS_2 are one level +# down (/platform/`uname -i`/{lib|sbin|kernel}. +# +$(ROOT_PLAT_LINKS): + $(INS.slink1) + +$(ROOT_PLAT_LINKS_2): + $(INS.slink2) + +$(USR_PLAT_LINKS): + $(INS.slink1) + +$(USR_PLAT_LINKS_2): + $(INS.slink2) + +# +# multiple builds support +# +def $(DEF_DEPS) := TARGET = def +all $(ALL_DEPS) := TARGET = all +clean $(CLEAN_DEPS) := TARGET = clean +clobber $(CLOBBER_DEPS) := TARGET = clobber +lint $(LINT_DEPS) := TARGET = lint +modlintlib $(MODLINTLIB_DEPS) := TARGET = modlintlib +modlist $(MODLIST_DEPS) := TARGET = modlist +modlist $(MODLIST_DEPS) := NO_STATE= -K $$MODSTATE$$$$ +clean.lint $(CLEAN_LINT_DEPS) := TARGET = clean.lint +install $(INSTALL_DEPS) := TARGET = install +symcheck $(SYM_DEPS) := TARGET = symcheck + +ALL_TARGS = def all clean clobber lint modlintlib \ + clean.lint lintlib install symcheck + +ALL_OBJ32 = $(ALL_TARGS:%=%.obj32) + +$(ALL_OBJ32): FRC + @BUILD_TYPE=OBJ32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ + +ALL_DEBUG32 = $(ALL_TARGS:%=%.debug32) + +$(ALL_DEBUG32): FRC + @BUILD_TYPE=DBG32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ + +ALL_OBJ64 = $(ALL_TARGS:%=%.obj64) + +$(ALL_OBJ64): FRC + @BUILD_TYPE=OBJ64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ + +ALL_DEBUG64 = $(ALL_TARGS:%=%.debug64) + +$(ALL_DEBUG64): FRC + @BUILD_TYPE=DBG64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ + +# +# Currently only the IP module needs symbol checking on obj64. +# Other modules have the same global-objs nm output for debug64 and obj64. +# +$(SISCHECK_DEPS): $(DEF_DEPS) + @TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \ + MODSYMS=$(MODULE).symbols.$$TARG; \ + if [ -f "$(MODULE).global-objs.$$TARG" ]; then \ + $(GREP) -v '#' $(MODULE).global-objs.$$TARG |$(GREP) . | \ + $(SORT) -u > $$MODSYMS.tmp; \ + $(NM) $$TARG/$(MODULE) |$(GREP) OBJT |$(GREP) -v UNDEF | \ + $(CUT) -d'|' -f8 |$(GREP) -v '^___const_' | \ + $(GREP) -v '\.[0-9]*$$' |$(SORT) -u \ + > $$MODSYMS.tmp.new; \ + $(DIFF) $$MODSYMS.tmp $$MODSYMS.tmp.new > $$MODSYMS.diff || \ + ($(ECHO) "warning: $(MODULE) symbol checking:" \ + "global variable(s) introduced and/or removed."; \ + $(CAT) $$MODSYMS.diff; exit 1) \ + fi + +$(SISCLEAN_DEPS): + -TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \ + MODSYMS=$(MODULE).symbols.$$TARG; \ + $(RM) $$MODSYMS.tmp $$MODSYMS.tmp.new $$MODSYMS.diff Nothing_to_remove + + +$(OBJS_DIR): + -@mkdir -p $@ 2> /dev/null + +def.targ: $(OBJS_DIR) $(ALL_TARGET) + +all.targ: $(OBJS_DIR) $(ALL_TARGET) + +lint.targ: $(OBJS_DIR) $(LINT_TARGET) + +modlintlib.targ: $(OBJS_DIR) $(MOD_LINT_LIB) + +install.targ: $(OBJS_DIR) $(INSTALL_TARGET) + +# +# Support for Install.sh. +# + +modlist: $(MODLIST_DEPS) + +# paths relative to $(ROOT). +RELMODULE = $(ROOTMODULE:$(ROOT)/%=%) +RELCONF = $(ROOT_CONFFILE:$(ROOT)/%=%) +RELLINK = $(ROOTLINK:$(ROOT)/%=%) +RELUNIX = $(UNIX32_LINK:$(ROOT)/%=%) +RELSOFTLINKS = $(ROOTSOFTLINKS:$(ROOT)/%=%) + +MODSRC:sh= pwd + +# +# Generate module information for Install.sh, i.e., specify what files +# Install.sh should include. Each line looks like +# <tag> <srcdir> <arg1> <arg2> ... +# where <tag> specifies the type of file, <srcdir> gives the source +# path (useful if there is an error), and <argN> is one or more +# additional bits of information that Install.sh needs (e.g., source +# directory, install directory, filtering tags). See Install.sh for +# details on the arguments for each tag type, especially the functions +# copymod, filtmod, and filtimpl. +# +# Changes to this target may require corresponding changes to +# Install.sh. +# +# Don't issue a MOD entry if it's not in the install list. +# + +$(MODLIST_DEPS): FRC + @case $@ in \ + *32) \ + class=32; \ + [ -n "$(RELMODULE)" ] && relmodule=`dirname $(RELMODULE)`;; \ + *64) \ + class=64; \ + [ -n "$(RELMODULE)" ] && \ + relmodule=`dirname $(RELMODULE)`/$(SUBDIR64);; \ + esac; \ + if [ -z "$(THISIMPL)" ]; then \ + impl=all; \ + else \ + impl=$(THISIMPL); \ + fi; \ + if [ -n "$(ROOTMODULE)" -a -n "$(INSTALL_TARGET)" ]; then \ + if [ -z "$(MODULE)" ]; then \ + module=`basename $(ROOTMODULE)`; \ + else \ + module=$(MODULE); \ + fi; \ + tinstall="$(INSTALL_TARGET)"; \ + for t in $$tinstall; do \ + if [ "$(ROOTMODULE)" = $$t ]; then \ + echo MOD $(MODSRC) $$module $$relmodule \ + $$class $$impl; \ + break; \ + fi \ + done \ + fi; \ + if [ -n "$(CONF_SRCDIR)" ]; then \ + tinstall="$(INSTALL_TARGET)"; \ + for t in $$tinstall; do \ + if [ $(ROOT_CONFFILE) = $$t ]; then \ + echo CONF $(MODSRC) $(RELCONF) \ + $(MODSRC)/$(CONF_SRCDIR) $$impl $$module; \ + break; \ + fi \ + done \ + fi; \ + if [ -n "$(ROOTLINK)" ]; then \ + rellinks="$(RELLINK)"; \ + for r in $$rellinks; do \ + if [ $$class = 32 ]; then \ + linkdir=`dirname $$r`; \ + else \ + linkdir=`dirname $$r`/$(SUBDIR64); \ + fi; \ + echo LINK $(MODSRC) $$relmodule $$module \ + $$linkdir `basename $$r` $$impl; \ + done \ + fi; \ + if [ -n "$(UNIX32_LINK)" ]; then \ + echo SYMLINK $(MODSRC) $(SUBDIR64)/$(UNIX) \ + `dirname $(RELUNIX)` unix $$impl $$module; \ + fi; \ + trelsoftlinks="$(RELSOFTLINKS)"; \ + for t in $$trelsoftlinks; do \ + if [ $$class = 32 ]; then \ + linkdir=`dirname $$t`; \ + else \ + linkdir=`dirname $$t`/$(SUBDIR64); \ + fi; \ + linkname=`basename $$t`; \ + echo SYMLINK $(MODSRC) $(MODULE) $$linkdir $$linkname \ + $$impl $$module; \ + done + +# +# Cleanliness is next to ... +# +clean.targ: + -$(RM) $(CLEANFILES) Nothing_to_remove + +clobber.targ: + -$(RM) $(CLOBBERFILES) Nothing_to_remove + +clean.lint.targ: + -$(RM) $(CLEANLINTFILES) Nothing_to_remove + +# +# Create fake lintlibs in the 64b dirs so +# global linting works +# +lint64: + @$(ECHO) $(MODULE) fake lints + @for dir in $(LINT64_DIRS); do \ + if [ ! -d $$dir ]; then mkdir $$dir; fi \ + done + @for file in $(LINT64_FILES); do \ + if [ ! -f $$file ]; then touch $$file; fi \ + done + +# +# In some places we also need to create fake lintlibs for 32b +# dirs so global linting works +# +lint32: + @$(ECHO) $(MODULE) fake lints + @for dir in $(LINT32_DIRS); do \ + if [ ! -d $$dir ]; then mkdir $$dir; fi \ + done + @for file in $(LINT32_FILES); do \ + if [ ! -f $$file ]; then touch $$file; fi \ + done + +FRC: diff --git a/usr/src/uts/Makefile.uts b/usr/src/uts/Makefile.uts new file mode 100644 index 0000000..ce8c310 --- /dev/null +++ b/usr/src/uts/Makefile.uts @@ -0,0 +1,677 @@ +# +# 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) 1991, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# + +# +# This Makefile contains the common targets and definitions for +# all kernels. It is to be included in the Makefiles for specific +# implementation architectures and processor architecture dependent +# modules: i.e.: all driving kernel Makefiles. +# +# Include global definitions: +# +include $(SRC)/Makefile.master + +# +# No text domain in the kernel. +# +DTEXTDOM = + +# +# Keep references to $(SRC)/common relative. +COMMONBASE= $(UTSBASE)/../common + +# +# Setup build-specific vars +# To add a build type: +# add name to ALL_BUILDS32 & ALL_BUILDS64 +# set CLASS_name and OBJ_DIR_name +# add targets to Makefile.targ +# + +# +# DEF_BUILDS is for def, lint, sischeck, and install +# ALL_BUILDS is for everything else (all, clean, ...) +# +# The NOT_RELEASE_BUILD noise is to maintain compatibility with the +# gatekeeper's nightly build script. +# +DEF_BUILDS32 = obj32 +DEF_BUILDS64 = obj64 +DEF_BUILDSONLY64 = obj64 +$(NOT_RELEASE_BUILD)DEF_BUILDS32 = debug32 +$(NOT_RELEASE_BUILD)DEF_BUILDS64 = debug64 +$(NOT_RELEASE_BUILD)DEF_BUILDSONLY64 = debug64 +ALL_BUILDS32 = obj32 debug32 +ALL_BUILDS64 = obj64 debug64 +ALL_BUILDSONLY64 = obj64 debug64 + +# +# For modules in 64b dirs that aren't built 64b +# or modules in 64b dirs that aren't built 32b we +# need to create empty modlintlib files so global lint works +# +LINT32_BUILDS = debug32 +LINT64_BUILDS = debug64 + +# +# Build class (32b or 64b) +# +CLASS_OBJ32 = 32 +CLASS_DBG32 = 32 +CLASS_OBJ64 = 64 +CLASS_DBG64 = 64 +CLASS = $(CLASS_$(BUILD_TYPE)) + +# +# Build subdirectory +# +OBJS_DIR_OBJ32 = obj32 +OBJS_DIR_DBG32 = debug32 +OBJS_DIR_OBJ64 = obj64 +OBJS_DIR_DBG64 = debug64 +OBJS_DIR = $(OBJS_DIR_$(BUILD_TYPE)) + +# +# Create defaults so empty rules don't +# confuse make +# +CLASS_ = 32 +OBJS_DIR_ = debug32 + +# +# Build tools +# +CC_sparc_32 = $(sparc_CC) +CC_sparc_64 = $(sparcv9_CC) + +CC_i386_32 = $(i386_CC) +CC_i386_64 = $(amd64_CC) +CC_amd64_64 = $(amd64_CC) + +CC = $(CC_$(MACH)_$(CLASS)) + +AS_sparc_32 = $(sparc_AS) +AS_sparc_64 = $(sparcv9_AS) + +AS_i386_32 = $(i386_AS) +AS_i386_64 = $(amd64_AS) +AS_amd64_64 = $(amd64_AS) + +AS = $(AS_$(MACH)_$(CLASS)) + +LD_sparc_32 = $(sparc_LD) +LD_sparc_64 = $(sparcv9_LD) + +LD_i386_32 = $(i386_LD) +LD_i386_64 = $(amd64_LD) +LD_amd64_64 = $(amd64_LD) + +LD = $(LD_$(MACH)_$(CLASS)) + +LINT_sparc_32 = $(sparc_LINT) +LINT_sparc_64 = $(sparcv9_LINT) + +LINT_i386_32 = $(i386_LINT) +LINT_i386_64 = $(amd64_LINT) +LINT_amd64_64 = $(amd64_LINT) + +LINT = $(LINT_$(MACH)_$(CLASS)) + +MODEL_32 = ilp32 +MODEL_64 = lp64 +MODEL = $(MODEL_$(CLASS)) + +# +# Build rules for linting the kernel. +# +LHEAD = $(ECHO) "\n$@"; + +# Note: egrep returns "failure" if there are no matches, which is +# exactly the opposite of what we need. +LGREP.2 = if egrep -v ' (_init|_fini|_info|_depends_on) '; then false; else true; fi + +LTAIL = + +LINT.c = $(LINT) -c -dirout=$(LINTS_DIR) $(LINTFLAGS) $(LINT_DEFS) $(CPPFLAGS) + +# Please do not add new erroff directives here. If you need to disable +# lint warnings in your module for things that cannot be fixed in any +# reasonable manner, please augment LINTTAGS in your module Makefile +# instead. +LINTTAGS = -erroff=E_INCONS_ARG_DECL2 +LINTTAGS += -erroff=E_INCONS_VAL_TYPE_DECL2 + +LINTFLAGS_sparc_32 = $(LINTCCMODE) -nsxmuF -errtags=yes +LINTFLAGS_sparc_64 = $(LINTFLAGS_sparc_32) -m64 +LINTFLAGS_i386_32 = $(LINTCCMODE) -nsxmuF -errtags=yes +LINTFLAGS_i386_64 = $(LINTFLAGS_i386_32) -m64 + +LINTFLAGS = $(LINTFLAGS_$(MACH)_$(CLASS)) $(LINTTAGS) +LINTFLAGS += $(C99LMODE) + +# +# Override this variable to modify the name of the lint target. +# +LINT_MODULE= $(MODULE) + +# +# Build the compile/assemble lines: +# +EXTRA_OPTIONS = +AS_DEFS = -D_ASM -D__STDC__=0 + +ALWAYS_DEFS_32 = -D_KERNEL -D_SYSCALL32 -D_DDI_STRICT +ALWAYS_DEFS_64 = -D_KERNEL -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64 \ + -D_DDI_STRICT +# +# XX64 This should be defined by the compiler! +# +ALWAYS_DEFS_64 += -Dsun -D__sun -D__SVR4 +ALWAYS_DEFS = $(ALWAYS_DEFS_$(CLASS)) + +# +# CPPFLAGS is deliberatly set with a "=" and not a "+=". For the kernel +# the header include path should not look for header files outside of +# the kernel code. This "=" removes the search path built in +# Makefile.master inside CPPFLAGS. Ditto for AS_CPPFLAGS. +# +CPPFLAGS = $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) \ + $(INCLUDE_PATH) $(EXTRA_OPTIONS) +ASFLAGS += -P +AS_CPPFLAGS = $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) $(AS_DEFS) \ + $(AS_INC_PATH) $(EXTRA_OPTIONS) + +# +# Make it (relatively) easy to share compilation options between +# all kernel implementations. +# + +# Override the default, the kernel is squeaky clean +CERRWARN = -errtags=yes -errwarn=%all + +C99MODE = $(C99_ENABLE) + +CFLAGS_uts = +CFLAGS_uts += $(STAND_FLAGS_$(CLASS)) +CFLAGS_uts += $(CCVERBOSE) +CFLAGS_uts += $(ILDOFF) +CFLAGS_uts += $(XAOPT) +CFLAGS_uts += $(CTF_FLAGS) +CFLAGS_uts += $(CERRWARN) +CFLAGS_uts += $(CGLOBALSTATIC) +CFLAGS_uts += $(EXTRA_CFLAGS) + +# +# Declare that $(OBJECTS) and $(LINTS) can be compiled in parallel. +# The DUMMY target is for those instances where OBJECTS and LINTS +# are empty (to avoid an unconditional .PARALLEL). +.PARALLEL: $(OBJECTS) $(LINTS) DUMMY + +# +# Expanded dependencies +# +DEF_DEPS = $(DEF_BUILDS:%=def.%) +ALL_DEPS = $(ALL_BUILDS:%=all.%) +CLEAN_DEPS = $(ALL_BUILDS:%=clean.%) +CLOBBER_DEPS = $(ALL_BUILDS:%=clobber.%) +LINT_DEPS = $(DEF_BUILDS:%=lint.%) +MODLINTLIB_DEPS = $(DEF_BUILDS:%=modlintlib.%) +MODLIST_DEPS = $(DEF_BUILDS:%=modlist.%) +CLEAN_LINT_DEPS = $(ALL_BUILDS:%=clean.lint.%) +INSTALL_DEPS = $(DEF_BUILDS:%=install.%) +SYM_DEPS = $(SYM_BUILDS:%=symcheck.%) +SISCHECK_DEPS = $(DEF_BUILDS:%=sischeck.%) +SISCLEAN_DEPS = $(ALL_BUILDS:%=sisclean.%) + +# +# Default module name +# +BINARY = $(OBJS_DIR)/$(MODULE) + +# +# Default cleanup definitions +# +CLEANLINTFILES = $(LINTS) $(MOD_LINT_LIB) +CLEANFILES = $(OBJECTS) $(CLEANLINTFILES) +CLOBBERFILES = $(BINARY) $(CLEANFILES) + +# +# Installation constants: +# +# FILEMODE is the mode given to the kernel modules +# CFILEMODE is the mode given to the '.conf' files +# +FILEMODE = 755 +DIRMODE = 755 +CFILEMODE = 644 + +# +# Special Installation Macros for the installation of '.conf' files. +# +# These are unique because they are not installed from the current +# working directory. +# +# Sigh. Apparently at some time in the past there was a confusion on +# whether the name is SRC_CONFFILE or SRC_CONFILE. Consistency with the +# other names would indicate SRC_CONFFILE, but the voting is >180 Makefiles +# with SRC_CONFILE and about 11 with SRC_CONFFILE. Software development +# isn't a popularity contest, though, and so my inclination is to define +# both names for now and incrementally convert to SRC_CONFFILE to be consistent +# with the other names. +# +CONFFILE = $(MODULE).conf +SRC_CONFFILE = $(CONF_SRCDIR)/$(CONFFILE) +SRC_CONFILE = $(SRC_CONFFILE) +ROOT_CONFFILE_32 = $(ROOTMODULE).conf +ROOT_CONFFILE_64 = $(ROOTMODULE:%/$(SUBDIR64)/$(MODULE)=%/$(MODULE)).conf +ROOT_CONFFILE = $(ROOT_CONFFILE_$(CLASS)) + + +INS.conffile= \ + $(RM) $@; $(INS) -s -m $(CFILEMODE) -f $(@D) $(SRC_CONFFILE) + +# +# The CTF merge of child kernel modules is performed against one of the genunix +# modules. For Intel builds, all modules will be used with a single genunix: +# the one built in intel/genunix. For SPARC builds, a given +# module may be +# used with one of a number of genunix files, depending on what platform the +# module is deployed on. We merge against the sun4u genunix to optimize for +# the common case. We also merge against the ip driver since networking is +# typically loaded and types defined therein are shared between many modules. +# +CTFMERGE_GUDIR_sparc = sparc +CTFMERGE_GUDIR_i386 = intel +CTFMERGE_GUDIR = $(CTFMERGE_GUDIR_$(MACH)) + +CTFMERGE_GENUNIX = \ + $(UTSBASE)/$(CTFMERGE_GUDIR)/genunix/$(OBJS_DIR)/genunix + +# +# Used to uniquify a non-genunix module against genunix. If used in patch +# mode (PATCH_BUILD != "#"), the patch ID corresponding to the module being +# built will be used as the label. If no ID is available, or if patch mode +# is not being used, the value of $VERSION will be used. +# +# For the ease of developers dropping modules onto possibly unrelated systems, +# you can set NO_GENUNIX_MERGE= in the environment to skip uniquifying against +# genunix. +# +NO_GENUNIX_UNIQUIFY=$(POUND_SIGN) +SKIP_GENUNIX_UNIQUIFY=no +$(NO_GENUNIX_UNIQUIFY)SKIP_GENUNIX_UNIQUIFY=yes + +CTFMERGE_UNIQUIFY_AGAINST_GENUNIX = \ + @label="-L VERSION" ; \ + uniq= ; \ + if [ -z "$(PATCH_BUILD)" ] ; then \ + uniq="-D BASE" ; \ + set -- `$(CTFFINDMOD) -n -r -t $(PMTMO_FILE) $@` ; \ + if [ "X$$1" != "X-" ] ; then \ + label="-l $$1" ; \ + if [ "$$2" != "fcs" ] ; then \ + uniq="-D $$2" ; \ + fi ; \ + fi ; \ + fi ; \ + if [ "$(SKIP_GENUNIX_UNIQUIFY)" = "yes" ]; then \ + uniq= ; \ + else \ + uniq="-d $(CTFMERGE_GENUNIX) $$uniq" ; \ + fi ; \ + cmd="$(CTFMERGE) $(CTFMRGFLAGS) $$label $$uniq" ; \ + cmd="$$cmd -o $@ $(OBJECTS) $(CTFEXTRAOBJS)" ; \ + echo $$cmd ; \ + $$cmd + +# +# Used to merge the genunix module. genunix has special requirements in +# patch mode. In particular, it needs to be able to find the genunix used +# in the previous version of the KU patch (or the FCS version of genunix in +# the case of KU 1). +# +CTFMERGE_GENUNIX_MERGE = \ + @if [ -z "$(PATCH_BUILD)" ] ; then \ + set -- `$(CTFFINDMOD) -b $(OBJS_DIR) -o patch,lastgu -n -r \ + -t $(PMTMO_FILE) $(GENUNIX) || true` '' ; \ + msg= ; \ + if [ $$$(POUND_SIGN) -eq 1 ] ; \ + then msg="Error in $(CTFFINDMOD)" ; \ + elif [ "X$$1" = "X-" ] ; then msg="Did not get label" ; \ + elif [ "X$$2" = "X-" ] ; then msg="Did not get withfile" ; \ + fi ; \ + if [ -n "$$msg" ] ; then \ + echo "make ctf: $$msg - removing $(GENUNIX)" ; \ + $(RM) $(GENUNIX) ; \ + exit 1 ; \ + fi ; \ + label="-l $$1" ; \ + with="-w $$2" ; \ + else \ + label="-L VERSION" ; \ + fi ; \ + cmd="$(CTFMERGE) $(CTFMRGFLAGS) $$label $$with -o $@" ; \ + echo $$cmd "$(OBJECTS) $(CTFEXTRAOBJS) $(IPCTF_TARGET)"; \ + $$cmd $(OBJECTS) $(CTFEXTRAOBJS) $(IPCTF_TARGET) + +# +# We ctfmerge the ip objects into genunix to maximize the number of common types +# found there, thus maximizing the effectiveness of uniquification. We don't +# want the genunix build to have to know about the individual ip objects, so we +# put them in an archive. The genunix ctfmerge then includes this archive. +# +IPCTF = $(IPDRV_DIR)/$(OBJS_DIR)/ipctf.a + +# +# Rule for building fake shared libraries used for symbol resolution +# when building other modules. -znoreloc is needed here to avoid +# tripping over code that isn't really suitable for shared libraries. +# +BUILD.SO = \ + $(LD) -o $@ $(GSHARED) $(ZNORELOC) -h $(SONAME) + +# +# SONAME defaults for common fake shared libraries. +# +$(LIBGEN) := SONAME = $(MODULE) +$(PLATLIB) := SONAME = misc/platmod +$(CPULIB) := SONAME = 'cpu/$$CPU' +$(DTRACESTUBS) := SONAME = dtracestubs + +# +# Installation directories +# + +# +# For now, 64b modules install into a subdirectory +# of their 32b brethren. +# +SUBDIR64_sparc = sparcv9 +SUBDIR64_i386 = amd64 +SUBDIR64 = $(SUBDIR64_$(MACH)) + +ROOT_MOD_DIR = $(ROOT)/kernel + +ROOT_KERN_DIR_32 = $(ROOT_MOD_DIR) +ROOT_BRAND_DIR_32 = $(ROOT_MOD_DIR)/brand +ROOT_DRV_DIR_32 = $(ROOT_MOD_DIR)/drv +ROOT_DTRACE_DIR_32 = $(ROOT_MOD_DIR)/dtrace +ROOT_EXEC_DIR_32 = $(ROOT_MOD_DIR)/exec +ROOT_FS_DIR_32 = $(ROOT_MOD_DIR)/fs +ROOT_SCHED_DIR_32 = $(ROOT_MOD_DIR)/sched +ROOT_SOCK_DIR_32 = $(ROOT_MOD_DIR)/socketmod +ROOT_STRMOD_DIR_32 = $(ROOT_MOD_DIR)/strmod +ROOT_IPP_DIR_32 = $(ROOT_MOD_DIR)/ipp +ROOT_SYS_DIR_32 = $(ROOT_MOD_DIR)/sys +ROOT_MISC_DIR_32 = $(ROOT_MOD_DIR)/misc +ROOT_KGSS_DIR_32 = $(ROOT_MOD_DIR)/misc/kgss +ROOT_SCSI_VHCI_DIR_32 = $(ROOT_MOD_DIR)/misc/scsi_vhci +ROOT_PMCS_FW_DIR_32 = $(ROOT_MOD_DIR)/misc/pmcs +ROOT_QLC_FW_DIR_32 = $(ROOT_MOD_DIR)/misc/qlc +ROOT_EMLXS_FW_DIR_32 = $(ROOT_MOD_DIR)/misc/emlxs +ROOT_NLMISC_DIR_32 = $(ROOT_MOD_DIR)/misc +ROOT_MACH_DIR_32 = $(ROOT_MOD_DIR)/mach +ROOT_CPU_DIR_32 = $(ROOT_MOD_DIR)/cpu +ROOT_TOD_DIR_32 = $(ROOT_MOD_DIR)/tod +ROOT_FONT_DIR_32 = $(ROOT_MOD_DIR)/fonts +ROOT_DACF_DIR_32 = $(ROOT_MOD_DIR)/dacf +ROOT_CRYPTO_DIR_32 = $(ROOT_MOD_DIR)/crypto +ROOT_MAC_DIR_32 = $(ROOT_MOD_DIR)/mac +ROOT_KICONV_DIR_32 = $(ROOT_MOD_DIR)/kiconv + +ROOT_KERN_DIR_64 = $(ROOT_MOD_DIR)/$(SUBDIR64) +ROOT_BRAND_DIR_64 = $(ROOT_MOD_DIR)/brand/$(SUBDIR64) +ROOT_DRV_DIR_64 = $(ROOT_MOD_DIR)/drv/$(SUBDIR64) +ROOT_DTRACE_DIR_64 = $(ROOT_MOD_DIR)/dtrace/$(SUBDIR64) +ROOT_EXEC_DIR_64 = $(ROOT_MOD_DIR)/exec/$(SUBDIR64) +ROOT_FS_DIR_64 = $(ROOT_MOD_DIR)/fs/$(SUBDIR64) +ROOT_SCHED_DIR_64 = $(ROOT_MOD_DIR)/sched/$(SUBDIR64) +ROOT_SOCK_DIR_64 = $(ROOT_MOD_DIR)/socketmod/$(SUBDIR64) +ROOT_STRMOD_DIR_64 = $(ROOT_MOD_DIR)/strmod/$(SUBDIR64) +ROOT_IPP_DIR_64 = $(ROOT_MOD_DIR)/ipp/$(SUBDIR64) +ROOT_SYS_DIR_64 = $(ROOT_MOD_DIR)/sys/$(SUBDIR64) +ROOT_MISC_DIR_64 = $(ROOT_MOD_DIR)/misc/$(SUBDIR64) +ROOT_KGSS_DIR_64 = $(ROOT_MOD_DIR)/misc/kgss/$(SUBDIR64) +ROOT_SCSI_VHCI_DIR_64 = $(ROOT_MOD_DIR)/misc/scsi_vhci/$(SUBDIR64) +ROOT_PMCS_FW_DIR_64 = $(ROOT_MOD_DIR)/misc/pmcs/$(SUBDIR64) +ROOT_QLC_FW_DIR_64 = $(ROOT_MOD_DIR)/misc/qlc/$(SUBDIR64) +ROOT_EMLXS_FW_DIR_64 = $(ROOT_MOD_DIR)/misc/emlxs/$(SUBDIR64) +ROOT_NLMISC_DIR_64 = $(ROOT_MOD_DIR)/misc/$(SUBDIR64) +ROOT_MACH_DIR_64 = $(ROOT_MOD_DIR)/mach/$(SUBDIR64) +ROOT_CPU_DIR_64 = $(ROOT_MOD_DIR)/cpu/$(SUBDIR64) +ROOT_TOD_DIR_64 = $(ROOT_MOD_DIR)/tod/$(SUBDIR64) +ROOT_FONT_DIR_64 = $(ROOT_MOD_DIR)/fonts/$(SUBDIR64) +ROOT_DACF_DIR_64 = $(ROOT_MOD_DIR)/dacf/$(SUBDIR64) +ROOT_CRYPTO_DIR_64 = $(ROOT_MOD_DIR)/crypto/$(SUBDIR64) +ROOT_MAC_DIR_64 = $(ROOT_MOD_DIR)/mac/$(SUBDIR64) +ROOT_KICONV_DIR_64 = $(ROOT_MOD_DIR)/kiconv/$(SUBDIR64) + +ROOT_KERN_DIR = $(ROOT_KERN_DIR_$(CLASS)) +ROOT_BRAND_DIR = $(ROOT_BRAND_DIR_$(CLASS)) +ROOT_DRV_DIR = $(ROOT_DRV_DIR_$(CLASS)) +ROOT_DTRACE_DIR = $(ROOT_DTRACE_DIR_$(CLASS)) +ROOT_EXEC_DIR = $(ROOT_EXEC_DIR_$(CLASS)) +ROOT_FS_DIR = $(ROOT_FS_DIR_$(CLASS)) +ROOT_SCHED_DIR = $(ROOT_SCHED_DIR_$(CLASS)) +ROOT_SOCK_DIR = $(ROOT_SOCK_DIR_$(CLASS)) +ROOT_STRMOD_DIR = $(ROOT_STRMOD_DIR_$(CLASS)) +ROOT_IPP_DIR = $(ROOT_IPP_DIR_$(CLASS)) +ROOT_SYS_DIR = $(ROOT_SYS_DIR_$(CLASS)) +ROOT_MISC_DIR = $(ROOT_MISC_DIR_$(CLASS)) +ROOT_KGSS_DIR = $(ROOT_KGSS_DIR_$(CLASS)) +ROOT_SCSI_VHCI_DIR = $(ROOT_SCSI_VHCI_DIR_$(CLASS)) +ROOT_PMCS_FW_DIR = $(ROOT_PMCS_FW_DIR_$(CLASS)) +ROOT_QLC_FW_DIR = $(ROOT_QLC_FW_DIR_$(CLASS)) +ROOT_EMLXS_FW_DIR = $(ROOT_EMLXS_FW_DIR_$(CLASS)) +ROOT_NLMISC_DIR = $(ROOT_NLMISC_DIR_$(CLASS)) +ROOT_MACH_DIR = $(ROOT_MACH_DIR_$(CLASS)) +ROOT_CPU_DIR = $(ROOT_CPU_DIR_$(CLASS)) +ROOT_TOD_DIR = $(ROOT_TOD_DIR_$(CLASS)) +ROOT_FONT_DIR = $(ROOT_FONT_DIR_$(CLASS)) +ROOT_DACF_DIR = $(ROOT_DACF_DIR_$(CLASS)) +ROOT_CRYPTO_DIR = $(ROOT_CRYPTO_DIR_$(CLASS)) +ROOT_MAC_DIR = $(ROOT_MAC_DIR_$(CLASS)) +ROOT_KICONV_DIR = $(ROOT_KICONV_DIR_$(CLASS)) + +ROOT_MOD_DIRS_32 = $(ROOT_BRAND_DIR_32) $(ROOT_DRV_DIR_32) +ROOT_MOD_DIRS_32 = $(ROOT_BRAND_DIR_32) $(ROOT_DRV_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_EXEC_DIR_32) $(ROOT_DTRACE_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_FS_DIR_32) $(ROOT_SCHED_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_STRMOD_DIR_32) $(ROOT_SYS_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_IPP_DIR_32) $(ROOT_SOCK_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_MISC_DIR_32) $(ROOT_MACH_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_KGSS_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_SCSI_VHCI_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_PMCS_FW_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_QLC_FW_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_EMLXS_FW_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_CPU_DIR_32) $(ROOT_FONT_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_TOD_DIR_32) $(ROOT_DACF_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_CRYPTO_DIR_32) $(ROOT_MAC_DIR_32) +ROOT_MOD_DIRS_32 += $(ROOT_KICONV_DIR_32) + +USR_MOD_DIR = $(ROOT)/usr/kernel + +USR_DRV_DIR_32 = $(USR_MOD_DIR)/drv +USR_EXEC_DIR_32 = $(USR_MOD_DIR)/exec +USR_FS_DIR_32 = $(USR_MOD_DIR)/fs +USR_SCHED_DIR_32 = $(USR_MOD_DIR)/sched +USR_SOCK_DIR_32 = $(USR_MOD_DIR)/socketmod +USR_STRMOD_DIR_32 = $(USR_MOD_DIR)/strmod +USR_SYS_DIR_32 = $(USR_MOD_DIR)/sys +USR_MISC_DIR_32 = $(USR_MOD_DIR)/misc +USR_DACF_DIR_32 = $(USR_MOD_DIR)/dacf +USR_PCBE_DIR_32 = $(USR_MOD_DIR)/pcbe +USR_DTRACE_DIR_32 = $(USR_MOD_DIR)/dtrace +USR_BRAND_DIR_32 = $(USR_MOD_DIR)/brand + +USR_DRV_DIR_64 = $(USR_MOD_DIR)/drv/$(SUBDIR64) +USR_EXEC_DIR_64 = $(USR_MOD_DIR)/exec/$(SUBDIR64) +USR_FS_DIR_64 = $(USR_MOD_DIR)/fs/$(SUBDIR64) +USR_SCHED_DIR_64 = $(USR_MOD_DIR)/sched/$(SUBDIR64) +USR_SOCK_DIR_64 = $(USR_MOD_DIR)/socketmod/$(SUBDIR64) +USR_STRMOD_DIR_64 = $(USR_MOD_DIR)/strmod/$(SUBDIR64) +USR_SYS_DIR_64 = $(USR_MOD_DIR)/sys/$(SUBDIR64) +USR_MISC_DIR_64 = $(USR_MOD_DIR)/misc/$(SUBDIR64) +USR_DACF_DIR_64 = $(USR_MOD_DIR)/dacf/$(SUBDIR64) +USR_PCBE_DIR_64 = $(USR_MOD_DIR)/pcbe/$(SUBDIR64) +USR_DTRACE_DIR_64 = $(USR_MOD_DIR)/dtrace/$(SUBDIR64) +USR_BRAND_DIR_64 = $(USR_MOD_DIR)/brand/$(SUBDIR64) + +USR_DRV_DIR = $(USR_DRV_DIR_$(CLASS)) +USR_EXEC_DIR = $(USR_EXEC_DIR_$(CLASS)) +USR_FS_DIR = $(USR_FS_DIR_$(CLASS)) +USR_SCHED_DIR = $(USR_SCHED_DIR_$(CLASS)) +USR_SOCK_DIR = $(USR_SOCK_DIR_$(CLASS)) +USR_STRMOD_DIR = $(USR_STRMOD_DIR_$(CLASS)) +USR_SYS_DIR = $(USR_SYS_DIR_$(CLASS)) +USR_MISC_DIR = $(USR_MISC_DIR_$(CLASS)) +USR_DACF_DIR = $(USR_DACF_DIR_$(CLASS)) +USR_PCBE_DIR = $(USR_PCBE_DIR_$(CLASS)) +USR_DTRACE_DIR = $(USR_DTRACE_DIR_$(CLASS)) +USR_BRAND_DIR = $(USR_BRAND_DIR_$(CLASS)) + +USR_MOD_DIRS_32 = $(USR_DRV_DIR_32) $(USR_EXEC_DIR_32) +USR_MOD_DIRS_32 += $(USR_FS_DIR_32) $(USR_SCHED_DIR_32) +USR_MOD_DIRS_32 += $(USR_STRMOD_DIR_32) $(USR_SYS_DIR_32) +USR_MOD_DIRS_32 += $(USR_MISC_DIR_32) $(USR_DACF_DIR_32) +USR_MOD_DIRS_32 += $(USR_PCBE_DIR_32) +USR_MOD_DIRS_32 += $(USR_DTRACE_DIR_32) $(USR_BRAND_DIR_32) +USR_MOD_DIRS_32 += $(USR_SOCK_DIR_32) + +# +# +# +#include $(SRC)/Makefile.psm XXX + +# +# The "-r" on the remove may be considered temporary, but is required +# while the replacement of the SUNW,SPARCstation-10,SX directory by +# a symbolic link is being propagated. +# +# IMPORTANT:: if you change any of these INS.mumble rules, then you MUST also +# change the corresponding override definitions in $CLOSED/Makefile.tonic. +# If you do not do this, then the closedbins build for the OpenSolaris +# community will break. PS, the gatekeepers will be upset too. +# +INS.slink1= $(RM) -r $@; $(SYMLINK) $(PLATFORM) $@ +INS.slink2= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/$(@F) $@ +INS.slink3= $(RM) -r $@; $(SYMLINK) $(IMPLEMENTED_PLATFORM) $@ +INS.slink4= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/include $@ +INS.slink5= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/sbin $@ +INS.slink6= $(RM) -r $@; $(SYMLINK) ../../$(PLATFORM)/lib/$(MODULE) $@ +INS.slink7= $(RM) -r $@; $(SYMLINK) ../../$(PLATFORM)/sbin/$(@F) $@ + +ROOT_PLAT_LINKS = $(PLAT_LINKS:%=$(ROOT_PLAT_DIR)/%) +ROOT_PLAT_LINKS_2 = $(PLAT_LINKS_2:%=$(ROOT_PLAT_DIR)/%) +USR_PLAT_LINKS = $(PLAT_LINKS:%=$(USR_PLAT_DIR)/%) +USR_PLAT_LINKS_2 = $(PLAT_LINKS_2:%=$(USR_PLAT_DIR)/%) + +# +# Collection of all relevant, delivered kernel modules. +# +# Note that we insist on building genunix first, because everything else +# uniquifies against it. When doing a 'make' from usr/src/uts/, we'll enter +# the platform directories first. These will cd into the corresponding genunix +# directory and build it. So genunix /shouldn't/ get rebuilt when we get to +# building all the kernel modules. However, due to an as-yet-unexplained +# problem with dependencies, sometimes it does get rebuilt, which then messes +# up the other modules. So we always force the issue here rather than try to +# build genunix in parallel with everything else. +# +PARALLEL_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \ + $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \ + $(NLMISC_KMODS) $(MACH_KMODS) $(CPU_KMODS) $(GSS_KMODS) \ + $(MMU_KMODS) $(DACF_KMODS) $(EXPORT_KMODS) $(IPP_KMODS) \ + $(CRYPTO_KMODS) $(PCBE_KMODS) \ + $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \ + $(BRAND_KMODS) $(KICONV_KMODS) \ + $(SOCKET_KMODS) + +KMODS = $(GENUNIX_KMODS) $(PARALLEL_KMODS) + +$(PARALLEL_KMODS): $(GENUNIX_KMODS) + +$(CLOSED_BUILD)CLOSED_KMODS = $(CLOSED_DRV_KMODS) $(CLOSED_TOD_KMODS) \ + $(CLOSED_MISC_KMODS) $(CLOSED_CPU_KMODS) \ + $(CLOSED_NLMISC_KMODS) $(CLOSED_DRV_KMODS_$(CLASS)) + +LINT_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \ + $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \ + $(MACH_KMODS) $(GSS_KMODS) $(DACF_KMODS) $(IPP_KMODS) \ + $(CRYPTO_KMODS) $(PCBE_KMODS) \ + $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \ + $(BRAND_KMODS) $(KICONV_KMODS) $(SOCKET_KMODS) + +$(CLOSED_BUILD)CLOSED_LINT_KMODS = $(CLOSED_DRV_KMODS) $(CLOSED_TOD_KMODS) \ + $(CLOSED_MISC_KMODS) $(CLOSED_DRV_KMODS_$(CLASS)) + +THIS_YEAR:sh= /bin/date +%Y +$(OBJS_DIR)/logsubr.o := CPPFLAGS += -DTHIS_YEAR=$(THIS_YEAR) +$(OBJS_DIR)/logsubr.ln := CPPFLAGS += -DTHIS_YEAR=$(THIS_YEAR) + +# +# Files to be compiled with -xa, to generate basic block execution +# count data. +# +# There are several ways to compile parts of the kernel for kcov: +# 1) Add targets to BB_FILES here or in other Makefiles +# (they must in the form of $(OBJS_DIR)/target.o) +# 2) setenv BB_FILES '$(XXX_OBJS:%=$(OBJS_DIR)/%)' +# 3) setenv BB_FILES '$(OBJECTS)' +# +# Do NOT setenv CFLAGS -xa, as that will cause infinite recursion +# in unix_bb.o +# +BB_FILES = +$(BB_FILES) := XAOPT = -xa + +# +# The idea here is for unix_bb.o to be in all kernels except the +# kernel which actually gets shipped to customers. In practice, +# $(RELEASE_BUILD) is on for a number of the late beta and fcs builds. +# +CODE_COVERAGE= +$(RELEASE_BUILD)CODE_COVERAGE:sh= echo \\043 +$(CODE_COVERAGE)$(OBJS_DIR)/unix_bb.o := CPPFLAGS += -DKCOV +$(CODE_COVERAGE)$(OBJS_DIR)/unix_bb.ln := CPPFLAGS += -DKCOV + +# +# Do not let unix_bb.o get compiled with -xa! +# +$(OBJS_DIR)/unix_bb.o := XAOPT = + +# +# Privilege files +# +PRIVS_AWK = $(SRC)/uts/common/os/privs.awk +PRIVS_DEF = $(SRC)/uts/common/os/priv_defs + +# +# USB device data +# +USBDEVS_AWK = $(SRC)/uts/common/io/usb/usbdevs2h.awk +USBDEVS_DATA = $(SRC)/uts/common/io/usb/usbdevs diff --git a/usr/src/uts/common/Makefile b/usr/src/uts/common/Makefile new file mode 100644 index 0000000..1f20c75 --- /dev/null +++ b/usr/src/uts/common/Makefile @@ -0,0 +1,31 @@ +# +# 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 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# uts/common/Makefile +# +include $(SRC)/Makefile.master + +.KEEP_STATE: diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files new file mode 100644 index 0000000..e5b1505 --- /dev/null +++ b/usr/src/uts/common/Makefile.files @@ -0,0 +1,116 @@ +# +# 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) 1991, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# + +# +# This Makefile defines all file modules for the directory uts/common +# and its children. These are the source files which may be considered +# common to all SunOS systems. + +COMMON_CORE_OBJS += + +CORE_OBJS += $(COMMON_CORE_OBJS) $($(MACH)_CORE_OBJS) + +ZLIB_OBJS = + +GENUNIX_OBJS += + +# +# Stubs for the stand-alone linker/loader +# +sparc_GENSTUBS_OBJS = + +i386_GENSTUBS_OBJS = + +COMMON_GENSTUBS_OBJS = + +GENSTUBS_OBJS += $(COMMON_GENSTUBS_OBJS) $($(MACH)_GENSTUBS_OBJS) + +# +# DTrace and DTrace Providers +# + +# +# Driver (pseudo-driver) Modules +# + +FOO_OBJS += foo.o + + + +# +# streams modules +# + +# +# ID mapping module +# + +# +# scheduling class modules +# + +# +# Inter-Process Communication (IPC) modules +# + +# +# bignum module +# + +# +# kernel cryptographic framework +# + +# +# kernel SSL +# + +# +# misc. modules +# + + +# +# Build up defines and paths. +# +LINT_DEFS += -Dunix + +# +# This duality can be removed when the native and target compilers +# are the same (or at least recognize the same command line syntax!) +# It is a bug in the current compilation system that the assember +# can't process the -Y I, flag. +# +NATIVE_INC_PATH += $(INC_PATH) $(CCYFLAG)$(UTSBASE)/common +AS_INC_PATH += $(INC_PATH) -I$(UTSBASE)/common +INCLUDE_PATH += $(INC_PATH) $(CCYFLAG)$(UTSBASE)/common + + +# nulldriver module +# +NULLDRIVER_OBJS = nulldriver.o + +TPM_OBJS = tpm.o tpm_hcall.o diff --git a/usr/src/uts/common/Makefile.rules b/usr/src/uts/common/Makefile.rules new file mode 100644 index 0000000..6507381 --- /dev/null +++ b/usr/src/uts/common/Makefile.rules @@ -0,0 +1,55 @@ +# +# 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) 1991, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# + +# +# uts/common/Makefile.rules +# +# This Makefile defines all the file build rules for the directory +# uts/common and its children. These are the source files which may +# be considered common to all SunOS systems. +# +# The following two-level ordering must be maintained in this file. +# Lines are sorted first in order of decreasing specificity based on +# the first directory component. That is, sun4u rules come before +# sparc rules come before common rules. +# +# Lines whose initial directory components are equal are sorted +# alphabetically by the remaining components. + +# +# Section 1a: C objects build rules +# + +$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/foo/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + +# +# Section 1b: Lint `objects' +# + +$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/foo/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) diff --git a/usr/src/uts/common/io/foo/foo.c b/usr/src/uts/common/io/foo/foo.c new file mode 100644 index 0000000..2780878 --- /dev/null +++ b/usr/src/uts/common/io/foo/foo.c @@ -0,0 +1,219 @@ +/* + * 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 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ + + +/* + * Sample driver + */ + +#include <sys/types.h> +#include <sys/errno.h> +#include <sys/stat.h> + +#include <sys/file.h> +#include <sys/open.h> +#include <sys/poll.h> +#include <sys/uio.h> +#include <sys/cred.h> +#include <sys/modctl.h> +#include <sys/conf.h> +#include <sys/ddi.h> +#include <sys/sunddi.h> + +#include <sys/foo.h> + +static dev_info_t *foo_dip; +static uint32_t foo_count; + +static int foo_open(dev_t *, int, int, cred_t *); +static int foo_close(dev_t, int, int, cred_t *); +static int foo_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, + cred_t *credp, int *rvalp); + +static int foo_attach(dev_info_t *, ddi_attach_cmd_t); +static int foo_detach(dev_info_t *, ddi_detach_cmd_t); +static int foo_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); + +/* DDI declarations */ +static struct cb_ops foo_cb_ops = { + foo_open, /* open */ + foo_close, /* close */ + nodev, /* strategy */ + nodev, /* print */ + nodev, /* dump */ + nodev, /* read */ + nodev, /* write */ + foo_ioctl, /* ioctl */ + nodev, /* devmap */ + nodev, /* mmap */ + nodev, /* segmap */ + nochpoll, /* chpoll */ + ddi_prop_op, /* prop_op */ + NULL, /* streamtab */ + (D_NEW | D_MP), /* cb_flag */ + CB_REV, /* cb_rev */ + nodev, /* aread */ + nodev /* awrite */ +}; + +static struct dev_ops foo_ops = { + DEVO_REV, /* devo_rev, */ + 0, /* refcnt */ + foo_getinfo, /* get_dev_info */ + nulldev, /* identify */ + nulldev, /* probe */ + foo_attach, /* attach */ + foo_detach, /* detach */ + nodev, /* reset */ + &foo_cb_ops, /* driver operations */ + NULL, /* bus operations */ + NULL, /* power */ + ddi_quiesce_not_needed, /* quiesce */ +}; + +/* Modlinkage */ +static struct modldrv modldrv = { + &mod_driverops, + "foo sample device", + &foo_ops +}; + +static struct modlinkage modlinkage = { MODREV_1, { &modldrv, NULL } }; + + +/* DDI glue */ + +int +_init(void) +{ + return (mod_install(&modlinkage)); +} + +int +_fini(void) +{ + return (mod_remove(&modlinkage)); +} + +int +_info(struct modinfo *modinfop) +{ + return (mod_info(&modlinkage, modinfop)); +} + +static int +foo_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) +{ + if (cmd != DDI_ATTACH) + return (DDI_FAILURE); + + if (ddi_create_minor_node(dip, "foo", S_IFCHR, 0, + DDI_PSEUDO, 0) == DDI_FAILURE) { + ddi_remove_minor_node(dip, NULL); + return (DDI_FAILURE); + } + + foo_dip = dip; + + return (DDI_SUCCESS); +} + +static int +foo_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) +{ + if (cmd != DDI_DETACH) + return (DDI_FAILURE); + + foo_dip = NULL; + ddi_remove_minor_node(dip, NULL); + + return (DDI_SUCCESS); +} + +/*ARGSUSED*/ +static int +foo_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) +{ + int error; + + switch (infocmd) { + case DDI_INFO_DEVT2DEVINFO: + *result = foo_dip; + error = DDI_SUCCESS; + break; + case DDI_INFO_DEVT2INSTANCE: + *result = (void *)0; + error = DDI_SUCCESS; + break; + default: + error = DDI_FAILURE; + } + return (error); +} + +/*ARGSUSED3*/ +static int +foo_open(dev_t *devp, int flag, int otyp, cred_t *credp) +{ + if (otyp != OTYP_CHR) + return (EINVAL); + + if (flag & FEXCL) + return (EINVAL); + + return (0); +} + +/*ARGSUSED*/ +static int +foo_close(dev_t dev, int flag, int otyp, cred_t *credp) +{ + return (0); +} + +/*ARGSUSED*/ +static int +foo_ioctl(dev_t dev, int cmd, intptr_t arg, int flags, /* model.h */ + cred_t *cr, int *rvalp) +{ + int err; + + err = 0; + switch (cmd) { + case FOO_IOC_GETCNT: + atomic_inc_32(&foo_count); + if (ddi_copyout(&foo_count, (void *)arg, + sizeof (foo_count), flags)) + err = EFAULT; + break; + + default: + err = ENOTTY; + break; + } + + return (err); +} diff --git a/usr/src/uts/common/io/foo/foo.conf b/usr/src/uts/common/io/foo/foo.conf new file mode 100644 index 0000000..9b54560 --- /dev/null +++ b/usr/src/uts/common/io/foo/foo.conf @@ -0,0 +1,16 @@ +# +# 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 Nexenta Systems, Inc. All rights reserved. +# +name="nsmb" parent="pseudo"; + diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile new file mode 100644 index 0000000..414e26e --- /dev/null +++ b/usr/src/uts/common/sys/Makefile @@ -0,0 +1,64 @@ +# +# 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) 1989, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/uts/Makefile.uts + +FILEMODE=644 + +# +# Note that the following headers are present in the kernel but +# neither installed or shipped as part of the product: +# cpuid_drv.h: Private interface for cpuid consumers +# unix_bb_info.h: Private interface to kcov +# + +i386_HDRS= +sparc_HDRS= + +# Generated headers +GENHDRS= + +CHKHDRS= + +HDRS= \ + $(GENHDRS) \ + $(CHKHDRS) + +all_h: $(GENHDRS) + +install_h: \ + $(ROOTDIRS) \ + .WAIT \ + $(ROOTHDRS) \ + +clean: + $(RM) $(GENHDRS) + +clobber: clean + +check: $(CHECKHDRS) + +FRC: + diff --git a/usr/src/uts/common/sys/foo.h b/usr/src/uts/common/sys/foo.h new file mode 100644 index 0000000..841e2ce --- /dev/null +++ b/usr/src/uts/common/sys/foo.h @@ -0,0 +1,7 @@ + +#define FOO_IOC_GETCNT 1 +typedef uint32_t foocnt_t; + +#ifndef _KERNEL +extern int foo_getcnt(uint32_t *); +#endif diff --git a/usr/src/uts/intel/Makefile b/usr/src/uts/intel/Makefile new file mode 100644 index 0000000..8ddcc8d --- /dev/null +++ b/usr/src/uts/intel/Makefile @@ -0,0 +1,97 @@ +# +# 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 +# +# uts/intel/Makefile +# +# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# This makefile drives the production of all implementation architecture +# independent modules for Intel processors. + +UTSBASE = .. + +include Makefile.intel + +LINT_KMODLIBS = $(LINT_KMODS) +LINT_LIBS = $(LINT_LIB) $(GEN_LINT_LIB) \ + $(LINT_KMODLIBS:%=$(LINT_LIB_DIR)/llib-l%.ln) + +def := TARGET= def +all := TARGET= all +install := TARGET= install +clean := TARGET= clean +clobber := TARGET= clobber +lint := TARGET= lint +modlintlib := TARGET= modlintlib +modlist := TARGET= modlist +modlist := NO_STATE= -K $$MODSTATE$$$$ +clean.lint := TARGET= clean.lint +check := TARGET= check +install_h := TARGET= install_h + +.KEEP_STATE: + +.PARALLEL: $(PARALLEL_KMODS) $(XMODS) $(LINT_DEPS) + +def all install clean clobber modlist: genunix .WAIT $(KMODS) $(XMODS) + +modlintlib clean.lint: $(LINT_KMODS) $(XMODS) + +genunix $(KMODS) $(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) + +$(XMODS): FRC + @if [ -f $@/Makefile ]; then \ + cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET); \ + else \ + true; \ + fi + +install_h check: FRC +# @cd sys; pwd; $(MAKE) $(TARGET) +# @cd asm; pwd; $(MAKE) $(TARGET) +# @cd ia32/sys; pwd; $(MAKE) $(TARGET) +# @cd amd64/sys; pwd; $(MAKE) $(TARGET) + +# +# Full kernel lint target. +# +LINT_TARGET = globallint + +globallint: + @pwd + @-$(ECHO) "\nFULL KERNEL: global crosschecks:" + @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) + +lint: modlintlib .WAIT $(LINT_DEPS) + +# EXPORT DELETE START + +EXPORT_SRC: + $(RM) Makefile+ + sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \ + < Makefile > Makefile+ + $(MV) Makefile+ Makefile + $(CHMOD) 444 Makefile + +# EXPORT DELETE END + +include ../Makefile.targ diff --git a/usr/src/uts/intel/Makefile.files b/usr/src/uts/intel/Makefile.files new file mode 100644 index 0000000..60c9f65 --- /dev/null +++ b/usr/src/uts/intel/Makefile.files @@ -0,0 +1,98 @@ +# +# 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) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# + +# +# This Makefile defines all file modules and build rules for the +# directory uts/intel and its children. These are the source files which +# are specific to x86 processor architectures. +# + +# +# Core (unix) objects +# +CORE_OBJS += + +# +# 64-bit multiply/divide compiler helper routines +# used only for ia32 +# + +SPECIAL_OBJS_32 += + +# +# Generic-unix Module +# +GENUNIX_OBJS += + + +# +# PROM Routines +# +GENUNIX_OBJS += + +# +# file system modules +# +CORE_OBJS += + +# +# ZFS file system module +# +ZFS_OBJS += + +# +# Decompression code +# +CORE_OBJS += + +# +# Microcode utilities +# +CORE_OBJS += + +# +# Driver modules +# + +# +# Kernel linker +# + +# +# misc. modules +# + + +# +# special files +# +MODSTUB_OBJ += + + +INC_PATH += -I$(UTSBASE)/intel + + +CPR_INTEL_OBJS += cpr_intel.o diff --git a/usr/src/uts/intel/Makefile.intel b/usr/src/uts/intel/Makefile.intel new file mode 100644 index 0000000..c3b2c91 --- /dev/null +++ b/usr/src/uts/intel/Makefile.intel @@ -0,0 +1,38 @@ +# +# 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 2011 Nexenta Systems, Inc. All rights reserved. +# + +UTSTREE=$(UTSBASE) + +include $(UTSBASE)/intel/Makefile.intel.shared + +# +# Ensure that the variable member of the cpu_t (cpu_m) is defined +# for the lint builds so as not to cause lint errors during the +# global cross check. +# +LINTFLAGS += -D_MACHDEP -I$(UTSBASE)/i86pc diff --git a/usr/src/uts/intel/Makefile.intel.shared b/usr/src/uts/intel/Makefile.intel.shared new file mode 100644 index 0000000..05481db --- /dev/null +++ b/usr/src/uts/intel/Makefile.intel.shared @@ -0,0 +1,267 @@ +# +# 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) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. + +# +# This makefile contains the common definitions for all intel +# implementation architecture independent modules. +# + +# +# Machine type (implementation architecture): +# +PLATFORM = i86pc + +# +# Everybody needs to know how to build modstubs.o and to locate unix.o. +# Note that unix.o must currently be selected from among the possible +# "implementation architectures". Note further, that unix.o is only +# used as an optional error check for undefines so (theoretically) +# any "implementation architectures" could be used. We choose i86pc +# because it is the reference port. +# +UNIX_DIR = $(UTSBASE)/i86pc/unix +GENLIB_DIR = $(UTSBASE)/intel/genunix +IPDRV_DIR = $(UTSBASE)/intel/ip +MODSTUBS_DIR = $(UNIX_DIR) +DSF_DIR = $(UTSBASE)/$(PLATFORM)/genassym +LINTS_DIR = $(OBJS_DIR) +LINT_LIB_DIR = $(UTSBASE)/intel/lint-libs/$(OBJS_DIR) + +UNIX_O = $(UNIX_DIR)/$(OBJS_DIR)/unix.o +GENLIB = $(GENLIB_DIR)/$(OBJS_DIR)/libgenunix.so +MODSTUBS_O = $(MODSTUBS_DIR)/$(OBJS_DIR)/modstubs.o +LINT_LIB = $(UTSBASE)/i86pc/lint-libs/$(OBJS_DIR)/llib-lunix.ln +GEN_LINT_LIB = $(UTSBASE)/intel/lint-libs/$(OBJS_DIR)/llib-lgenunix.ln + +# +# Include the makefiles which define build rule templates, the +# collection of files per module, and a few specific flags. Note +# that order is significant, just as with an include path. The +# first build rule template which matches the files name will be +# used. By including these in order from most machine dependent +# to most machine independent, we allow a machine dependent file +# to be used in preference over a machine independent version +# (Such as a machine specific optimization, which preserves the +# interfaces.) +# +include $(UTSTREE)/intel/Makefile.files +include $(UTSTREE)/common/Makefile.files + +# +# ----- TRANSITIONAL SECTION -------------------------------------------------- +# + +# +# Not everything which *should* be a module is a module yet. The +# following is a list of such objects which are currently part of +# genunix but which might someday become kmods. This must be +# defined before we include Makefile.uts, or else genunix's build +# won't be as parallel as we might like. +# +NOT_YET_KMODS = + +# +# ----- END OF TRANSITIONAL SECTION ------------------------------------------- +# +# Include machine independent rules. Note that this does not imply +# that the resulting module from rules in Makefile.uts is machine +# independent. Only that the build rules are machine independent. +# +include $(UTSBASE)/Makefile.uts + +# +# The following must be defined for all implementations: +# +MODSTUBS = $(UTSBASE)/intel/ia32/ml/modstubs.s + +# +# Define supported builds +# +DEF_BUILDS = $(DEF_BUILDS64) $(DEF_BUILDS32) +ALL_BUILDS = $(ALL_BUILDS64) $(ALL_BUILDS32) + +# +# x86 or amd64 inline templates +# +INLINES_32 = $(UTSBASE)/intel/ml/ia32.il +INLINES_64 = $(UTSBASE)/intel/ml/amd64.il +INLINES += $(INLINES_$(CLASS)) + +# +# kernel-specific optimizations; override default in Makefile.master +# + +CFLAGS_XARCH_32 = $(i386_CFLAGS) +CFLAGS_XARCH_64 = $(amd64_CFLAGS) +CFLAGS_XARCH = $(CFLAGS_XARCH_$(CLASS)) + +COPTFLAG_32 = $(COPTFLAG) +COPTFLAG_64 = $(COPTFLAG64) +COPTIMIZE = $(COPTFLAG_$(CLASS)) + +CFLAGS = $(CFLAGS_XARCH) +CFLAGS += $(COPTIMIZE) +CFLAGS += $(INLINES) -D_ASM_INLINES +CFLAGS += $(CCMODE) +CFLAGS += $(SPACEFLAG) +CFLAGS += $(CCUNBOUND) +CFLAGS += $(CFLAGS_uts) +CFLAGS += -xstrconst + +ASFLAGS_XARCH_32 = $(i386_ASFLAGS) +ASFLAGS_XARCH_64 = $(amd64_ASFLAGS) +ASFLAGS_XARCH = $(ASFLAGS_XARCH_$(CLASS)) + +ASFLAGS += $(ASFLAGS_XARCH) + +# +# Define the base directory for installation. +# +BASE_INS_DIR = $(ROOT) + +# +# Debugging level +# +# Special knowledge of which special debugging options affect which +# file is used to optimize the build if these flags are changed. +# +DEBUG_DEFS_OBJ32 = +DEBUG_DEFS_DBG32 = -DDEBUG +DEBUG_DEFS_OBJ64 = +DEBUG_DEFS_DBG64 = -DDEBUG +DEBUG_DEFS = $(DEBUG_DEFS_$(BUILD_TYPE)) + +DEBUG_COND_OBJ32 :sh = echo \\043 +DEBUG_COND_DBG32 = +DEBUG_COND_OBJ64 :sh = echo \\043 +DEBUG_COND_DBG64 = +IF_DEBUG_OBJ = $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/ + +$(IF_DEBUG_OBJ)syscall.o := DEBUG_DEFS += -DSYSCALLTRACE +$(IF_DEBUG_OBJ)clock.o := DEBUG_DEFS += -DKSLICE=1 + +# +# Collect the preprocessor definitions to be associated with *all* +# files. +# +ALL_DEFS = $(DEBUG_DEFS) $(OPTION_DEFS) + +# +# The kernels modules which are "implementation architecture" +# specific for this machine are enumerated below. Note that most +# of these modules must exist (in one form or another) for each +# architecture. +# +# Common Drivers (usually pseudo drivers) (/kernel/drv) +# DRV_KMODS are built both 32-bit and 64-bit +# DRV_KMODS_32 are built only 32-bit +# DRV_KMODS_64 are built only 64-bit +# +DRV_KMODS += foo + +# +# Common code drivers +# + +# +# Brand modules +# +BRAND_KMODS += + +# +# Exec Class Modules (/kernel/exec): +# +EXEC_KMODS += + +# +# Scheduling Class Modules (/kernel/sched): +# +SCHED_KMODS += + +# +# File System Modules (/kernel/fs): +# +FS_KMODS += + +# +# Streams Modules (/kernel/strmod): +# +STRMOD_KMODS += + +# +# 'System' Modules (/kernel/sys): +# +SYS_KMODS += + +# +# 'Misc' Modules (/kernel/misc) +# MISC_KMODS are built both 32-bit and 64-bit +# MISC_KMODS_32 are built only 32-bit +# MISC_KMODS_64 are built only 64-bit +# +MISC_KMODS += + +# +# Software Cryptographic Providers (/kernel/crypto): +# +CRYPTO_KMODS += + +# +# IP Policy Modules (/kernel/ipp) +# +IPP_KMODS += + +# +# generic-unix module (/kernel/genunix): +# +GENUNIX_KMODS += + +# +# 'Dacf' Modules (/kernel/dacf): +# + +# +# Performance Counter BackEnd modules (/usr/kernel/pcbe) +# +PCBE_KMODS += + +# +# MAC-Type Plugin Modules (/kernel/mac) +# +MAC_KMODS += + +# +# socketmod (kernel/socketmod) +# +SOCKET_KMODS += + +# +# kiconv modules (/kernel/kiconv): +# +KICONV_KMODS += + +# +# 'Dacf' Modules (/kernel/dacf): +# +DACF_KMODS += diff --git a/usr/src/uts/intel/Makefile.rules b/usr/src/uts/intel/Makefile.rules new file mode 100644 index 0000000..0698c7c --- /dev/null +++ b/usr/src/uts/intel/Makefile.rules @@ -0,0 +1,101 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# + +# +# This Makefile defines all file modules and build rules for the +# directory uts/intel and its children. These are the source files which +# are specific to the intel processor. +# +# The following two-level ordering must be maintained in this file. +# Lines are sorted first in order of decreasing specificity based on +# the first directory component. That is, sun4u rules come before +# sparc rules come before common rules. +# +# Lines whose initial directory components are equal are sorted +# alphabetically by the remaining components. + +# +# Need a way to distinguish between the ia32 and amd64 subdirs. +# +SUBARCH_DIR_32 = ia32 +SUBARCH_DIR_64 = amd64 +SUBARCH_DIR = $(SUBARCH_DIR_$(CLASS)) + +# +# Section 1a: C object build rules +# +$(OBJS_DIR)/%.o: $(SRC)/common/fs/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + +$(OBJS_DIR)/%.o: $(UTSBASE)/intel/zfs/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + +# +# krtld compiled into unix +# + +KRTLD_INC_PATH = -I$(UTSBASE)/common/krtld -I$(UTSBASE)/intel/sys +KRTLD_INC_PATH += -I$(UTSBASE)/intel/$(SUBARCH_DIR)/krtld + +KRTLD_CPPFLAGS_32 = -DELF_TARGET_386 +KRTLD_CPPFLAGS_64 = -DELF_TARGET_AMD64 -DMODDIR_SUFFIX=\"amd64\" +KRTLD_CPPFLAGS = $(KRTLD_CPPFLAGS_$(CLASS)) -D_KRTLD + +$(OBJS_DIR)/%.o: $(UTSBASE)/common/krtld/%.c + $(COMPILE.c) $(KRTLD_INC_PATH) $(KRTLD_CPPFLAGS) -o $@ $< + $(CTFCONVERT_O) + +$(OBJS_DIR)/%.o: $(UTSBASE)/intel/$(SUBARCH_DIR)/krtld/%.c + $(COMPILE.c) $(KRTLD_INC_PATH) $(KRTLD_CPPFLAGS) -o $@ $< + $(CTFCONVERT_O) + +# +# _DBOOT indicates that krtld is called from a dboot ELF section +# +$(OBJS_DIR)/kobj.o := CPPFLAGS += -D_DBOOT + +$(OBJS_DIR)/%.o: $(UTSBASE)/intel/$(SUBARCH_DIR)/krtld/%.s + $(COMPILE.s) $(KRTLD_INC_PATH) $(KRTLD_CPPFLAGS) -o $@ $< + $(CTFCONVERT_O) + +$(OBJS_DIR)/%.o: $(SRC)/common/util/$(SUBARCH_DIR)/%.c + $(COMPILE.c) $(KRTLD_INC_PATH) $(KRTLD_CPPFLAGS) -o $@ $< + $(CTFCONVERT_O) + + +# +# Section 1b: Lint `object' build rules. +# +$(LINTS_DIR)/%.ln: $(SRC)/common/fs/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) + +$(LINTS_DIR)/%.ln: $(UTSBASE)/intel/zfs/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) + +$(OBJS_DIR)/kobj.ln := CPPFLAGS += -D_DBOOT diff --git a/usr/src/uts/intel/Makefile.targ b/usr/src/uts/intel/Makefile.targ new file mode 100644 index 0000000..beddac8 --- /dev/null +++ b/usr/src/uts/intel/Makefile.targ @@ -0,0 +1,29 @@ +# 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 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# + +UTSTREE=$(UTSBASE) + +include $(UTSBASE)/intel/Makefile.targ.shared diff --git a/usr/src/uts/intel/Makefile.targ.shared b/usr/src/uts/intel/Makefile.targ.shared new file mode 100644 index 0000000..e18db74 --- /dev/null +++ b/usr/src/uts/intel/Makefile.targ.shared @@ -0,0 +1,44 @@ +# +# 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 +# +# +# uts/intel/Makefile.targ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# This Makefile defines the set of all required, target containing +# included Makefiles for the intel "implementation architecture". +# + +# +# Targets for all implementations: +# +include $(UTSBASE)/Makefile.targ + +# +# Target set for intel (order is not important, as it is with the +# isomorphic Makefile.files set). +# +include $(UTSTREE)/intel/Makefile.rules +include $(UTSTREE)/common/Makefile.rules diff --git a/usr/src/uts/intel/foo/Makefile b/usr/src/uts/intel/foo/Makefile new file mode 100644 index 0000000..fa39aca --- /dev/null +++ b/usr/src/uts/intel/foo/Makefile @@ -0,0 +1,101 @@ +# +# 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 +# +# +# uts/intel/foo/Makefile +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# This makefile drives the production of the foo `drv' +# kernel module. +# +# intel implementation architecture dependent +# + +# +# Path to the base of the uts directory tree (usually /usr/src/uts). +# +UTSBASE = ../.. + +# +# Define the module and object file sets. +# +MODULE = foo +OBJECTS = $(FOO_OBJS:%=$(OBJS_DIR)/%) +LINTS = $(FOO_OBJS:%.o=$(LINTS_DIR)/%.ln) +ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) +CONF_SRCDIR = $(UTSBASE)/common/io/foo + +# +# Include common rules. +# +include $(UTSBASE)/intel/Makefile.intel + +# +# Define targets +# +ALL_TARGET = $(BINARY) # $(SRC_CONFILE) +LINT_TARGET = $(MODULE).lint +INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) + +# +# Overrides +# + +# +# For now, disable these lint checks; maintainers should endeavor +# to investigate and remove these for maximum lint coverage. +# Please do not carry these forward to new Makefiles. +# +LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN + +# +# Driver depends on MAC +# +# LDFLAGS += -dy -N misc/mac + +# +# Default build targets. +# +.KEEP_STATE: + +def: $(DEF_DEPS) + +all: $(ALL_DEPS) + +clean: $(CLEAN_DEPS) + +clobber: $(CLOBBER_DEPS) + +lint: $(LINT_DEPS) + +modlintlib: $(MODLINTLIB_DEPS) + +clean.lint: $(CLEAN_LINT_DEPS) + +install: $(INSTALL_DEPS) + +# +# Include common targets. +# +include $(UTSBASE)/intel/Makefile.targ diff --git a/usr/src/uts/intel/genunix/Makefile b/usr/src/uts/intel/genunix/Makefile new file mode 100644 index 0000000..4f7456d --- /dev/null +++ b/usr/src/uts/intel/genunix/Makefile @@ -0,0 +1,37 @@ + +# This is just for ctfmerge; copy from the build machine. + +GUDIR=/kernel + +DBG_LINKS= debug32/genunix debug64/genunix +OBJ_LINKS= obj32/genunix obj64/genunix + +def: all +all: $(DBG_LINKS) $(OBJ_LINKS) + +$(DBG_LINKS) : FRC + -mkdir debug32 debug64 + -rm -f $(DBG_LINKS) + ln -s $(GUDIR)/genunix debug32/genunix + ln -s $(GUDIR)/amd64/genunix debug64/genunix + +$(OBJ_LINKS) : FRC + -mkdir obj32 obj64 + -rm -f $(OBJ_LINKS) + ln -s $(GUDIR)/genunix obj32/genunix + ln -s $(GUDIR)/amd64/genunix obj64/genunix + +clean: FRC + -rm -f $(DBG_LINKS) $(OBJ_LINKS) + +clobber: clean + +lint: + +modlintlib: + +clean.lint: + +install: all + +FRC: diff --git a/usr/src/uts/intel/ml/amd64.il b/usr/src/uts/intel/ml/amd64.il new file mode 100644 index 0000000..2afcf93 --- /dev/null +++ b/usr/src/uts/intel/ml/amd64.il @@ -0,0 +1,231 @@ +/* + * 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 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/ +/ In-line functions for amd64 kernels. +/ + +/ +/ return current thread pointer +/ +/ NOTE: the "0x18" should be replaced by the computed value of the +/ offset of "cpu_thread" from the beginning of the struct cpu. +/ Including "assym.h" does not work, however, since that stuff +/ is PSM-specific and is only visible to the 'unix' build anyway. +/ Same with current cpu pointer, where "0xc" should be replaced +/ by the computed value of the offset of "cpu_self". +/ Ugh -- what a disaster. +/ + .inline threadp,0 + movq %gs:0x18, %rax + .end + +/ +/ return current cpu pointer +/ + .inline curcpup,0 + movq %gs:0x10, %rax + .end + +/ +/ return caller +/ + .inline caller,0 + movq 8(%rbp), %rax + .end + +/ +/ convert ipl to spl. This is the identity function for i86 +/ + .inline ipltospl,0 + movq %rdi, %rax + .end + +/ +/ find the low order bit in a word +/ + .inline lowbit,4 + movq $-1, %rax + bsfq %rdi, %rax + incq %rax + .end + +/ +/ Networking byte order functions (too bad, Intel has the wrong byte order) +/ + + .inline htonll,4 + movq %rdi, %rax + bswapq %rax + .end + + .inline ntohll,4 + movq %rdi, %rax + bswapq %rax + .end + + .inline htonl,4 + movl %edi, %eax + bswap %eax + .end + + .inline ntohl,4 + movl %edi, %eax + bswap %eax + .end + + .inline htons,4 + movl %edi, %eax + bswap %eax + shrl $16, %eax + .end + + .inline ntohs,4 + movl %edi, %eax + bswap %eax + shrl $16, %eax + .end + +/* + * multiply two long numbers and yield a u_lonlong_t result + * Provided to manipulate hrtime_t values. + */ + /* XX64 These don't work correctly with SOS9 build 13.0 yet + .inline mul32, 8 + xorl %edx, %edx + movl %edi, %eax + mull %esi + shlq $32, %rdx + orq %rdx, %rax + ret + .end + */ +/* + * Unlock hres_lock and increment the count value. (See clock.h) + */ + .inline unlock_hres_lock, 0 + lock + incl hres_lock + .end + + .inline atomic_orb,8 + movl %esi, %eax + lock + orb %al,(%rdi) + .end + + .inline atomic_andb,8 + movl %esi, %eax + lock + andb %al,(%rdi) + .end + +/* + * atomic inc/dec operations. + * void atomic_inc16(uint16_t *addr) { ++*addr; } + * void atomic_dec16(uint16_t *addr) { --*addr; } + */ + .inline atomic_inc16,4 + lock + incw (%rdi) + .end + + .inline atomic_dec16,4 + lock + decw (%rdi) + .end + +/* + * atomic bit clear + */ + .inline atomic_btr32,8 + lock + btrl %esi, (%rdi) + setc %al + .end + +/* + * Call the pause instruction. To the Pentium 4 Xeon processor, it acts as + * a hint that the code sequence is a busy spin-wait loop. Without a pause + * instruction in these loops, the P4 Xeon processor may suffer a severe + * penalty when exiting the loop because the processor detects a possible + * memory violation. Inserting the pause instruction significantly reduces + * the likelihood of a memory order violation, improving performance. + * The pause instruction is a NOP on all other IA-32 processors. + */ + .inline ht_pause, 0 + pause + .end + +/* + * inlines for update_sregs(). + */ + .inline __set_ds, 0 + movw %di, %ds + .end + + .inline __set_es, 0 + movw %di, %es + .end + + .inline __set_fs, 0 + movw %di, %fs + .end + + .inline __set_gs, 0 + movw %di, %gs + .end + + /* + * OPTERON_ERRATUM_88 requires mfence + */ + .inline __swapgs, 0 + mfence + swapgs + .end + +/* + * prefetch 64 bytes + */ + + .inline prefetch_read_many,8 + prefetcht0 (%rdi) + prefetcht0 32(%rdi) + .end + + .inline prefetch_read_once,8 + prefetchnta (%rdi) + prefetchnta 32(%rdi) + .end + + .inline prefetch_write_many,8 + prefetcht0 (%rdi) + prefetcht0 32(%rdi) + .end + + .inline prefetch_write_once,8 + prefetcht0 (%rdi) + prefetcht0 32(%rdi) + .end diff --git a/usr/src/uts/intel/ml/ia32.il b/usr/src/uts/intel/ml/ia32.il new file mode 100644 index 0000000..78a2b6c --- /dev/null +++ b/usr/src/uts/intel/ml/ia32.il @@ -0,0 +1,218 @@ +/* + * 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 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/ +/ Inline functions for i386 kernels. +/ Shared between all x86 platform variants. +/ + +/ +/ return current thread pointer +/ +/ NOTE: the "0x10" should be replaced by the computed value of the +/ offset of "cpu_thread" from the beginning of the struct cpu. +/ Including "assym.h" does not work, however, since that stuff +/ is PSM-specific and is only visible to the 'unix' build anyway. +/ Same with current cpu pointer, where "0xc" should be replaced +/ by the computed value of the offset of "cpu_self". +/ Ugh -- what a disaster. +/ + .inline threadp,0 + movl %gs:0x10, %eax + .end + +/ +/ return current cpu pointer +/ + .inline curcpup,0 + movl %gs:0xc, %eax + .end + +/ +/ return caller +/ + .inline caller,0 + movl 4(%ebp), %eax + .end + +/ +/ convert ipl to spl. This is the identity function for i86 +/ + .inline ipltospl,0 + movl (%esp), %eax + .end + +/ +/ find the low order bit in a word +/ + .inline lowbit,4 + movl $-1, %eax + bsfl (%esp), %eax + incl %eax + .end + +/ +/ find the high order bit in a word +/ + .inline highbit,4 + movl $-1, %eax + bsrl (%esp), %eax + incl %eax + .end + +/ +/ Networking byte order functions (too bad, Intel has the wrong byte order) +/ + .inline htonll,4 + movl (%esp), %edx + movl 4(%esp), %eax + bswap %edx + bswap %eax + .end + + .inline ntohll,4 + movl (%esp), %edx + movl 4(%esp), %eax + bswap %edx + bswap %eax + .end + + .inline htonl,4 + movl (%esp), %eax + bswap %eax + .end + + .inline ntohl,4 + movl (%esp), %eax + bswap %eax + .end + + .inline htons,4 + movl (%esp), %eax + bswap %eax + shrl $16, %eax + .end + + .inline ntohs,4 + movl (%esp), %eax + bswap %eax + shrl $16, %eax + .end + +/* + * multiply two long numbers and yield a u_longlong_t result + * Provided to manipulate hrtime_t values. + */ + .inline mul32, 8 + movl 4(%esp), %eax + movl (%esp), %ecx + mull %ecx + .end + +/* + * Unlock hres_lock and increment the count value. (See clock.h) + */ + .inline unlock_hres_lock, 0 + lock + incl hres_lock + .end + + .inline atomic_orb,8 + movl (%esp), %eax + movl 4(%esp), %edx + lock + orb %dl,(%eax) + .end + + .inline atomic_andb,8 + movl (%esp), %eax + movl 4(%esp), %edx + lock + andb %dl,(%eax) + .end + +/* + * atomic inc/dec operations. + * void atomic_inc16(uint16_t *addr) { ++*addr; } + * void atomic_dec16(uint16_t *addr) { --*addr; } + */ + .inline atomic_inc16,4 + movl (%esp), %eax + lock + incw (%eax) + .end + + .inline atomic_dec16,4 + movl (%esp), %eax + lock + decw (%eax) + .end + +/* + * Call the pause instruction. To the Pentium 4 Xeon processor, it acts as + * a hint that the code sequence is a busy spin-wait loop. Without a pause + * instruction in these loops, the P4 Xeon processor may suffer a severe + * penalty when exiting the loop because the processor detects a possible + * memory violation. Inserting the pause instruction significantly reduces + * the likelihood of a memory order violation, improving performance. + * The pause instruction is a NOP on all other IA-32 processors. + */ + .inline ht_pause, 0 + rep / our compiler doesn't support "pause" yet, + nop / so we're using "F3 90" opcode directly + .end + +/* + * prefetch 64 bytes + * + * prefetch is an SSE extension which is not supported on older 32-bit processors + * so define this as a no-op for now + */ + + .inline prefetch_read_many,4 +/ movl (%esp), %eax +/ prefetcht0 (%eax) +/ prefetcht0 32(%eax) + .end + + .inline prefetch_read_once,4 +/ movl (%esp), %eax +/ prefetchnta (%eax) +/ prefetchnta 32(%eax) + .end + + .inline prefetch_write_many,4 +/ movl (%esp), %eax +/ prefetcht0 (%eax) +/ prefetcht0 32(%eax) + .end + + .inline prefetch_write_once,4 +/ movl (%esp), %eax +/ prefetcht0 (%eax) +/ prefetcht0 32(%eax) + .end + diff --git a/usr/src/uts/sparc/Makefile b/usr/src/uts/sparc/Makefile new file mode 100644 index 0000000..4620b88 --- /dev/null +++ b/usr/src/uts/sparc/Makefile @@ -0,0 +1,101 @@ +# +# 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 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# uts/sparc/Makefile +# +# This makefile drives the production of all implementation architecture +# independent modules for the SPARC processor. (For those unsure, this +# means the module will run on all SPARC processor based machines +# running SunOS.) + +UTSBASE = .. + +include Makefile.sparc + +LINT_KMODLIBS = $(LINT_KMODS) +LINT_LIBS = $(LINT_LIB) $(GEN_LINT_LIB) \ + $(LINT_KMODLIBS:%=$(LINT_LIB_DIR)/llib-l%.ln) + +def := TARGET= def +all := TARGET= all +install := TARGET= install +clean := TARGET= clean +clobber := TARGET= clobber +lint := TARGET= lint +modlintlib := TARGET= modlintlib +modlist := TARGET= modlist +modlist := NO_STATE= -K $$MODSTATE$$$$ +clean.lint := TARGET= clean.lint +check := TARGET= check +install_h := TARGET= install_h + +.KEEP_STATE: + +.PARALLEL: $(PARALLEL_KMODS) $(XMODS) $(LINT_DEPS) + +def all install clean clobber modlist: genunix .WAIT $(KMODS) $(XMODS) + +modlintlib clean.lint: $(LINT_KMODS) $(XMODS) + +genunix $(KMODS) $(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) + +$(XMODS): FRC + @if [ -f $@/Makefile ]; then \ + cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET); \ + else \ + true; \ + fi + +install_h check: FRC +# @cd asm; pwd; $(MAKE) $(TARGET) +# @cd sys; pwd; $(MAKE) $(TARGET) +# @cd v7/sys; pwd; $(MAKE) $(TARGET) +# @cd v9/sys; pwd; $(MAKE) $(TARGET) + +# +# Full kernel lint target. +# +LINT_TARGET = globallint + +globallint: + @pwd + @-$(ECHO) "\nFULL KERNEL: global crosschecks:" + @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) + +lint: modlintlib .WAIT $(LINT_DEPS) + +# EXPORT DELETE START + +EXPORT_SRC: + $(RM) Makefile+ + sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \ + < Makefile > Makefile+ + $(MV) Makefile+ Makefile + $(CHMOD) 444 Makefile + +# EXPORT DELETE END + +include ../Makefile.targ diff --git a/usr/src/uts/sparc/Makefile.files b/usr/src/uts/sparc/Makefile.files new file mode 100644 index 0000000..1c00568 --- /dev/null +++ b/usr/src/uts/sparc/Makefile.files @@ -0,0 +1,76 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# This Makefile defines all file modules and build rules for the +# directory uts/sparc and it's children. These are the source files which +# are specific to the sparc processor. +# + +# +# object lists +# + +CORE_OBJS += + +# +# generic-unix module +# + +# +# Driver (pseudo-driver) Modules +# + +# +# Driver modules +# + +# +# file system modules +# + +# ZFS file system module +ZFS_OBJS += + +# +# misc modules +# + +# +# special files +# +MODSTUB_OBJ = modstubs.o + +# +# Build up paths and defines. +# +LINT_DEFS += -Dsparc +INC_PATH += -I$(UTSBASE)/sparc +INC_PATH += -I$(UTSBASE)/sparc/krtld + +# +# Inlined assembler routines. +# +INLINES += $(UTSBASE)/sparc/ml/sparc.il diff --git a/usr/src/uts/sparc/Makefile.rules b/usr/src/uts/sparc/Makefile.rules new file mode 100644 index 0000000..a35f183 --- /dev/null +++ b/usr/src/uts/sparc/Makefile.rules @@ -0,0 +1,77 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# This Makefile defines all file modules and build rules for the +# directory uts/sparc and its children. These are the source files which +# are specific to the sparc processor. +# +# The following two-level ordering must be maintained in this file. +# Lines are sorted first in order of decreasing specificity based on +# the first directory component. That is, sun4u rules come before +# sparc rules come before common rules. +# +# Lines whose initial directory components are equal are sorted +# alphabetically by the remaining components. + +# +# Section 1a: C object build rules +# + +$(OBJS_DIR)/%.o: $(UTSBASE)/sparc/zfs/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + +# +# _RELSEG indicates that the dynamic syms are put in a separate ELF +# section so they can be freed later. +# +$(OBJS_DIR)/kobj_bootflags.o := CPPFLAGS += -I$(SRC)/common +$(OBJS_DIR)/kobj.o := CPPFLAGS += -DMODDIR_SUFFIX=\"sparcv9\" +$(OBJS_DIR)/kobj.o := CPPFLAGS += -D_RELSEG + +$(OBJS_DIR)/%.o: $(UTSBASE)/sparc/os/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + +$(OBJS_DIR)/%.o: $(UTSBASE)/sparc/syscall/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + +# +# Section 1b: Lint `object' build rules. +# +$(LINTS_DIR)/%.ln: $(UTSBASE)/sparc/io/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) + +$(OBJS_DIR)/kobj_bootflags.ln := CPPFLAGS += -I$(SRC)/common +$(OBJS_DIR)/kobj.ln := CPPFLAGS += -DMODDIR_SUFFIX=\"sparcv9\" +$(OBJS_DIR)/kobj.ln := CPPFLAGS += -D_RELSEG + +$(LINTS_DIR)/%.ln: $(UTSBASE)/sparc/os/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) + +$(LINTS_DIR)/%.ln: $(UTSBASE)/sparc/syscall/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) diff --git a/usr/src/uts/sparc/Makefile.sparc b/usr/src/uts/sparc/Makefile.sparc new file mode 100644 index 0000000..e282255 --- /dev/null +++ b/usr/src/uts/sparc/Makefile.sparc @@ -0,0 +1,38 @@ +# 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 2011 Nexenta Systems, Inc. All rights reserved. +# + +UTSTREE=$(UTSBASE) + +include $(UTSBASE)/sparc/Makefile.sparc.shared + +# +# Ensure that the variable member of the cpu_t (cpu_m) is defined +# for the lint builds so as not to cause lint errors during the +# global cross check. +# +$(LINTFLAGSUPPRESS)LINTFLAGS += -D_MACHDEP -I$(UTSBASE)/sun4 \ + -I$(UTSBASE)/sun4u -I$(UTSBASE)/sfmmu diff --git a/usr/src/uts/sparc/Makefile.sparc.shared b/usr/src/uts/sparc/Makefile.sparc.shared new file mode 100644 index 0000000..62eeca2 --- /dev/null +++ b/usr/src/uts/sparc/Makefile.sparc.shared @@ -0,0 +1,273 @@ +# +# 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) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. + +# +# This makefile contains the common definitions for all sparc +# implementation architecture independent modules. +# + +# +# Define supported builds +# +DEF_BUILDS = $(DEF_BUILDS64) +ALL_BUILDS = $(ALL_BUILDS64) + +# +# Everybody needs to know how to build modstubs.o and to locate unix.o. +# Note that unix.o must currently be selected from among the possible +# "implementation architectures". Note further, that unix.o is only +# used as an optional error check for undefines so (theoretically) +# any "implementation architectures" could be used. We choose sun4u +# because it is the reference port. +# +UNIX_DIR = $(UTSBASE)/sun4u/unix +GENLIB_DIR = $(UTSBASE)/sun4u/genunix +IPDRV_DIR = $(UTSBASE)/sparc/ip +MODSTUBS_DIR = $(UNIX_DIR) +DSF_DIR = $(UNIX_DIR) +LINTS_DIR = $(OBJS_DIR) +LINT_LIB_DIR = $(UTSBASE)/sparc/lint-libs/$(OBJS_DIR) + +UNIX_O = $(UNIX_DIR)/$(OBJS_DIR)/unix.o +MODSTUBS_O = $(MODSTUBS_DIR)/$(OBJS_DIR)/modstubs.o +GENLIB = $(UTSBASE)/sun4u/lint-libs/$(OBJS_DIR)/libgenunix.so + +LINT_LIB_32 = $(UTSBASE)/sun4u/lint-libs/$(OBJS_DIR)/llib-lunix.ln +GEN_LINT_LIB_32 = $(UTSBASE)/sun4u/lint-libs/$(OBJS_DIR)/llib-lgenunix.ln + +LINT_LIB_64 = $(UTSBASE)/sun4u/lint-libs/$(OBJS_DIR)/llib-lunix.ln +GEN_LINT_LIB_64 = $(UTSBASE)/sun4u/lint-libs/$(OBJS_DIR)/llib-lgenunix.ln + +LINT_LIB = $(LINT_LIB_$(CLASS)) +GEN_LINT_LIB = $(GEN_LINT_LIB_$(CLASS)) + +LINT32_DIRS = $(LINT32_BUILDS:%=$(UTSBASE)/sparc/lint-libs/%) +LINT32_FILES = $(LINT32_DIRS:%=%/llib-l$(MODULE).ln) + +LINT64_DIRS = $(LINT64_BUILDS:%=$(UTSBASE)/sparc/lint-libs/%) +LINT64_FILES = $(LINT64_DIRS:%=%/llib-l$(MODULE).ln) + +# +# Include the makefiles which define build rule templates, the +# collection of files per module, and a few specific flags. Note +# that order is significant, just as with an include path. The +# first build rule template which matches the files name will be +# used. By including these in order from most machine dependent +# to most machine independent, we allow a machine dependent file +# to be used in preference over a machine independent version +# (Such as a machine specific optimization, which preserves the +# interfaces.) +# +include $(UTSBASE)/sparc/Makefile.files +include $(UTSBASE)/sparc/v9/Makefile.files +include $(UTSTREE)/sun/Makefile.files +include $(UTSTREE)/common/Makefile.files + +# +# ----- TRANSITIONAL SECTION -------------------------------------------------- +# + +# +# Not everything which *should* be a module is a module yet. The +# following is a list of such objects which are currently part of +# genunix but which might someday become kmods. This must be +# defined before we include Makefile.uts, or else genunix's build +# won't be as parallel as we might like. +# +NOT_YET_KMODS = $(OLDPTY_OBJS) $(PTY_OBJS) $(VCONS_CONF_OBJS) $(MOD_OBJS) + +# +# ----- END OF TRANSITIONAL SECTION ------------------------------------------- +# +# Include machine independent rules. Note that this does not imply +# that the resulting module from rules in Makefile.uts is machine +# independent. Only that the build rules are machine independent. +# +include $(UTSBASE)/Makefile.uts + +# +# machine specific optimization, override default in Makefile.master +# +XARCH_32 = -xarch=v8 +XARCH_64 = -m64 +XARCH = $(XARCH_$(CLASS)) + +COPTIMIZE_32 = -xO3 +COPTIMIZE_64 = -xO3 +COPTIMIZE = $(COPTIMIZE_$(CLASS)) + +CCMODE = -Xa + +CFLAGS_32 = -xcg92 +CFLAGS_64 = -xchip=ultra $(CCABS32) $(CCREGSYM) +CFLAGS = $(CFLAGS_$(CLASS)) + +CFLAGS += $(XARCH) +CFLAGS += $(COPTIMIZE) +CFLAGS += $(EXTRA_CFLAGS) +CFLAGS += $(XAOPT) +CFLAGS += $(INLINES) -D_ASM_INLINES +CFLAGS += $(CCMODE) +CFLAGS += $(SPACEFLAG) +CFLAGS += $(CERRWARN) +CFLAGS += $(CTF_FLAGS) +CFLAGS += $(C99MODE) +CFLAGS += $(CCUNBOUND) +CFLAGS += $(CCSTATICSYM) +CFLAGS += $(IROPTFLAG) +CFLAGS += $(CGLOBALSTATIC) +CFLAGS += -xregs=no%float +CFLAGS += -xstrconst + +ASFLAGS += $(XARCH) + +LINT_DEFS_32 = +LINT_DEFS_64 = -m64 +LINT_DEFS += $(LINT_DEFS_$(CLASS)) + +# +# The following must be defined for all implementations: +# +# MODSTUBS: Module stubs source file. +# +MODSTUBS = $(UTSBASE)/sparc/ml/modstubs.s + +# +# Define the actual specific platforms - obviously none. +# +MACHINE_DEFS = + +# +# Debugging level +# +# Special knowledge of which special debugging options effect which +# file is used to optimize the build if these flags are changed. +# +# XXX: The above could possibly be done for more flags and files, but +# is left as an experiment to the interested reader. Be forewarned, +# that excessive use could lead to maintenance difficulties. +# +DEBUG_DEFS_OBJ32 = +DEBUG_DEFS_DBG32 = -DDEBUG +DEBUG_DEFS_OBJ64 = +DEBUG_DEFS_DBG64 = -DDEBUG +DEBUG_DEFS = $(DEBUG_DEFS_$(BUILD_TYPE)) + +DEBUG_COND_OBJ32 :sh = echo \\043 +DEBUG_COND_DBG32 = +DEBUG_COND_OBJ64 :sh = echo \\043 +DEBUG_COND_DBG64 = +IF_DEBUG_OBJ = $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/ + +$(IF_DEBUG_OBJ)syscall.o := DEBUG_DEFS += -DSYSCALLTRACE +$(IF_DEBUG_OBJ)clock.o := DEBUG_DEFS += -DKSLICE=1 + +# Comment these out if you don't want dispatcher lock statistics. + +# $(IF_DEBUG_OBJ)disp_lock.o := DEBUG_DEFS += -DDISP_LOCK_STATS + +# +# Collect the preprocessor definitions to be associated with *all* +# files. +# +ALL_DEFS = $(MACHINE_DEFS) $(DEBUG_DEFS) $(OPTION_DEFS) +# +# +# The kernels modules which are "implementation architecture" +# specific for this machine are enumerated below. Note that most +# of these modules must exist (in one form or another) for each +# architecture. +# +# Common Drivers (usually pseudo drivers) (/kernel/drv): +# +DRV_KMODS += foo + +# +# Exec Class Modules (/kernel/exec): +# +EXEC_KMODS += + +# +# Scheduling Class Modules (/kernel/sched): +# +SCHED_KMODS += + +# +# File System Modules (/kernel/fs): +# +FS_KMODS += + +# +# Streams Modules (/kernel/strmod): +# +STRMOD_KMODS += + +# +# 'System' Modules (/kernel/sys): +# +SYS_KMODS += + +# +# 'User' Modules (/kernel/misc): +# +MISC_KMODS += + +# +# Software Cryptographic Providers (/kernel/crypto): +# +CRYPTO_KMODS += + +# +# IP Policy Modules (/kernel/ipp): +# +IPP_KMODS += + +# +# 'Dacf' modules (/kernel/dacf) +DACF_KMODS += + +# +# Modules eXcluded from the product: +# +XMODS += + +# +# 'Dacf' Modules (/kernel/dacf): +# +DACF_KMODS += + +# +# MAC-Type Plugin Modules (/kernel/mac) +# +MAC_KMODS += + +# +# socketmod (kernel/socketmod) +# +SOCKET_KMODS += + +# +# kiconv modules (/kernel/kiconv): +# +KICONV_KMODS += diff --git a/usr/src/uts/sparc/Makefile.targ b/usr/src/uts/sparc/Makefile.targ new file mode 100644 index 0000000..7041935 --- /dev/null +++ b/usr/src/uts/sparc/Makefile.targ @@ -0,0 +1,29 @@ +# 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 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# + +UTSTREE=$(UTSBASE) + +include $(UTSBASE)/sparc/Makefile.targ.shared diff --git a/usr/src/uts/sparc/Makefile.targ.shared b/usr/src/uts/sparc/Makefile.targ.shared new file mode 100644 index 0000000..e4da945 --- /dev/null +++ b/usr/src/uts/sparc/Makefile.targ.shared @@ -0,0 +1,42 @@ +# +# 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 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# This Makefile defines the set of all required, target containing +# included Makefiles for the sparc architecture. +# + +# +# Targets for all implementations: +# +include $(UTSBASE)/Makefile.targ + +# +# Target set for sparc (order is not important, as it is with the +# isomorphic Makefile.files set). +# +include $(UTSBASE)/sparc/Makefile.rules +include $(UTSTREE)/common/Makefile.rules diff --git a/usr/src/uts/sparc/foo/Makefile b/usr/src/uts/sparc/foo/Makefile new file mode 100644 index 0000000..4e6d906 --- /dev/null +++ b/usr/src/uts/sparc/foo/Makefile @@ -0,0 +1,99 @@ +# +# 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 +# +# +# uts/sparc/foo/Makefile +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# +# This makefile drives the production of the foo `drv' +# kernel module. +# + +# +# Path to the base of the uts directory tree (usually /usr/src/uts). +# +UTSBASE = ../.. + +# +# Define the module and object file sets. +# +MODULE = foo +OBJECTS = $(FOO_OBJS:%=$(OBJS_DIR)/%) +LINTS = $(FOO_OBJS:%.o=$(LINTS_DIR)/%.ln) +ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) +CONF_SRCDIR = $(UTSBASE)/common/io/foo + +# +# Include common rules. +# +include $(UTSBASE)/sparc/Makefile.sparc + +# +# Define targets +# +ALL_TARGET = $(BINARY) # $(SRC_CONFILE) +LINT_TARGET = $(MODULE).lint +INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) + +# +# Overrides +# + +# +# For now, disable these lint checks; maintainers should endeavor +# to investigate and remove these for maximum lint coverage. +# Please do not carry these forward to new Makefiles. +# +LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN + +# +# Driver depends on MAC +# +# LDFLAGS += -dy -N misc/mac + +# +# Default build targets. +# +.KEEP_STATE: + +def: $(DEF_DEPS) + +all: $(ALL_DEPS) + +clean: $(CLEAN_DEPS) + +clobber: $(CLOBBER_DEPS) + +lint: $(LINT_DEPS) + +modlintlib: $(MODLINTLIB_DEPS) + +clean.lint: $(CLEAN_LINT_DEPS) + +install: $(INSTALL_DEPS) + +# +# Include common targets. +# +include $(UTSBASE)/sparc/Makefile.targ diff --git a/usr/src/uts/sparc/genunix/Makefile b/usr/src/uts/sparc/genunix/Makefile new file mode 100644 index 0000000..f658edf --- /dev/null +++ b/usr/src/uts/sparc/genunix/Makefile @@ -0,0 +1,35 @@ + +# This is just for ctfmerge; copy from the build machine. + +GUDIR=/platform/sun4u/kernel + +DBG_LINKS= debug64/genunix +OBJ_LINKS= obj64/genunix + +def: all +all: $(DBG_LINKS) $(OBJ_LINKS) + +$(DBG_LINKS) : FRC + -mkdir debug64 + -rm -f $(DBG_LINKS) + ln -s $(GUDIR)/sparcv9/genunix debug64/genunix + +$(OBJ_LINKS) : FRC + -mkdir obj64 + -rm -f $(OBJ_LINKS) + ln -s $(GUDIR)/sparcv9/genunix obj64/genunix + +clean: FRC + -rm -f $(DBG_LINKS) $(OBJ_LINKS) + +clobber: + +lint: + +modlintlib: + +clean.lint: + +install: all + +FRC: |