Home | History | Annotate | Line # | Download | only in include
bootinfo.h revision 1.1.40.1
      1  1.1.40.1  yamt /*       $NetBSD: bootinfo.h,v 1.1.40.1 2006/02/01 14:51:37 yamt Exp $        */
      2       1.1   mrg 
      3  1.1.40.1  yamt /*-
      4  1.1.40.1  yamt  * Copyright (c) 2005 The NetBSD Foundation, Inc.
      5  1.1.40.1  yamt  * All rights reserved.
      6  1.1.40.1  yamt  *
      7  1.1.40.1  yamt  * Redistribution and use in source and binary forms, with or without
      8  1.1.40.1  yamt  * modification, are permitted provided that the following conditions
      9  1.1.40.1  yamt  * are met:
     10  1.1.40.1  yamt  * 1. Redistributions of source code must retain the above copyright
     11  1.1.40.1  yamt  *    notice, this list of conditions and the following disclaimer.
     12  1.1.40.1  yamt  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1.40.1  yamt  *    notice, this list of conditions and the following disclaimer in the
     14  1.1.40.1  yamt  *    documentation and/or other materials provided with the distribution.
     15  1.1.40.1  yamt  * 3. All advertising materials mentioning features or use of this software
     16  1.1.40.1  yamt  *    must display the following acknowledgement:
     17  1.1.40.1  yamt  *        This product includes software developed by the NetBSD
     18  1.1.40.1  yamt  *        Foundation, Inc. and its contributors.
     19  1.1.40.1  yamt  * 4. Neither the name of The NetBSD Foundation nor the names of its
     20  1.1.40.1  yamt  *    contributors may be used to endorse or promote products derived
     21  1.1.40.1  yamt  *    from this software without specific prior written permission.
     22  1.1.40.1  yamt  *
     23  1.1.40.1  yamt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     24  1.1.40.1  yamt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25  1.1.40.1  yamt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26  1.1.40.1  yamt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     27  1.1.40.1  yamt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28  1.1.40.1  yamt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29  1.1.40.1  yamt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30  1.1.40.1  yamt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31  1.1.40.1  yamt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32  1.1.40.1  yamt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33  1.1.40.1  yamt  * POSSIBILITY OF SUCH DAMAGE.
     34  1.1.40.1  yamt  */
     35  1.1.40.1  yamt 
     36  1.1.40.1  yamt #ifndef _BOOTINFO_H_
     37  1.1.40.1  yamt #define _BOOTINFO_H_
     38  1.1.40.1  yamt 
     39  1.1.40.1  yamt #include <machine/param.h>
     40       1.1   mrg #include <sparc/bootinfo.h>
     41  1.1.40.1  yamt 
     42  1.1.40.1  yamt /*
     43  1.1.40.1  yamt  * The bootloader v1.9 and higher makes a call into a kernel with the following
     44  1.1.40.1  yamt  * arguments:
     45  1.1.40.1  yamt  *
     46  1.1.40.1  yamt  * %o0		OpenFirmware entry point, to keep Sun's updaters happy
     47  1.1.40.1  yamt  * %o1		Address of boot information vector (see below)
     48  1.1.40.1  yamt  * %o2		Length of the vector, in bytes
     49  1.1.40.1  yamt  * %o3		OpenFirmware entry point, to mimic Sun bootloader behavior
     50  1.1.40.1  yamt  * %o4		OpenFirmware entry point, to meet earlier NetBSD kernels
     51  1.1.40.1  yamt  *              expectations
     52  1.1.40.1  yamt  *
     53  1.1.40.1  yamt  * All parameters are of void* type except for vector length which is of
     54  1.1.40.1  yamt  * integer type.
     55  1.1.40.1  yamt  *
     56  1.1.40.1  yamt  * The boot information vector format was dictated by earlier kernels and
     57  1.1.40.1  yamt  * starting from ofwboot v1.9 has four entries:
     58  1.1.40.1  yamt  *
     59  1.1.40.1  yamt  *      +-------------------------------------+
     60  1.1.40.1  yamt  * #0   | NetBSD boot magic number ('DDB2')   |
     61  1.1.40.1  yamt  *      +-------------------------------------+
     62  1.1.40.1  yamt  * #1   | ksyms' table end address            |
     63  1.1.40.1  yamt  *      +-------------------------------------+
     64  1.1.40.1  yamt  * #2   | ksyms' table start address          |
     65  1.1.40.1  yamt  *      +-------------------------------------+
     66  1.1.40.1  yamt  * #3   | Pointer to a bootinfo binary object |
     67  1.1.40.1  yamt  *      +-------------------------------------+
     68  1.1.40.1  yamt  *
     69  1.1.40.1  yamt  * Kernels written for pre-v1.8 ofwboot require first three cells to present
     70  1.1.40.1  yamt  * in this particular order, those that rely on v1.9 and higher won't work if
     71  1.1.40.1  yamt  * the last pointer is not in the table; therefore, the vector cannot be
     72  1.1.40.1  yamt  * shorter than 4 * sizeof(u_int32_t) or 4 * sizeof(u_int64_t) for 32-bit and
     73  1.1.40.1  yamt  * 64-bit boot loader, respectively.
     74  1.1.40.1  yamt  *
     75  1.1.40.1  yamt  * As of ofwboot v1.9,  bootinfo binary object is placed right after the kernel
     76  1.1.40.1  yamt  * data segment end, i.e. in the permanently locked 4MB page. There is no order
     77  1.1.40.1  yamt  * for the data located in bootinfo binary object. The kernel however expects
     78  1.1.40.1  yamt  * at least following parameters to exist in there:
     79  1.1.40.1  yamt  *
     80  1.1.40.1  yamt  * - Symbol information (size, start, end; see struct btinfo_symtab)
     81  1.1.40.1  yamt  * - Kernel end address, calculated as true kernel end address plus size of
     82  1.1.40.1  yamt  *   space reserved for bootinfo binary object (struct btinfo_kernend)
     83  1.1.40.1  yamt  * - Number of text segment pages (struct btinfo_count)
     84  1.1.40.1  yamt  * - Number of data segment pages (struct btinfo_count)
     85  1.1.40.1  yamt  * - Array of text pages VA/PA (struct btinfo_tlb)
     86  1.1.40.1  yamt  * - Array of data pages VA/PA (struct btinfo_tlb)
     87  1.1.40.1  yamt  *
     88  1.1.40.1  yamt  * The last four data structures fully describe kernel mappings. ofwboot v1.9
     89  1.1.40.1  yamt  * and higher map the kernel with 4MB permanent pages and this is the only
     90  1.1.40.1  yamt  * way to let kernel know how exactly it was mapped.
     91  1.1.40.1  yamt  */
     92  1.1.40.1  yamt 
     93  1.1.40.1  yamt /* Boot magic number */
     94  1.1.40.1  yamt #define SPARC_MACHINE_OPENFIRMWARE	0x44444230
     95  1.1.40.1  yamt 
     96  1.1.40.1  yamt #ifdef BOOTINFO_SIZE
     97  1.1.40.1  yamt #undef BOOTINFO_SIZE
     98  1.1.40.1  yamt #endif
     99  1.1.40.1  yamt 
    100  1.1.40.1  yamt #define BOOTINFO_SIZE			NBPG
    101  1.1.40.1  yamt 
    102  1.1.40.1  yamt #define BTINFO_DTLB_SLOTS		100
    103  1.1.40.1  yamt #define BTINFO_ITLB_SLOTS		101
    104  1.1.40.1  yamt #define BTINFO_DTLB			102
    105  1.1.40.1  yamt #define BTINFO_ITLB			103
    106  1.1.40.1  yamt #define BTINFO_KERNEND			104
    107  1.1.40.1  yamt 
    108  1.1.40.1  yamt #define LOOKUP_BOOTINFO(btp, info) \
    109  1.1.40.1  yamt do { \
    110  1.1.40.1  yamt 	if ( ((btp) = lookup_bootinfo(info)) == NULL) { \
    111  1.1.40.1  yamt 		panic("lookup_bootinfo: No " #info " found.\n"); \
    112  1.1.40.1  yamt 	} \
    113  1.1.40.1  yamt } while (0)
    114  1.1.40.1  yamt 
    115  1.1.40.1  yamt struct tlb_entry {
    116  1.1.40.1  yamt 	uint64_t te_pa;
    117  1.1.40.1  yamt 	uint64_t te_va;
    118  1.1.40.1  yamt };
    119  1.1.40.1  yamt 
    120  1.1.40.1  yamt struct btinfo_count {
    121  1.1.40.1  yamt 	struct btinfo_common common;
    122  1.1.40.1  yamt 	int count;
    123  1.1.40.1  yamt };
    124  1.1.40.1  yamt 
    125  1.1.40.1  yamt struct btinfo_tlb {
    126  1.1.40.1  yamt 	struct btinfo_common common;
    127  1.1.40.1  yamt 	struct tlb_entry tlb[1];
    128  1.1.40.1  yamt };
    129  1.1.40.1  yamt 
    130  1.1.40.1  yamt struct btinfo_kernend {
    131  1.1.40.1  yamt 	struct btinfo_common common;
    132  1.1.40.1  yamt 	uint64_t addr;
    133  1.1.40.1  yamt };
    134  1.1.40.1  yamt 
    135  1.1.40.1  yamt #endif /* _BOOTINFO_H_ */
    136