1 /* $Id$
2  *
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
8  */
9 #ifndef _ASM_IA64_SN_DRIVER_H
10 #define _ASM_IA64_SN_DRIVER_H
11 
12 #include <asm/sn/sgi.h>
13 #include <asm/types.h>
14 
15 /*
16 ** Interface for device driver handle management.
17 **
18 ** These functions are mostly for use by the loadable driver code, and
19 ** for use by I/O bus infrastructure code.
20 */
21 
22 typedef struct device_driver_s *device_driver_t;
23 
24 /* == Driver thread priority support == */
25 typedef int ilvl_t;
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 struct eframe_s;
32 struct piomap;
33 struct dmamap;
34 
35 typedef __psunsigned_t iobush_t;
36 
37 /* interrupt function */
38 typedef void	       *intr_arg_t;
39 typedef void		intr_func_f(intr_arg_t);
40 typedef intr_func_f    *intr_func_t;
41 
42 #define	INTR_ARG(n)	((intr_arg_t)(__psunsigned_t)(n))
43 
44 /* system interrupt resource handle -- returned from intr_alloc */
45 typedef struct intr_s *intr_t;
46 #define INTR_HANDLE_NONE ((intr_t)0)
47 
48 /*
49  * restore interrupt level value, returned from intr_block_level
50  * for use with intr_unblock_level.
51  */
52 typedef void *rlvl_t;
53 
54 
55 /*
56  * A basic, platform-independent description of I/O requirements for
57  * a device. This structure is usually formed by lboot based on information
58  * in configuration files.  It contains information about PIO, DMA, and
59  * interrupt requirements for a specific instance of a device.
60  *
61  * The pio description is currently unused.
62  *
63  * The dma description describes bandwidth characteristics and bandwidth
64  * allocation requirements. (TBD)
65  *
66  * The Interrupt information describes the priority of interrupt, desired
67  * destination, policy (TBD), whether this is an error interrupt, etc.
68  * For now, interrupts are targeted to specific CPUs.
69  */
70 
71 typedef struct device_desc_s {
72 	/* pio description (currently none) */
73 
74 	/* dma description */
75 	/* TBD: allocated badwidth requirements */
76 
77 	/* interrupt description */
78 	vertex_hdl_t	intr_target;	/* Hardware locator string */
79 	int 		intr_policy;	/* TBD */
80 	ilvl_t		intr_swlevel;	/* software level for blocking intr */
81 	char		*intr_name;	/* name of interrupt, if any */
82 
83 	int		flags;
84 } *device_desc_t;
85 
86 /* flag values */
87 #define	D_INTR_ISERR	0x1		/* interrupt is for error handling */
88 #define D_IS_ASSOC	0x2		/* descriptor is associated with a dev */
89 #define D_INTR_NOTHREAD	0x4		/* Interrupt handler isn't threaded. */
90 
91 #define INTR_SWLEVEL_NOTHREAD_DEFAULT 	0	/* Default
92 						 * Interrupt level in case of
93 						 * non-threaded interrupt
94 						 * handlers
95 						 */
96 #endif /* _ASM_IA64_SN_DRIVER_H */
97