1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _ASM_X86_UV_BIOS_H
3 #define _ASM_X86_UV_BIOS_H
6 * UV BIOS layer definitions.
8 * Copyright (c) 2008-2009 Silicon Graphics, Inc. All Rights Reserved.
9 * Copyright (c) Russ Anderson <rja@sgi.com>
12 #include <linux/rtc.h>
15 * Values for the BIOS calls. It is passed as the first * argument in the
16 * BIOS call. Passing any other value in the first argument will result
17 * in a BIOS_STATUS_UNIMPLEMENTED return status.
23 UV_BIOS_WATCHLIST_ALLOC
,
24 UV_BIOS_WATCHLIST_FREE
,
26 UV_BIOS_GET_PARTITION_ADDR
,
27 UV_BIOS_SET_LEGACY_VGA_TARGET
31 * Status values returned from a BIOS call.
34 BIOS_STATUS_MORE_PASSES
= 1,
35 BIOS_STATUS_SUCCESS
= 0,
36 BIOS_STATUS_UNIMPLEMENTED
= -ENOSYS
,
37 BIOS_STATUS_EINVAL
= -EINVAL
,
38 BIOS_STATUS_UNAVAIL
= -EBUSY
,
39 BIOS_STATUS_ABORT
= -EINTR
,
42 /* Address map parameters */
43 struct uv_gam_parameters
{
46 u8 mmr_shift
; /* Convert PNode to MMR space offset */
47 u8 gru_shift
; /* Convert PNode to GRU space offset */
48 u8 gpa_shift
; /* Size of offset field in GRU phys addr */
52 /* UV_TABLE_GAM_RANGE_ENTRY values */
53 #define UV_GAM_RANGE_TYPE_UNUSED 0 /* End of table */
54 #define UV_GAM_RANGE_TYPE_RAM 1 /* Normal RAM */
55 #define UV_GAM_RANGE_TYPE_NVRAM 2 /* Non-volatile memory */
56 #define UV_GAM_RANGE_TYPE_NV_WINDOW 3 /* NVMDIMM block window */
57 #define UV_GAM_RANGE_TYPE_NV_MAILBOX 4 /* NVMDIMM mailbox */
58 #define UV_GAM_RANGE_TYPE_HOLE 5 /* Unused address range */
59 #define UV_GAM_RANGE_TYPE_MAX 6
61 /* The structure stores PA bits 56:26, for 64MB granularity */
62 #define UV_GAM_RANGE_SHFT 26 /* 64MB */
64 struct uv_gam_range_entry
{
65 char type
; /* Entry type: GAM_RANGE_TYPE_UNUSED, etc. */
67 u16 nasid
; /* HNasid */
68 u16 sockid
; /* Socket ID, high bits of APIC ID */
69 u16 pnode
; /* Index to MMR and GRU spaces */
71 u32 limit
; /* PA bits 56:26 (UV_GAM_RANGE_SHFT) */
74 #define UV_SYSTAB_SIG "UVST"
75 #define UV_SYSTAB_VERSION_1 1 /* UV1/2/3 BIOS version */
76 #define UV_SYSTAB_VERSION_UV4 0x400 /* UV4 BIOS base version */
77 #define UV_SYSTAB_VERSION_UV4_1 0x401 /* + gpa_shift */
78 #define UV_SYSTAB_VERSION_UV4_2 0x402 /* + TYPE_NVRAM/WINDOW/MBOX */
79 #define UV_SYSTAB_VERSION_UV4_3 0x403 /* - GAM Range PXM Value */
80 #define UV_SYSTAB_VERSION_UV4_LATEST UV_SYSTAB_VERSION_UV4_3
82 #define UV_SYSTAB_TYPE_UNUSED 0 /* End of table (offset == 0) */
83 #define UV_SYSTAB_TYPE_GAM_PARAMS 1 /* GAM PARAM conversions */
84 #define UV_SYSTAB_TYPE_GAM_RNG_TBL 2 /* GAM entry table */
85 #define UV_SYSTAB_TYPE_MAX 3
88 * The UV system table describes specific firmware
89 * capabilities available to the Linux kernel at runtime.
92 char signature
[4]; /* must be UV_SYSTAB_SIG */
93 u32 revision
; /* distinguish different firmware revs */
94 u64 function
; /* BIOS runtime callback function ptr */
95 u32 size
; /* systab size (starting with _VERSION_UV4) */
97 u32 type
:8; /* type of entry */
98 u32 offset
:24; /* byte offset from struct start to entry */
99 } entry
[1]; /* additional entries follow */
101 extern struct uv_systab
*uv_systab
;
102 /* (... end of definitions from UV BIOS ...) */
105 BIOS_FREQ_BASE_PLATFORM
= 0,
106 BIOS_FREQ_BASE_INTERVAL_TIMER
= 1,
107 BIOS_FREQ_BASE_REALTIME_CLOCK
= 2
110 union partition_info_u
{
121 UV_MEMPROT_RESTRICT_ACCESS
,
122 UV_MEMPROT_ALLOW_AMO
,
127 * bios calls have 6 parameters
129 extern s64
uv_bios_call(enum uv_bios_cmd
, u64
, u64
, u64
, u64
, u64
);
130 extern s64
uv_bios_call_irqsave(enum uv_bios_cmd
, u64
, u64
, u64
, u64
, u64
);
132 extern s64
uv_bios_get_sn_info(int, int *, long *, long *, long *, long *);
133 extern s64
uv_bios_freq_base(u64
, u64
*);
134 extern int uv_bios_mq_watchlist_alloc(unsigned long, unsigned int,
136 extern int uv_bios_mq_watchlist_free(int, int);
137 extern s64
uv_bios_change_memprotect(u64
, u64
, enum uv_memprotect
);
138 extern s64
uv_bios_reserved_page_pa(u64
, u64
*, u64
*, u64
*);
139 extern int uv_bios_set_legacy_vga_target(bool decode
, int domain
, int bus
);
141 extern int uv_bios_init(void);
143 extern unsigned long sn_rtc_cycles_per_second
;
145 extern long sn_partition_id
;
146 extern long sn_coherency_id
;
147 extern long sn_region_size
;
148 extern long system_serial_number
;
149 #define uv_partition_coherence_id() (sn_coherency_id)
151 extern struct kobject
*sgi_uv_kobj
; /* /sys/firmware/sgi_uv */
154 * EFI runtime lock; cf. firmware/efi/runtime-wrappers.c for details
156 extern struct semaphore __efi_uv_runtime_lock
;
158 #endif /* _ASM_X86_UV_BIOS_H */