File: driver.h

package info (click to toggle)
kernel-image-2.4.17-hppa 32.4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 156,356 kB
  • ctags: 442,585
  • sloc: ansic: 2,542,442; asm: 144,771; makefile: 8,468; sh: 3,097; perl: 2,578; yacc: 1,177; tcl: 577; lex: 352; awk: 251; lisp: 218; sed: 72
file content (150 lines) | stat: -rw-r--r-- 4,856 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* $Id$
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 1992 - 1997, 2000 Silicon Graphics, Inc.
 * Copyright (C) 2000 by Colin Ngam
 */
#ifndef _ASM_SN_DRIVER_H
#define _ASM_SN_DRIVER_H

/*
** Interface for device driver handle management.
**
** These functions are mostly for use by the loadable driver code, and
** for use by I/O bus infrastructure code.
*/

typedef struct device_driver_s *device_driver_t;
#define DEVICE_DRIVER_NONE (device_driver_t)NULL

/* == Driver thread priority support == */
typedef int ilvl_t;
/* default driver thread priority level */
#define DRIVER_THREAD_PRI_DEFAULT	(ilvl_t)230
/* invalid driver thread priority level */
#define DRIVER_THREAD_PRI_INVALID	(ilvl_t)-1

/* Associate a thread priority with a driver */
extern int device_driver_thread_pri_set(device_driver_t driver,
					ilvl_t pri);

/* Get the thread priority associated with the driver */
extern ilvl_t device_driver_thread_pri_get(device_driver_t driver);

/* Get the thread priority for a driver from the sysgen paramters */
extern ilvl_t device_driver_sysgen_thread_pri_get(char *driver_prefix);

/* Initialize device driver functions. */
extern void device_driver_init(void);


/* Allocate a driver handle */
extern device_driver_t device_driver_alloc(char *prefix);


/* Free a driver handle */
extern void device_driver_free(device_driver_t driver);


/* Given a device driver prefix, return a handle to the driver. */
extern device_driver_t device_driver_get(char *prefix);

/* Given a device, return a handle to the driver. */
extern device_driver_t device_driver_getbydev(devfs_handle_t device);

struct cdevsw;
struct bdevsw;

/* Associate a driver with bdevsw/cdevsw pointers. */
extern int
device_driver_devsw_put(device_driver_t driver,
			struct bdevsw *my_bdevsw,
			struct cdevsw *my_cdevsw);


/* Given a driver, return the corresponding bdevsw and cdevsw pointers. */
extern void
device_driver_devsw_get(	device_driver_t driver, 
				struct bdevsw **bdevswp,
				struct cdevsw **cdevswp);

/* Given a driver, return its name (prefix). */
extern void device_driver_name_get(device_driver_t driver, char *buffer, int length);


/* 
 * A descriptor for every static device driver in the system.
 * lboot creates a table of these and places in in master.c.
 * device_driver_init runs through this table during initialization
 * in order to "register" every static device driver.
 */
typedef struct static_device_driver_desc_s {
	char 		*sdd_prefix;
	struct bdevsw 	*sdd_bdevsw;
	struct cdevsw 	*sdd_cdevsw;
} *static_device_driver_desc_t;

extern struct static_device_driver_desc_s static_device_driver_table[];
extern int static_devsw_count;


/*====== administration support ========== */
/* structure of each entry in the table created by lboot for
 * device / driver administration
*/
typedef struct dev_admin_info_s {
	char	*dai_name;		/* name of the device or driver
					 * prefix 
					 */
	char	*dai_param_name;	/* device or driver parameter name */
	char	*dai_param_val;		/* value of the parameter */
} dev_admin_info_t;


/* Update all the administrative hints associated with the device */
extern void 	device_admin_info_update(devfs_handle_t	dev_vhdl);

/* Update all the administrative hints associated with the device driver */
extern void	device_driver_admin_info_update(device_driver_t	driver);

/* Get a particular administrative hint associated with a device */
extern char 	*device_admin_info_get(devfs_handle_t	dev_vhdl,
				       char		*info_lbl);

/* Associate a particular administrative hint for a device */
extern int	device_admin_info_set(devfs_handle_t	dev_vhdl,
				      char		*info_lbl,
				      char		*info_val);

/* Get a particular administrative hint associated with a device driver*/
extern char 	*device_driver_admin_info_get(char	*driver_prefix,	
					      char	*info_name);

/* Associate a particular administrative hint for a device driver*/
extern int	device_driver_admin_info_set(char	*driver_prefix,
					     char	*driver_info_lbl,
					     char	*driver_info_val);

/* Initialize the extended device administrative hint table */
extern void	device_admin_table_init(void);

/* Add a hint corresponding to a device to the extended device administrative
 * hint table.
 */
extern void	device_admin_table_update(char *dev_name,
					  char *param_name,
					  char *param_val);

/* Initialize the extended device driver administrative hint table */
extern void	device_driver_admin_table_init(void);

/* Add a hint corresponding to a device to the extended device driver 
 * administrative hint table.
 */
extern void	device_driver_admin_table_update(char *drv_prefix,
						 char *param_name,
						 char *param_val);	
#endif /* _ASM_SN_DRIVER_H */