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