2 nubus.h: various definitions and prototypes for NuBus drivers to use.
4 Originally written by Alan Cox.
6 Hacked to death by C. Scott Ananian and David Huggins-Daines.
8 Some of the constants in here are from the corresponding
9 NetBSD/OpenBSD header file, by Allen Briggs. We figured out the
10 rest of them on our own. */
14 #include <asm/nubus.h>
15 #include <uapi/linux/nubus.h>
18 struct nubus_board* next;
19 struct nubus_dev* first_dev;
21 /* Only 9-E actually exist, though 0-8 are also theoretically
22 possible, and 0 is a special case which represents the
23 motherboard and onboard peripherals (Ethernet, video) */
25 /* For slot 0, this is bogus. */
29 unsigned char* fblock;
30 /* Root directory (does *not* always equal fblock + doffset!) */
31 unsigned char* directory;
33 unsigned long slot_addr;
34 /* Offset to root directory (sometimes) */
35 unsigned long doffset;
36 /* Length over which to compute the crc */
37 unsigned long rom_length;
38 /* Completely useless most of the time */
46 /* Next link in device list */
47 struct nubus_dev* next;
48 /* Directory entry in /proc/bus/nubus */
49 struct proc_dir_entry* procdir;
51 /* The functional resource ID of this device */
53 /* These are mostly here for convenience; we could always read
54 them from the ROMs if we wanted to */
55 unsigned short category;
59 /* This is the device's name rather than the board's.
60 Sometimes they are different. Usually the board name is
63 /* MacOS driver (I kid you not) */
64 unsigned char* driver;
65 /* Actually this is an offset */
68 unsigned char flags, hwdevid;
70 /* Functional directory */
71 unsigned char* directory;
72 /* Much of our info comes from here */
73 struct nubus_board* board;
76 /* This is all NuBus devices (used to find devices later on) */
77 extern struct nubus_dev* nubus_devices;
78 /* This is all NuBus cards */
79 extern struct nubus_board* nubus_boards;
81 /* Generic NuBus interface functions, modelled after the PCI interface */
82 void nubus_scan_bus(void);
83 extern void nubus_proc_init(void);
84 int get_nubus_list(char *buf);
85 int nubus_proc_attach_device(struct nubus_dev *dev);
86 int nubus_proc_detach_device(struct nubus_dev *dev);
87 /* If we need more precision we can add some more of these */
88 struct nubus_dev* nubus_find_device(unsigned short category,
92 const struct nubus_dev* from);
93 struct nubus_dev* nubus_find_type(unsigned short category,
95 const struct nubus_dev* from);
96 /* Might have more than one device in a slot, you know... */
97 struct nubus_dev* nubus_find_slot(unsigned int slot,
98 const struct nubus_dev* from);
100 /* These are somewhat more NuBus-specific. They all return 0 for
101 success and -1 for failure, as you'd expect. */
103 /* The root directory which contains the board and functional
105 int nubus_get_root_dir(const struct nubus_board* board,
106 struct nubus_dir* dir);
107 /* The board directory */
108 int nubus_get_board_dir(const struct nubus_board* board,
109 struct nubus_dir* dir);
110 /* The functional directory */
111 int nubus_get_func_dir(const struct nubus_dev* dev,
112 struct nubus_dir* dir);
114 /* These work on any directory gotten via the above */
115 int nubus_readdir(struct nubus_dir* dir,
116 struct nubus_dirent* ent);
117 int nubus_find_rsrc(struct nubus_dir* dir,
118 unsigned char rsrc_type,
119 struct nubus_dirent* ent);
120 int nubus_rewinddir(struct nubus_dir* dir);
122 /* Things to do with directory entries */
123 int nubus_get_subdir(const struct nubus_dirent* ent,
124 struct nubus_dir* dir);
125 void nubus_get_rsrc_mem(void* dest,
126 const struct nubus_dirent *dirent,
128 void nubus_get_rsrc_str(void* dest,
129 const struct nubus_dirent *dirent,
131 #endif /* LINUX_NUBUS_H */