Home | History | Annotate | Line # | Download | only in sun3x
machdep.c revision 1.76.4.4
      1  1.76.4.4  nathanw /*	$NetBSD: machdep.c,v 1.76.4.4 2002/04/01 07:43:25 nathanw Exp $	*/
      2  1.76.4.2      scw 
      3  1.76.4.2      scw /*
      4  1.76.4.2      scw  * Copyright (c) 1988 University of Utah.
      5  1.76.4.2      scw  * Copyright (c) 1982, 1986, 1990, 1993
      6  1.76.4.2      scw  *	The Regents of the University of California.  All rights reserved.
      7  1.76.4.2      scw  *
      8  1.76.4.2      scw  * This code is derived from software contributed to Berkeley by
      9  1.76.4.2      scw  * the Systems Programming Group of the University of Utah Computer
     10  1.76.4.2      scw  * Science Department.
     11  1.76.4.2      scw  *
     12  1.76.4.2      scw  * Redistribution and use in source and binary forms, with or without
     13  1.76.4.2      scw  * modification, are permitted provided that the following conditions
     14  1.76.4.2      scw  * are met:
     15  1.76.4.2      scw  * 1. Redistributions of source code must retain the above copyright
     16  1.76.4.2      scw  *    notice, this list of conditions and the following disclaimer.
     17  1.76.4.2      scw  * 2. Redistributions in binary form must reproduce the above copyright
     18  1.76.4.2      scw  *    notice, this list of conditions and the following disclaimer in the
     19  1.76.4.2      scw  *    documentation and/or other materials provided with the distribution.
     20  1.76.4.2      scw  * 3. All advertising materials mentioning features or use of this software
     21  1.76.4.2      scw  *    must display the following acknowledgement:
     22  1.76.4.2      scw  *	This product includes software developed by the University of
     23  1.76.4.2      scw  *	California, Berkeley and its contributors.
     24  1.76.4.2      scw  * 4. Neither the name of the University nor the names of its contributors
     25  1.76.4.2      scw  *    may be used to endorse or promote products derived from this software
     26  1.76.4.2      scw  *    without specific prior written permission.
     27  1.76.4.2      scw  *
     28  1.76.4.2      scw  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     29  1.76.4.2      scw  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     30  1.76.4.2      scw  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     31  1.76.4.2      scw  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     32  1.76.4.2      scw  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     33  1.76.4.2      scw  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     34  1.76.4.2      scw  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     35  1.76.4.2      scw  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     36  1.76.4.2      scw  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     37  1.76.4.2      scw  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     38  1.76.4.2      scw  * SUCH DAMAGE.
     39  1.76.4.2      scw  *
     40  1.76.4.2      scw  *	from: Utah Hdr: machdep.c 1.74 92/12/20
     41  1.76.4.2      scw  *	from: @(#)machdep.c	8.10 (Berkeley) 4/20/94
     42  1.76.4.2      scw  */
     43  1.76.4.2      scw 
     44  1.76.4.2      scw #include "opt_ddb.h"
     45  1.76.4.2      scw #include "opt_kgdb.h"
     46  1.76.4.2      scw 
     47  1.76.4.2      scw #include <sys/param.h>
     48  1.76.4.2      scw #include <sys/systm.h>
     49  1.76.4.2      scw #include <sys/kernel.h>
     50  1.76.4.2      scw #include <sys/map.h>
     51  1.76.4.2      scw #include <sys/lwp.h>
     52  1.76.4.2      scw #include <sys/proc.h>
     53  1.76.4.2      scw #include <sys/buf.h>
     54  1.76.4.2      scw #include <sys/reboot.h>
     55  1.76.4.2      scw #include <sys/conf.h>
     56  1.76.4.2      scw #include <sys/file.h>
     57  1.76.4.2      scw #include <sys/clist.h>
     58  1.76.4.2      scw #include <sys/device.h>
     59  1.76.4.2      scw #include <sys/malloc.h>
     60  1.76.4.2      scw #include <sys/mbuf.h>
     61  1.76.4.2      scw #include <sys/msgbuf.h>
     62  1.76.4.2      scw #include <sys/ioctl.h>
     63  1.76.4.2      scw #include <sys/tty.h>
     64  1.76.4.2      scw #include <sys/mount.h>
     65  1.76.4.2      scw #include <sys/user.h>
     66  1.76.4.2      scw #include <sys/exec.h>
     67  1.76.4.2      scw #include <sys/core.h>
     68  1.76.4.2      scw #include <sys/kcore.h>
     69  1.76.4.2      scw #include <sys/vnode.h>
     70  1.76.4.2      scw #include <sys/syscallargs.h>
     71  1.76.4.2      scw #ifdef	KGDB
     72  1.76.4.2      scw #include <sys/kgdb.h>
     73  1.76.4.2      scw #endif
     74  1.76.4.2      scw 
     75  1.76.4.2      scw #include <uvm/uvm_extern.h>
     76  1.76.4.2      scw 
     77  1.76.4.2      scw #include <sys/sysctl.h>
     78  1.76.4.2      scw 
     79  1.76.4.2      scw #include <dev/cons.h>
     80  1.76.4.2      scw 
     81  1.76.4.2      scw #include <machine/cpu.h>
     82  1.76.4.2      scw #include <machine/dvma.h>
     83  1.76.4.2      scw #include <machine/idprom.h>
     84  1.76.4.2      scw #include <machine/kcore.h>
     85  1.76.4.2      scw #include <machine/reg.h>
     86  1.76.4.2      scw #include <machine/psl.h>
     87  1.76.4.2      scw #include <machine/pte.h>
     88  1.76.4.2      scw 
     89  1.76.4.2      scw #if defined(DDB)
     90  1.76.4.2      scw #include <machine/db_machdep.h>
     91  1.76.4.2      scw #include <ddb/db_sym.h>
     92  1.76.4.2      scw #include <ddb/db_extern.h>
     93  1.76.4.2      scw #endif
     94  1.76.4.2      scw 
     95  1.76.4.2      scw #include <sun3/sun3/machdep.h>
     96  1.76.4.2      scw 
     97  1.76.4.2      scw /* Defined in locore.s */
     98  1.76.4.2      scw extern char kernel_text[];
     99  1.76.4.2      scw /* Defined by the linker */
    100  1.76.4.2      scw extern char etext[];
    101  1.76.4.2      scw 
    102  1.76.4.2      scw /* Our exported CPU info; we can have only one. */
    103  1.76.4.2      scw struct cpu_info cpu_info_store;
    104  1.76.4.2      scw 
    105  1.76.4.2      scw struct vm_map *exec_map = NULL;
    106  1.76.4.2      scw struct vm_map *mb_map = NULL;
    107  1.76.4.2      scw struct vm_map *phys_map = NULL;
    108  1.76.4.2      scw 
    109  1.76.4.2      scw int	physmem;
    110  1.76.4.2      scw int	fputype;
    111  1.76.4.2      scw caddr_t	msgbufaddr;
    112  1.76.4.2      scw 
    113  1.76.4.2      scw /* Virtual page frame for /dev/mem (see mem.c) */
    114  1.76.4.2      scw vaddr_t vmmap;
    115  1.76.4.2      scw 
    116  1.76.4.2      scw /*
    117  1.76.4.2      scw  * safepri is a safe priority for sleep to set for a spin-wait
    118  1.76.4.2      scw  * during autoconfiguration or after a panic.
    119  1.76.4.2      scw  */
    120  1.76.4.2      scw int	safepri = PSL_LOWIPL;
    121  1.76.4.2      scw 
    122  1.76.4.2      scw u_char cpu_machine_id = 0;
    123  1.76.4.2      scw char *cpu_string = NULL;
    124  1.76.4.2      scw int cpu_has_vme = 0;
    125  1.76.4.2      scw int has_iocache = 0;
    126  1.76.4.2      scw 
    127  1.76.4.2      scw vaddr_t dumppage;
    128  1.76.4.2      scw 
    129  1.76.4.2      scw static void identifycpu __P((void));
    130  1.76.4.2      scw static void initcpu __P((void));
    131  1.76.4.2      scw 
    132  1.76.4.2      scw /*
    133  1.76.4.2      scw  * Console initialization: called early on from main,
    134  1.76.4.2      scw  * before vm init or cpu_startup.  This system is able
    135  1.76.4.2      scw  * to use the console for output immediately (via PROM)
    136  1.76.4.2      scw  * but can not use it for input until after this point.
    137  1.76.4.2      scw  */
    138  1.76.4.2      scw void
    139  1.76.4.2      scw consinit()
    140  1.76.4.2      scw {
    141  1.76.4.2      scw 
    142  1.76.4.2      scw 	/*
    143  1.76.4.2      scw 	 * Switch from the PROM console (output only)
    144  1.76.4.2      scw 	 * to our own console driver.
    145  1.76.4.2      scw 	 */
    146  1.76.4.2      scw 	cninit();
    147  1.76.4.2      scw 
    148  1.76.4.2      scw #ifdef DDB
    149  1.76.4.2      scw 	{
    150  1.76.4.2      scw 		extern int nsym;
    151  1.76.4.2      scw 		extern char *ssym, *esym;
    152  1.76.4.2      scw 
    153  1.76.4.2      scw 		ddb_init(nsym, ssym, esym);
    154  1.76.4.2      scw 	}
    155  1.76.4.2      scw #endif	/* DDB */
    156  1.76.4.2      scw 
    157  1.76.4.2      scw 	/*
    158  1.76.4.2      scw 	 * Now that the console can do input as well as
    159  1.76.4.2      scw 	 * output, consider stopping for a debugger.
    160  1.76.4.2      scw 	 */
    161  1.76.4.2      scw 	if (boothowto & RB_KDB) {
    162  1.76.4.2      scw #ifdef KGDB
    163  1.76.4.2      scw 		/* XXX - Ask on console for kgdb_dev? */
    164  1.76.4.2      scw 		/* Note: this will just return if kgdb_dev==NODEV */
    165  1.76.4.2      scw 		kgdb_connect(1);
    166  1.76.4.2      scw #else	/* KGDB */
    167  1.76.4.2      scw 		/* Either DDB or no debugger (just PROM). */
    168  1.76.4.2      scw 		Debugger();
    169  1.76.4.2      scw #endif	/* KGDB */
    170  1.76.4.2      scw 	}
    171  1.76.4.2      scw }
    172  1.76.4.2      scw 
    173  1.76.4.2      scw /*
    174  1.76.4.2      scw  * cpu_startup: allocate memory for variable-sized tables,
    175  1.76.4.2      scw  * initialize cpu, and do autoconfiguration.
    176  1.76.4.2      scw  *
    177  1.76.4.2      scw  * This is called early in init_main.c:main(), after the
    178  1.76.4.2      scw  * kernel memory allocator is ready for use, but before
    179  1.76.4.2      scw  * the creation of processes 1,2, and mountroot, etc.
    180  1.76.4.2      scw  */
    181  1.76.4.2      scw void
    182  1.76.4.2      scw cpu_startup()
    183  1.76.4.2      scw {
    184  1.76.4.2      scw 	caddr_t v;
    185  1.76.4.2      scw 	int sz, i;
    186  1.76.4.2      scw 	vsize_t size;
    187  1.76.4.2      scw 	int base, residual;
    188  1.76.4.2      scw 	vaddr_t minaddr, maxaddr;
    189  1.76.4.2      scw 	char pbuf[9];
    190  1.76.4.2      scw 
    191  1.76.4.3      scw 	if (fputype != FPU_NONE)
    192  1.76.4.3      scw 		m68k_make_fpu_idle_frame();
    193  1.76.4.3      scw 
    194  1.76.4.2      scw 	/*
    195  1.76.4.2      scw 	 * Initialize message buffer (for kernel printf).
    196  1.76.4.2      scw 	 * This is put in physical page zero so it will
    197  1.76.4.2      scw 	 * always be in the same place after a reboot.
    198  1.76.4.2      scw 	 * Its mapping was prepared in pmap_bootstrap().
    199  1.76.4.2      scw 	 * Also, offset some to avoid PROM scribbles.
    200  1.76.4.2      scw 	 */
    201  1.76.4.2      scw 	v = (caddr_t) KERNBASE;
    202  1.76.4.2      scw 	msgbufaddr = (caddr_t)(v + MSGBUFOFF);
    203  1.76.4.2      scw 	initmsgbuf(msgbufaddr, MSGBUFSIZE);
    204  1.76.4.2      scw 
    205  1.76.4.2      scw 	/*
    206  1.76.4.2      scw 	 * Good {morning,afternoon,evening,night}.
    207  1.76.4.2      scw 	 */
    208  1.76.4.2      scw 	printf(version);
    209  1.76.4.2      scw 	identifycpu();
    210  1.76.4.2      scw 	initfpu();	/* also prints FPU type */
    211  1.76.4.2      scw 
    212  1.76.4.2      scw 	format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
    213  1.76.4.2      scw 	printf("total memory = %s\n", pbuf);
    214  1.76.4.2      scw 
    215  1.76.4.2      scw 	/*
    216  1.76.4.2      scw 	 * Get scratch page for dumpsys().
    217  1.76.4.2      scw 	 */
    218  1.76.4.2      scw 	if ((dumppage = uvm_km_alloc(kernel_map, NBPG)) == 0)
    219  1.76.4.2      scw 		panic("startup: alloc dumppage");
    220  1.76.4.2      scw 
    221  1.76.4.2      scw 	/*
    222  1.76.4.2      scw 	 * Find out how much space we need, allocate it,
    223  1.76.4.2      scw 	 * and then give everything true virtual addresses.
    224  1.76.4.2      scw 	 */
    225  1.76.4.2      scw 	sz = (int)allocsys(NULL, NULL);
    226  1.76.4.2      scw 	if ((v = (caddr_t)uvm_km_alloc(kernel_map, round_page(sz))) == 0)
    227  1.76.4.2      scw 		panic("startup: no room for tables");
    228  1.76.4.2      scw 	if (allocsys(v, NULL) - v != sz)
    229  1.76.4.2      scw 		panic("startup: table size inconsistency");
    230  1.76.4.2      scw 
    231  1.76.4.2      scw 	/*
    232  1.76.4.2      scw 	 * Now allocate buffers proper.  They are different than the above
    233  1.76.4.2      scw 	 * in that they usually occupy more virtual memory than physical.
    234  1.76.4.2      scw 	 */
    235  1.76.4.2      scw 	size = MAXBSIZE * nbuf;
    236  1.76.4.2      scw 	if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size),
    237  1.76.4.2      scw 		    NULL, UVM_UNKNOWN_OFFSET, 0,
    238  1.76.4.2      scw 		    UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
    239  1.76.4.2      scw 				UVM_ADV_NORMAL, 0)) != 0)
    240  1.76.4.2      scw 		panic("startup: cannot allocate VM for buffers");
    241  1.76.4.2      scw 	minaddr = (vaddr_t)buffers;
    242  1.76.4.2      scw 	if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
    243  1.76.4.2      scw 		/* don't want to alloc more physical mem than needed */
    244  1.76.4.2      scw 		bufpages = btoc(MAXBSIZE) * nbuf;
    245  1.76.4.2      scw 	}
    246  1.76.4.2      scw 	base = bufpages / nbuf;
    247  1.76.4.2      scw 	residual = bufpages % nbuf;
    248  1.76.4.2      scw 	for (i = 0; i < nbuf; i++) {
    249  1.76.4.2      scw 		vsize_t curbufsize;
    250  1.76.4.2      scw 		vaddr_t curbuf;
    251  1.76.4.2      scw 		struct vm_page *pg;
    252  1.76.4.2      scw 
    253  1.76.4.2      scw 		/*
    254  1.76.4.2      scw 		 * Each buffer has MAXBSIZE bytes of VM space allocated.  Of
    255  1.76.4.2      scw 		 * that MAXBSIZE space, we allocate and map (base+1) pages
    256  1.76.4.2      scw 		 * for the first "residual" buffers, and then we allocate
    257  1.76.4.2      scw 		 * "base" pages for the rest.
    258  1.76.4.2      scw 		 */
    259  1.76.4.2      scw 		curbuf = (vaddr_t) buffers + (i * MAXBSIZE);
    260  1.76.4.2      scw 		curbufsize = NBPG * ((i < residual) ? (base+1) : base);
    261  1.76.4.2      scw 
    262  1.76.4.2      scw 		while (curbufsize) {
    263  1.76.4.2      scw 			pg = uvm_pagealloc(NULL, 0, NULL, 0);
    264  1.76.4.2      scw 			if (pg == NULL)
    265  1.76.4.2      scw 				panic("cpu_startup: not enough memory for "
    266  1.76.4.2      scw 				    "buffer cache");
    267  1.76.4.2      scw 			pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
    268  1.76.4.2      scw 				       VM_PROT_READ|VM_PROT_WRITE);
    269  1.76.4.2      scw 			curbuf += PAGE_SIZE;
    270  1.76.4.2      scw 			curbufsize -= PAGE_SIZE;
    271  1.76.4.2      scw 		}
    272  1.76.4.2      scw 	}
    273  1.76.4.2      scw 	pmap_update(pmap_kernel());
    274  1.76.4.2      scw 
    275  1.76.4.2      scw 	/*
    276  1.76.4.2      scw 	 * Allocate a submap for exec arguments.  This map effectively
    277  1.76.4.2      scw 	 * limits the number of processes exec'ing at any time.
    278  1.76.4.2      scw 	 */
    279  1.76.4.2      scw 	exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
    280  1.76.4.2      scw 				   16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
    281  1.76.4.2      scw 
    282  1.76.4.2      scw 	/*
    283  1.76.4.2      scw 	 * We don't use a submap for physio, and use a separate map
    284  1.76.4.2      scw 	 * for DVMA allocations.  Our vmapbuf just maps pages into
    285  1.76.4.2      scw 	 * the kernel map (any kernel mapping is OK) and then the
    286  1.76.4.2      scw 	 * device drivers clone the kernel mappings into DVMA space.
    287  1.76.4.2      scw 	 */
    288  1.76.4.2      scw 
    289  1.76.4.2      scw 	/*
    290  1.76.4.2      scw 	 * Finally, allocate mbuf cluster submap.
    291  1.76.4.2      scw 	 */
    292  1.76.4.2      scw 	mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
    293  1.76.4.2      scw 				 nmbclusters * mclbytes, VM_MAP_INTRSAFE,
    294  1.76.4.2      scw 				 FALSE, NULL);
    295  1.76.4.2      scw 
    296  1.76.4.2      scw 	format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
    297  1.76.4.2      scw 	printf("avail memory = %s\n", pbuf);
    298  1.76.4.2      scw 	format_bytes(pbuf, sizeof(pbuf), bufpages * NBPG);
    299  1.76.4.2      scw 	printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
    300  1.76.4.2      scw 
    301  1.76.4.2      scw 	/*
    302  1.76.4.2      scw 	 * Allocate a virtual page (for use by /dev/mem)
    303  1.76.4.2      scw 	 * This page is handed to pmap_enter() therefore
    304  1.76.4.2      scw 	 * it has to be in the normal kernel VA range.
    305  1.76.4.2      scw 	 */
    306  1.76.4.2      scw 	vmmap = uvm_km_valloc_wait(kernel_map, NBPG);
    307  1.76.4.2      scw 
    308  1.76.4.2      scw 	/*
    309  1.76.4.2      scw 	 * Create the DVMA maps.
    310  1.76.4.2      scw 	 */
    311  1.76.4.2      scw 	dvma_init();
    312  1.76.4.2      scw 
    313  1.76.4.2      scw 	/*
    314  1.76.4.2      scw 	 * Set up CPU-specific registers, cache, etc.
    315  1.76.4.2      scw 	 */
    316  1.76.4.2      scw 	initcpu();
    317  1.76.4.2      scw 
    318  1.76.4.2      scw 	/*
    319  1.76.4.2      scw 	 * Set up buffers, so they can be used to read disk labels.
    320  1.76.4.2      scw 	 */
    321  1.76.4.2      scw 	bufinit();
    322  1.76.4.2      scw }
    323  1.76.4.2      scw 
    324  1.76.4.2      scw /*
    325  1.76.4.2      scw  * Set registers on exec.
    326  1.76.4.2      scw  */
    327  1.76.4.2      scw void
    328  1.76.4.2      scw setregs(l, pack, stack)
    329  1.76.4.2      scw 	struct lwp *l;
    330  1.76.4.2      scw 	struct exec_package *pack;
    331  1.76.4.2      scw 	u_long stack;
    332  1.76.4.2      scw {
    333  1.76.4.2      scw 	struct trapframe *tf = (struct trapframe *)l->l_md.md_regs;
    334  1.76.4.2      scw 
    335  1.76.4.2      scw 	tf->tf_sr = PSL_USERSET;
    336  1.76.4.2      scw 	tf->tf_pc = pack->ep_entry & ~1;
    337  1.76.4.2      scw 	tf->tf_regs[D0] = 0;
    338  1.76.4.2      scw 	tf->tf_regs[D1] = 0;
    339  1.76.4.2      scw 	tf->tf_regs[D2] = 0;
    340  1.76.4.2      scw 	tf->tf_regs[D3] = 0;
    341  1.76.4.2      scw 	tf->tf_regs[D4] = 0;
    342  1.76.4.2      scw 	tf->tf_regs[D5] = 0;
    343  1.76.4.2      scw 	tf->tf_regs[D6] = 0;
    344  1.76.4.2      scw 	tf->tf_regs[D7] = 0;
    345  1.76.4.2      scw 	tf->tf_regs[A0] = 0;
    346  1.76.4.2      scw 	tf->tf_regs[A1] = 0;
    347  1.76.4.4  nathanw 	tf->tf_regs[A2] = (int)p->p_psstr;
    348  1.76.4.2      scw 	tf->tf_regs[A3] = 0;
    349  1.76.4.2      scw 	tf->tf_regs[A4] = 0;
    350  1.76.4.2      scw 	tf->tf_regs[A5] = 0;
    351  1.76.4.2      scw 	tf->tf_regs[A6] = 0;
    352  1.76.4.2      scw 	tf->tf_regs[SP] = stack;
    353  1.76.4.2      scw 
    354  1.76.4.2      scw 	/* restore a null state frame */
    355  1.76.4.2      scw 	l->l_addr->u_pcb.pcb_fpregs.fpf_null = 0;
    356  1.76.4.2      scw 	if (fputype)
    357  1.76.4.2      scw 		m68881_restore(&l->l_addr->u_pcb.pcb_fpregs);
    358  1.76.4.2      scw 
    359  1.76.4.2      scw 	l->l_md.md_flags = 0;
    360  1.76.4.2      scw }
    361  1.76.4.2      scw 
    362  1.76.4.2      scw /*
    363  1.76.4.2      scw  * Info for CTL_HW
    364  1.76.4.2      scw  */
    365  1.76.4.2      scw char	machine[16] = MACHINE;		/* from <machine/param.h> */
    366  1.76.4.2      scw char	kernel_arch[16] = "sun3x";	/* XXX needs a sysctl node */
    367  1.76.4.2      scw char	cpu_model[120];
    368  1.76.4.2      scw 
    369  1.76.4.2      scw /*
    370  1.76.4.2      scw  * XXX - Should empirically estimate the divisor...
    371  1.76.4.2      scw  * Note that the value of delay_divisor is roughly
    372  1.76.4.2      scw  * 2048 / cpuclock	(where cpuclock is in MHz).
    373  1.76.4.2      scw  */
    374  1.76.4.2      scw int delay_divisor = 62;		/* assume the fastest (33 MHz) */
    375  1.76.4.2      scw 
    376  1.76.4.2      scw void
    377  1.76.4.2      scw identifycpu()
    378  1.76.4.2      scw {
    379  1.76.4.2      scw 	u_char machtype;
    380  1.76.4.2      scw 
    381  1.76.4.2      scw 	machtype = identity_prom.idp_machtype;
    382  1.76.4.2      scw 	if ((machtype & IDM_ARCH_MASK) != IDM_ARCH_SUN3X) {
    383  1.76.4.2      scw 		printf("Bad IDPROM arch!\n");
    384  1.76.4.2      scw 		sunmon_abort();
    385  1.76.4.2      scw 	}
    386  1.76.4.2      scw 
    387  1.76.4.2      scw 	cpu_machine_id = machtype;
    388  1.76.4.2      scw 	switch (cpu_machine_id) {
    389  1.76.4.2      scw 
    390  1.76.4.2      scw 	case SUN3X_MACH_80:
    391  1.76.4.2      scw 		cpu_string = "80";  	/* Hydra */
    392  1.76.4.2      scw 		delay_divisor = 102;	/* 20 MHz */
    393  1.76.4.2      scw 		cpu_has_vme = FALSE;
    394  1.76.4.2      scw 		break;
    395  1.76.4.2      scw 
    396  1.76.4.2      scw 	case SUN3X_MACH_470:
    397  1.76.4.2      scw 		cpu_string = "470"; 	/* Pegasus */
    398  1.76.4.2      scw 		delay_divisor = 62; 	/* 33 MHz */
    399  1.76.4.2      scw 		cpu_has_vme = TRUE;
    400  1.76.4.2      scw 		break;
    401  1.76.4.2      scw 
    402  1.76.4.2      scw 	default:
    403  1.76.4.2      scw 		printf("unknown sun3x model\n");
    404  1.76.4.2      scw 		sunmon_abort();
    405  1.76.4.2      scw 	}
    406  1.76.4.2      scw 
    407  1.76.4.2      scw 	/* Other stuff? (VAC, mc6888x version, etc.) */
    408  1.76.4.2      scw 	/* Note: miniroot cares about the kernel_arch part. */
    409  1.76.4.2      scw 	sprintf(cpu_model, "%s %s", kernel_arch, cpu_string);
    410  1.76.4.2      scw 
    411  1.76.4.2      scw 	printf("Model: %s\n", cpu_model);
    412  1.76.4.2      scw }
    413  1.76.4.2      scw 
    414  1.76.4.2      scw /*
    415  1.76.4.2      scw  * machine dependent system variables.
    416  1.76.4.2      scw  */
    417  1.76.4.2      scw int
    418  1.76.4.2      scw cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
    419  1.76.4.2      scw 	int *name;
    420  1.76.4.2      scw 	u_int namelen;
    421  1.76.4.2      scw 	void *oldp;
    422  1.76.4.2      scw 	size_t *oldlenp;
    423  1.76.4.2      scw 	void *newp;
    424  1.76.4.2      scw 	size_t newlen;
    425  1.76.4.2      scw 	struct proc *p;
    426  1.76.4.2      scw {
    427  1.76.4.2      scw 	int error;
    428  1.76.4.2      scw 	dev_t consdev;
    429  1.76.4.2      scw 
    430  1.76.4.2      scw 	/* all sysctl names at this level are terminal */
    431  1.76.4.2      scw 	if (namelen != 1)
    432  1.76.4.2      scw 		return (ENOTDIR);		/* overloaded */
    433  1.76.4.2      scw 
    434  1.76.4.2      scw 	switch (name[0]) {
    435  1.76.4.2      scw 	case CPU_CONSDEV:
    436  1.76.4.2      scw 		if (cn_tab != NULL)
    437  1.76.4.2      scw 			consdev = cn_tab->cn_dev;
    438  1.76.4.2      scw 		else
    439  1.76.4.2      scw 			consdev = NODEV;
    440  1.76.4.2      scw 		error = sysctl_rdstruct(oldp, oldlenp, newp,
    441  1.76.4.2      scw 		    &consdev, sizeof consdev);
    442  1.76.4.2      scw 		break;
    443  1.76.4.2      scw 
    444  1.76.4.2      scw #if 0	/* XXX - Not yet... */
    445  1.76.4.2      scw 	case CPU_ROOT_DEVICE:
    446  1.76.4.2      scw 		error = sysctl_rdstring(oldp, oldlenp, newp, root_device);
    447  1.76.4.2      scw 		break;
    448  1.76.4.2      scw 
    449  1.76.4.2      scw 	case CPU_BOOTED_KERNEL:
    450  1.76.4.2      scw 		error = sysctl_rdstring(oldp, oldlenp, newp, booted_kernel);
    451  1.76.4.2      scw 		break;
    452  1.76.4.2      scw #endif
    453  1.76.4.2      scw 
    454  1.76.4.2      scw 	default:
    455  1.76.4.2      scw 		error = EOPNOTSUPP;
    456  1.76.4.2      scw 	}
    457  1.76.4.2      scw 	return (error);
    458  1.76.4.2      scw }
    459  1.76.4.2      scw 
    460  1.76.4.2      scw /* See: sig_machdep.c */
    461  1.76.4.2      scw 
    462  1.76.4.2      scw /*
    463  1.76.4.2      scw  * Do a sync in preparation for a reboot.
    464  1.76.4.2      scw  * XXX - This could probably be common code.
    465  1.76.4.2      scw  * XXX - And now, most of it is in vfs_shutdown()
    466  1.76.4.2      scw  * XXX - Put waittime checks in there too?
    467  1.76.4.2      scw  */
    468  1.76.4.2      scw int waittime = -1;	/* XXX - Who else looks at this? -gwr */
    469  1.76.4.2      scw static void
    470  1.76.4.2      scw reboot_sync __P((void))
    471  1.76.4.2      scw {
    472  1.76.4.2      scw 
    473  1.76.4.2      scw 	/* Check waittime here to localize its use to this function. */
    474  1.76.4.2      scw 	if (waittime >= 0)
    475  1.76.4.2      scw 		return;
    476  1.76.4.2      scw 	waittime = 0;
    477  1.76.4.2      scw 	vfs_shutdown();
    478  1.76.4.2      scw }
    479  1.76.4.2      scw 
    480  1.76.4.2      scw /*
    481  1.76.4.2      scw  * Common part of the BSD and SunOS reboot system calls.
    482  1.76.4.2      scw  */
    483  1.76.4.2      scw __dead void
    484  1.76.4.2      scw cpu_reboot(howto, user_boot_string)
    485  1.76.4.2      scw 	int howto;
    486  1.76.4.2      scw 	char *user_boot_string;
    487  1.76.4.2      scw {
    488  1.76.4.2      scw 	/* Note: this string MUST be static! */
    489  1.76.4.2      scw 	static char bootstr[128];
    490  1.76.4.2      scw 	char *p;
    491  1.76.4.2      scw 
    492  1.76.4.2      scw 	/* If system is cold, just halt. (early panic?) */
    493  1.76.4.2      scw 	if (cold)
    494  1.76.4.2      scw 		goto haltsys;
    495  1.76.4.2      scw 
    496  1.76.4.2      scw 	/* Un-blank the screen if appropriate. */
    497  1.76.4.2      scw 	cnpollc(1);
    498  1.76.4.2      scw 
    499  1.76.4.2      scw 	if ((howto & RB_NOSYNC) == 0) {
    500  1.76.4.2      scw 		reboot_sync();
    501  1.76.4.2      scw 		/*
    502  1.76.4.2      scw 		 * If we've been adjusting the clock, the todr
    503  1.76.4.2      scw 		 * will be out of synch; adjust it now.
    504  1.76.4.2      scw 		 *
    505  1.76.4.2      scw 		 * XXX - However, if the kernel has been sitting in ddb,
    506  1.76.4.2      scw 		 * the time will be way off, so don't set the HW clock!
    507  1.76.4.2      scw 		 * XXX - Should do sanity check against HW clock. -gwr
    508  1.76.4.2      scw 		 */
    509  1.76.4.2      scw 		/* resettodr(); */
    510  1.76.4.2      scw 	}
    511  1.76.4.2      scw 
    512  1.76.4.2      scw 	/* Disable interrupts. */
    513  1.76.4.2      scw 	splhigh();
    514  1.76.4.2      scw 
    515  1.76.4.2      scw 	/* Write out a crash dump if asked. */
    516  1.76.4.2      scw 	if (howto & RB_DUMP)
    517  1.76.4.2      scw 		dumpsys();
    518  1.76.4.2      scw 
    519  1.76.4.2      scw 	/* run any shutdown hooks */
    520  1.76.4.2      scw 	doshutdownhooks();
    521  1.76.4.2      scw 
    522  1.76.4.2      scw 	if (howto & RB_HALT) {
    523  1.76.4.2      scw 	haltsys:
    524  1.76.4.2      scw 		printf("halted.\n");
    525  1.76.4.2      scw 		sunmon_halt();
    526  1.76.4.2      scw 	}
    527  1.76.4.2      scw 
    528  1.76.4.2      scw 	/*
    529  1.76.4.2      scw 	 * Automatic reboot.
    530  1.76.4.2      scw 	 */
    531  1.76.4.2      scw 	if (user_boot_string)
    532  1.76.4.2      scw 		strncpy(bootstr, user_boot_string, sizeof(bootstr));
    533  1.76.4.2      scw 	else {
    534  1.76.4.2      scw 		/*
    535  1.76.4.2      scw 		 * Build our own boot string with an empty
    536  1.76.4.2      scw 		 * boot device/file and (maybe) some flags.
    537  1.76.4.2      scw 		 * The PROM will supply the device/file name.
    538  1.76.4.2      scw 		 */
    539  1.76.4.2      scw 		p = bootstr;
    540  1.76.4.2      scw 		*p = '\0';
    541  1.76.4.2      scw 		if (howto & (RB_KDB|RB_ASKNAME|RB_SINGLE)) {
    542  1.76.4.2      scw 			/* Append the boot flags. */
    543  1.76.4.2      scw 			*p++ = ' ';
    544  1.76.4.2      scw 			*p++ = '-';
    545  1.76.4.2      scw 			if (howto & RB_KDB)
    546  1.76.4.2      scw 				*p++ = 'd';
    547  1.76.4.2      scw 			if (howto & RB_ASKNAME)
    548  1.76.4.2      scw 				*p++ = 'a';
    549  1.76.4.2      scw 			if (howto & RB_SINGLE)
    550  1.76.4.2      scw 				*p++ = 's';
    551  1.76.4.2      scw 			*p = '\0';
    552  1.76.4.2      scw 		}
    553  1.76.4.2      scw 	}
    554  1.76.4.2      scw 	printf("rebooting...\n");
    555  1.76.4.2      scw 	sunmon_reboot(bootstr);
    556  1.76.4.2      scw 	for (;;) ;
    557  1.76.4.2      scw 	/*NOTREACHED*/
    558  1.76.4.2      scw }
    559  1.76.4.2      scw 
    560  1.76.4.2      scw /*
    561  1.76.4.2      scw  * These variables are needed by /sbin/savecore
    562  1.76.4.2      scw  */
    563  1.76.4.4  nathanw u_int32_t dumpmag = 0x8fca0101;	/* magic number */
    564  1.76.4.2      scw int 	dumpsize = 0;		/* pages */
    565  1.76.4.2      scw long	dumplo = 0; 		/* blocks */
    566  1.76.4.2      scw 
    567  1.76.4.2      scw #define DUMP_EXTRA	1	/* CPU-dependent extra pages */
    568  1.76.4.2      scw 
    569  1.76.4.2      scw /*
    570  1.76.4.2      scw  * This is called by main to set dumplo, dumpsize.
    571  1.76.4.2      scw  * Dumps always skip the first NBPG of disk space
    572  1.76.4.2      scw  * in case there might be a disk label stored there.
    573  1.76.4.2      scw  * If there is extra space, put dump at the end to
    574  1.76.4.2      scw  * reduce the chance that swapping trashes it.
    575  1.76.4.2      scw  */
    576  1.76.4.2      scw void
    577  1.76.4.2      scw cpu_dumpconf()
    578  1.76.4.2      scw {
    579  1.76.4.2      scw 	int devblks;	/* size of dump device in blocks */
    580  1.76.4.2      scw 	int dumpblks;	/* size of dump image in blocks */
    581  1.76.4.2      scw 	int maj;
    582  1.76.4.2      scw 	int (*getsize)__P((dev_t));
    583  1.76.4.2      scw 
    584  1.76.4.2      scw 	if (dumpdev == NODEV)
    585  1.76.4.2      scw 		return;
    586  1.76.4.2      scw 
    587  1.76.4.2      scw 	maj = major(dumpdev);
    588  1.76.4.2      scw 	if (maj < 0 || maj >= nblkdev)
    589  1.76.4.2      scw 		panic("dumpconf: bad dumpdev=0x%x", dumpdev);
    590  1.76.4.2      scw 	getsize = bdevsw[maj].d_psize;
    591  1.76.4.2      scw 	if (getsize == NULL)
    592  1.76.4.2      scw 		return;
    593  1.76.4.2      scw 	devblks = (*getsize)(dumpdev);
    594  1.76.4.2      scw 	if (devblks <= ctod(1))
    595  1.76.4.2      scw 		return;
    596  1.76.4.2      scw 	devblks &= ~(ctod(1) - 1);
    597  1.76.4.2      scw 
    598  1.76.4.2      scw 	/*
    599  1.76.4.2      scw 	 * Note: savecore expects dumpsize to be the
    600  1.76.4.2      scw 	 * number of pages AFTER the dump header.
    601  1.76.4.2      scw 	 */
    602  1.76.4.2      scw 	dumpsize = physmem; 	/* pages */
    603  1.76.4.2      scw 
    604  1.76.4.2      scw 	/* Position dump image near end of space, page aligned. */
    605  1.76.4.2      scw 	dumpblks = ctod(physmem + DUMP_EXTRA);
    606  1.76.4.2      scw 	dumplo = devblks - dumpblks;
    607  1.76.4.2      scw 
    608  1.76.4.2      scw 	/* If it does not fit, truncate it by moving dumplo. */
    609  1.76.4.2      scw 	/* Note: Must force signed comparison. */
    610  1.76.4.2      scw 	if (dumplo < ((long)ctod(1))) {
    611  1.76.4.2      scw 		dumplo = ctod(1);
    612  1.76.4.2      scw 		dumpsize = dtoc(devblks - dumplo) - DUMP_EXTRA;
    613  1.76.4.2      scw 	}
    614  1.76.4.2      scw }
    615  1.76.4.2      scw 
    616  1.76.4.2      scw /* Note: gdb looks for "dumppcb" in a kernel crash dump. */
    617  1.76.4.2      scw struct pcb dumppcb;
    618  1.76.4.2      scw 
    619  1.76.4.2      scw /*
    620  1.76.4.2      scw  * Write a crash dump.  The format while in swap is:
    621  1.76.4.2      scw  *   kcore_seg_t cpu_hdr;
    622  1.76.4.2      scw  *   cpu_kcore_hdr_t cpu_data;
    623  1.76.4.2      scw  *   padding (NBPG-sizeof(kcore_seg_t))
    624  1.76.4.2      scw  *   pagemap (2*NBPG)
    625  1.76.4.2      scw  *   physical memory...
    626  1.76.4.2      scw  */
    627  1.76.4.2      scw void
    628  1.76.4.2      scw dumpsys()
    629  1.76.4.2      scw {
    630  1.76.4.2      scw 	struct bdevsw *dsw;
    631  1.76.4.2      scw 	kcore_seg_t *kseg_p;
    632  1.76.4.2      scw 	cpu_kcore_hdr_t *chdr_p;
    633  1.76.4.2      scw 	struct sun3x_kcore_hdr *sh;
    634  1.76.4.2      scw 	phys_ram_seg_t *crs_p;
    635  1.76.4.2      scw 	char *vaddr;
    636  1.76.4.2      scw 	paddr_t paddr;
    637  1.76.4.2      scw 	int psize, todo, seg, segsz;
    638  1.76.4.2      scw 	daddr_t blkno;
    639  1.76.4.2      scw 	int error = 0;
    640  1.76.4.2      scw 
    641  1.76.4.2      scw 	if (dumpdev == NODEV)
    642  1.76.4.2      scw 		return;
    643  1.76.4.2      scw 
    644  1.76.4.2      scw 	/*
    645  1.76.4.2      scw 	 * For dumps during autoconfiguration,
    646  1.76.4.2      scw 	 * if dump device has already configured...
    647  1.76.4.2      scw 	 */
    648  1.76.4.2      scw 	if (dumpsize == 0)
    649  1.76.4.2      scw 		cpu_dumpconf();
    650  1.76.4.2      scw 	if (dumplo <= 0) {
    651  1.76.4.2      scw 		printf("\ndump to dev %u,%u not possible\n", major(dumpdev),
    652  1.76.4.2      scw 		    minor(dumpdev));
    653  1.76.4.2      scw 		return;
    654  1.76.4.2      scw 	}
    655  1.76.4.2      scw 	savectx(&dumppcb);
    656  1.76.4.2      scw 
    657  1.76.4.2      scw 	dsw = &bdevsw[major(dumpdev)];
    658  1.76.4.2      scw 	psize = (*(dsw->d_psize))(dumpdev);
    659  1.76.4.2      scw 	if (psize == -1) {
    660  1.76.4.2      scw 		printf("dump area unavailable\n");
    661  1.76.4.2      scw 		return;
    662  1.76.4.2      scw 	}
    663  1.76.4.2      scw 
    664  1.76.4.2      scw 	printf("\ndumping to dev %u,%u offset %ld\n", major(dumpdev),
    665  1.76.4.2      scw 	    minor(dumpdev), dumplo);
    666  1.76.4.2      scw 
    667  1.76.4.2      scw 	/*
    668  1.76.4.2      scw 	 * Prepare the dump header
    669  1.76.4.2      scw 	 */
    670  1.76.4.2      scw 	blkno = dumplo;
    671  1.76.4.2      scw 	todo = dumpsize;	/* pages */
    672  1.76.4.2      scw 	vaddr = (char *)dumppage;
    673  1.76.4.2      scw 	memset(vaddr, 0, NBPG);
    674  1.76.4.2      scw 
    675  1.76.4.2      scw 	/* Set pointers to all three parts. */
    676  1.76.4.2      scw 	kseg_p = (kcore_seg_t *)vaddr;
    677  1.76.4.2      scw 	chdr_p = (cpu_kcore_hdr_t *)(kseg_p + 1);
    678  1.76.4.2      scw 	sh = &chdr_p->un._sun3x;
    679  1.76.4.2      scw 
    680  1.76.4.2      scw 	/* Fill in kcore_seg_t part. */
    681  1.76.4.2      scw 	CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
    682  1.76.4.2      scw 	kseg_p->c_size = (ctob(DUMP_EXTRA) - sizeof(*kseg_p));
    683  1.76.4.2      scw 
    684  1.76.4.2      scw 	/* Fill in cpu_kcore_hdr_t part. */
    685  1.76.4.2      scw 	strncpy(chdr_p->name, kernel_arch, sizeof(chdr_p->name));
    686  1.76.4.2      scw 	chdr_p->page_size = NBPG;
    687  1.76.4.2      scw 	chdr_p->kernbase = KERNBASE;
    688  1.76.4.2      scw 
    689  1.76.4.2      scw 	/* Fill in the sun3x_kcore_hdr part. */
    690  1.76.4.2      scw 	pmap_kcore_hdr(sh);
    691  1.76.4.2      scw 
    692  1.76.4.2      scw 	/* Write out the dump header. */
    693  1.76.4.2      scw 	error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
    694  1.76.4.2      scw 	if (error)
    695  1.76.4.2      scw 		goto fail;
    696  1.76.4.2      scw 	blkno += btodb(NBPG);
    697  1.76.4.2      scw 
    698  1.76.4.2      scw 	/*
    699  1.76.4.2      scw 	 * Now dump physical memory.  Note that physical memory
    700  1.76.4.2      scw 	 * might NOT be congiguous, so do it by segments.
    701  1.76.4.2      scw 	 */
    702  1.76.4.2      scw 
    703  1.76.4.2      scw 	vaddr = (char *)vmmap;	/* Borrow /dev/mem VA */
    704  1.76.4.2      scw 
    705  1.76.4.2      scw 	for (seg = 0; seg < SUN3X_NPHYS_RAM_SEGS; seg++) {
    706  1.76.4.2      scw 		crs_p = &sh->ram_segs[seg];
    707  1.76.4.2      scw 		paddr = crs_p->start;
    708  1.76.4.2      scw 		segsz = crs_p->size;
    709  1.76.4.2      scw 
    710  1.76.4.2      scw 		while (todo && (segsz > 0)) {
    711  1.76.4.2      scw 
    712  1.76.4.2      scw 			/* Print pages left after every 16. */
    713  1.76.4.2      scw 			if ((todo & 0xf) == 0)
    714  1.76.4.2      scw 				printf("\r%4d", todo);
    715  1.76.4.2      scw 
    716  1.76.4.2      scw 			/* Make a temporary mapping for the page. */
    717  1.76.4.2      scw 			pmap_kenter_pa(vmmap, paddr | PMAP_NC, VM_PROT_READ);
    718  1.76.4.2      scw 			pmap_update(pmap_kernel());
    719  1.76.4.2      scw 			error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
    720  1.76.4.2      scw 			pmap_kremove(vmmap, NBPG);
    721  1.76.4.2      scw 			pmap_update(pmap_kernel());
    722  1.76.4.2      scw 			if (error)
    723  1.76.4.2      scw 				goto fail;
    724  1.76.4.2      scw 			paddr += NBPG;
    725  1.76.4.2      scw 			segsz -= NBPG;
    726  1.76.4.2      scw 			blkno += btodb(NBPG);
    727  1.76.4.2      scw 			todo--;
    728  1.76.4.2      scw 		}
    729  1.76.4.2      scw 	}
    730  1.76.4.2      scw 	printf("\rdump succeeded\n");
    731  1.76.4.2      scw 	return;
    732  1.76.4.2      scw fail:
    733  1.76.4.2      scw 	printf(" dump error=%d\n", error);
    734  1.76.4.2      scw }
    735  1.76.4.2      scw 
    736  1.76.4.2      scw static void
    737  1.76.4.2      scw initcpu()
    738  1.76.4.2      scw {
    739  1.76.4.2      scw 	/* XXX: Enable RAM parity/ECC checking? */
    740  1.76.4.2      scw 	/* XXX: parityenable(); */
    741  1.76.4.2      scw 
    742  1.76.4.2      scw #ifdef	HAVECACHE
    743  1.76.4.2      scw 	cache_enable();
    744  1.76.4.2      scw #endif
    745  1.76.4.2      scw }
    746  1.76.4.2      scw 
    747  1.76.4.2      scw /* straptrap() in trap.c */
    748  1.76.4.2      scw 
    749  1.76.4.2      scw /* from hp300: badaddr() */
    750  1.76.4.2      scw /* peek_byte(), peek_word() moved to bus_subr.c */
    751  1.76.4.2      scw 
    752  1.76.4.2      scw /* XXX: parityenable() ? */
    753  1.76.4.2      scw /* regdump() moved to regdump.c */
    754  1.76.4.2      scw 
    755  1.76.4.2      scw /*
    756  1.76.4.2      scw  * cpu_exec_aout_makecmds():
    757  1.76.4.2      scw  *	cpu-dependent a.out format hook for execve().
    758  1.76.4.2      scw  *
    759  1.76.4.2      scw  * Determine if the given exec package refers to something which we
    760  1.76.4.2      scw  * understand and, if so, set up the vmcmds for it.
    761  1.76.4.2      scw  */
    762  1.76.4.2      scw int
    763  1.76.4.2      scw cpu_exec_aout_makecmds(p, epp)
    764  1.76.4.2      scw 	struct proc *p;
    765  1.76.4.2      scw 	struct exec_package *epp;
    766  1.76.4.2      scw {
    767  1.76.4.2      scw 	return ENOEXEC;
    768  1.76.4.2      scw }
    769