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/i86xpv/Makefile.i86xpv
24#
25# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
26# Use is subject to license terms.
27# Copyright (c) 2013 Andrew Stormont.  All rights reserved.
28# Copyright 2019 Joyent, Inc.
29#
30
31#
32#	This makefile contains the common definitions for the i86xpv unix
33#	and all i86xpv implementation architecture dependent modules.
34#
35
36#
37#	Machine type (implementation architecture):
38#
39PLATFORM	 = i86xpv
40
41#
42#	uname -m value
43#
44UNAME_M		 = i86pc
45
46#
47#	Everybody needs to know how to build modstubs.o and to locate unix.o
48#
49UNIX_DIR	 = $(UTSBASE)/$(PLATFORM)/unix
50GENLIB_DIR	 = $(UTSBASE)/intel/genunix
51MODSTUBS_DIR	 = $(UNIX_DIR)
52DSF_DIR		 = $(UTSBASE)/$(PLATFORM)/genassym
53
54DTRACESTUBS_O	 = $(OBJS_DIR)/dtracestubs.o
55DTRACESTUBS	 = $(OBJS_DIR)/libdtracestubs.so
56
57SYM_MOD		= $(OBJS_DIR)/unix.sym
58
59UNIX_O		 = $(UNIX_DIR)/$(OBJS_DIR)/unix.o
60MODSTUBS_O	 = $(MODSTUBS_DIR)/$(OBJS_DIR)/modstubs.o
61GENLIB		 = $(GENLIB_DIR)/$(OBJS_DIR)/libgenunix.so
62
63#
64#	Include the makefiles which define build rule templates, the
65#	collection of files per module, and a few specific flags. Note
66#	that order is significant, just as with an include path. The
67#	first build rule template which matches the files name will be
68#	used. By including these in order from most machine dependent
69#	to most machine independent, we allow a machine dependent file
70#	to be used in preference over a machine independent version
71#	(Such as a machine specific optimization, which preserves the
72#	interfaces.)
73#
74include $(UTSBASE)/$(PLATFORM)/Makefile.files
75include $(UTSBASE)/intel/Makefile.files
76include $(UTSBASE)/common/Makefile.files
77
78#
79#	Include machine independent rules. Note that this does not imply
80#	that the resulting module from rules in Makefile.uts is	machine
81#	independent. Only that the build rules are machine independent.
82#
83include $(UTSBASE)/Makefile.uts
84
85#
86#	Define supported builds
87#
88DEF_BUILDS		= $(DEF_BUILDS64)
89ALL_BUILDS		= $(ALL_BUILDS64)
90
91#
92#	kernel-specific optimizations; override default in Makefile.master
93#
94
95CFLAGS_XARCH_32		= $(i386_CFLAGS)
96CFLAGS_XARCH_64		= $(amd64_CFLAGS)
97CFLAGS_XARCH		= $(CFLAGS_XARCH_$(CLASS))
98
99COPTFLAG_32		= $(COPTFLAG)
100COPTFLAG_64		= $(COPTFLAG64)
101COPTIMIZE		= $(COPTFLAG_$(CLASS))
102
103CFLAGS			= $(CFLAGS_XARCH)
104CFLAGS			+= $(COPTIMIZE)
105CFLAGS			+= -D_ASM_INLINES
106CFLAGS			+= $(CCMODE)
107CFLAGS			+= $(SPACEFLAG)
108CFLAGS			+= $(CCUNBOUND)
109CFLAGS			+= $(CFLAGS_uts)
110
111ASFLAGS_XARCH_32	= $(i386_ASFLAGS)
112ASFLAGS_XARCH_64	= $(amd64_ASFLAGS)
113ASFLAGS_XARCH		= $(ASFLAGS_XARCH_$(CLASS))
114
115ASFLAGS			= $(ASFLAGS_XARCH)
116ASFLAGS			+= $(ASFLAGS_uts)
117
118AS_INC_PATH		+= -I$(DSF_DIR)/$(OBJS_DIR)
119
120#
121#	The following must be defined for all implementations:
122#
123#	UNIX_MAPFILE:	ld mapfile for the build of kernel/unix.
124#	MODSTUBS:	Module stubs source file.
125#	GENASSYM_SRC:	genassym.c
126
127UNIX_MAPFILE	= $(UTSBASE)/$(PLATFORM)/conf/Mapfile
128MODSTUBS	= $(UTSBASE)/intel/ml/modstubs.S
129GENASSYM_SRC	= $(UTSBASE)/i86pc/ml/genassym.c
130OFFSETS_SRC	= $(UTSBASE)/i86pc/ml/offsets.in
131
132PLATFORM_OFFSETS_SRC	= $(UTSBASE)/intel/amd64/ml/mach_offsets.in
133KDI_OFFSETS_SRC		= $(UTSBASE)/intel/kdi/kdi_offsets.in
134
135#
136#	Define the actual specific platforms
137#
138MACHINE_DEFS	 = -D__$(PLATFORM) -D__xpv -D_MACHDEP
139
140#
141#	Software workarounds for hardware "features"
142#
143
144include	$(UTSBASE)/i86pc/Makefile.workarounds
145
146#
147#	Debugging level
148#
149#	Special knowledge of which special debugging options effect which
150#	file is used to optimize the build if these flags are changed.
151#
152#	XXX: The above could possibly be done for more flags and files, but
153#	     is left as an experiment to the interested reader. Be forewarned,
154#	     that excessive use could lead to maintenance difficulties.
155#
156DEBUG_DEFS_OBJ32	=
157DEBUG_DEFS_DBG32	= -DDEBUG
158DEBUG_DEFS_OBJ64	=
159DEBUG_DEFS_DBG64	= -DDEBUG
160DEBUG_DEFS		= $(DEBUG_DEFS_$(BUILD_TYPE))
161
162DEBUG_COND_OBJ32	= $(POUND_SIGN)
163DEBUG_COND_DBG32	=
164DEBUG_COND_OBJ64	= $(POUND_SIGN)
165DEBUG_COND_DBG64	=
166IF_DEBUG_OBJ		= $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/
167
168$(IF_DEBUG_OBJ)trap.o		:= DEBUG_DEFS += -DTRAPDEBUG -DTRAPTRACE
169$(IF_DEBUG_OBJ)syscall_asm_amd64.o := DEBUG_DEFS += -DSYSCALLTRACE -DTRAPTRACE
170$(IF_DEBUG_OBJ)fast_trap_asm.o	:= DEBUG_DEFS += -DTRAPTRACE
171$(IF_DEBUG_OBJ)interrupt.o	:= DEBUG_DEFS += -DTRAPTRACE
172$(IF_DEBUG_OBJ)intr.o		:= DEBUG_DEFS += -DTRAPTRACE
173$(IF_DEBUG_OBJ)locore.o		:= DEBUG_DEFS += -DTRAPTRACE
174$(IF_DEBUG_OBJ)mp_startup.o	:= DEBUG_DEFS += -DTRAPTRACE
175$(IF_DEBUG_OBJ)machdep.o	:= DEBUG_DEFS += -DTRAPTRACE
176$(IF_DEBUG_OBJ)exception.o	:= DEBUG_DEFS += -DTRAPTRACE
177$(IF_DEBUG_OBJ)x_call.o		:= DEBUG_DEFS += -DTRAPTRACE
178$(IF_DEBUG_OBJ)mp_call.o	:= DEBUG_DEFS += -DTRAPTRACE
179$(IF_DEBUG_OBJ)cbe.o		:= DEBUG_DEFS += -DTRAPTRACE
180$(IF_DEBUG_OBJ)hyperevent.o	:= DEBUG_DEFS += -DTRAPTRACE
181$(IF_DEBUG_OBJ)evtchn.o		:= DEBUG_DEFS += -DTRAPTRACE
182
183#
184#	Collect the preprocessor definitions to be associated with *all*
185#	files.
186#
187ALL_DEFS	 = $(MACHINE_DEFS) $(WORKAROUND_DEFS) $(DEBUG_DEFS) \
188		   $(OPTION_DEFS)
189GENASSYM_DEFS	 = $(MACHINE_DEFS) $(OPTION_DEFS) \
190			-_gcc=-fno-eliminate-unused-debug-symbols \
191			-_gcc=-fno-eliminate-unused-debug-types
192
193#
194# ----- TRANSITIONAL SECTION --------------------------------------------------
195#
196
197#
198#	Not everything which *should* be a module is a module yet. The
199#	following is a list of such objects which are currently part of
200#	the base kernel but should soon become kmods.
201#
202#	XXX: $(KMACCT_OBJS) is neither in the MT kernel nor was it ever
203#	     made into a module. If it is made MT safe before being made
204#	     into a module, it should be added to this list. It was in
205#	     this list pre ON-4.0.
206#
207#
208MACH_NOT_YET_KMODS	= $(AUTOCONF_OBJS)
209
210#
211# ----- END OF TRANSITIONAL SECTION -------------------------------------------
212#
213
214#
215#	The kernels modules which are "implementation architecture"
216#	specific for this machine are enumerated below. Note that most
217#	of these modules must exist (in one form or another) for each
218#	architecture.
219#
220#	Machine Specific Driver Modules (/kernel/drv):
221#	DRV_KMODS are built both 32-bit and 64-bit
222#	DRV_KMODS_32 are built only 32-bit
223#	DRV_KMODS_64 are built only 64-bit
224#
225
226DRV_KMODS	+= rootnex
227DRV_KMODS	+= ioat
228DRV_KMODS	+= isa
229DRV_KMODS	+= pci
230DRV_KMODS	+= pit_beep
231DRV_KMODS	+= npe
232DRV_KMODS	+= pci-ide
233DRV_KMODS	+= xsvc
234DRV_KMODS	+= xenbus
235DRV_KMODS	+= xencons
236DRV_KMODS	+= xpvd
237DRV_KMODS	+= xnbe
238DRV_KMODS	+= xnbo
239DRV_KMODS	+= xnbu
240DRV_KMODS	+= xnf
241DRV_KMODS	+= xdb
242DRV_KMODS	+= xdf
243DRV_KMODS	+= privcmd
244DRV_KMODS	+= domcaps
245DRV_KMODS	+= evtchn
246DRV_KMODS	+= balloon
247DRV_KMODS	+= xpvtap
248DRV_KMODS	+= xdt
249
250#
251#	CPU Modules
252#
253CPU_KMODS	+= generic_cpu
254CPU_KMODS	+= amd_opteron
255CPU_KMODS	+= genuineintel
256CPU_KMODS	+= authenticamd
257
258#
259#	Exec Class Modules (/kernel/exec):
260#
261EXEC_KMODS	+=
262
263#
264#	Scheduling Class Modules (/kernel/sched):
265#
266SCHED_KMODS	+=
267
268#
269#	File System Modules (/kernel/fs):
270#
271FS_KMODS	+=
272
273#
274#	Streams Modules (/kernel/strmod):
275#
276STRMOD_KMODS	+=
277
278#
279#	'System' Modules (/kernel/sys):
280#
281SYS_KMODS	+=
282
283#
284#	'Misc' Modules (/kernel/misc):
285#
286MISC_KMODS	+= xpv_autoconfig gfx_private xnb
287
288#	'Dacf' modules (/kernel/dacf)
289#
290DACF_KMODS	+= consconfig_dacf
291
292#
293#	'Mach' Modules (/kernel/mach):
294#
295MACH_KMODS	+= xpv_psm xpv_uppc
296
297#
298#	'TOD' modules (/platform/.../kernel/tod):
299#
300TOD_KMODS	+= xpvtod
301