Home | History | Annotate | Line # | Download | only in include
      1 /* $NetBSD: autoconf.h,v 1.24 2025/03/09 01:06:42 thorpej 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 for autoconfiguration
     32  */
     33 
     34 struct mainbus_attach_args {
     35 	const char *ma_name;		/* device name */
     36 	int	    ma_slot;		/* CPU "slot" number; only meaningful
     37 					   when attaching CPUs */
     38 };
     39 
     40 struct bootdev_data {
     41 	char	*protocol;
     42 	int	bus;
     43 	int	slot;
     44 	int	channel;
     45 	char	*remote_address;
     46 	int	unit;
     47 	int	boot_dev_type;
     48 	char	*ctrl_dev_type;
     49 };
     50 
     51 /*
     52  * The boot program passes a pointer (in the boot environment virtual
     53  * address address space; "BEVA") to a bootinfo to the kernel using
     54  * the following convention:
     55  *
     56  *	a0 contains first free page frame number
     57  *	a1 contains page number of current level 1 page table
     58  *	if a2 contains BOOTINFO_MAGIC and a4 is nonzero:
     59  *		a3 contains pointer (BEVA) to bootinfo
     60  *		a4 contains bootinfo version number
     61  *	if a2 contains BOOTINFO_MAGIC and a4 contains 0 (backward compat):
     62  *		a3 contains pointer (BEVA) to bootinfo version
     63  *		    (u_long), then the bootinfo
     64  */
     65 
     66 #define	BOOTINFO_MAGIC			0xdeadbeeffeedface
     67 
     68 struct bootinfo_v1 {
     69 	u_long	ssym;			/* 0: start of kernel sym table	*/
     70 	u_long	esym;			/* 8: end of kernel sym table	*/
     71 	char	boot_flags[64];		/* 16: boot flags		*/
     72 	char	booted_kernel[64];	/* 80: name of booted kernel	*/
     73 	void	*hwrpb;			/* 144: hwrpb pointer (BEVA)	*/
     74 	u_long	hwrpbsize;		/* 152: size of hwrpb data	*/
     75 	int	(*cngetc)(void);	/* 160: console getc pointer	*/
     76 	void	(*cnputc)(int);		/* 168: console putc pointer	*/
     77 	void	(*cnpollc)(int);	/* 176: console pollc pointer	*/
     78 	u_long	pad[9];			/* 184: rsvd for future use	*/
     79 					/* 256: total size		*/
     80 };
     81 
     82 /*
     83  * Kernel-internal structure used to hold important bits of boot
     84  * information.  NOT to be used by boot blocks.
     85  *
     86  * Note that not all of the fields from the bootinfo struct(s)
     87  * passed by the boot blocks aren't here (because they're not currently
     88  * used by the kernel!).  Fields here which aren't supplied by the
     89  * bootinfo structure passed by the boot blocks are supposed to be
     90  * filled in at startup with sane contents.
     91  */
     92 struct bootinfo_kernel {
     93 	u_long	ssym;			/* start of syms */
     94 	u_long	esym;			/* end of syms */
     95 	u_long	hwrpb_phys;		/* hwrpb physical address */
     96 	u_long	hwrpb_size;		/* size of hwrpb data */
     97 	char	boot_flags[64];		/* boot flags */
     98 	char	booted_kernel[64];	/* name of booted kernel */
     99 	char	booted_dev[64];		/* name of booted device */
    100 };
    101 
    102 /*
    103  * Lookup table entry for Alpha system variations.
    104  */
    105 struct alpha_variation_table {
    106 	uint64_t	avt_variation;	/* variation, from HWRPB */
    107 	const char	*avt_model;	/* model string */
    108 };
    109 
    110 #ifdef _KERNEL
    111 extern struct bootdev_data *bootdev_data;
    112 extern struct bootinfo_kernel bootinfo;
    113 extern bool bootdev_is_disk, bootdev_is_net;
    114 
    115 const char *alpha_variation_name(uint64_t,
    116     const struct alpha_variation_table *);
    117 const char *alpha_unknown_sysname(void);
    118 #endif /* _KERNEL */
    119