xref: /openbmc/linux/arch/x86/include/asm/uv/bios.h (revision 23c35700)
105e4d316SH. Peter Anvin #ifndef _ASM_X86_UV_BIOS_H
205e4d316SH. Peter Anvin #define _ASM_X86_UV_BIOS_H
3bb898558SAl Viro 
4bb898558SAl Viro /*
5bb898558SAl Viro  * UV BIOS layer definitions.
6bb898558SAl Viro  *
7bb898558SAl Viro  *  This program is free software; you can redistribute it and/or modify
8bb898558SAl Viro  *  it under the terms of the GNU General Public License as published by
9bb898558SAl Viro  *  the Free Software Foundation; either version 2 of the License, or
10bb898558SAl Viro  *  (at your option) any later version.
11bb898558SAl Viro  *
12bb898558SAl Viro  *  This program is distributed in the hope that it will be useful,
13bb898558SAl Viro  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14bb898558SAl Viro  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15bb898558SAl Viro  *  GNU General Public License for more details.
16bb898558SAl Viro  *
17bb898558SAl Viro  *  You should have received a copy of the GNU General Public License
18bb898558SAl Viro  *  along with this program; if not, write to the Free Software
19bb898558SAl Viro  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20bb898558SAl Viro  *
21bb898558SAl Viro  *  Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
22bb898558SAl Viro  *  Copyright (c) Russ Anderson
23bb898558SAl Viro  */
24bb898558SAl Viro 
25bb898558SAl Viro #include <linux/rtc.h>
26bb898558SAl Viro 
27bb898558SAl Viro /*
28bb898558SAl Viro  * Values for the BIOS calls.  It is passed as the first * argument in the
29bb898558SAl Viro  * BIOS call.  Passing any other value in the first argument will result
30bb898558SAl Viro  * in a BIOS_STATUS_UNIMPLEMENTED return status.
31bb898558SAl Viro  */
32bb898558SAl Viro enum uv_bios_cmd {
33bb898558SAl Viro 	UV_BIOS_COMMON,
34bb898558SAl Viro 	UV_BIOS_GET_SN_INFO,
3564ccf2f9SRuss Anderson 	UV_BIOS_FREQ_BASE,
3664ccf2f9SRuss Anderson 	UV_BIOS_WATCHLIST_ALLOC,
37e8929c8aSRuss Anderson 	UV_BIOS_WATCHLIST_FREE,
3823c35700SRuss Anderson 	UV_BIOS_MEMPROTECT,
3923c35700SRuss Anderson 	UV_BIOS_GET_PARTITION_ADDR
40bb898558SAl Viro };
41bb898558SAl Viro 
42bb898558SAl Viro /*
43bb898558SAl Viro  * Status values returned from a BIOS call.
44bb898558SAl Viro  */
45bb898558SAl Viro enum {
4623c35700SRuss Anderson 	BIOS_STATUS_MORE_PASSES		=  1,
47bb898558SAl Viro 	BIOS_STATUS_SUCCESS		=  0,
48bb898558SAl Viro 	BIOS_STATUS_UNIMPLEMENTED	= -ENOSYS,
49bb898558SAl Viro 	BIOS_STATUS_EINVAL		= -EINVAL,
50bb898558SAl Viro 	BIOS_STATUS_UNAVAIL		= -EBUSY
51bb898558SAl Viro };
52bb898558SAl Viro 
53bb898558SAl Viro /*
54bb898558SAl Viro  * The UV system table describes specific firmware
55bb898558SAl Viro  * capabilities available to the Linux kernel at runtime.
56bb898558SAl Viro  */
57bb898558SAl Viro struct uv_systab {
58bb898558SAl Viro 	char signature[4];	/* must be "UVST" */
59bb898558SAl Viro 	u32 revision;		/* distinguish different firmware revs */
60bb898558SAl Viro 	u64 function;		/* BIOS runtime callback function ptr */
61bb898558SAl Viro };
62bb898558SAl Viro 
63bb898558SAl Viro enum {
64bb898558SAl Viro 	BIOS_FREQ_BASE_PLATFORM = 0,
65bb898558SAl Viro 	BIOS_FREQ_BASE_INTERVAL_TIMER = 1,
66bb898558SAl Viro 	BIOS_FREQ_BASE_REALTIME_CLOCK = 2
67bb898558SAl Viro };
68bb898558SAl Viro 
69bb898558SAl Viro union partition_info_u {
70bb898558SAl Viro 	u64	val;
71bb898558SAl Viro 	struct {
72bb898558SAl Viro 		u64	hub_version	:  8,
73bb898558SAl Viro 			partition_id	: 16,
74bb898558SAl Viro 			coherence_id	: 16,
75bb898558SAl Viro 			region_size	: 24;
76bb898558SAl Viro 	};
77bb898558SAl Viro };
78bb898558SAl Viro 
7964ccf2f9SRuss Anderson union uv_watchlist_u {
8064ccf2f9SRuss Anderson 	u64	val;
8164ccf2f9SRuss Anderson 	struct {
8264ccf2f9SRuss Anderson 		u64	blade	: 16,
8364ccf2f9SRuss Anderson 			size	: 32,
8464ccf2f9SRuss Anderson 			filler	: 16;
8564ccf2f9SRuss Anderson 	};
8664ccf2f9SRuss Anderson };
8764ccf2f9SRuss Anderson 
88e8929c8aSRuss Anderson enum uv_memprotect {
89e8929c8aSRuss Anderson 	UV_MEMPROT_RESTRICT_ACCESS,
90e8929c8aSRuss Anderson 	UV_MEMPROT_ALLOW_AMO,
91e8929c8aSRuss Anderson 	UV_MEMPROT_ALLOW_RW
92e8929c8aSRuss Anderson };
93e8929c8aSRuss Anderson 
94bb898558SAl Viro /*
95bb898558SAl Viro  * bios calls have 6 parameters
96bb898558SAl Viro  */
97bb898558SAl Viro extern s64 uv_bios_call(enum uv_bios_cmd, u64, u64, u64, u64, u64);
98bb898558SAl Viro extern s64 uv_bios_call_irqsave(enum uv_bios_cmd, u64, u64, u64, u64, u64);
99bb898558SAl Viro extern s64 uv_bios_call_reentrant(enum uv_bios_cmd, u64, u64, u64, u64, u64);
100bb898558SAl Viro 
101bb898558SAl Viro extern s64 uv_bios_get_sn_info(int, int *, long *, long *, long *);
102bb898558SAl Viro extern s64 uv_bios_freq_base(u64, u64 *);
10364ccf2f9SRuss Anderson extern int uv_bios_mq_watchlist_alloc(int, void *, unsigned int,
10464ccf2f9SRuss Anderson 					unsigned long *);
10564ccf2f9SRuss Anderson extern int uv_bios_mq_watchlist_free(int, int);
106e8929c8aSRuss Anderson extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect);
10723c35700SRuss Anderson extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *);
108bb898558SAl Viro 
109bb898558SAl Viro extern void uv_bios_init(void);
110bb898558SAl Viro 
11164ccf2f9SRuss Anderson extern unsigned long sn_rtc_cycles_per_second;
112bb898558SAl Viro extern int uv_type;
113bb898558SAl Viro extern long sn_partition_id;
1145292ae11SIngo Molnar extern long sn_coherency_id;
1155292ae11SIngo Molnar extern long sn_region_size;
1165292ae11SIngo Molnar #define partition_coherence_id()	(sn_coherency_id)
117bb898558SAl Viro 
118bb898558SAl Viro extern struct kobject *sgi_uv_kobj;	/* /sys/firmware/sgi_uv */
119bb898558SAl Viro 
12005e4d316SH. Peter Anvin #endif /* _ASM_X86_UV_BIOS_H */
121