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/i86pc/Makefile.i86pc
  24 #
  25 # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  26 # Copyright (c) 2013 Andrew Stormont.  All rights reserved.
  27 # Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
  28 #
  29 #
  30 #       This makefile contains the common definitions for the i86pc unix
  31 #       and all i86pc implementation architecture dependent modules.
  32 #
  33 
  34 #
  35 #       Machine type (implementation architecture):
  36 #
  37 PLATFORM         = i86pc
  38 
  39 #
  40 #       uname -m value
  41 #
  42 UNAME_M         = $(PLATFORM)
  43 
  44 #
  45 # Definitions for the platform-specific /platform directories.
  46 #
  47 # IMPLEMENTATIONS is used to designate i86pc machines which have
  48 # platform specific modules.  All code specific to a given implementation
  49 # resides in the appropriately named subdirectory.   This requires
  50 # these platforms to have their own Makefiles to define ROOT_PLAT_DIRS,
  51 # USR_PLAT_DIRS, etc.
  52 #
  53 IMPLEMENTATIONS = i86hvm
  54 
  55 #
  56 #       Everybody needs to know how to build modstubs.o and to locate unix.o
  57 #
  58 UNIX_DIR         = $(UTSBASE)/$(PLATFORM)/unix
  59 GENLIB_DIR       = $(UTSBASE)/intel/genunix
  60 MODSTUBS_DIR     = $(UNIX_DIR)
  61 DSF_DIR          = $(UTSBASE)/$(PLATFORM)/genassym
  62 
  63 DTRACESTUBS_O    = $(OBJS_DIR)/dtracestubs.o
  64 DTRACESTUBS      = $(OBJS_DIR)/libdtracestubs.so
  65 
  66 SYM_MOD         = $(OBJS_DIR)/unix.sym
  67 
  68 UNIX_O           = $(UNIX_DIR)/$(OBJS_DIR)/unix.o
  69 MODSTUBS_O       = $(MODSTUBS_DIR)/$(OBJS_DIR)/modstubs.o
  70 GENLIB           = $(GENLIB_DIR)/$(OBJS_DIR)/libgenunix.so
  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 #       x86 or amd64 inline templates
 102 #
 103 INLINES_32              = $(UTSBASE)/intel/ia32/ml/ia32.il \
 104                           $(UTSBASE)/$(PLATFORM)/ml/ia32.il
 105 INLINES_64              = $(UTSBASE)/intel/amd64/ml/amd64.il \
 106                           $(UTSBASE)/$(PLATFORM)/ml/amd64.il
 107 INLINES                 += $(INLINES_$(CLASS))
 108 
 109 #
 110 #       kernel-specific optimizations; override default in Makefile.master
 111 #
 112 
 113 CFLAGS_XARCH_32         = $(i386_CFLAGS)
 114 CFLAGS_XARCH_64         = $(amd64_CFLAGS)
 115 CFLAGS_XARCH            = $(CFLAGS_XARCH_$(CLASS))
 116 
 117 COPTFLAG_32             = $(COPTFLAG)
 118 COPTFLAG_64             = $(COPTFLAG64)
 119 COPTIMIZE               = $(COPTFLAG_$(CLASS))
 120 
 121 CFLAGS                  = $(CFLAGS_XARCH)
 122 CFLAGS                  += $(COPTIMIZE)
 123 CFLAGS                  += $(INLINES) -D_ASM_INLINES
 124 CFLAGS                  += $(CCMODE)
 125 CFLAGS                  += $(SPACEFLAG)
 126 CFLAGS                  += $(CCUNBOUND)
 127 CFLAGS                  += $(CFLAGS_uts)
 128 CFLAGS                  += -xstrconst
 129 
 130 ASFLAGS_XARCH_32        = $(i386_ASFLAGS)
 131 ASFLAGS_XARCH_64        = $(amd64_ASFLAGS)
 132 ASFLAGS_XARCH           = $(ASFLAGS_XARCH_$(CLASS))
 133 
 134 ASFLAGS                 += $(ASFLAGS_XARCH)
 135 
 136 AS_INC_PATH             += -I$(DSF_DIR)/$(OBJS_DIR)
 137 
 138 #
 139 #       The following must be defined for all implementations:
 140 #
 141 #       MAPFILE:        ld mapfile for the build of kernel/unix.
 142 #       MODSTUBS:       Module stubs source file.
 143 #       GENASSYM_SRC:   genassym.c
 144 #
 145 MAPFILE          = $(UTSBASE)/$(PLATFORM)/conf/Mapfile
 146 MODSTUBS         = $(UTSBASE)/intel/ia32/ml/modstubs.s
 147 GENASSYM_SRC     = $(UTSBASE)/$(PLATFORM)/ml/genassym.c
 148 OFFSETS_SRC      = $(UTSBASE)/$(PLATFORM)/ml/offsets.in
 149 PLATFORM_OFFSETS_32     = $(UTSBASE)/$(PLATFORM)/ml/mach_offsets.in
 150 PLATFORM_OFFSETS_64     = $(UTSBASE)/intel/amd64/ml/mach_offsets.in
 151 PLATFORM_OFFSETS_SRC    = $(PLATFORM_OFFSETS_$(CLASS))
 152 KDI_OFFSETS_SRC  = $(UTSBASE)/intel/kdi/kdi_offsets.in
 153 
 154 #
 155 #       Define the actual specific platforms
 156 #
 157 MACHINE_DEFS     = -D$(PLATFORM) -D_MACHDEP
 158 
 159 #
 160 #       Software workarounds for hardware "features"
 161 #
 162 
 163 include $(UTSBASE)/$(PLATFORM)/Makefile.workarounds
 164 
 165 #
 166 #       Debugging level
 167 #
 168 #       Special knowledge of which special debugging options effect which
 169 #       file is used to optimize the build if these flags are changed.
 170 #
 171 #       XXX: The above could possibly be done for more flags and files, but
 172 #            is left as an experiment to the interested reader. Be forewarned,
 173 #            that excessive use could lead to maintenance difficulties.
 174 #
 175 DEBUG_DEFS_OBJ32        =
 176 DEBUG_DEFS_DBG32        = -DDEBUG
 177 DEBUG_DEFS_OBJ64        =
 178 DEBUG_DEFS_DBG64        = -DDEBUG
 179 DEBUG_DEFS              = $(DEBUG_DEFS_$(BUILD_TYPE))
 180 
 181 DEBUG_COND_OBJ32        = $(POUND_SIGN)
 182 DEBUG_COND_DBG32        =
 183 DEBUG_COND_OBJ64        = $(POUND_SIGN)
 184 DEBUG_COND_DBG64        =
 185 IF_DEBUG_OBJ            = $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/
 186 
 187 $(IF_DEBUG_OBJ)trap.o           := DEBUG_DEFS += -DTRAPDEBUG -DTRAPTRACE
 188 $(IF_DEBUG_OBJ)syscall_asm.o    := DEBUG_DEFS += -DSYSCALLTRACE -DTRAPTRACE
 189 $(IF_DEBUG_OBJ)syscall_asm_amd64.o := DEBUG_DEFS += -DSYSCALLTRACE -DTRAPTRACE
 190 $(IF_DEBUG_OBJ)fast_trap_asm.o  := DEBUG_DEFS += -DTRAPTRACE
 191 $(IF_DEBUG_OBJ)interrupt.o      := DEBUG_DEFS += -DTRAPTRACE
 192 $(IF_DEBUG_OBJ)intr.o           := DEBUG_DEFS += -DTRAPTRACE
 193 $(IF_DEBUG_OBJ)locore.o         := DEBUG_DEFS += -DTRAPTRACE
 194 $(IF_DEBUG_OBJ)mp_startup.o     := DEBUG_DEFS += -DTRAPTRACE
 195 $(IF_DEBUG_OBJ)machdep.o        := DEBUG_DEFS += -DTRAPTRACE
 196 $(IF_DEBUG_OBJ)exception.o      := DEBUG_DEFS += -DTRAPTRACE
 197 $(IF_DEBUG_OBJ)x_call.o         := DEBUG_DEFS += -DTRAPTRACE
 198 $(IF_DEBUG_OBJ)mp_call.o        := DEBUG_DEFS += -DTRAPTRACE
 199 $(IF_DEBUG_OBJ)cbe.o            := DEBUG_DEFS += -DTRAPTRACE
 200 
 201 #
 202 #       Collect the preprocessor definitions to be associated with *all*
 203 #       files.
 204 #
 205 ALL_DEFS         = $(MACHINE_DEFS) $(WORKAROUND_DEFS) $(DEBUG_DEFS) \
 206                    $(OPTION_DEFS)
 207 GENASSYM_DEFS    = $(MACHINE_DEFS) $(OPTION_DEFS) \
 208                         -_gcc=-fno-eliminate-unused-debug-symbols \
 209                         -_gcc=-fno-eliminate-unused-debug-types
 210 
 211 #
 212 # ----- TRANSITIONAL SECTION --------------------------------------------------
 213 #
 214 
 215 #
 216 #       Not everything which *should* be a module is a module yet. The
 217 #       following is a list of such objects which are currently part of
 218 #       the base kernel but should soon become kmods.
 219 #
 220 #       XXX: $(KMACCT_OBJS) is neither in the MT kernel nor was it ever
 221 #            made into a module. If it is made MT safe before being made
 222 #            into a module, it should be added to this list. It was in
 223 #            this list pre ON-4.0.
 224 #
 225 #
 226 MACH_NOT_YET_KMODS      = $(AUTOCONF_OBJS)
 227 
 228 #
 229 # ----- END OF TRANSITIONAL SECTION -------------------------------------------
 230 #
 231 
 232 #
 233 #       The kernels modules which are "implementation architecture"
 234 #       specific for this machine are enumerated below. Note that most
 235 #       of these modules must exist (in one form or another) for each
 236 #       architecture.
 237 #
 238 #       Machine Specific Driver Modules (/kernel/drv)
 239 #       DRV_KMODS are built both 32-bit and 64-bit
 240 #       DRV_KMODS_32 are built only 32-bit
 241 #       DRV_KMODS_64 are built only 64-bit
 242 #
 243 DRV_KMODS       += rootnex
 244 DRV_KMODS       += isa
 245 DRV_KMODS       += pcplusmp
 246 DRV_KMODS       += apix
 247 DRV_KMODS       += cpc
 248 DRV_KMODS       += pci
 249 DRV_KMODS       += npe
 250 DRV_KMODS       += pci-ide
 251 DRV_KMODS       += xsvc
 252 DRV_KMODS       += tzmon
 253 DRV_KMODS       += acpi_drv
 254 DRV_KMODS       += acpinex
 255 DRV_KMODS       += amd_iommu
 256 DRV_KMODS       += dr
 257 DRV_KMODS       += ioat
 258 DRV_KMODS       += fipe
 259 
 260 DRV_KMODS       += cpudrv
 261 
 262 
 263 #
 264 # Platform Power Modules
 265 #
 266 DRV_KMODS       += ppm acpippm
 267 
 268 #
 269 #       CPU Modules
 270 #
 271 CPU_KMODS       += amd_opteron
 272 CPU_KMODS       += generic_cpu
 273 CPU_KMODS       += authenticamd
 274 CPU_KMODS       += genuineintel
 275 
 276 #
 277 #       Exec Class Modules (/kernel/exec):
 278 #
 279 EXEC_KMODS      +=
 280 
 281 #
 282 #       Scheduling Class Modules (/kernel/sched):
 283 #
 284 SCHED_KMODS     +=
 285 
 286 #
 287 #       File System Modules (/kernel/fs):
 288 #
 289 FS_KMODS        +=
 290 
 291 #
 292 #       Streams Modules (/kernel/strmod):
 293 #
 294 STRMOD_KMODS    +=
 295 
 296 #
 297 #       'System' Modules (/kernel/sys):
 298 #
 299 SYS_KMODS       +=
 300 
 301 #
 302 #       'Misc' Modules (/kernel/misc):
 303 #
 304 MISC_KMODS      += gfx_private pcie
 305 MISC_KMODS      += acpidev
 306 MISC_KMODS      += drmach_acpi
 307 
 308 #
 309 #       'Dacf' modules (/kernel/dacf)
 310 #
 311 DACF_KMODS      += consconfig_dacf
 312 
 313 #
 314 #       'Mach' Modules (/kernel/mach):
 315 #
 316 MACH_KMODS      += uppc
 317 
 318 #
 319 #       CPR Misc Module.
 320 #
 321 MISC_KMODS      += cpr