1
2
3
4
5
6
7
8
9
10
11#ifndef LINUX_NUBUS_H
12#define LINUX_NUBUS_H
13
14#include <asm/nubus.h>
15#include <uapi/linux/nubus.h>
16
17struct nubus_board {
18 struct nubus_board* next;
19 struct nubus_dev* first_dev;
20
21
22
23
24 int slot;
25
26 char name[64];
27
28
29 unsigned char* fblock;
30
31 unsigned char* directory;
32
33 unsigned long slot_addr;
34
35 unsigned long doffset;
36
37 unsigned long rom_length;
38
39 unsigned long crc;
40 unsigned char rev;
41 unsigned char format;
42 unsigned char lanes;
43};
44
45struct nubus_dev {
46
47 struct nubus_dev* next;
48
49 struct proc_dir_entry* procdir;
50
51
52 unsigned char resid;
53
54
55 unsigned short category;
56 unsigned short type;
57 unsigned short dr_sw;
58 unsigned short dr_hw;
59
60
61
62 char name[64];
63
64 unsigned char* driver;
65
66 unsigned long iobase;
67 unsigned long iosize;
68 unsigned char flags, hwdevid;
69
70
71 unsigned char* directory;
72
73 struct nubus_board* board;
74};
75
76
77extern struct nubus_dev* nubus_devices;
78
79extern struct nubus_board* nubus_boards;
80
81
82void nubus_scan_bus(void);
83#ifdef CONFIG_PROC_FS
84extern void nubus_proc_init(void);
85#else
86static inline void nubus_proc_init(void) {}
87#endif
88int get_nubus_list(char *buf);
89int nubus_proc_attach_device(struct nubus_dev *dev);
90
91struct nubus_dev* nubus_find_device(unsigned short category,
92 unsigned short type,
93 unsigned short dr_hw,
94 unsigned short dr_sw,
95 const struct nubus_dev* from);
96struct nubus_dev* nubus_find_type(unsigned short category,
97 unsigned short type,
98 const struct nubus_dev* from);
99
100struct nubus_dev* nubus_find_slot(unsigned int slot,
101 const struct nubus_dev* from);
102
103
104
105
106
107
108int nubus_get_root_dir(const struct nubus_board* board,
109 struct nubus_dir* dir);
110
111int nubus_get_board_dir(const struct nubus_board* board,
112 struct nubus_dir* dir);
113
114int nubus_get_func_dir(const struct nubus_dev* dev,
115 struct nubus_dir* dir);
116
117
118int nubus_readdir(struct nubus_dir* dir,
119 struct nubus_dirent* ent);
120int nubus_find_rsrc(struct nubus_dir* dir,
121 unsigned char rsrc_type,
122 struct nubus_dirent* ent);
123int nubus_rewinddir(struct nubus_dir* dir);
124
125
126int nubus_get_subdir(const struct nubus_dirent* ent,
127 struct nubus_dir* dir);
128void nubus_get_rsrc_mem(void* dest,
129 const struct nubus_dirent *dirent,
130 int len);
131void nubus_get_rsrc_str(void* dest,
132 const struct nubus_dirent *dirent,
133 int maxlen);
134#endif
135