aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/bios_uv.c
diff options
context:
space:
mode:
authorRuss Anderson <rja@sgi.com>2008-10-03 12:59:15 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:53:13 -0400
commit7f5942329e0787087a5e4dced838cee711ac2b58 (patch)
tree7bf3d4d91e15694977ff5d46bf6ceab7ebbd6c54 /arch/x86/kernel/bios_uv.c
parenta50f70b17541c0060967c6df61133e968bad3652 (diff)
x86: Add UV bios call infrastructure v4
Add the EFI callback function and associated wrapper code. Initialize SAL system table entry info at boot time. Signed-off-by: Russ Anderson <rja@sgi.com> Signed-off-by: Paul Jackson <pj@sgi.com> Acked-by: Huang Ying <ying.huang@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/bios_uv.c')
-rw-r--r--arch/x86/kernel/bios_uv.c101
1 files changed, 80 insertions, 21 deletions
diff --git a/arch/x86/kernel/bios_uv.c b/arch/x86/kernel/bios_uv.c
index fdd585f9c53d..5481eb59f783 100644
--- a/arch/x86/kernel/bios_uv.c
+++ b/arch/x86/kernel/bios_uv.c
@@ -1,8 +1,6 @@
1/* 1/*
2 * BIOS run time interface routines. 2 * BIOS run time interface routines.
3 * 3 *
4 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 6 * the Free Software Foundation; either version 2 of the License, or
@@ -16,33 +14,94 @@
16 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
19 * Copyright (c) Russ Anderson
19 */ 20 */
20 21
22#include <linux/efi.h>
23#include <asm/efi.h>
24#include <linux/io.h>
21#include <asm/uv/bios.h> 25#include <asm/uv/bios.h>
22 26
23const char * 27struct uv_systab uv_systab;
24x86_bios_strerror(long status) 28
29s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
25{ 30{
26 const char *str; 31 struct uv_systab *tab = &uv_systab;
27 switch (status) { 32
28 case 0: str = "Call completed without error"; break; 33 if (!tab->function)
29 case -1: str = "Not implemented"; break; 34 /*
30 case -2: str = "Invalid argument"; break; 35 * BIOS does not support UV systab
31 case -3: str = "Call completed with error"; break; 36 */
32 default: str = "Unknown BIOS status code"; break; 37 return BIOS_STATUS_UNIMPLEMENTED;
33 } 38
34 return str; 39 return efi_call6((void *)__va(tab->function),
40 (u64)which, a1, a2, a3, a4, a5);
35} 41}
36 42
37long 43s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
38x86_bios_freq_base(unsigned long which, unsigned long *ticks_per_second, 44 u64 a4, u64 a5)
39 unsigned long *drift_info)
40{ 45{
41 struct uv_bios_retval isrv; 46 unsigned long bios_flags;
47 s64 ret;
48
49 local_irq_save(bios_flags);
50 ret = uv_bios_call(which, a1, a2, a3, a4, a5);
51 local_irq_restore(bios_flags);
52
53 return ret;
54}
55
56s64 uv_bios_call_reentrant(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
57 u64 a4, u64 a5)
58{
59 s64 ret;
60
61 preempt_disable();
62 ret = uv_bios_call(which, a1, a2, a3, a4, a5);
63 preempt_enable();
42 64
43 BIOS_CALL(isrv, BIOS_FREQ_BASE, which, 0, 0, 0, 0, 0, 0); 65 return ret;
44 *ticks_per_second = isrv.v0; 66}
45 *drift_info = isrv.v1; 67
46 return isrv.status; 68long
69x86_bios_freq_base(unsigned long clock_type, unsigned long *ticks_per_second,
70 unsigned long *drift_info)
71{
72 return uv_bios_call(UV_BIOS_FREQ_BASE, clock_type,
73 (u64)ticks_per_second, 0, 0, 0);
47} 74}
48EXPORT_SYMBOL_GPL(x86_bios_freq_base); 75EXPORT_SYMBOL_GPL(x86_bios_freq_base);
76
77
78#ifdef CONFIG_EFI
79void uv_bios_init(void)
80{
81 struct uv_systab *tab;
82
83 if ((efi.uv_systab == EFI_INVALID_TABLE_ADDR) ||
84 (efi.uv_systab == (unsigned long)NULL)) {
85 printk(KERN_CRIT "No EFI UV System Table.\n");
86 uv_systab.function = (unsigned long)NULL;
87 return;
88 }
89
90 tab = (struct uv_systab *)ioremap(efi.uv_systab,
91 sizeof(struct uv_systab));
92 if (strncmp(tab->signature, "UVST", 4) != 0)
93 printk(KERN_ERR "bad signature in UV system table!");
94
95 /*
96 * Copy table to permanent spot for later use.
97 */
98 memcpy(&uv_systab, tab, sizeof(struct uv_systab));
99 iounmap(tab);
100
101 printk(KERN_INFO "EFI UV System Table Revision %d\n", tab->revision);
102}
103#else /* !CONFIG_EFI */
104
105void uv_bios_init(void) { }
106#endif
107