183856Sdfr/*-
283856Sdfr * Copyright (c) 2001 Doug Rabson
383856Sdfr * All rights reserved.
483856Sdfr *
583856Sdfr * Redistribution and use in source and binary forms, with or without
683856Sdfr * modification, are permitted provided that the following conditions
783856Sdfr * are met:
883856Sdfr * 1. Redistributions of source code must retain the above copyright
983856Sdfr *    notice, this list of conditions and the following disclaimer.
1083856Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1183856Sdfr *    notice, this list of conditions and the following disclaimer in the
1283856Sdfr *    documentation and/or other materials provided with the distribution.
1383856Sdfr *
1483856Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1583856Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1683856Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1783856Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1883856Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1983856Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2083856Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2183856Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2283856Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2383856Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2483856Sdfr * SUCH DAMAGE.
2583856Sdfr *
2683856Sdfr * $FreeBSD$
2783856Sdfr */
2883856Sdfr
2983856Sdfr#ifndef _MACHINE_SAL_H_
3083856Sdfr#define _MACHINE_SAL_H_
3183856Sdfr
3283856Sdfrstruct sal_system_table {
3383856Sdfr	char		sal_signature[4];
34110211Smarcel#define	SAL_SIGNATURE	"SST_"
35208283Smarcel	uint32_t	sal_length;
36208283Smarcel	uint8_t		sal_rev[2];
37208283Smarcel	uint16_t	sal_entry_count;
38208283Smarcel	uint8_t		sal_checksum;
39208283Smarcel	uint8_t		sal_reserved1[7];
40208283Smarcel	uint8_t		sal_a_version[2];
41208283Smarcel	uint8_t		sal_b_version[2];
4283856Sdfr	char		sal_oem_id[32];
4383856Sdfr	char		sal_product_id[32];
44208283Smarcel	uint8_t		sal_reserved2[8];
4583856Sdfr};
4683856Sdfr
4783856Sdfrstruct sal_entrypoint_descriptor {
48208283Smarcel	uint8_t		sale_type;	/* == 0 */
49208283Smarcel	uint8_t		sale_reserved1[7];
50208283Smarcel	uint64_t	sale_pal_proc;
51208283Smarcel	uint64_t	sale_sal_proc;
52208283Smarcel	uint64_t	sale_sal_gp;
53208283Smarcel	uint8_t		sale_reserved2[16];
5483856Sdfr};
5583856Sdfr
5683856Sdfrstruct sal_memory_descriptor {
57208283Smarcel	uint8_t		sale_type;	/* == 1 */
58208283Smarcel	uint8_t		sale_need_virtual;
59208283Smarcel	uint8_t		sale_current_attribute;
60208283Smarcel	uint8_t		sale_access_rights;
61208283Smarcel	uint8_t		sale_supported_attributes;
62208283Smarcel	uint8_t		sale_reserved1;
63208283Smarcel	uint8_t		sale_memory_type[2];
64208283Smarcel	uint64_t	sale_physical_address;
65208283Smarcel	uint32_t	sale_length;
66208283Smarcel	uint8_t		sale_reserved2[12];
6783856Sdfr};
6883856Sdfr
6983856Sdfrstruct sal_platform_descriptor {
70208283Smarcel	uint8_t		sale_type;	/* == 2 */
71208283Smarcel	uint8_t		sale_features;
72208283Smarcel	uint8_t		sale_reserved[14];
7383856Sdfr};
7483856Sdfr
7583856Sdfrstruct sal_tr_descriptor {
76208283Smarcel	uint8_t		sale_type;	/* == 3 */
77208283Smarcel	uint8_t		sale_register_type;
78208283Smarcel	uint8_t		sale_register_number;
79208283Smarcel	uint8_t		sale_reserved1[5];
80208283Smarcel	uint64_t	sale_virtual_address;
81208283Smarcel	uint64_t	sale_page_size;
82208283Smarcel	uint8_t		sale_reserved2[8];
8383856Sdfr};
8483856Sdfr
8583856Sdfrstruct sal_ptc_cache_descriptor {
86208283Smarcel	uint8_t		sale_type;	/* == 4 */
87208283Smarcel	uint8_t		sale_reserved[3];
88208283Smarcel	uint32_t	sale_domains;
89208283Smarcel	uint64_t	sale_address;
9083856Sdfr};
9183856Sdfr
9283856Sdfrstruct sal_ap_wakeup_descriptor {
93208283Smarcel	uint8_t		sale_type;	/* == 5 */
94208283Smarcel	uint8_t		sale_mechanism;
95208283Smarcel	uint8_t		sale_reserved[6];
96208283Smarcel	uint64_t	sale_vector;
9783856Sdfr};
9883856Sdfr
9984122Sdfr/*
10084122Sdfr * SAL Procedure numbers.
10184122Sdfr */
10284122Sdfr
10384122Sdfr#define SAL_SET_VECTORS		0x01000000
10484122Sdfr#define SAL_GET_STATE_INFO	0x01000001
10584122Sdfr#define SAL_GET_STATE_INFO_SIZE	0x01000002
10684122Sdfr#define SAL_CLEAR_STATE_INFO	0x01000003
10784122Sdfr#define SAL_MC_RENDEZ		0x01000004
10884122Sdfr#define SAL_MC_SET_PARAMS	0x01000005
10984122Sdfr#define SAL_REGISTER_PHYSICAL_ADDR 0x01000006
11084122Sdfr#define SAL_CACHE_FLUSH		0x01000008
11184122Sdfr#define SAL_CACHE_INIT		0x01000009
11284122Sdfr#define SAL_PCI_CONFIG_READ	0x01000010
11384122Sdfr#define SAL_PCI_CONFIG_WRITE	0x01000011
11484122Sdfr#define SAL_FREQ_BASE		0x01000012
11584122Sdfr#define SAL_UPDATE_PAL		0x01000020
11684122Sdfr
11785656Smarcel/* SAL_SET_VECTORS event handler types */
11885656Smarcel#define	SAL_OS_MCA		0
11985656Smarcel#define	SAL_OS_INIT		1
12085656Smarcel#define	SAL_OS_BOOT_RENDEZ	2
12185656Smarcel
12295244Smarcel/* SAL_GET_STATE_INFO, SAL_GET_STATE_INFO_SIZE types */
12395244Smarcel#define	SAL_INFO_MCA		0
12495244Smarcel#define	SAL_INFO_INIT		1
12595244Smarcel#define	SAL_INFO_CMC		2
12695244Smarcel#define	SAL_INFO_CPE		3
12795244Smarcel#define	SAL_INFO_TYPES		4	/* number of types we know about */
12895244Smarcel
12984122Sdfrstruct ia64_sal_result {
13084122Sdfr	int64_t		sal_status;
131208283Smarcel	uint64_t	sal_result[3];
13284122Sdfr};
13384122Sdfr
134208283Smarceltypedef struct ia64_sal_result sal_entry_t(uint64_t, uint64_t, uint64_t,
135208283Smarcel    uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
13684122Sdfr
13784122Sdfrextern sal_entry_t *ia64_sal_entry;
13884122Sdfr
139135453Smarcelextern void ia64_sal_init(void);
14095244Smarcel
14183856Sdfr#endif /* _MACHINE_SAL_H_ */
142