]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/nubus.h
cfg80211/mac80211: make ieee80211_send_layer2_update a public function
[mirror_ubuntu-bionic-kernel.git] / include / linux / nubus.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 nubus.h: various definitions and prototypes for NuBus drivers to use.
4
5 Originally written by Alan Cox.
6
7 Hacked to death by C. Scott Ananian and David Huggins-Daines.
8
9 Some of the constants in here are from the corresponding
10 NetBSD/OpenBSD header file, by Allen Briggs. We figured out the
11 rest of them on our own. */
12 #ifndef LINUX_NUBUS_H
13 #define LINUX_NUBUS_H
14
15 #include <asm/nubus.h>
16 #include <uapi/linux/nubus.h>
17
18 struct nubus_board {
19 struct nubus_board* next;
20 struct nubus_dev* first_dev;
21
22 /* Only 9-E actually exist, though 0-8 are also theoretically
23 possible, and 0 is a special case which represents the
24 motherboard and onboard peripherals (Ethernet, video) */
25 int slot;
26 /* For slot 0, this is bogus. */
27 char name[64];
28
29 /* Format block */
30 unsigned char* fblock;
31 /* Root directory (does *not* always equal fblock + doffset!) */
32 unsigned char* directory;
33
34 unsigned long slot_addr;
35 /* Offset to root directory (sometimes) */
36 unsigned long doffset;
37 /* Length over which to compute the crc */
38 unsigned long rom_length;
39 /* Completely useless most of the time */
40 unsigned long crc;
41 unsigned char rev;
42 unsigned char format;
43 unsigned char lanes;
44 };
45
46 struct nubus_dev {
47 /* Next link in device list */
48 struct nubus_dev* next;
49 /* Directory entry in /proc/bus/nubus */
50 struct proc_dir_entry* procdir;
51
52 /* The functional resource ID of this device */
53 unsigned char resid;
54 /* These are mostly here for convenience; we could always read
55 them from the ROMs if we wanted to */
56 unsigned short category;
57 unsigned short type;
58 unsigned short dr_sw;
59 unsigned short dr_hw;
60 /* This is the device's name rather than the board's.
61 Sometimes they are different. Usually the board name is
62 more correct. */
63 char name[64];
64 /* MacOS driver (I kid you not) */
65 unsigned char* driver;
66 /* Actually this is an offset */
67 unsigned long iobase;
68 unsigned long iosize;
69 unsigned char flags, hwdevid;
70
71 /* Functional directory */
72 unsigned char* directory;
73 /* Much of our info comes from here */
74 struct nubus_board* board;
75 };
76
77 /* This is all NuBus devices (used to find devices later on) */
78 extern struct nubus_dev* nubus_devices;
79 /* This is all NuBus cards */
80 extern struct nubus_board* nubus_boards;
81
82 /* Generic NuBus interface functions, modelled after the PCI interface */
83 void nubus_scan_bus(void);
84 #ifdef CONFIG_PROC_FS
85 extern void nubus_proc_init(void);
86 #else
87 static inline void nubus_proc_init(void) {}
88 #endif
89 int get_nubus_list(char *buf);
90 int nubus_proc_attach_device(struct nubus_dev *dev);
91 /* If we need more precision we can add some more of these */
92 struct 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);
97 struct nubus_dev* nubus_find_type(unsigned short category,
98 unsigned short type,
99 const struct nubus_dev* from);
100 /* Might have more than one device in a slot, you know... */
101 struct nubus_dev* nubus_find_slot(unsigned int slot,
102 const struct nubus_dev* from);
103
104 /* These are somewhat more NuBus-specific. They all return 0 for
105 success and -1 for failure, as you'd expect. */
106
107 /* The root directory which contains the board and functional
108 directories */
109 int nubus_get_root_dir(const struct nubus_board* board,
110 struct nubus_dir* dir);
111 /* The board directory */
112 int nubus_get_board_dir(const struct nubus_board* board,
113 struct nubus_dir* dir);
114 /* The functional directory */
115 int nubus_get_func_dir(const struct nubus_dev* dev,
116 struct nubus_dir* dir);
117
118 /* These work on any directory gotten via the above */
119 int nubus_readdir(struct nubus_dir* dir,
120 struct nubus_dirent* ent);
121 int nubus_find_rsrc(struct nubus_dir* dir,
122 unsigned char rsrc_type,
123 struct nubus_dirent* ent);
124 int nubus_rewinddir(struct nubus_dir* dir);
125
126 /* Things to do with directory entries */
127 int nubus_get_subdir(const struct nubus_dirent* ent,
128 struct nubus_dir* dir);
129 void nubus_get_rsrc_mem(void* dest,
130 const struct nubus_dirent *dirent,
131 int len);
132 void nubus_get_rsrc_str(void* dest,
133 const struct nubus_dirent *dirent,
134 int maxlen);
135 #endif /* LINUX_NUBUS_H */