1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 #
  23 # uts/i86xpv/Makefile.i86xpv
  24 #
  25 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  26 # Use is subject to license terms.
  27 # Copyright (c) 2013 Andrew Stormont.  All rights reserved.
  28 # Copyright 2019 Joyent, Inc.
  29 #
  30 
  31 #
  32 #       This makefile contains the common definitions for the i86xpv unix
  33 #       and all i86xpv implementation architecture dependent modules.
  34 #
  35 
  36 #
  37 #       Machine type (implementation architecture):
  38 #
  39 PLATFORM         = i86xpv
  40 
  41 #
  42 #       uname -m value
  43 #
  44 UNAME_M          = i86pc
  45 
  46 #
  47 #       Everybody needs to know how to build modstubs.o and to locate unix.o
  48 #
  49 UNIX_DIR         = $(UTSBASE)/$(PLATFORM)/unix
  50 GENLIB_DIR       = $(UTSBASE)/intel/genunix
  51 MODSTUBS_DIR     = $(UNIX_DIR)
  52 DSF_DIR          = $(UTSBASE)/$(PLATFORM)/genassym
  53 LINTS_DIR        = $(OBJS_DIR)
  54 LINT_LIB_DIR     = $(UTSBASE)/$(PLATFORM)/lint-libs/$(OBJS_DIR)
  55 GEN_LINT_LIB_DIR = $(UTSBASE)/intel/lint-libs/$(OBJS_DIR)
  56 
  57 DTRACESTUBS_O    = $(OBJS_DIR)/dtracestubs.o
  58 DTRACESTUBS      = $(OBJS_DIR)/libdtracestubs.so
  59 
  60 SYM_MOD         = $(OBJS_DIR)/unix.sym
  61 
  62 UNIX_O           = $(UNIX_DIR)/$(OBJS_DIR)/unix.o
  63 MODSTUBS_O       = $(MODSTUBS_DIR)/$(OBJS_DIR)/modstubs.o
  64 GENLIB           = $(GENLIB_DIR)/$(OBJS_DIR)/libgenunix.so
  65 LINT_LIB         = $(LINT_LIB_DIR)/llib-lunix.ln
  66 DBOOT_LINT_LIB   = $(LINT_LIB_DIR)/llib-ldboot.ln
  67 GEN_LINT_LIB     = $(GEN_LINT_LIB_DIR)/llib-lgenunix.ln
  68 
  69 LINT32_DIRS      = $(LINT32_BUILDS:%=$(UTSBASE)/$(PLATFORM)/lint-libs/%)
  70 LINT32_FILES     = $(LINT32_DIRS:%=%/llib-l$(MODULE).ln)
  71 
  72 #
  73 #       Include the makefiles which define build rule templates, the
  74 #       collection of files per module, and a few specific flags. Note
  75 #       that order is significant, just as with an include path. The
  76 #       first build rule template which matches the files name will be
  77 #       used. By including these in order from most machine dependent
  78 #       to most machine independent, we allow a machine dependent file
  79 #       to be used in preference over a machine independent version
  80 #       (Such as a machine specific optimization, which preserves the
  81 #       interfaces.)
  82 #
  83 include $(UTSBASE)/$(PLATFORM)/Makefile.files
  84 include $(UTSBASE)/intel/Makefile.files
  85 include $(UTSBASE)/common/Makefile.files
  86 
  87 #
  88 #       Include machine independent rules. Note that this does not imply
  89 #       that the resulting module from rules in Makefile.uts is machine
  90 #       independent. Only that the build rules are machine independent.
  91 #
  92 include $(UTSBASE)/Makefile.uts
  93 
  94 #
  95 #       Define supported builds
  96 #
  97 DEF_BUILDS              = $(DEF_BUILDS64)
  98 ALL_BUILDS              = $(ALL_BUILDS64)
  99 
 100 #
 101 #       kernel-specific optimizations; override default in Makefile.master
 102 #
 103 
 104 CFLAGS_XARCH_32         = $(i386_CFLAGS)
 105 CFLAGS_XARCH_64         = $(amd64_CFLAGS)
 106 CFLAGS_XARCH            = $(CFLAGS_XARCH_$(CLASS))
 107 
 108 COPTFLAG_32             = $(COPTFLAG)
 109 COPTFLAG_64             = $(COPTFLAG64)
 110 COPTIMIZE               = $(COPTFLAG_$(CLASS))
 111 
 112 CFLAGS                  = $(CFLAGS_XARCH)
 113 CFLAGS                  += $(COPTIMIZE)
 114 CFLAGS                  += -D_ASM_INLINES
 115 CFLAGS                  += $(CCMODE)
 116 CFLAGS                  += $(SPACEFLAG)
 117 CFLAGS                  += $(CCUNBOUND)
 118 CFLAGS                  += $(CFLAGS_uts)
 119 
 120 ASFLAGS_XARCH_32        = $(i386_ASFLAGS)
 121 ASFLAGS_XARCH_64        = $(amd64_ASFLAGS)
 122 ASFLAGS_XARCH           = $(ASFLAGS_XARCH_$(CLASS))
 123 
 124 ASFLAGS                 += $(ASFLAGS_XARCH)
 125 
 126 AS_INC_PATH             += -I$(DSF_DIR)/$(OBJS_DIR)
 127 
 128 #
 129 #       The following must be defined for all implementations:
 130 #
 131 #       MAPFILE:        ld mapfile for the build of kernel/unix.
 132 #       MODSTUBS:       Module stubs source file.
 133 #       GENASSYM_SRC:   genassym.c
 134 
 135 MAPFILE         = $(UTSBASE)/$(PLATFORM)/conf/Mapfile
 136 MODSTUBS        = $(UTSBASE)/intel/ia32/ml/modstubs.s
 137 GENASSYM_SRC    = $(UTSBASE)/i86pc/ml/genassym.c
 138 OFFSETS_SRC     = $(UTSBASE)/i86pc/ml/offsets.in
 139 
 140 PLATFORM_OFFSETS_SRC    = $(UTSBASE)/intel/amd64/ml/mach_offsets.in
 141 KDI_OFFSETS_SRC         = $(UTSBASE)/intel/kdi/kdi_offsets.in
 142 
 143 #
 144 #       Define the actual specific platforms
 145 #
 146 MACHINE_DEFS     = -D__$(PLATFORM) -D__xpv -D_MACHDEP
 147 
 148 #
 149 #       Software workarounds for hardware "features"
 150 #
 151 
 152 include $(UTSBASE)/i86pc/Makefile.workarounds
 153 
 154 #
 155 #       Debugging level
 156 #
 157 #       Special knowledge of which special debugging options effect which
 158 #       file is used to optimize the build if these flags are changed.
 159 #
 160 #       XXX: The above could possibly be done for more flags and files, but
 161 #            is left as an experiment to the interested reader. Be forewarned,
 162 #            that excessive use could lead to maintenance difficulties.
 163 #
 164 DEBUG_DEFS_OBJ32        =
 165 DEBUG_DEFS_DBG32        = -DDEBUG
 166 DEBUG_DEFS_OBJ64        =
 167 DEBUG_DEFS_DBG64        = -DDEBUG
 168 DEBUG_DEFS              = $(DEBUG_DEFS_$(BUILD_TYPE))
 169 
 170 DEBUG_COND_OBJ32        = $(POUND_SIGN)
 171 DEBUG_COND_DBG32        =
 172 DEBUG_COND_OBJ64        = $(POUND_SIGN)
 173 DEBUG_COND_DBG64        =
 174 IF_DEBUG_OBJ            = $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/
 175 
 176 $(IF_DEBUG_OBJ)trap.o           := DEBUG_DEFS += -DTRAPDEBUG -DTRAPTRACE
 177 $(IF_DEBUG_OBJ)syscall_asm.o    := DEBUG_DEFS += -DSYSCALLTRACE -DTRAPTRACE
 178 $(IF_DEBUG_OBJ)fast_trap_asm.o  := DEBUG_DEFS += -DTRAPTRACE
 179 $(IF_DEBUG_OBJ)interrupt.o      := DEBUG_DEFS += -DTRAPTRACE
 180 $(IF_DEBUG_OBJ)intr.o           := DEBUG_DEFS += -DTRAPTRACE
 181 $(IF_DEBUG_OBJ)locore.o         := DEBUG_DEFS += -DTRAPTRACE
 182 $(IF_DEBUG_OBJ)mp_startup.o     := DEBUG_DEFS += -DTRAPTRACE
 183 $(IF_DEBUG_OBJ)machdep.o        := DEBUG_DEFS += -DTRAPTRACE
 184 $(IF_DEBUG_OBJ)exception.o      := DEBUG_DEFS += -DTRAPTRACE
 185 $(IF_DEBUG_OBJ)x_call.o         := DEBUG_DEFS += -DTRAPTRACE
 186 $(IF_DEBUG_OBJ)mp_call.o        := DEBUG_DEFS += -DTRAPTRACE
 187 $(IF_DEBUG_OBJ)cbe.o            := DEBUG_DEFS += -DTRAPTRACE
 188 $(IF_DEBUG_OBJ)hyperevent.o     := DEBUG_DEFS += -DTRAPTRACE
 189 $(IF_DEBUG_OBJ)evtchn.o         := DEBUG_DEFS += -DTRAPTRACE
 190 
 191 #
 192 #       Collect the preprocessor definitions to be associated with *all*
 193 #       files.
 194 #
 195 ALL_DEFS         = $(MACHINE_DEFS) $(WORKAROUND_DEFS) $(DEBUG_DEFS) \
 196                    $(OPTION_DEFS)
 197 GENASSYM_DEFS    = $(MACHINE_DEFS) $(OPTION_DEFS) \
 198                         -_gcc=-fno-eliminate-unused-debug-symbols \
 199                         -_gcc=-fno-eliminate-unused-debug-types
 200 
 201 #
 202 # ----- TRANSITIONAL SECTION --------------------------------------------------
 203 #
 204 
 205 #
 206 #       Not everything which *should* be a module is a module yet. The
 207 #       following is a list of such objects which are currently part of
 208 #       the base kernel but should soon become kmods.
 209 #
 210 #       XXX: $(KMACCT_OBJS) is neither in the MT kernel nor was it ever
 211 #            made into a module. If it is made MT safe before being made
 212 #            into a module, it should be added to this list. It was in
 213 #            this list pre ON-4.0.
 214 #
 215 #
 216 MACH_NOT_YET_KMODS      = $(AUTOCONF_OBJS)
 217 
 218 #
 219 # ----- END OF TRANSITIONAL SECTION -------------------------------------------
 220 #
 221 
 222 #
 223 #       The kernels modules which are "implementation architecture"
 224 #       specific for this machine are enumerated below. Note that most
 225 #       of these modules must exist (in one form or another) for each
 226 #       architecture.
 227 #
 228 #       Machine Specific Driver Modules (/kernel/drv):
 229 #       DRV_KMODS are built both 32-bit and 64-bit
 230 #       DRV_KMODS_32 are built only 32-bit
 231 #       DRV_KMODS_64 are built only 64-bit
 232 #
 233 
 234 DRV_KMODS       += rootnex
 235 DRV_KMODS       += ioat
 236 DRV_KMODS       += isa
 237 DRV_KMODS       += pci
 238 DRV_KMODS       += pit_beep
 239 DRV_KMODS       += npe
 240 DRV_KMODS       += pci-ide
 241 DRV_KMODS       += xsvc
 242 DRV_KMODS       += xenbus
 243 DRV_KMODS       += xencons
 244 DRV_KMODS       += xpvd
 245 DRV_KMODS       += xnbe
 246 DRV_KMODS       += xnbo
 247 DRV_KMODS       += xnbu
 248 DRV_KMODS       += xnf
 249 DRV_KMODS       += xdb
 250 DRV_KMODS       += xdf
 251 DRV_KMODS       += privcmd
 252 DRV_KMODS       += domcaps
 253 DRV_KMODS       += evtchn
 254 DRV_KMODS       += balloon
 255 DRV_KMODS       += xpvtap
 256 DRV_KMODS       += xdt
 257 
 258 #
 259 #       CPU Modules
 260 #
 261 CPU_KMODS       += generic_cpu
 262 CPU_KMODS       += amd_opteron
 263 CPU_KMODS       += genuineintel
 264 CPU_KMODS       += authenticamd
 265 
 266 #
 267 #       Exec Class Modules (/kernel/exec):
 268 #
 269 EXEC_KMODS      +=
 270 
 271 #
 272 #       Scheduling Class Modules (/kernel/sched):
 273 #
 274 SCHED_KMODS     +=
 275 
 276 #
 277 #       File System Modules (/kernel/fs):
 278 #
 279 FS_KMODS        +=
 280 
 281 #
 282 #       Streams Modules (/kernel/strmod):
 283 #
 284 STRMOD_KMODS    +=
 285 
 286 #
 287 #       'System' Modules (/kernel/sys):
 288 #
 289 SYS_KMODS       +=
 290 
 291 #
 292 #       'Misc' Modules (/kernel/misc):
 293 #
 294 MISC_KMODS      += xpv_autoconfig gfx_private xnb
 295 
 296 #       'Dacf' modules (/kernel/dacf)
 297 #
 298 DACF_KMODS      += consconfig_dacf
 299 
 300 #
 301 #       'Mach' Modules (/kernel/mach):
 302 #
 303 MACH_KMODS      += xpv_psm xpv_uppc
 304 
 305 #
 306 #       'TOD' modules (/platform/.../kernel/tod):
 307 #
 308 TOD_KMODS       += xpvtod