Home | History | Annotate | Line # | Download | only in common
OSFpal.c revision 1.8.2.2
      1  1.8.2.2  wiz /* $NetBSD: OSFpal.c,v 1.8.2.2 2001/07/22 15:17:31 wiz Exp $ */
      2  1.8.2.2  wiz 
      3  1.8.2.2  wiz /*
      4  1.8.2.2  wiz  * Copyright (c) 1994, 1996 Carnegie-Mellon University.
      5  1.8.2.2  wiz  * All rights reserved.
      6  1.8.2.2  wiz  *
      7  1.8.2.2  wiz  * Author: Keith Bostic
      8  1.8.2.2  wiz  *
      9  1.8.2.2  wiz  * Permission to use, copy, modify and distribute this software and
     10  1.8.2.2  wiz  * its documentation is hereby granted, provided that both the copyright
     11  1.8.2.2  wiz  * notice and this permission notice appear in all copies of the
     12  1.8.2.2  wiz  * software, derivative works or modified versions, and any portions
     13  1.8.2.2  wiz  * thereof, and that both notices appear in supporting documentation.
     14  1.8.2.2  wiz  *
     15  1.8.2.2  wiz  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  1.8.2.2  wiz  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  1.8.2.2  wiz  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  1.8.2.2  wiz  *
     19  1.8.2.2  wiz  * Carnegie Mellon requests users of this software to return to
     20  1.8.2.2  wiz  *
     21  1.8.2.2  wiz  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  1.8.2.2  wiz  *  School of Computer Science
     23  1.8.2.2  wiz  *  Carnegie Mellon University
     24  1.8.2.2  wiz  *  Pittsburgh PA 15213-3890
     25  1.8.2.2  wiz  *
     26  1.8.2.2  wiz  * any improvements or extensions that they make and grant Carnegie the
     27  1.8.2.2  wiz  * rights to redistribute these changes.
     28  1.8.2.2  wiz  */
     29  1.8.2.2  wiz 
     30  1.8.2.2  wiz #include <sys/types.h>
     31  1.8.2.2  wiz #include <lib/libsa/stand.h>
     32  1.8.2.2  wiz 
     33  1.8.2.2  wiz #include <machine/prom.h>
     34  1.8.2.2  wiz #include <machine/rpb.h>
     35  1.8.2.2  wiz #include <machine/alpha_cpu.h>
     36  1.8.2.2  wiz 
     37  1.8.2.2  wiz paddr_t ptbr_save;
     38  1.8.2.2  wiz 
     39  1.8.2.2  wiz #include "common.h"
     40  1.8.2.2  wiz 
     41  1.8.2.2  wiz void
     42  1.8.2.2  wiz OSFpal()
     43  1.8.2.2  wiz {
     44  1.8.2.2  wiz 	struct rpb *r;
     45  1.8.2.2  wiz 	struct pcs *p;
     46  1.8.2.2  wiz 
     47  1.8.2.2  wiz 	r = (struct rpb *)HWRPB_ADDR;
     48  1.8.2.2  wiz 	/*
     49  1.8.2.2  wiz 	 * Note, cpu_number() is a VMS op, can't necessarily call it.
     50  1.8.2.2  wiz 	 * Real fun: PAL_VMS_mfpr_whami == PAL_OSF1_rti...
     51  1.8.2.2  wiz 	 * We might not be rpb_primary_cpu_id, but it is supposed to go
     52  1.8.2.2  wiz 	 * first so the answer should apply to everyone.
     53  1.8.2.2  wiz 	 */
     54  1.8.2.2  wiz 	p = LOCATE_PCS(r, r->rpb_primary_cpu_id);
     55  1.8.2.2  wiz 
     56  1.8.2.2  wiz 	printf("VMS PAL rev: 0x%lx\n", p->pcs_palrevisions[PALvar_OpenVMS]);
     57  1.8.2.2  wiz 	printf("OSF PAL rev: 0x%lx\n", p->pcs_palrevisions[PALvar_OSF1]);
     58  1.8.2.2  wiz 
     59  1.8.2.2  wiz 	if(p->pcs_pal_type==PAL_TYPE_OSF1) {
     60  1.8.2.2  wiz 		printf("OSF PAL code already running.\n");
     61  1.8.2.2  wiz 		ptbr_save = ((struct alpha_pcb *)p)->apcb_ptbr;
     62  1.8.2.2  wiz 		printf("PTBR is:          0x%lx\n", ptbr_save);
     63  1.8.2.2  wiz 		return;
     64  1.8.2.2  wiz 	}
     65  1.8.2.2  wiz 	switch_palcode();
     66  1.8.2.2  wiz 	memcpy(&p->pcs_pal_rev, &p->pcs_palrevisions[PALvar_OSF1],
     67  1.8.2.2  wiz 	    sizeof(p->pcs_pal_rev));
     68  1.8.2.2  wiz 	printf("Switch to OSF PAL code succeeded.\n");
     69  1.8.2.2  wiz }
     70  1.8.2.2  wiz 
     71