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 2019 Peter Tribble.
  27 #
  28 #       This makefile contains the common definitions for the sun4u unix
  29 #       and all sun4u implementation architecture dependent modules.
  30 #
  31 
  32 #
  33 #       Machine type (implementation architecture):
  34 #
  35 PLATFORM         = sun4u
  36 PROMIF           = ieee1275
  37 PSMBASE          = $(UTSBASE)/../psm
  38 
  39 #
  40 #       uname -m value
  41 #
  42 UNAME_M         = $(PLATFORM)
  43 
  44 #
  45 # Definitions for the platform-specific /platform directories.
  46 #
  47 # PLATFORMS designates those sun4u machines which have no platform
  48 # specific code.
  49 #
  50 # IMPLEMENTATIONS is used to designate sun4u machines which do have
  51 # platform specific modules (perhaps including their own unix).  All
  52 # code specific to a given implementation resides in the appropriately
  53 # named subdirectory.   This requires these platforms to have their
  54 # own Makefiles to define ROOT_PLAT_DIRS, USR_PLAT_DIRS, etc.
  55 #
  56 # So if we had an implementation named 'foo', we would need the following
  57 # Makefiles in the foo subdirectory:
  58 #
  59 #       sun4u/foo/Makefile
  60 #       sun4u/foo/Makefile.foo
  61 #       sun4u/foo/Makefile.targ
  62 #
  63 
  64 #
  65 # /usr/platform/$(IMPLEMENTED_PLATFORM) is created as a directory that
  66 # all the $(LINKED_PLATFORMS) link to.
  67 #
  68 IMPLEMENTED_PLATFORM    = SUNW,Ultra-2
  69 
  70 LINKED_PLATFORMS        += SUNW,Ultra-30
  71 LINKED_PLATFORMS        += SUNW,Ultra-60
  72 
  73 #
  74 # all PLATFORMS that do not belong in the $(IMPLEMENTATIONS) list
  75 # ie. all desktop platforms
  76 #
  77 PLATFORMS                = $(IMPLEMENTED_PLATFORM)
  78 PLATFORMS               += $(LINKED_PLATFORMS)
  79 
  80 ROOT_PLAT_DIRS          = $(PLATFORMS:%=$(ROOT_PLAT_DIR)/%)
  81 USR_PLAT_DIRS           = $(PLATFORMS:%=$(USR_PLAT_DIR)/%)
  82 
  83 USR_DESKTOP_DIR         = $(USR_PLAT_DIR)/$(IMPLEMENTED_PLATFORM)
  84 USR_DESKTOP_INC_DIR     = $(USR_DESKTOP_DIR)/include
  85 USR_DESKTOP_SBIN_DIR    = $(USR_DESKTOP_DIR)/sbin
  86 USR_DESKTOP_LIB_DIR     = $(USR_DESKTOP_DIR)/lib
  87 
  88 #
  89 # Welcome to SPARC V9.
  90 #
  91 
  92 #
  93 #       Define supported builds
  94 #
  95 DEF_BUILDS      = $(DEF_BUILDS64)
  96 ALL_BUILDS      = $(ALL_BUILDS64)
  97 
  98 #
  99 #       Everybody needs to know how to build modstubs.o and to locate unix.o
 100 #
 101 UNIX_DIR         = $(UTSBASE)/$(PLATFORM)/unix
 102 GENLIB_DIR       = $(UTSBASE)/$(PLATFORM)/genunix
 103 MODSTUBS_DIR     = $(UNIX_DIR)
 104 DSF_DIR          = $(UTSBASE)/$(PLATFORM)/genassym
 105 LINTS_DIR        = $(OBJS_DIR)
 106 LINT_LIB_DIR     = $(UTSBASE)/$(PLATFORM)/lint-libs/$(OBJS_DIR)
 107 
 108 DTRACESTUBS_O    = $(OBJS_DIR)/dtracestubs.o
 109 DTRACESTUBS      = $(OBJS_DIR)/libdtracestubs.so
 110 
 111 UNIX_O           = $(UNIX_DIR)/$(OBJS_DIR)/unix.o
 112 MODSTUBS_O       = $(MODSTUBS_DIR)/$(OBJS_DIR)/modstubs.o
 113 GENLIB           = $(GENLIB_DIR)/$(OBJS_DIR)/libgenunix.so
 114 
 115 LINT_LIB         = $(LINT_LIB_DIR)/llib-lunix.ln
 116 GEN_LINT_LIB     = $(LINT_LIB_DIR)/llib-lgenunix.ln
 117 
 118 LINT64_DIRS      = $(LINT64_BUILDS:%=$(UTSBASE)/$(PLATFORM)/lint-libs/%)
 119 LINT64_FILES     = $(LINT64_DIRS:%=%/llib-l$(MODULE).ln)
 120 
 121 #
 122 #       cpu and platform modules need to know how to build their own symcheck module
 123 #
 124 PLATMOD          = platmod
 125 PLATLIB          = $(PLAT_DIR)/$(OBJS_DIR)/libplatmod.so
 126 
 127 CPUNAME          = cpu
 128 CPULIB           = $(CPU_DIR)/$(OBJS_DIR)/libcpu.so
 129 
 130 SYM_MOD          = $(OBJS_DIR)/unix.sym
 131 
 132 #
 133 #       Include the makefiles which define build rule templates, the
 134 #       collection of files per module, and a few specific flags. Note
 135 #       that order is significant, just as with an include path. The
 136 #       first build rule template which matches the files name will be
 137 #       used. By including these in order from most machine dependent
 138 #       to most machine independent, we allow a machine dependent file
 139 #       to be used in preference over a machine independent version
 140 #       (Such as a machine specific optimization, which preserves the
 141 #       interfaces.)
 142 #
 143 include $(UTSBASE)/sun4/Makefile.files
 144 include $(UTSBASE)/$(PLATFORM)/Makefile.files
 145 include $(UTSBASE)/sfmmu/Makefile.files
 146 include $(UTSBASE)/sparc/v9/Makefile.files
 147 include $(UTSBASE)/sparc/Makefile.files
 148 include $(UTSBASE)/sun/Makefile.files
 149 include $(SRC)/psm/promif/$(PROMIF)/common/Makefile.files
 150 include $(SRC)/psm/promif/$(PROMIF)/$(PLATFORM)/Makefile.files
 151 include $(UTSBASE)/common/Makefile.files
 152 
 153 #
 154 #       Include machine independent rules. Note that this does not imply
 155 #       that the resulting module from rules in Makefile.uts is machine
 156 #       independent. Only that the build rules are machine independent.
 157 #
 158 include $(UTSBASE)/Makefile.uts
 159 
 160 # These come after Makefile.uts.
 161 IMPLEMENTATIONS          = tazmo
 162 IMPLEMENTATIONS         += javelin
 163 IMPLEMENTATIONS         += darwin
 164 IMPLEMENTATIONS         += quasar
 165 IMPLEMENTATIONS         += grover
 166 IMPLEMENTATIONS         += enchilada
 167 IMPLEMENTATIONS         += taco
 168 IMPLEMENTATIONS         += mpxu
 169 IMPLEMENTATIONS         += excalibur
 170 IMPLEMENTATIONS         += serengeti
 171 IMPLEMENTATIONS         += littleneck
 172 IMPLEMENTATIONS         += daktari
 173 IMPLEMENTATIONS         += cherrystone
 174 IMPLEMENTATIONS         += fjlite
 175 IMPLEMENTATIONS         += schumacher
 176 IMPLEMENTATIONS         += blade
 177 IMPLEMENTATIONS         += boston
 178 IMPLEMENTATIONS         += seattle
 179 IMPLEMENTATIONS         += chicago
 180 IMPLEMENTATIONS         += sunfire
 181 IMPLEMENTATIONS         += lw8
 182 IMPLEMENTATIONS         += opl
 183 IMPLEMENTATIONS         += lw2plus
 184 
 185 #
 186 #       machine specific optimization, override default in Makefile.master
 187 #
 188 CC_XARCH        = -m64 -xarch=sparcvis
 189 AS_XARCH        = -xarch=v9a
 190 COPTIMIZE       = -xO3
 191 CCMODE          = -Xa
 192 
 193 CFLAGS          = -xchip=ultra $(CCABS32) $(CCREGSYM)
 194 CFLAGS          += $(CC_XARCH)
 195 CFLAGS          += $(COPTIMIZE)
 196 CFLAGS          += $(EXTRA_CFLAGS)
 197 CFLAGS          += $(XAOPT)
 198 CFLAGS          += $(INLINES) -D_ASM_INLINES
 199 CFLAGS          += $(CCMODE)
 200 CFLAGS          += $(SPACEFLAG)
 201 CFLAGS          += $(CERRWARN)
 202 CFLAGS          += $(CTF_FLAGS_$(CLASS))
 203 CFLAGS          += $(CSTD)
 204 CFLAGS          += $(CCUNBOUND)
 205 CFLAGS          += $(CCNOAUTOINLINE)
 206 CFLAGS          += $(CCSTATICSYM)
 207 CFLAGS          += $(CC32BITCALLERS)
 208 CFLAGS          += $(IROPTFLAG)
 209 CFLAGS          += $(CGLOBALSTATIC)
 210 CFLAGS          += -xregs=no%float
 211 CFLAGS          += -xstrconst
 212 CFLAGS          += $(CSOURCEDEBUGFLAGS)
 213 CFLAGS          += $(CUSERFLAGS)
 214 
 215 ASFLAGS         += $(AS_XARCH)
 216 
 217 AS_INC_PATH     += -I$(DSF_DIR)/$(OBJS_DIR)
 218 
 219 LINT_KMODS      += $(GENUNIX_KMODS)
 220 
 221 LINT_DEFS = -m64
 222 
 223 #
 224 #       The following must be defined for all implementations:
 225 #
 226 #       MAPFILE:                ld mapfile for the build of kernel/unix.
 227 #       MODSTUBS:               Module stubs source file.
 228 #       GENCONST_SRC:           genconst.c
 229 #       OFFSETS:                offsets.in
 230 #       PLATFORM_OFFSETS:       Platform specific mach_offsets.in
 231 #       FDOFFSETS:              fd_offsets.in
 232 #
 233 MAPFILE          = $(UTSBASE)/sun4/conf/Mapfile
 234 MODSTUBS         = $(UTSBASE)/sparc/ml/modstubs.s
 235 GENCONST_SRC     = $(UTSBASE)/sun4/ml/genconst.c
 236 OFFSETS          = $(UTSBASE)/sun4/ml/offsets.in
 237 PLATFORM_OFFSETS = $(UTSBASE)/sun4u/ml/mach_offsets.in
 238 FDOFFSETS        = $(UTSBASE)/sun/io/fd_offsets.in
 239 
 240 #
 241 #       Define the actual specific platforms
 242 #
 243 
 244 MACHINE_DEFS    = -D$(PLATFORM) -D_MACHDEP -DSFMMU
 245 
 246 #
 247 #       Software workarounds for hardware "features"
 248 #
 249 
 250 include $(UTSBASE)/$(PLATFORM)/Makefile.workarounds
 251 
 252 #
 253 #       Debugging level
 254 #
 255 #       Special knowledge of which special debugging options effect which
 256 #       file is used to optimize the build if these flags are changed.
 257 #
 258 #       XXX: The above could possibly be done for more flags and files, but
 259 #            is left as an experiment to the interested reader. Be forewarned,
 260 #            that excessive use could lead to maintenance difficulties.
 261 #
 262 #       Note: kslice can be enabled for the sun4u, but is disabled by default
 263 #             in all cases.
 264 #
 265 
 266 DEBUG_DEFS_OBJ64        =
 267 DEBUG_DEFS_DBG64        = -DDEBUG
 268 DEBUG_DEFS              = $(DEBUG_DEFS_$(BUILD_TYPE))
 269 
 270 DEBUG_COND_OBJ64        = $(POUND_SIGN)
 271 DEBUG_COND_DBG64        =
 272 IF_DEBUG_OBJ            = $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/
 273 
 274 $(IF_DEBUG_OBJ)trap.o           :=      DEBUG_DEFS      += -DTRAPDEBUG
 275 $(IF_DEBUG_OBJ)mach_trap.o      :=      DEBUG_DEFS      += -DTRAPDEBUG
 276 $(IF_DEBUG_OBJ)syscall_trap.o   :=      DEBUG_DEFS      += -DSYSCALLTRACE
 277 $(IF_DEBUG_OBJ)clock.o          :=      DEBUG_DEFS      += -DKSLICE=0
 278 
 279 IF_TRAPTRACE_OBJ = $(IF_DEBUG_OBJ)
 280 # comment this out for a non-debug kernel with TRAPTRACE
 281 #IF_TRAPTRACE_OBJ = $(OBJS_DIR)/
 282 
 283 $(IF_TRAPTRACE_OBJ)mach_locore.o        :=      DEBUG_DEFS      += -DTRAPTRACE
 284 $(IF_TRAPTRACE_OBJ)mlsetup.o            :=      DEBUG_DEFS      += -DTRAPTRACE
 285 $(IF_TRAPTRACE_OBJ)syscall_trap.o       :=      DEBUG_DEFS      += -DTRAPTRACE
 286 $(IF_TRAPTRACE_OBJ)startup.o            :=      DEBUG_DEFS      += -DTRAPTRACE
 287 $(IF_TRAPTRACE_OBJ)mach_startup.o       :=      DEBUG_DEFS      += -DTRAPTRACE
 288 $(IF_TRAPTRACE_OBJ)mp_startup.o         :=      DEBUG_DEFS      += -DTRAPTRACE
 289 $(IF_TRAPTRACE_OBJ)cpu_states.o         :=      DEBUG_DEFS      += -DTRAPTRACE
 290 $(IF_TRAPTRACE_OBJ)mach_cpu_states.o    :=      DEBUG_DEFS      += -DTRAPTRACE
 291 $(IF_TRAPTRACE_OBJ)interrupt.o          :=      DEBUG_DEFS      += -DTRAPTRACE
 292 $(IF_TRAPTRACE_OBJ)mach_interrupt.o     :=      DEBUG_DEFS      += -DTRAPTRACE
 293 $(IF_TRAPTRACE_OBJ)sfmmu_asm.o          :=      DEBUG_DEFS      += -DTRAPTRACE
 294 $(IF_TRAPTRACE_OBJ)trap_table.o         :=      DEBUG_DEFS      += -DTRAPTRACE
 295 $(IF_TRAPTRACE_OBJ)xc.o                 :=      DEBUG_DEFS      += -DTRAPTRACE
 296 $(IF_TRAPTRACE_OBJ)mach_xc.o            :=      DEBUG_DEFS      += -DTRAPTRACE
 297 $(IF_TRAPTRACE_OBJ)wbuf.o               :=      DEBUG_DEFS      += -DTRAPTRACE
 298 $(IF_TRAPTRACE_OBJ)trap.o               :=      DEBUG_DEFS      += -DTRAPTRACE
 299 $(IF_TRAPTRACE_OBJ)mach_trap.o          :=      DEBUG_DEFS      += -DTRAPTRACE
 300 $(IF_TRAPTRACE_OBJ)x_call.o             :=      DEBUG_DEFS      += -DTRAPTRACE
 301 $(IF_TRAPTRACE_OBJ)spitfire_asm.o       :=      DEBUG_DEFS      += -DTRAPTRACE
 302 $(IF_TRAPTRACE_OBJ)us3_common_asm.o     :=      DEBUG_DEFS      += -DTRAPTRACE
 303 $(IF_TRAPTRACE_OBJ)us3_cheetah_asm.o    :=      DEBUG_DEFS      += -DTRAPTRACE
 304 $(IF_TRAPTRACE_OBJ)us3_cheetahplus_asm.o :=     DEBUG_DEFS      += -DTRAPTRACE
 305 $(IF_TRAPTRACE_OBJ)us3_jalapeno_asm.o   :=      DEBUG_DEFS      += -DTRAPTRACE
 306 $(IF_TRAPTRACE_OBJ)opl_olympus_asm.o    :=      DEBUG_DEFS      += -DTRAPTRACE
 307 
 308 # Comment these out if you don't want dispatcher lock statistics.
 309 
 310 #$(IF_DEBUG_OBJ)lock_prim.o     := DEBUG_DEFS   += -DDISP_LOCK_STATS
 311 #$(IF_DEBUG_OBJ)disp.o          := DEBUG_DEFS   += -DDISP_LOCK_STATS
 312 
 313 # Comment these out if you don't want dispatcher debugging
 314 
 315 #$(IF_DEBUG_OBJ)lock_prim.o     := DEBUG_DEFS   += -DDISP_DEBUG
 316 
 317 #
 318 #       Collect the preprocessor definitions to be associated with *all*
 319 #       files.
 320 #
 321 ALL_DEFS         = $(MACHINE_DEFS) $(WORKAROUND_DEFS) $(DEBUG_DEFS) \
 322                    $(OPTION_DEFS)
 323 GENCONST_DEFS    = $(MACHINE_DEFS) $(OPTION_DEFS)
 324 
 325 #
 326 # ----- TRANSITIONAL SECTION --------------------------------------------------
 327 #
 328 
 329 #
 330 #       Not everything which *should* be a module is a module yet. The
 331 #       following is a list of such objects which are currently part of
 332 #       the base kernel but should soon become kmods.
 333 #
 334 MACH_NOT_YET_KMODS       = $(AUTOCONF_OBJS)
 335 
 336 #
 337 # ----- END OF TRANSITIONAL SECTION -------------------------------------------
 338 #
 339 
 340 #
 341 #       The kernels modules which are "implementation architecture"
 342 #       specific for this machine are enumerated below. Note that most
 343 #       of these modules must exist (in one form or another) for each
 344 #       architecture.
 345 #
 346 #       Common Drivers (usually pseudo drivers) (/kernel/drv):
 347 #
 348 
 349 #
 350 #       Machine Specific Driver Modules (/kernel/drv):
 351 #
 352 #       XXX: How many of these are really machine specific?
 353 #
 354 DRV_KMODS       += bbc_beep
 355 DRV_KMODS       += cpc
 356 DRV_KMODS       += fd
 357 DRV_KMODS       += rootnex sbusmem upa64s zs zsh
 358 DRV_KMODS       += sbus
 359 DRV_KMODS       += pcisch pcipsy simba
 360 DRV_KMODS       += px
 361 DRV_KMODS       += ebus
 362 DRV_KMODS       += su
 363 DRV_KMODS       += tod
 364 DRV_KMODS       += power
 365 DRV_KMODS       += epic
 366 DRV_KMODS       += grbeep
 367 DRV_KMODS       += pcf8584 max1617 seeprom tda8444 pca9556
 368 DRV_KMODS       += ics951601 adm1031
 369 DRV_KMODS       += lm75 ltc1427 pcf8591 pcf8574 ssc050 ssc100
 370 DRV_KMODS       += pic16f819
 371 DRV_KMODS       += pic16f747
 372 DRV_KMODS       += adm1026
 373 DRV_KMODS       += us
 374 DRV_KMODS       += ppm schppm jbusppm
 375 DRV_KMODS       += mc-us3
 376 DRV_KMODS       += mc-us3i
 377 DRV_KMODS       += smbus
 378 DRV_KMODS       += db21554
 379 DRV_KMODS       += gpio_87317
 380 DRV_KMODS       += isadma
 381 DRV_KMODS       += sbbc
 382 DRV_KMODS       += pmubus
 383 DRV_KMODS       += pmugpio
 384 DRV_KMODS       += pmc
 385 DRV_KMODS       += trapstat
 386 DRV_KMODS       += rmc_comm
 387 DRV_KMODS       += rmcadm
 388 DRV_KMODS       += rmclomv
 389 DRV_KMODS       += sf
 390 DRV_KMODS       += nxge
 391 DRV_KMODS       += i2bsc
 392 DRV_KMODS       += mem_cache
 393 
 394 #
 395 #       Exec Class Modules (/kernel/exec):
 396 #
 397 EXEC_KMODS      +=
 398 
 399 #
 400 #       Scheduling Class Modules (/kernel/sched):
 401 #
 402 SCHED_KMODS     +=
 403 
 404 #
 405 #       File System Modules (/kernel/fs):
 406 #
 407 FS_KMODS        +=
 408 
 409 #
 410 #       'System' Modules (/kernel/sys):
 411 #
 412 SYS_KMODS       +=
 413 
 414 #
 415 #       'User' Modules (/kernel/misc):
 416 #
 417 MISC_KMODS      += bignum
 418 MISC_KMODS      += obpsym bootdev vis cpr platmod md5 sha1 i2c_svc
 419 MISC_KMODS      += sbd
 420 
 421 MISC_KMODS      += opl_cfg
 422 MISC_KMODS      += gptwo_cpu gptwocfg
 423 MISC_KMODS      += pcie
 424 
 425 #
 426 #       Brand modules
 427 #
 428 BRAND_KMODS     += sn1_brand s10_brand
 429 
 430 #
 431 #       Software Cryptographic Providers (/kernel/crypto):
 432 #
 433 CRYPTO_KMODS    += aes
 434 CRYPTO_KMODS    += arcfour
 435 CRYPTO_KMODS    += des
 436 
 437 #
 438 #       generic-unix module (/kernel/genunix):
 439 #
 440 GENUNIX_KMODS   += genunix
 441 
 442 #       'User' "Modules" excluded from the Full Kernel lint target:
 443 #
 444 
 445 #
 446 #       Modules eXcluded from the product:
 447 #
 448 XMODS           +=
 449 
 450 #
 451 #       cpu modules
 452 #
 453 CPU_KMODS       += cheetah cheetahplus jalapeno serrano spitfire hummingbird
 454 
 455 #
 456 #       sun4u 'TOD' Modules (/platform/.../kernel/tod):
 457 #
 458 TOD_KMODS       += todds1287 todds1337 todmostek
 459 TOD_KMODS       += todm5819 todblade todbq4802 todsg todopl
 460 TOD_KMODS       += todm5819p_rmc
 461 
 462 #
 463 #       Performance Counter BackEnd Modules (/usr/kernel/pcbe):
 464 #
 465 PCBE_KMODS      += us234_pcbe
 466 PCBE_KMODS      += opl_pcbe