* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: initconfig.c
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
#pragma ident "@(#)initconfig.c 1.6 06/09/24 SMI"
* The parser is the first pass through the configuration.
* This is the second pass, and builds all the support data
* structures and virtual function pointers that the simulator
static void init_system(system_t
* systemp
);
static void init_domain(domain_t
* domain
);
* This function initializes the simualtor configuration
* parse the config and state files.
DBG( printf("init_config()\n"); );
/* Initialise the systems within this config
for (idx
=0; idx
<target_config
.systems
.count
; idx
++) {
systemp
= LIST_ENTRY( target_config
.systems
, idx
);
DBG( printf("init system %d : \"%s\"\n", idx
, systemp
->namep
); );
* Initialise the components of a given system, then
* the appropriate info for itself.
void init_system(system_t
* systemp
)
* init the service_processor (if there is one)
systemp
->service_procp
->dev_typep
->init_dev(NULL
);
for (idx
=0; idx
<systemp
->domains
.count
; idx
++) {
domainp
= LIST_ENTRY( systemp
->domains
, idx
);
DBG( printf("init_system: domain %d\n",
* OK, initialise the components of a domain -
* IO/mem devices, and CPUs.
void init_domain(domain_t
* domainp
)
config_dev_t
* config_devp
;
for (idx
=0; idx
<domainp
->procs
.count
; idx
++) {
proc_type_t
* proc_typep
;
config_proc_t
* config_procp
;
config_procp
= LIST_ENTRY( domainp
->procs
, idx
);
proc_typep
= config_procp
->proc_typep
;
assert( proc_typep
->proc_magic
== CPU_MAGIC
);
DBG( printf("init_domain: proc %d : %s\n",
config_procp
->proc_id
, proc_typep
->proc_type_namep
); );
/* based on the proc type we call the proc-dependent init */
proc_typep
->init_proc(domainp
, config_procp
);
config_devp
= domainp
->device
.listp
;
for (idx
=0; idx
<domainp
->device
.count
; idx
++) {
dev_typep
= config_devp
->dev_typep
;
DBG( printf("init_domain: device %d : %s : 0x%llx + 0x%llx\n",
config_devp
->device_id
, dev_typep
->dev_type_namep
,
config_devp
->addrp
->baseaddr
,
config_devp
->addrp
->topaddr
- config_devp
->addrp
->baseaddr
); );
assert( dev_typep
->dev_magic
== DEV_MAGIC
);
dev_typep
->init_dev(config_devp
);
config_devp
= config_devp
->nextp
;