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			+= $(CFLAGS_uts)
107
108ASFLAGS_XARCH_32	= $(i386_ASFLAGS)
109ASFLAGS_XARCH_64	= $(amd64_ASFLAGS)
110ASFLAGS_XARCH		= $(ASFLAGS_XARCH_$(CLASS))
111
112ASFLAGS			= $(ASFLAGS_XARCH)
113ASFLAGS			+= $(ASFLAGS_uts)
114
115AS_INC_PATH		+= -I$(DSF_DIR)/$(OBJS_DIR)
116
117#
118#	The following must be defined for all implementations:
119#
120#	UNIX_MAPFILE:	ld mapfile for the build of kernel/unix.
121#	MODSTUBS:	Module stubs source file.
122#	GENASSYM_SRC:	genassym.c
123
124UNIX_MAPFILE	= $(UTSBASE)/$(PLATFORM)/conf/Mapfile
125MODSTUBS	= $(UTSBASE)/intel/ml/modstubs.S
126GENASSYM_SRC	= $(UTSBASE)/i86pc/ml/genassym.c
127OFFSETS_SRC	= $(UTSBASE)/i86pc/ml/offsets.in
128
129PLATFORM_OFFSETS_SRC	= $(UTSBASE)/intel/amd64/ml/mach_offsets.in
130KDI_OFFSETS_SRC		= $(UTSBASE)/intel/kdi/kdi_offsets.in
131
132#
133#	Define the actual specific platforms
134#
135MACHINE_DEFS	 = -D__$(PLATFORM) -D__xpv -D_MACHDEP
136
137#
138#	Software workarounds for hardware "features"
139#
140
141include	$(UTSBASE)/i86pc/Makefile.workarounds
142
143#
144#	Debugging level
145#
146#	Special knowledge of which special debugging options effect which
147#	file is used to optimize the build if these flags are changed.
148#
149#	XXX: The above could possibly be done for more flags and files, but
150#	     is left as an experiment to the interested reader. Be forewarned,
151#	     that excessive use could lead to maintenance difficulties.
152#
153DEBUG_DEFS_OBJ32	=
154DEBUG_DEFS_DBG32	= -DDEBUG
155DEBUG_DEFS_OBJ64	=
156DEBUG_DEFS_DBG64	= -DDEBUG
157DEBUG_DEFS		= $(DEBUG_DEFS_$(BUILD_TYPE))
158
159DEBUG_COND_OBJ32	= $(POUND_SIGN)
160DEBUG_COND_DBG32	=
161DEBUG_COND_OBJ64	= $(POUND_SIGN)
162DEBUG_COND_DBG64	=
163IF_DEBUG_OBJ		= $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/
164
165$(IF_DEBUG_OBJ)trap.o		:= DEBUG_DEFS += -DTRAPDEBUG -DTRAPTRACE
166$(IF_DEBUG_OBJ)syscall_asm_amd64.o := DEBUG_DEFS += -DSYSCALLTRACE -DTRAPTRACE
167$(IF_DEBUG_OBJ)fast_trap_asm.o	:= DEBUG_DEFS += -DTRAPTRACE
168$(IF_DEBUG_OBJ)interrupt.o	:= DEBUG_DEFS += -DTRAPTRACE
169$(IF_DEBUG_OBJ)intr.o		:= DEBUG_DEFS += -DTRAPTRACE
170$(IF_DEBUG_OBJ)locore.o		:= DEBUG_DEFS += -DTRAPTRACE
171$(IF_DEBUG_OBJ)mp_startup.o	:= DEBUG_DEFS += -DTRAPTRACE
172$(IF_DEBUG_OBJ)machdep.o	:= DEBUG_DEFS += -DTRAPTRACE
173$(IF_DEBUG_OBJ)exception.o	:= DEBUG_DEFS += -DTRAPTRACE
174$(IF_DEBUG_OBJ)x_call.o		:= DEBUG_DEFS += -DTRAPTRACE
175$(IF_DEBUG_OBJ)mp_call.o	:= DEBUG_DEFS += -DTRAPTRACE
176$(IF_DEBUG_OBJ)cbe.o		:= DEBUG_DEFS += -DTRAPTRACE
177$(IF_DEBUG_OBJ)hyperevent.o	:= DEBUG_DEFS += -DTRAPTRACE
178$(IF_DEBUG_OBJ)evtchn.o		:= DEBUG_DEFS += -DTRAPTRACE
179
180#
181#	Collect the preprocessor definitions to be associated with *all*
182#	files.
183#
184ALL_DEFS	 = $(MACHINE_DEFS) $(WORKAROUND_DEFS) $(DEBUG_DEFS) \
185		   $(OPTION_DEFS)
186GENASSYM_DEFS	 = $(MACHINE_DEFS) $(OPTION_DEFS) \
187			-_gcc=-fno-eliminate-unused-debug-symbols \
188			-_gcc=-fno-eliminate-unused-debug-types
189
190#
191# ----- TRANSITIONAL SECTION --------------------------------------------------
192#
193
194#
195#	Not everything which *should* be a module is a module yet. The
196#	following is a list of such objects which are currently part of
197#	the base kernel but should soon become kmods.
198#
199#	XXX: $(KMACCT_OBJS) is neither in the MT kernel nor was it ever
200#	     made into a module. If it is made MT safe before being made
201#	     into a module, it should be added to this list. It was in
202#	     this list pre ON-4.0.
203#
204#
205MACH_NOT_YET_KMODS	= $(AUTOCONF_OBJS)
206
207#
208# ----- END OF TRANSITIONAL SECTION -------------------------------------------
209#
210
211#
212#	The kernels modules which are "implementation architecture"
213#	specific for this machine are enumerated below. Note that most
214#	of these modules must exist (in one form or another) for each
215#	architecture.
216#
217#	Machine Specific Driver Modules (/kernel/drv):
218#	DRV_KMODS are built both 32-bit and 64-bit
219#	DRV_KMODS_32 are built only 32-bit
220#	DRV_KMODS_64 are built only 64-bit
221#
222
223DRV_KMODS	+= rootnex
224DRV_KMODS	+= ioat
225DRV_KMODS	+= isa
226DRV_KMODS	+= pci
227DRV_KMODS	+= pit_beep
228DRV_KMODS	+= npe
229DRV_KMODS	+= pci-ide
230DRV_KMODS	+= xsvc
231DRV_KMODS	+= xenbus
232DRV_KMODS	+= xencons
233DRV_KMODS	+= xpvd
234DRV_KMODS	+= xnbe
235DRV_KMODS	+= xnbo
236DRV_KMODS	+= xnbu
237DRV_KMODS	+= xnf
238DRV_KMODS	+= xdb
239DRV_KMODS	+= xdf
240DRV_KMODS	+= privcmd
241DRV_KMODS	+= domcaps
242DRV_KMODS	+= evtchn
243DRV_KMODS	+= balloon
244DRV_KMODS	+= xpvtap
245DRV_KMODS	+= xdt
246
247#
248#	CPU Modules
249#
250CPU_KMODS	+= generic_cpu
251CPU_KMODS	+= amd_opteron
252CPU_KMODS	+= genuineintel
253CPU_KMODS	+= authenticamd
254
255#
256#	Exec Class Modules (/kernel/exec):
257#
258EXEC_KMODS	+=
259
260#
261#	Scheduling Class Modules (/kernel/sched):
262#
263SCHED_KMODS	+=
264
265#
266#	File System Modules (/kernel/fs):
267#
268FS_KMODS	+=
269
270#
271#	Streams Modules (/kernel/strmod):
272#
273STRMOD_KMODS	+=
274
275#
276#	'System' Modules (/kernel/sys):
277#
278SYS_KMODS	+=
279
280#
281#	'Misc' Modules (/kernel/misc):
282#
283MISC_KMODS	+= xpv_autoconfig gfx_private xnb pcie pci_prd
284
285#	'Dacf' modules (/kernel/dacf)
286#
287DACF_KMODS	+= consconfig_dacf
288
289#
290#	'Mach' Modules (/kernel/mach):
291#
292MACH_KMODS	+= xpv_psm xpv_uppc
293
294#
295#	'TOD' modules (/platform/.../kernel/tod):
296#
297TOD_KMODS	+= xpvtod
298