Home | History | Annotate | Download | only in machine
      1 /*	$NetBSD: sal.h,v 1.1 2006/04/07 14:21:18 cherry Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2001 Doug Rabson
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  *
     28  * $FreeBSD$
     29  */
     30 
     31 #ifndef _MACHINE_SAL_H_
     32 #define _MACHINE_SAL_H_
     33 
     34 struct sal_system_table {
     35 	char		sal_signature[4];
     36 #define	SAL_SIGNATURE	"SST_"
     37 	u_int32_t	sal_length;
     38 	u_int8_t	sal_rev[2];
     39 	u_int16_t	sal_entry_count;
     40 	u_int8_t	sal_checksum;
     41 	u_int8_t	sal_reserved1[7];
     42 	u_int8_t	sal_a_version[2];
     43 	u_int8_t	sal_b_version[2];
     44 	char		sal_oem_id[32];
     45 	char		sal_product_id[32];
     46 	u_int8_t	sal_reserved2[8];
     47 };
     48 
     49 struct sal_entrypoint_descriptor {
     50 	u_int8_t	sale_type;	/* == 0 */
     51 	u_int8_t	sale_reserved1[7];
     52 	u_int64_t	sale_pal_proc;
     53 	u_int64_t	sale_sal_proc;
     54 	u_int64_t	sale_sal_gp;
     55 	u_int8_t	sale_reserved2[16];
     56 };
     57 
     58 struct sal_memory_descriptor {
     59 	u_int8_t	sale_type;	/* == 1 */
     60 	u_int8_t	sale_need_virtual;
     61 	u_int8_t	sale_current_attribute;
     62 	u_int8_t	sale_access_rights;
     63 	u_int8_t	sale_supported_attributes;
     64 	u_int8_t	sale_reserved1;
     65 	u_int8_t	sale_memory_type[2];
     66 	u_int64_t	sale_physical_address;
     67 	u_int32_t	sale_length;
     68 	u_int8_t	sale_reserved2[12];
     69 };
     70 
     71 struct sal_platform_descriptor {
     72 	u_int8_t	sale_type;	/* == 2 */
     73 	u_int8_t	sale_features;
     74 	u_int8_t	sale_reserved[14];
     75 };
     76 
     77 struct sal_tr_descriptor {
     78 	u_int8_t	sale_type;	/* == 3 */
     79 	u_int8_t	sale_register_type;
     80 	u_int8_t	sale_register_number;
     81 	u_int8_t	sale_reserved1[5];
     82 	u_int64_t	sale_virtual_address;
     83 	u_int64_t	sale_page_size;
     84 	u_int8_t	sale_reserved2[8];
     85 };
     86 
     87 struct sal_ptc_cache_descriptor {
     88 	u_int8_t	sale_type;	/* == 4 */
     89 	u_int8_t	sale_reserved[3];
     90 	u_int32_t	sale_domains;
     91 	u_int64_t	sale_address;
     92 };
     93 
     94 struct sal_ap_wakeup_descriptor {
     95 	u_int8_t	sale_type;	/* == 5 */
     96 	u_int8_t	sale_mechanism;
     97 	u_int8_t	sale_reserved[6];
     98 	u_int64_t	sale_vector;
     99 };
    100 
    101 /*
    102  * SAL Procedure numbers.
    103  */
    104 
    105 #define SAL_SET_VECTORS		0x01000000
    106 #define SAL_GET_STATE_INFO	0x01000001
    107 #define SAL_GET_STATE_INFO_SIZE	0x01000002
    108 #define SAL_CLEAR_STATE_INFO	0x01000003
    109 #define SAL_MC_RENDEZ		0x01000004
    110 #define SAL_MC_SET_PARAMS	0x01000005
    111 #define SAL_REGISTER_PHYSICAL_ADDR 0x01000006
    112 #define SAL_CACHE_FLUSH		0x01000008
    113 #define SAL_CACHE_INIT		0x01000009
    114 #define SAL_PCI_CONFIG_READ	0x01000010
    115 #define SAL_PCI_CONFIG_WRITE	0x01000011
    116 #define SAL_FREQ_BASE		0x01000012
    117 #define SAL_UPDATE_PAL		0x01000020
    118 
    119 /* SAL_SET_VECTORS event handler types */
    120 #define	SAL_OS_MCA		0
    121 #define	SAL_OS_INIT		1
    122 #define	SAL_OS_BOOT_RENDEZ	2
    123 
    124 /* SAL_GET_STATE_INFO, SAL_GET_STATE_INFO_SIZE types */
    125 #define	SAL_INFO_MCA		0
    126 #define	SAL_INFO_INIT		1
    127 #define	SAL_INFO_CMC		2
    128 #define	SAL_INFO_CPE		3
    129 #define	SAL_INFO_TYPES		4	/* number of types we know about */
    130 
    131 struct ia64_sal_result {
    132 	int64_t		sal_status;
    133 	u_int64_t	sal_result[3];
    134 };
    135 
    136 typedef struct ia64_sal_result sal_entry_t
    137 	(u_int64_t, u_int64_t, u_int64_t, u_int64_t,
    138 	 u_int64_t, u_int64_t, u_int64_t, u_int64_t);
    139 
    140 extern sal_entry_t *ia64_sal_entry;
    141 
    142 extern void ia64_sal_init(void);
    143 
    144 #endif /* _MACHINE_SAL_H_ */
    145