17c478bd9Sstevel@tonic-gate #ifndef _DEV_H
27c478bd9Sstevel@tonic-gate #define _DEV_H
37c478bd9Sstevel@tonic-gate 
47c478bd9Sstevel@tonic-gate #include "isa.h"
57c478bd9Sstevel@tonic-gate #include "pci.h"
67c478bd9Sstevel@tonic-gate 
77c478bd9Sstevel@tonic-gate /* Need to check the packing of this struct if Etherboot is ported */
87c478bd9Sstevel@tonic-gate struct dev_id
97c478bd9Sstevel@tonic-gate {
107c478bd9Sstevel@tonic-gate 	unsigned short	vendor_id;
117c478bd9Sstevel@tonic-gate 	unsigned short	device_id;
127c478bd9Sstevel@tonic-gate 	unsigned char	bus_type;
137c478bd9Sstevel@tonic-gate #define	PCI_BUS_TYPE	1
147c478bd9Sstevel@tonic-gate #define	ISA_BUS_TYPE	2
157c478bd9Sstevel@tonic-gate };
167c478bd9Sstevel@tonic-gate 
177c478bd9Sstevel@tonic-gate /* Dont use sizeof, that will include the padding */
187c478bd9Sstevel@tonic-gate #define	DEV_ID_SIZE	8
197c478bd9Sstevel@tonic-gate 
207c478bd9Sstevel@tonic-gate 
217c478bd9Sstevel@tonic-gate struct pci_probe_state
227c478bd9Sstevel@tonic-gate {
237c478bd9Sstevel@tonic-gate #ifdef CONFIG_PCI
247c478bd9Sstevel@tonic-gate 	struct pci_device dev;
257c478bd9Sstevel@tonic-gate 	int advance;
267c478bd9Sstevel@tonic-gate #else
277c478bd9Sstevel@tonic-gate 	int dummy;
287c478bd9Sstevel@tonic-gate #endif
297c478bd9Sstevel@tonic-gate };
307c478bd9Sstevel@tonic-gate struct isa_probe_state
317c478bd9Sstevel@tonic-gate {
327c478bd9Sstevel@tonic-gate #ifdef CONFIG_ISA
337c478bd9Sstevel@tonic-gate 	const struct isa_driver *driver;
347c478bd9Sstevel@tonic-gate 	int advance;
357c478bd9Sstevel@tonic-gate #else
367c478bd9Sstevel@tonic-gate 	int dummy;
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate };
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate union probe_state
417c478bd9Sstevel@tonic-gate {
427c478bd9Sstevel@tonic-gate 	struct pci_probe_state pci;
437c478bd9Sstevel@tonic-gate 	struct isa_probe_state isa;
447c478bd9Sstevel@tonic-gate };
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate struct dev
477c478bd9Sstevel@tonic-gate {
487c478bd9Sstevel@tonic-gate 	void		(*disable)P((struct dev *));
497c478bd9Sstevel@tonic-gate 	struct dev_id	devid;	/* device ID string (sent to DHCP server) */
507c478bd9Sstevel@tonic-gate 	int		index;  /* Index of next device on this controller to probe */
517c478bd9Sstevel@tonic-gate 	int		type;		/* Type of device I am probing for */
527c478bd9Sstevel@tonic-gate 	int		how_probe;	/* First, next or awake */
537c478bd9Sstevel@tonic-gate 	int 		to_probe;	/* Flavor of device I am probing */
547c478bd9Sstevel@tonic-gate 	int		failsafe;	/* Failsafe probe requested */
557c478bd9Sstevel@tonic-gate 	int		type_index;	/* Index of this device (within type) */
567c478bd9Sstevel@tonic-gate #define	PROBE_NONE 0
577c478bd9Sstevel@tonic-gate #define PROBE_PCI  1
587c478bd9Sstevel@tonic-gate #define PROBE_ISA  2
597c478bd9Sstevel@tonic-gate 	union probe_state state;
607c478bd9Sstevel@tonic-gate };
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate #define NIC_DRIVER    0
647c478bd9Sstevel@tonic-gate #define DISK_DRIVER   1
657c478bd9Sstevel@tonic-gate #define FLOPPY_DRIVER 2
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #define BRIDGE_DRIVER 1000
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #define PROBE_FIRST  (-1)
707c478bd9Sstevel@tonic-gate #define PROBE_NEXT   0
717c478bd9Sstevel@tonic-gate #define PROBE_AWAKE  1		/* After calling disable bring up the same device */
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /* The probe result codes are selected
747c478bd9Sstevel@tonic-gate  * to allow them to be fed back into the probe
757c478bd9Sstevel@tonic-gate  * routine and get a successful probe.
767c478bd9Sstevel@tonic-gate  */
777c478bd9Sstevel@tonic-gate #define PROBE_FAILED PROBE_FIRST
787c478bd9Sstevel@tonic-gate #define PROBE_WORKED  PROBE_NEXT
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate extern int probe(struct dev *dev);
817c478bd9Sstevel@tonic-gate extern void disable(struct dev *dev);
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #endif /* _DEV_H */
84