xref: /titanic_50/usr/src/grub/grub-0.97/netboot/dev.h (revision 4f680cc668fa6cf678c531083400ade9a9c7934c)
1 #ifndef _DEV_H
2 #define _DEV_H
3 
4 #include "isa.h"
5 #include "pci.h"
6 
7 /* Need to check the packing of this struct if Etherboot is ported */
8 struct dev_id
9 {
10 	unsigned short	vendor_id;
11 	unsigned short	device_id;
12 	unsigned char	bus_type;
13 #define	PCI_BUS_TYPE	1
14 #define	ISA_BUS_TYPE	2
15 };
16 
17 /* Dont use sizeof, that will include the padding */
18 #define	DEV_ID_SIZE	8
19 
20 
21 struct pci_probe_state
22 {
23 #ifdef CONFIG_PCI
24 	struct pci_device dev;
25 	int advance;
26 #else
27 	int dummy;
28 #endif
29 };
30 struct isa_probe_state
31 {
32 #ifdef CONFIG_ISA
33 	const struct isa_driver *driver;
34 	int advance;
35 #else
36 	int dummy;
37 #endif
38 };
39 
40 union probe_state
41 {
42 	struct pci_probe_state pci;
43 	struct isa_probe_state isa;
44 };
45 
46 struct dev
47 {
48 	void		(*disable)P((struct dev *));
49 	struct dev_id	devid;	/* device ID string (sent to DHCP server) */
50 	int		index;  /* Index of next device on this controller to probe */
51 	int		type;		/* Type of device I am probing for */
52 	int		how_probe;	/* First, next or awake */
53 	int 		to_probe;	/* Flavor of device I am probing */
54 	int		failsafe;	/* Failsafe probe requested */
55 	int		type_index;	/* Index of this device (within type) */
56 #define	PROBE_NONE 0
57 #define PROBE_PCI  1
58 #define PROBE_ISA  2
59 	union probe_state state;
60 };
61 
62 
63 #define NIC_DRIVER    0
64 #define DISK_DRIVER   1
65 #define FLOPPY_DRIVER 2
66 
67 #define BRIDGE_DRIVER 1000
68 
69 #define PROBE_FIRST  (-1)
70 #define PROBE_NEXT   0
71 #define PROBE_AWAKE  1		/* After calling disable bring up the same device */
72 
73 /* The probe result codes are selected
74  * to allow them to be fed back into the probe
75  * routine and get a successful probe.
76  */
77 #define PROBE_FAILED PROBE_FIRST
78 #define PROBE_WORKED  PROBE_NEXT
79 
80 extern int probe(struct dev *dev);
81 extern void disable(struct dev *dev);
82 
83 #endif /* _DEV_H */
84