forked from hercules-390/hyperion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bldcfg.c
136 lines (111 loc) · 4.71 KB
/
bldcfg.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* BLDCFG.C (c) Copyright Roger Bowler, 1999-2012 */
/* (c) Copyright Jan Jaeger, 1999-2012 */
/* (c) Copyright TurboHercules, SAS 2010-2011 */
/* ESA/390 Configuration Builder */
/* Interpretive Execution - (c) Copyright Jan Jaeger, 1999-2012 */
/* */
/* Released under "The Q Public License Version 1" */
/* (http://www.hercules-390.org/herclic.html) as modifications to */
/* Hercules. */
/* z/Architecture support - (c) Copyright Jan Jaeger, 1999-2012 */
/*-------------------------------------------------------------------*/
/* This module builds the configuration tables for the Hercules */
/* ESA/390 emulator. It reads information about the processors */
/* and I/O devices from a configuration file. It allocates */
/* main storage and expanded storage, initializes control blocks, */
/* and creates detached threads to handle console attention */
/* requests and to maintain the TOD clock and CPU timers. */
/*-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*/
/* Additional credits: */
/* TOD clock offset contributed by Jay Maynard */
/* Dynamic device attach/detach by Jan Jaeger */
/* OSTAILOR parameter by Jay Maynard */
/* PANRATE parameter by Reed H. Petty */
/* CPUPRIO parameter by Jan Jaeger */
/* HERCPRIO, TODPRIO, DEVPRIO parameters by Mark L. Gaubatz */
/* $(DEFSYM) symbol substitution support by Ivan Warren */
/* Patch for ${var=def} symbol substitution (hax #26), */
/* and INCLUDE <filename> support (modified hax #27), */
/* contributed by Enrico Sorichetti based on */
/* original patches by "Hackules" */
/*-------------------------------------------------------------------*/
#include "hstdinc.h"
#if !defined(_BLDCFG_C_)
#define _BLDCFG_C_
#endif
#if !defined(_HENGINE_DLL_)
#define _HENGINE_DLL_
#endif
#include "hercules.h"
#include "devtype.h"
#include "opcode.h"
#include "hostinfo.h"
#include "hdl.h"
#include "tapedev.h"
#if !defined(_GEN_ARCH)
#if defined(_ARCHMODE3)
#define _GEN_ARCH _ARCHMODE3
#include "bldcfg.c"
#undef _GEN_ARCH
#endif
#if defined(_ARCHMODE2)
#define _GEN_ARCH _ARCHMODE2
#include "bldcfg.c"
#undef _GEN_ARCH
#endif
/*-------------------------------------------------------------------*/
/* Function to build system configuration */
/*-------------------------------------------------------------------*/
int build_config (char *hercules_cnf)
{
int i; /* Array subscript */
int devtmax; /* Max number device threads */
/* From impl.c, using system defaults of:
*
* LPARNUM 1 # LPAR 1 with LPAR ID 01
* CPUIDFMT 0 # CPU ID format 0
*
*/
/* XPNDSIZE 0 # Expanded storage size */
sysblk.xpndsize = 0;
sysblk.maxcpu = MAX_CPU_ENGINES;
#ifdef _FEATURE_VECTOR_FACILITY
sysblk.numvec = sysblk.maxcpu;
#else //!_FEATURE_VECTOR_FACILITY
sysblk.numvec = 0;
#endif // _FEATURE_VECTOR_FACILITY
#if defined(_900)
set_archlvl(_ARCH_900_NAME);
#elif defined(_390)
set_archlvl(_ARCH_390_NAME);
#else
set_archlvl(_ARCH_370_NAME);
#endif
devtmax = MAX_DEVICE_THREADS;
ptt_trace_init (0, 1);
/* Set max number device threads */
sysblk.devtmax = devtmax;
sysblk.devtwait = sysblk.devtnbr =
sysblk.devthwm = sysblk.devtunavail = 0;
#if defined(OPTION_LPP_RESTRICT)
/* Default the licence setting */
losc_set(PGM_PRD_OS_RESTRICTED);
#endif
/* Reset the clock steering registers */
csr_reset();
/* Default CPU type CP */
for (i = 0; i < sysblk.maxcpu; i++)
sysblk.ptyp[i] = SCCB_PTYP_CP;
/* Default main storage to 2M with one CPU */
configure_storage(2 << (SHIFT_MEBIBYTE - 12));
configure_numcpu(1);
if (hercules_cnf && (process_config(hercules_cnf)))
return -1;
/* Connect each channel set to its home cpu */
for (i = 0; i < sysblk.maxcpu; i++)
if (IS_CPU_ONLINE(i))
sysblk.regs[i]->chanset = i < FEATURE_LCSS_MAX ? i : 0xFFFF;
return 0;
} /* end function build_config */
#endif /*!defined(_GEN_ARCH)*/