This source file includes following definitions.
- nubus_proc_init
- nubus_proc_add_board
- nubus_proc_add_rsrc_dir
- nubus_proc_add_rsrc_mem
- nubus_proc_add_rsrc
- nubus_set_drvdata
- nubus_get_drvdata
- nubus_slot_addr
1
2
3
4
5
6
7
8
9
10 #ifndef LINUX_NUBUS_H
11 #define LINUX_NUBUS_H
12
13 #include <linux/device.h>
14 #include <asm/nubus.h>
15 #include <uapi/linux/nubus.h>
16
17 struct proc_dir_entry;
18 struct seq_file;
19
20 struct nubus_dir {
21 unsigned char *base;
22 unsigned char *ptr;
23 int done;
24 int mask;
25 struct proc_dir_entry *procdir;
26 };
27
28 struct nubus_dirent {
29 unsigned char *base;
30 unsigned char type;
31 __u32 data;
32 int mask;
33 };
34
35 struct nubus_board {
36 struct device dev;
37
38
39
40
41 int slot;
42
43 char name[64];
44
45
46 unsigned char *fblock;
47
48 unsigned char *directory;
49
50 unsigned long slot_addr;
51
52 unsigned long doffset;
53
54 unsigned long rom_length;
55
56 unsigned long crc;
57 unsigned char rev;
58 unsigned char format;
59 unsigned char lanes;
60
61
62 struct proc_dir_entry *procdir;
63 };
64
65 struct nubus_rsrc {
66 struct list_head list;
67
68
69 unsigned char resid;
70
71
72 unsigned short category;
73 unsigned short type;
74 unsigned short dr_sw;
75 unsigned short dr_hw;
76
77
78 unsigned char *directory;
79
80 struct nubus_board *board;
81 };
82
83
84 extern struct list_head nubus_func_rsrcs;
85
86 struct nubus_driver {
87 struct device_driver driver;
88 int (*probe)(struct nubus_board *board);
89 int (*remove)(struct nubus_board *board);
90 };
91
92 extern struct bus_type nubus_bus_type;
93
94
95 #ifdef CONFIG_PROC_FS
96 void nubus_proc_init(void);
97 struct proc_dir_entry *nubus_proc_add_board(struct nubus_board *board);
98 struct proc_dir_entry *nubus_proc_add_rsrc_dir(struct proc_dir_entry *procdir,
99 const struct nubus_dirent *ent,
100 struct nubus_board *board);
101 void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir,
102 const struct nubus_dirent *ent,
103 unsigned int size);
104 void nubus_proc_add_rsrc(struct proc_dir_entry *procdir,
105 const struct nubus_dirent *ent);
106 #else
107 static inline void nubus_proc_init(void) {}
108 static inline
109 struct proc_dir_entry *nubus_proc_add_board(struct nubus_board *board)
110 { return NULL; }
111 static inline
112 struct proc_dir_entry *nubus_proc_add_rsrc_dir(struct proc_dir_entry *procdir,
113 const struct nubus_dirent *ent,
114 struct nubus_board *board)
115 { return NULL; }
116 static inline void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir,
117 const struct nubus_dirent *ent,
118 unsigned int size) {}
119 static inline void nubus_proc_add_rsrc(struct proc_dir_entry *procdir,
120 const struct nubus_dirent *ent) {}
121 #endif
122
123 struct nubus_rsrc *nubus_first_rsrc_or_null(void);
124 struct nubus_rsrc *nubus_next_rsrc_or_null(struct nubus_rsrc *from);
125
126 #define for_each_func_rsrc(f) \
127 for (f = nubus_first_rsrc_or_null(); f; f = nubus_next_rsrc_or_null(f))
128
129 #define for_each_board_func_rsrc(b, f) \
130 for_each_func_rsrc(f) if (f->board != b) {} else
131
132
133
134
135
136
137 int nubus_get_root_dir(const struct nubus_board *board,
138 struct nubus_dir *dir);
139
140 int nubus_get_board_dir(const struct nubus_board *board,
141 struct nubus_dir *dir);
142
143 int nubus_get_func_dir(const struct nubus_rsrc *fres, struct nubus_dir *dir);
144
145
146 int nubus_readdir(struct nubus_dir *dir,
147 struct nubus_dirent *ent);
148 int nubus_find_rsrc(struct nubus_dir *dir,
149 unsigned char rsrc_type,
150 struct nubus_dirent *ent);
151 int nubus_rewinddir(struct nubus_dir *dir);
152
153
154 int nubus_get_subdir(const struct nubus_dirent *ent,
155 struct nubus_dir *dir);
156 void nubus_get_rsrc_mem(void *dest, const struct nubus_dirent *dirent,
157 unsigned int len);
158 unsigned int nubus_get_rsrc_str(char *dest, const struct nubus_dirent *dirent,
159 unsigned int len);
160 void nubus_seq_write_rsrc_mem(struct seq_file *m,
161 const struct nubus_dirent *dirent,
162 unsigned int len);
163 unsigned char *nubus_dirptr(const struct nubus_dirent *nd);
164
165
166 int nubus_parent_device_register(void);
167 int nubus_device_register(struct nubus_board *board);
168 int nubus_driver_register(struct nubus_driver *ndrv);
169 void nubus_driver_unregister(struct nubus_driver *ndrv);
170 int nubus_proc_show(struct seq_file *m, void *data);
171
172 static inline void nubus_set_drvdata(struct nubus_board *board, void *data)
173 {
174 dev_set_drvdata(&board->dev, data);
175 }
176
177 static inline void *nubus_get_drvdata(struct nubus_board *board)
178 {
179 return dev_get_drvdata(&board->dev);
180 }
181
182
183 static inline void *nubus_slot_addr(int slot)
184 {
185 return (void *)(0xF0000000 | (slot << 24));
186 }
187
188 #endif