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