Home | History | Annotate | Line # | Download | only in include
autoconf.h revision 1.14
      1 /* $NetBSD: autoconf.h,v 1.14 1998/02/13 02:09:12 cgd Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
      5  * All rights reserved.
      6  *
      7  * Author: Chris G. Demetriou
      8  *
      9  * Permission to use, copy, modify and distribute this software and
     10  * its documentation is hereby granted, provided that both the copyright
     11  * notice and this permission notice appear in all copies of the
     12  * software, derivative works or modified versions, and any portions
     13  * thereof, and that both notices appear in supporting documentation.
     14  *
     15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  *
     19  * Carnegie Mellon requests users of this software to return to
     20  *
     21  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  *  School of Computer Science
     23  *  Carnegie Mellon University
     24  *  Pittsburgh PA 15213-3890
     25  *
     26  * any improvements or extensions that they make and grant Carnegie the
     27  * rights to redistribute these changes.
     28  */
     29 
     30 /*
     31  * Machine-dependent structures of autoconfiguration
     32  */
     33 
     34 struct confargs;
     35 
     36 typedef int (*intr_handler_t) __P((void *));
     37 
     38 struct abus {
     39 	struct	device *ab_dv;		/* back-pointer to device */
     40 	int	ab_type;		/* bus type (see below) */
     41 	void	(*ab_intr_establish)	/* bus's set-handler function */
     42 		    __P((struct confargs *, intr_handler_t, void *));
     43 	void	(*ab_intr_disestablish)	/* bus's unset-handler function */
     44 		    __P((struct confargs *));
     45 	caddr_t	(*ab_cvtaddr)		/* convert slot/offset to address */
     46 		    __P((struct confargs *));
     47 	int	(*ab_matchname)		/* see if name matches driver */
     48 		    __P((struct confargs *, char *));
     49 };
     50 
     51 #define	BUS_MAIN	1		/* mainbus */
     52 #define	BUS_TC		2		/* TurboChannel */
     53 #define	BUS_ASIC	3		/* IOCTL ASIC; under TurboChannel */
     54 #define	BUS_TCDS	4		/* TCDS ASIC; under TurboChannel */
     55 
     56 #define	BUS_INTR_ESTABLISH(ca, handler, val)				\
     57 	    (*(ca)->ca_bus->ab_intr_establish)((ca), (handler), (val))
     58 #define	BUS_INTR_DISESTABLISH(ca)					\
     59 	    (*(ca)->ca_bus->ab_intr_establish)(ca)
     60 #define	BUS_CVTADDR(ca)							\
     61 	    (*(ca)->ca_bus->ab_cvtaddr)(ca)
     62 #define	BUS_MATCHNAME(ca, name)						\
     63 	    (*(ca)->ca_bus->ab_matchname)((ca), (name))
     64 
     65 struct confargs {
     66 	char	*ca_name;		/* Device name. */
     67 	int	ca_slot;		/* Device slot. */
     68 	int	ca_offset;		/* Offset into slot. */
     69 	struct	abus *ca_bus;		/* bus device resides on. */
     70 };
     71 
     72 struct bootdev_data {
     73 	char	*protocol;
     74 	int	bus;
     75 	int	slot;
     76 	int	channel;
     77 	char	*remote_address;
     78 	int	unit;
     79 	int	boot_dev_type;
     80 	char	*ctrl_dev_type;
     81 };
     82 
     83 /*
     84  * The boot program passes a pointer (in the boot environment virtual
     85  * address address space; "BEVA") to a bootinfo to the kernel using
     86  * the following convention:
     87  *
     88  *	a0 contains first free page frame number
     89  *	a1 contains page number of current level 1 page table
     90  *	if a2 contains BOOTINFO_MAGIC and a4 is nonzero:
     91  *		a3 contains pointer (BEVA) to bootinfo
     92  *		a4 contains bootinfo version number
     93  *	if a2 contains BOOTINFO_MAGIC and a4 contains 0 (backward compat):
     94  *		a3 contains pointer (BEVA) to bootinfo version
     95  *		    (u_long), then the bootinfo
     96  */
     97 
     98 #define	BOOTINFO_MAGIC			0xdeadbeeffeedface
     99 
    100 struct bootinfo_v1 {
    101 	u_long	ssym;			/* 0: start of kernel sym table	*/
    102 	u_long	esym;			/* 8: end of kernel sym table	*/
    103 	char	boot_flags[64];		/* 16: boot flags		*/
    104 	char	booted_kernel[64];	/* 80: name of booted kernel	*/
    105 	void	*hwrpb;			/* 144: hwrpb pointer (BEVA)	*/
    106 	u_long	hwrpbsize;		/* 152: size of hwrpb data	*/
    107 	int	(*cngetc) __P((void));	/* 160: console getc pointer	*/
    108 	void	(*cnputc) __P((int));	/* 168: console putc pointer	*/
    109 	void	(*cnpollc) __P((int));	/* 176: console pollc pointer	*/
    110 	u_long	pad[9];			/* 184: rsvd for future use	*/
    111 					/* 256: total size		*/
    112 };
    113 
    114 /*
    115  * Kernel-internal structure used to hold important bits of boot
    116  * information.  NOT to be used by boot blocks.
    117  *
    118  * Note that not all of the fields from the bootinfo struct(s)
    119  * passed by the boot blocks aren't here (because they're not currently
    120  * used by the kernel!).  Fields here which aren't supplied by the
    121  * bootinfo structure passed by the boot blocks are supposed to be
    122  * filled in at startup with sane contents.
    123  */
    124 struct bootinfo_kernel {
    125 	u_long	ssym;			/* start of syms */
    126 	u_long	esym;			/* end of syms */
    127 	u_long	hwrpb_phys;		/* hwrpb physical address */
    128 	u_long	hwrpb_size;		/* size of hwrpb data */
    129 	char	boot_flags[64];		/* boot flags */
    130 	char	booted_kernel[64];	/* name of booted kernel */
    131 	char	booted_dev[64];		/* name of booted device */
    132 };
    133 
    134 /*
    135  * Lookup table entry for Alpha system variations.
    136  */
    137 struct alpha_variation_table {
    138 	u_int64_t	avt_variation;	/* variation, from HWRPB */
    139 	const char	*avt_model;	/* model string */
    140 };
    141 
    142 #ifdef _KERNEL
    143 #ifdef EVCNT_COUNTERS
    144 extern struct evcnt clock_intr_evcnt;
    145 #endif
    146 
    147 extern struct device *booted_device;
    148 extern int booted_partition;
    149 extern struct bootdev_data *bootdev_data;
    150 extern struct bootinfo_kernel bootinfo;
    151 
    152 const char *alpha_variation_name __P((u_int64_t,
    153     const struct alpha_variation_table *));
    154 const char *alpha_unknown_sysname __P((void));
    155 #endif /* _KERNEL */
    156