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 # Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 # Copyright (c) 2013 Andrew Stormont.  All rights reserved.
  26 # Copyright 2014 Gary Mills
  27 #
  28 #       This makefile contains the common definitions for the sun4v unix
  29 #       and all sun4v implementation architecture dependent modules.
  30 #
  31 
  32 #
  33 #       Machine type (implementation architecture):
  34 #
  35 PLATFORM         = sun4v
  36 LINKED_PLATFORMS += SUNW,Sun-Fire-T1000
  37 LINKED_PLATFORMS += SUNW,SPARC-Enterprise-T5120
  38 LINKED_PLATFORMS += SUNW,SPARC-Enterprise-T5220
  39 LINKED_PLATFORMS += SUNW,T5140
  40 LINKED_PLATFORMS += SUNW,T5240
  41 LINKED_PLATFORMS += SUNW,T5440
  42 LINKED_PLATFORMS += SUNW,SPARC-Enterprise-T1000
  43 LINKED_PLATFORMS += SUNW,Sun-Blade-T6300
  44 LINKED_PLATFORMS += SUNW,Sun-Blade-T6320
  45 LINKED_PLATFORMS += SUNW,Netra-CP3260
  46 LINKED_PLATFORMS += SUNW,Netra-T5220
  47 LINKED_PLATFORMS += SUNW,USBRDT-5240
  48 LINKED_PLATFORMS += SUNW,Netra-T5440
  49 LINKED_PLATFORMS += SUNW,Sun-Blade-T6340
  50 PROMIF           = ieee1275
  51 PSMBASE          = $(UTSBASE)/../psm
  52 
  53 #
  54 #       uname -m value
  55 #
  56 UNAME_M         = $(PLATFORM)
  57 
  58 #
  59 # Definitions for the platform-specific /platform directories.
  60 #
  61 # PLATFORMS designates those sun4v machines which have no platform
  62 # specific code.
  63 #
  64 # IMPLEMENTATIONS is used to designate sun4v machines which have
  65 # platform specific modules.  All code specific to a given implementation
  66 # resides in the appropriately named subdirectory.   This requires
  67 # these platforms to have their own Makefiles to define ROOT_PLAT_DIRS,
  68 # USR_PLAT_DIRS, etc.
  69 # The number of IMPLEMENTATIONS should not grow!
  70 #
  71 # So if we had an implementation named 'foo', we would need the following
  72 # Makefiles in the foo subdirectory:
  73 #
  74 #       sun4v/foo/Makefile
  75 #       sun4v/foo/Makefile.foo
  76 #       sun4v/foo/Makefile.targ
  77 #
  78 
  79 #
  80 # all PLATFORMS that do not belong in the $(IMPLEMENTATIONS) list.
  81 # This list should be empty.  A platform without platform modules
  82 # is a plain, generic sun4v platform.
  83 #
  84 #IMPLEMENTED_PLATFORM   =
  85 #PLATFORMS                = $(IMPLEMENTED_PLATFORM)
  86 
  87 IMPLEMENTATIONS         = ontario montoya huron maramba
  88 
  89 #ROOT_PLAT_DIRS         = $(PLATFORMS:%=$(ROOT_PLAT_DIR)/%)
  90 #USR_PLAT_DIRS          = $(PLATFORMS:%=$(USR_PLAT_DIR)/%)
  91 
  92 #USR_DESKTOP_DIR                = $(USR_PLAT_DIR)/$(IMPLEMENTED_PLATFORM)
  93 #USR_DESKTOP_INC_DIR    = $(USR_DESKTOP_DIR)/include
  94 #USR_DESKTOP_SBIN_DIR   = $(USR_DESKTOP_DIR)/sbin
  95 #USR_DESKTOP_LIB_DIR    = $(USR_DESKTOP_DIR)/lib
  96 
  97 #
  98 #       Define supported builds
  99 #
 100 DEF_BUILDS      = $(DEF_BUILDS64)
 101 ALL_BUILDS      = $(ALL_BUILDS64)
 102 
 103 #
 104 #       Everybody needs to know how to build modstubs.o and to locate unix.o
 105 #
 106 UNIX_DIR         = $(UTSBASE)/$(PLATFORM)/unix
 107 GENLIB_DIR       = $(UTSBASE)/$(PLATFORM)/genunix
 108 MODSTUBS_DIR     = $(UNIX_DIR)
 109 DSF_DIR          = $(UTSBASE)/$(PLATFORM)/genassym
 110 LINTS_DIR        = $(OBJS_DIR)
 111 LINT_LIB_DIR     = $(UTSBASE)/$(PLATFORM)/lint-libs/$(OBJS_DIR)
 112 
 113 DTRACESTUBS_O    = $(OBJS_DIR)/dtracestubs.o
 114 DTRACESTUBS      = $(OBJS_DIR)/libdtracestubs.so
 115 
 116 UNIX_O           = $(UNIX_DIR)/$(OBJS_DIR)/unix.o
 117 MODSTUBS_O       = $(MODSTUBS_DIR)/$(OBJS_DIR)/modstubs.o
 118 GENLIB           = $(GENLIB_DIR)/$(OBJS_DIR)/libgenunix.so
 119 
 120 LINT_LIB         = $(LINT_LIB_DIR)/llib-lunix.ln
 121 GEN_LINT_LIB     = $(LINT_LIB_DIR)/llib-lgenunix.ln
 122 
 123 LINT64_DIRS      = $(LINT64_BUILDS:%=$(UTSBASE)/$(PLATFORM)/lint-libs/%)
 124 LINT64_FILES     = $(LINT64_DIRS:%=%/llib-l$(MODULE).ln)
 125 
 126 #
 127 #       cpu and platform modules need to know how to build their own symcheck module
 128 #
 129 PLATMOD          = platmod
 130 PLATLIB          = $(PLAT_DIR)/$(OBJS_DIR)/libplatmod.so
 131 
 132 CPUNAME          = cpu
 133 CPULIB           = $(CPU_DIR)/$(OBJS_DIR)/libcpu.so
 134 
 135 SYM_MOD          = $(OBJS_DIR)/unix.sym
 136 
 137 #
 138 #       Include the makefiles which define build rule templates, the
 139 #       collection of files per module, and a few specific flags. Note
 140 #       that order is significant, just as with an include path. The
 141 #       first build rule template which matches the files name will be
 142 #       used. By including these in order from most machine dependent
 143 #       to most machine independent, we allow a machine dependent file
 144 #       to be used in preference over a machine independent version
 145 #       (Such as a machine specific optimization, which preserves the
 146 #       interfaces.)
 147 #
 148 include $(UTSBASE)/sun4/Makefile.files
 149 include $(UTSBASE)/$(PLATFORM)/Makefile.files
 150 include $(UTSBASE)/sfmmu/Makefile.files
 151 include $(UTSBASE)/sparc/v9/Makefile.files
 152 include $(UTSBASE)/sparc/Makefile.files
 153 include $(UTSBASE)/sun/Makefile.files
 154 include $(SRC)/psm/promif/$(PROMIF)/common/Makefile.files
 155 include $(SRC)/psm/promif/$(PROMIF)/$(PLATFORM)/Makefile.files
 156 include $(UTSBASE)/common/Makefile.files
 157 
 158 #
 159 #       Include machine independent rules. Note that this does not imply
 160 #       that the resulting module from rules in Makefile.uts is machine
 161 #       independent. Only that the build rules are machine independent.
 162 #
 163 include $(UTSBASE)/Makefile.uts
 164 
 165 CTFMERGE_GUDIR  = sun4v
 166 
 167 #
 168 #       machine specific optimization, override default in Makefile.master
 169 #
 170 CC_XARCH        = -m64 -xarch=sparcvis
 171 AS_XARCH        = -xarch=v9v
 172 COPTIMIZE       = -_cc=-xO3 -_gcc=-O2
 173 CCMODE          = -Xa
 174 
 175 CFLAGS          = -xchip=ultra $(CCABS32) $(CCREGSYM)
 176 CFLAGS          += $(CC_XARCH)
 177 CFLAGS          += $(COPTIMIZE)
 178 CFLAGS          += $(EXTRA_CFLAGS)
 179 CFLAGS          += $(XAOPT)
 180 CFLAGS          += $(INLINES) -D_ASM_INLINES
 181 CFLAGS          += $(CCMODE)
 182 CFLAGS          += $(SPACEFLAG)
 183 CFLAGS          += $(CERRWARN)
 184 CFLAGS          += $(CTF_FLAGS_$(CLASS))
 185 CFLAGS          += $(C99MODE)
 186 CFLAGS          += $(CCUNBOUND)
 187 CFLAGS          += $(CCNOAUTOINLINE)
 188 CFLAGS          += $(CCSTATICSYM)
 189 CFLAGS          += $(CC32BITCALLERS)
 190 CFLAGS          += $(IROPTFLAG)
 191 CFLAGS          += $(CGLOBALSTATIC)
 192 CFLAGS          += -xregs=no%float
 193 CFLAGS          += -xstrconst
 194 CFLAGS          += $(CSOURCEDEBUGFLAGS)
 195 CFLAGS          += $(CUSERFLAGS)
 196 
 197 CPPFLAGS        += -DGLREG
 198 
 199 ASFLAGS         += $(AS_XARCH) -DGLREG
 200 
 201 AS_INC_PATH     += -I$(DSF_DIR)/$(OBJS_DIR)
 202 
 203 LINT_KMODS      += $(GENUNIX_KMODS)
 204 
 205 LINT_DEFS       = -m64
 206 
 207 #
 208 #       The following must be defined for all implementations:
 209 #
 210 #       MAPFILE:                ld mapfile for the build of kernel/unix.
 211 #       MODSTUBS:               Module stubs source file.
 212 #       GENCONST_SRC:           genconst.c
 213 #       OFFSETS:                offsets.in
 214 #       PLATFORM_OFFSETS:       Platform specific mach_offsets.in
 215 #       FDOFFSETS:              fd_offsets.in
 216 #
 217 MAPFILE          = $(UTSBASE)/sun4/conf/Mapfile
 218 MODSTUBS         = $(UTSBASE)/sparc/ml/modstubs.s
 219 GENCONST_SRC     = $(UTSBASE)/sun4/ml/genconst.c
 220 OFFSETS          = $(UTSBASE)/sun4/ml/offsets.in
 221 PLATFORM_OFFSETS = $(UTSBASE)/sun4v/ml/mach_offsets.in
 222 FDOFFSETS        = $(UTSBASE)/sun/io/fd_offsets.in
 223 
 224 #
 225 #       Define the actual specific platforms
 226 #
 227 
 228 MACHINE_DEFS    = -D$(PLATFORM) -D_MACHDEP -DSFMMU
 229 MACHINE_DEFS    += -DMAX_MEM_NODES=8
 230 
 231 #
 232 #       Software workarounds for hardware "features"
 233 #
 234 
 235 include $(UTSBASE)/$(PLATFORM)/Makefile.workarounds
 236 
 237 #
 238 #       Debugging level
 239 #
 240 #       Special knowledge of which special debugging options effect which
 241 #       file is used to optimize the build if these flags are changed.
 242 #
 243 #       XXX: The above could possibly be done for more flags and files, but
 244 #            is left as an experiment to the interested reader. Be forewarned,
 245 #            that excessive use could lead to maintenance difficulties.
 246 #
 247 #       Note: kslice can be enabled for the sun4v, but is disabled by default
 248 #             in all cases.
 249 #
 250 
 251 DEBUG_DEFS_OBJ64        =
 252 DEBUG_DEFS_DBG64        = -DDEBUG
 253 DEBUG_DEFS              = $(DEBUG_DEFS_$(BUILD_TYPE))
 254 
 255 DEBUG_COND_OBJ64        = $(POUND_SIGN)
 256 DEBUG_COND_DBG64        =
 257 IF_DEBUG_OBJ            = $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/
 258 
 259 $(IF_DEBUG_OBJ)trap.o           :=      DEBUG_DEFS      += -DTRAPDEBUG
 260 $(IF_DEBUG_OBJ)mach_trap.o      :=      DEBUG_DEFS      += -DTRAPDEBUG
 261 $(IF_DEBUG_OBJ)syscall_trap.o   :=      DEBUG_DEFS      += -DSYSCALLTRACE
 262 $(IF_DEBUG_OBJ)clock.o          :=      DEBUG_DEFS      += -DKSLICE=0
 263 
 264 IF_TRAPTRACE_OBJ = $(IF_DEBUG_OBJ)
 265 # comment this out for a non-debug kernel with TRAPTRACE
 266 #IF_TRAPTRACE_OBJ = $(OBJS_DIR)/
 267 
 268 $(IF_TRAPTRACE_OBJ)mach_locore.o        :=      DEBUG_DEFS      += -DTRAPTRACE
 269 $(IF_TRAPTRACE_OBJ)mlsetup.o            :=      DEBUG_DEFS      += -DTRAPTRACE
 270 $(IF_TRAPTRACE_OBJ)syscall_trap.o       :=      DEBUG_DEFS      += -DTRAPTRACE
 271 $(IF_TRAPTRACE_OBJ)startup.o            :=      DEBUG_DEFS      += -DTRAPTRACE
 272 $(IF_TRAPTRACE_OBJ)mach_startup.o       :=      DEBUG_DEFS      += -DTRAPTRACE
 273 $(IF_TRAPTRACE_OBJ)mp_startup.o         :=      DEBUG_DEFS      += -DTRAPTRACE
 274 $(IF_TRAPTRACE_OBJ)cpu_states.o         :=      DEBUG_DEFS      += -DTRAPTRACE
 275 $(IF_TRAPTRACE_OBJ)mach_cpu_states.o    :=      DEBUG_DEFS      += -DTRAPTRACE
 276 $(IF_TRAPTRACE_OBJ)interrupt.o          :=      DEBUG_DEFS      += -DTRAPTRACE
 277 $(IF_TRAPTRACE_OBJ)mach_interrupt.o     :=      DEBUG_DEFS      += -DTRAPTRACE
 278 $(IF_TRAPTRACE_OBJ)sfmmu_asm.o          :=      DEBUG_DEFS      += -DTRAPTRACE
 279 $(IF_TRAPTRACE_OBJ)trap_table.o         :=      DEBUG_DEFS      += -DTRAPTRACE
 280 $(IF_TRAPTRACE_OBJ)xc.o                 :=      DEBUG_DEFS      += -DTRAPTRACE
 281 $(IF_TRAPTRACE_OBJ)mach_xc.o            :=      DEBUG_DEFS      += -DTRAPTRACE
 282 $(IF_TRAPTRACE_OBJ)wbuf.o               :=      DEBUG_DEFS      += -DTRAPTRACE
 283 $(IF_TRAPTRACE_OBJ)trap.o               :=      DEBUG_DEFS      += -DTRAPTRACE
 284 $(IF_TRAPTRACE_OBJ)mach_trap.o          :=      DEBUG_DEFS      += -DTRAPTRACE
 285 $(IF_TRAPTRACE_OBJ)x_call.o             :=      DEBUG_DEFS      += -DTRAPTRACE
 286 
 287 # Comment these out if you don't want dispatcher lock statistics.
 288 
 289 #$(IF_DEBUG_OBJ)lock_prim.o     := DEBUG_DEFS   += -DDISP_LOCK_STATS
 290 #$(IF_DEBUG_OBJ)disp.o          := DEBUG_DEFS   += -DDISP_LOCK_STATS
 291 
 292 # Comment these out if you don't want dispatcher debugging
 293 
 294 #$(IF_DEBUG_OBJ)lock_prim.o     := DEBUG_DEFS   += -DDISP_DEBUG
 295 
 296 #
 297 #       Collect the preprocessor definitions to be associated with *all*
 298 #       files.
 299 #
 300 ALL_DEFS         = $(MACHINE_DEFS) $(WORKAROUND_DEFS) $(DEBUG_DEFS) \
 301                    $(OPTION_DEFS)
 302 GENCONST_DEFS    = $(MACHINE_DEFS) $(OPTION_DEFS)
 303 
 304 #
 305 # ----- TRANSITIONAL SECTION --------------------------------------------------
 306 #
 307 
 308 #
 309 #       Not everything which *should* be a module is a module yet. The
 310 #       following is a list of such objects which are currently part of
 311 #       the base kernel but should soon become kmods.
 312 #
 313 MACH_NOT_YET_KMODS       = $(AUTOCONF_OBJS)
 314 
 315 #
 316 # ----- END OF TRANSITIONAL SECTION -------------------------------------------
 317 #
 318 
 319 #
 320 #       The kernels modules which are "implementation architecture"
 321 #       specific for this machine are enumerated below. Note that most
 322 #       of these modules must exist (in one form or another) for each
 323 #       architecture.
 324 #
 325 #       Common Drivers (usually pseudo drivers) (/kernel/drv):
 326 #
 327 
 328 #
 329 #       Machine Specific Driver Modules (/kernel/drv):
 330 #
 331 DRV_KMODS       += bge
 332 DRV_KMODS       += cnex
 333 DRV_KMODS       += cpc
 334 DRV_KMODS       += drctl
 335 DRV_KMODS       += ds_pri
 336 DRV_KMODS       += ds_snmp
 337 DRV_KMODS       += ebus
 338 DRV_KMODS       += fpc
 339 DRV_KMODS       += glvc
 340 DRV_KMODS       += mdesc
 341 DRV_KMODS       += niumx
 342 DRV_KMODS       += ntwdt
 343 DRV_KMODS       += nxge
 344 DRV_KMODS       += n2piupc
 345 DRV_KMODS       += iospc
 346 DRV_KMODS       += n2rng
 347 DRV_KMODS       += px
 348 DRV_KMODS       += qcn
 349 DRV_KMODS       += rootnex
 350 DRV_KMODS       += su
 351 DRV_KMODS       += tpm
 352 DRV_KMODS       += trapstat
 353 DRV_KMODS       += vcc
 354 DRV_KMODS       += vdc
 355 DRV_KMODS       += vds
 356 DRV_KMODS       += vldc
 357 DRV_KMODS       += vlds
 358 DRV_KMODS       += vnet
 359 DRV_KMODS       += vnex
 360 DRV_KMODS       += vsw
 361 
 362 #
 363 #       Exec Class Modules (/kernel/exec):
 364 #
 365 EXEC_KMODS      +=
 366 
 367 #
 368 #       Scheduling Class Modules (/kernel/sched):
 369 #
 370 SCHED_KMODS     +=
 371 
 372 #
 373 #       File System Modules (/kernel/fs):
 374 #
 375 FS_KMODS        +=
 376 
 377 #
 378 #       Streams Modules (/kernel/strmod):
 379 #
 380 # STRMOD_KMODS  += kb
 381 
 382 #
 383 #       'System' Modules (/kernel/sys):
 384 #
 385 SYS_KMODS       +=
 386 
 387 #
 388 #       'User' Modules (/kernel/misc):
 389 #
 390 MISC_KMODS      += bootdev
 391 MISC_KMODS      += dr_cpu
 392 MISC_KMODS      += dr_io
 393 MISC_KMODS      += dr_mem
 394 MISC_KMODS      += ds
 395 MISC_KMODS      += fault_iso
 396 MISC_KMODS      += ldc
 397 MISC_KMODS      += obpsym
 398 MISC_KMODS      += platmod
 399 MISC_KMODS      += platsvc
 400 MISC_KMODS      += vis
 401 MISC_KMODS      += pcie
 402 
 403 #       md5 optimized for Niagara
 404 #
 405 MISC_KMODS      += md5
 406 
 407 #
 408 #       Brand modules
 409 #
 410 BRAND_KMODS     += sn1_brand s10_brand
 411 
 412 #
 413 #       Software Cryptographic Providers (/kernel/crypto):
 414 #
 415 CRYPTO_KMODS    += arcfour
 416 
 417 #
 418 #       generic-unix module (/kernel/genunix):
 419 #
 420 GENUNIX_KMODS   += genunix
 421 
 422 #
 423 #       Modules eXcluded from the product:
 424 #
 425 XMODS           +=
 426 
 427 #
 428 #       cpu modules
 429 #
 430 CPU_KMODS       += generic niagara niagara2 vfalls kt
 431 
 432 LINT_CPU_KMODS  += generic
 433 
 434 #
 435 #       Performance Counter BackEnd Modules (/usr/kernel/pcbe):
 436 #
 437 PCBE_KMODS      += niagara_pcbe
 438 PCBE_KMODS      += niagara2_pcbe
 439 PCBE_KMODS      += vfalls_pcbe
 440 PCBE_KMODS      += kt_pcbe