xref: /illumos-gate/usr/src/uts/i86pc/Makefile.i86pc (revision 5328fc53d11d7151861fa272e4fb0248b8f0e145)
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#
37PLATFORM	 = i86pc
38
39#
40#	uname -m value
41#
42UNAME_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#
53IMPLEMENTATIONS	= i86hvm
54
55#
56#	Everybody needs to know how to build modstubs.o and to locate unix.o
57#
58UNIX_DIR	 = $(UTSBASE)/$(PLATFORM)/unix
59GENLIB_DIR	 = $(UTSBASE)/intel/genunix
60MODSTUBS_DIR	 = $(UNIX_DIR)
61DSF_DIR		 = $(UTSBASE)/$(PLATFORM)/genassym
62
63DTRACESTUBS_O	 = $(OBJS_DIR)/dtracestubs.o
64DTRACESTUBS	 = $(OBJS_DIR)/libdtracestubs.so
65
66SYM_MOD		= $(OBJS_DIR)/unix.sym
67
68UNIX_O		 = $(UNIX_DIR)/$(OBJS_DIR)/unix.o
69MODSTUBS_O	 = $(MODSTUBS_DIR)/$(OBJS_DIR)/modstubs.o
70GENLIB		 = $(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#
83include $(UTSBASE)/$(PLATFORM)/Makefile.files
84include $(UTSBASE)/intel/Makefile.files
85include $(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#
92include $(UTSBASE)/Makefile.uts
93
94#
95#	Define supported builds
96#
97DEF_BUILDS		= $(DEF_BUILDS64)
98ALL_BUILDS		= $(ALL_BUILDS64)
99
100#
101#	x86 or amd64 inline templates
102#
103INLINES_32		= $(UTSBASE)/intel/ia32/ml/ia32.il \
104			  $(UTSBASE)/$(PLATFORM)/ml/ia32.il
105INLINES_64		= $(UTSBASE)/intel/amd64/ml/amd64.il \
106			  $(UTSBASE)/$(PLATFORM)/ml/amd64.il
107INLINES			+= $(INLINES_$(CLASS))
108
109#
110#	kernel-specific optimizations; override default in Makefile.master
111#
112
113CFLAGS_XARCH_32		= $(i386_CFLAGS)
114CFLAGS_XARCH_64		= $(amd64_CFLAGS)
115CFLAGS_XARCH		= $(CFLAGS_XARCH_$(CLASS))
116
117COPTFLAG_32		= $(COPTFLAG)
118COPTFLAG_64		= $(COPTFLAG64)
119COPTIMIZE		= $(COPTFLAG_$(CLASS))
120
121CFLAGS			= $(CFLAGS_XARCH)
122CFLAGS			+= $(COPTIMIZE)
123CFLAGS			+= $(INLINES) -D_ASM_INLINES
124CFLAGS			+= $(CCMODE)
125CFLAGS			+= $(SPACEFLAG)
126CFLAGS			+= $(CCUNBOUND)
127CFLAGS			+= $(CFLAGS_uts)
128CFLAGS			+= -xstrconst
129
130ASFLAGS_XARCH_32	= $(i386_ASFLAGS)
131ASFLAGS_XARCH_64	= $(amd64_ASFLAGS)
132ASFLAGS_XARCH		= $(ASFLAGS_XARCH_$(CLASS))
133
134ASFLAGS			+= $(ASFLAGS_XARCH)
135
136AS_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#
145MAPFILE		 = $(UTSBASE)/$(PLATFORM)/conf/Mapfile
146MODSTUBS	 = $(UTSBASE)/intel/ia32/ml/modstubs.s
147GENASSYM_SRC	 = $(UTSBASE)/$(PLATFORM)/ml/genassym.c
148OFFSETS_SRC	 = $(UTSBASE)/$(PLATFORM)/ml/offsets.in
149PLATFORM_OFFSETS_32	= $(UTSBASE)/$(PLATFORM)/ml/mach_offsets.in
150PLATFORM_OFFSETS_64	= $(UTSBASE)/intel/amd64/ml/mach_offsets.in
151PLATFORM_OFFSETS_SRC	= $(PLATFORM_OFFSETS_$(CLASS))
152KDI_OFFSETS_SRC	 = $(UTSBASE)/intel/kdi/kdi_offsets.in
153
154#
155#	Define the actual specific platforms
156#
157MACHINE_DEFS	 = -D$(PLATFORM) -D_MACHDEP
158
159#
160#	Software workarounds for hardware "features"
161#
162
163include	$(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#
175DEBUG_DEFS_OBJ32	=
176DEBUG_DEFS_DBG32	= -DDEBUG
177DEBUG_DEFS_OBJ64	=
178DEBUG_DEFS_DBG64	= -DDEBUG
179DEBUG_DEFS		= $(DEBUG_DEFS_$(BUILD_TYPE))
180
181DEBUG_COND_OBJ32	= $(POUND_SIGN)
182DEBUG_COND_DBG32	=
183DEBUG_COND_OBJ64	= $(POUND_SIGN)
184DEBUG_COND_DBG64	=
185IF_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#
205ALL_DEFS	 = $(MACHINE_DEFS) $(WORKAROUND_DEFS) $(DEBUG_DEFS) \
206		   $(OPTION_DEFS)
207GENASSYM_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#
226MACH_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#
243DRV_KMODS	+= rootnex
244DRV_KMODS	+= isa
245DRV_KMODS	+= pcplusmp
246DRV_KMODS	+= apix
247DRV_KMODS	+= cpc
248DRV_KMODS	+= pci
249DRV_KMODS	+= npe
250DRV_KMODS	+= pci-ide
251DRV_KMODS	+= xsvc
252DRV_KMODS	+= tzmon
253DRV_KMODS	+= acpi_drv
254DRV_KMODS	+= acpinex
255DRV_KMODS	+= amd_iommu
256DRV_KMODS	+= dr
257DRV_KMODS	+= ioat
258DRV_KMODS	+= fipe
259
260DRV_KMODS	+= cpudrv
261
262
263#
264# Platform Power Modules
265#
266DRV_KMODS	+= ppm acpippm
267
268#
269#	CPU Modules
270#
271CPU_KMODS	+= amd_opteron
272CPU_KMODS	+= generic_cpu
273CPU_KMODS	+= authenticamd
274CPU_KMODS	+= genuineintel
275
276#
277#	Exec Class Modules (/kernel/exec):
278#
279EXEC_KMODS	+=
280
281#
282#	Scheduling Class Modules (/kernel/sched):
283#
284SCHED_KMODS	+=
285
286#
287#	File System Modules (/kernel/fs):
288#
289FS_KMODS	+=
290
291#
292#	Streams Modules (/kernel/strmod):
293#
294STRMOD_KMODS	+=
295
296#
297#	'System' Modules (/kernel/sys):
298#
299SYS_KMODS	+=
300
301#
302#	'Misc' Modules (/kernel/misc):
303#
304MISC_KMODS	+= gfx_private pcie
305MISC_KMODS	+= acpidev
306MISC_KMODS	+= drmach_acpi
307
308#
309#	'Dacf' modules (/kernel/dacf)
310#
311DACF_KMODS	+= consconfig_dacf
312
313#
314#	'Mach' Modules (/kernel/mach):
315#
316MACH_KMODS	+= uppc
317
318#
319#	CPR Misc Module.
320#
321MISC_KMODS	+= cpr
322