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