1/* $OpenBSD: autoconf.h,v 1.14 2023/04/11 00:45:07 jsg Exp $ */
2/* $NetBSD: autoconf.h,v 1.19 2000/06/08 03:10:06 thorpej Exp $ */
3
4/*
5 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
6 * All rights reserved.
7 *
8 * Author: Chris G. Demetriou
9 *
10 * Permission to use, copy, modify and distribute this software and
11 * its documentation is hereby granted, provided that both the copyright
12 * notice and this permission notice appear in all copies of the
13 * software, derivative works or modified versions, and any portions
14 * thereof, and that both notices appear in supporting documentation.
15 *
16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23 *  School of Computer Science
24 *  Carnegie Mellon University
25 *  Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie the
28 * rights to redistribute these changes.
29 */
30
31/*
32 * Machine-dependent structures of autoconfiguration
33 */
34
35struct mainbus_attach_args {
36	const char *ma_name;		/* device name */
37	int	    ma_slot;		/* CPU "slot" number; only meaningful
38					   when attaching CPUs */
39};
40
41struct bootdev_data {
42	char	*protocol;
43	int	bus;
44	int	slot;
45	int	channel;
46	char	*remote_address;
47	int	unit;
48	int	boot_dev_type;
49	char	*ctrl_dev_type;
50};
51
52/*
53 * The boot program passes a pointer (in the boot environment virtual
54 * address space; "BEVA") to a bootinfo to the kernel using
55 * the following convention:
56 *
57 *	a0 contains first free page frame number
58 *	a1 contains page number of current level 1 page table
59 *	if a2 contains BOOTINFO_MAGIC and a4 is nonzero:
60 *		a3 contains pointer (BEVA) to bootinfo
61 *		a4 contains bootinfo version number
62 *	if a2 contains BOOTINFO_MAGIC and a4 contains 0 (backward compat):
63 *		a3 contains pointer (BEVA) to bootinfo version
64 *		    (u_long), then the bootinfo
65 */
66
67#define	BOOTINFO_MAGIC			0xdeadbeeffeedface
68
69struct bootinfo_v1 {
70	u_long	ssym;			/* 0: start of kernel sym table	*/
71	u_long	esym;			/* 8: end of kernel sym table	*/
72	char	boot_flags[64];		/* 16: boot flags		*/
73	char	booted_kernel[64];	/* 80: name of booted kernel	*/
74	void	*hwrpb;			/* 144: hwrpb pointer (BEVA)	*/
75	u_long	hwrpbsize;		/* 152: size of hwrpb data	*/
76	int	(*cngetc)(void);	/* 160: console getc pointer	*/
77	void	(*cnputc)(int);		/* 168: console putc pointer	*/
78	void	(*cnpollc)(int);	/* 176: console pollc pointer	*/
79	long	howto;			/* 184: boothowto flags		*/
80	u_long	pad[8];			/* 192: rsvd for future use	*/
81					/* 256: total size		*/
82};
83
84/*
85 * Kernel-internal structure used to hold important bits of boot
86 * information.  NOT to be used by boot blocks.
87 *
88 * Note that not all of the fields from the bootinfo struct(s)
89 * passed by the boot blocks aren't here (because they're not currently
90 * used by the kernel!).  Fields here which aren't supplied by the
91 * bootinfo structure passed by the boot blocks are supposed to be
92 * filled in at startup with sane contents.
93 */
94struct bootinfo_kernel {
95	u_long	ssym;			/* start of syms */
96	u_long	esym;			/* end of syms */
97	u_long	hwrpb_phys;		/* hwrpb physical address */
98	u_long	hwrpb_size;		/* size of hwrpb data */
99	char	boot_flags[64];		/* boot flags */
100	char	booted_kernel[64];	/* name of booted kernel */
101	char	booted_dev[64];		/* name of booted device */
102};
103
104/*
105 * Lookup table entry for Alpha system variations.
106 */
107struct alpha_variation_table {
108	u_int64_t	avt_variation;	/* variation, from HWRPB */
109	const char	*avt_model;	/* model string */
110};
111
112#ifdef _KERNEL
113extern struct device *booted_device;
114extern int booted_partition;
115extern struct bootdev_data *bootdev_data;
116extern struct bootinfo_kernel bootinfo;
117
118const char *alpha_variation_name(u_int64_t,
119    const struct alpha_variation_table *);
120const char *alpha_unknown_sysname(void);
121#endif /* _KERNEL */
122