[BACK]Return to bootinfo.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / x86 / include

Annotation of src/sys/arch/x86/include/bootinfo.h, Revision 1.26

1.26    ! nonaka      1: /*     $NetBSD: bootinfo.h,v 1.25 2017/01/24 11:09:14 nonaka Exp $     */
1.1       fvdl        2:
                      3: /*
                      4:  * Copyright (c) 1997
                      5:  *     Matthias Drochner.  All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  *
                     16:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     17:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     18:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     19:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     20:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     21:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     22:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     23:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     24:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     25:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     26:  *
                     27:  */
                     28:
1.6       thorpej    29: #define BTINFO_BOOTPATH                0
1.11      jmmv       30: #define BTINFO_ROOTDEVICE      1
1.6       thorpej    31: #define BTINFO_BOOTDISK                3
                     32: #define BTINFO_NETIF           4
                     33: #define BTINFO_CONSOLE         6
                     34: #define BTINFO_BIOSGEOM                7
                     35: #define BTINFO_SYMTAB          8
                     36: #define BTINFO_MEMMAP          9
                     37: #define        BTINFO_BOOTWEDGE        10
1.13      ad         38: #define BTINFO_MODULELIST      11
1.15      jmcneill   39: #define BTINFO_FRAMEBUFFER     12
1.18      uebayasi   40: #define BTINFO_USERCONFCOMMANDS        13
1.24      christos   41: #define BTINFO_EFI             14
1.25      nonaka     42: #define BTINFO_EFIMEMMAP       15
1.24      christos   43:
                     44: #define BTINFO_STR "bootpath", "rootdevice", "bootdisk", "netif", \
                     45:     "console", "biosgeom", "symtab", "memmap", "bootwedge", "modulelist", \
1.25      nonaka     46:     "framebuffer", "userconfcommands", "efi", "efimemmap",
1.13      ad         47:
                     48: #ifndef _LOCORE
                     49:
                     50: struct btinfo_common {
                     51:        int len;
                     52:        int type;
                     53: };
1.1       fvdl       54:
                     55: struct btinfo_bootpath {
                     56:        struct btinfo_common common;
                     57:        char bootpath[80];
                     58: };
                     59:
1.11      jmmv       60: struct btinfo_rootdevice {
                     61:        struct btinfo_common common;
                     62:        char devname[16];
                     63: };
                     64:
1.1       fvdl       65: struct btinfo_bootdisk {
                     66:        struct btinfo_common common;
                     67:        int labelsector; /* label valid if != -1 */
                     68:        struct {
1.9       junyoung   69:                uint16_t type, checksum;
1.1       fvdl       70:                char packname[16];
                     71:        } label;
                     72:        int biosdev;
                     73:        int partition;
                     74: };
                     75:
1.6       thorpej    76: struct btinfo_bootwedge {
                     77:        struct btinfo_common common;
                     78:        int biosdev;
                     79:        daddr_t startblk;
                     80:        uint64_t nblks;
                     81:        daddr_t matchblk;
                     82:        uint64_t matchnblks;
                     83:        uint8_t matchhash[16];  /* MD5 hash */
1.12      perry      84: } __packed;
1.6       thorpej    85:
1.1       fvdl       86: struct btinfo_netif {
                     87:        struct btinfo_common common;
                     88:        char ifname[16];
                     89:        int bus;
                     90: #define BI_BUS_ISA 0
                     91: #define BI_BUS_PCI 1
                     92:        union {
                     93:                unsigned int iobase; /* ISA */
                     94:                unsigned int tag; /* PCI, BIOS format */
                     95:        } addr;
                     96: };
                     97:
                     98: struct btinfo_console {
                     99:        struct btinfo_common common;
                    100:        char devname[16];
                    101:        int addr;
                    102:        int speed;
                    103: };
                    104:
                    105: struct btinfo_symtab {
                    106:        struct btinfo_common common;
                    107:        int nsym;
                    108:        int ssym;
                    109:        int esym;
                    110: };
                    111:
                    112: struct bi_memmap_entry {
1.9       junyoung  113:        uint64_t addr;          /* beginning of block */        /* 8 */
                    114:        uint64_t size;          /* size of block */             /* 8 */
                    115:        uint32_t type;          /* type of block */             /* 4 */
1.12      perry     116: } __packed;                            /*      == 20 */
1.1       fvdl      117:
                    118: #define        BIM_Memory      1       /* available RAM usable by OS */
                    119: #define        BIM_Reserved    2       /* in use or reserved by the system */
                    120: #define        BIM_ACPI        3       /* ACPI Reclaim memory */
                    121: #define        BIM_NVS         4       /* ACPI NVS memory */
1.26    ! nonaka    122: #define        BIM_Unusable    5       /* errors have been detected */
        !           123: #define        BIM_Disabled    6       /* not enabled */
        !           124: #define        BIM_PMEM        7       /* Persistent memory */
        !           125: #define        BIM_PRAM        12      /* legacy NVDIMM (OEM defined) */
1.1       fvdl      126:
                    127: struct btinfo_memmap {
                    128:        struct btinfo_common common;
                    129:        int num;
                    130:        struct bi_memmap_entry entry[1]; /* var len */
                    131: };
                    132:
1.8       dyoung    133: #if HAVE_NBTOOL_CONFIG_H
                    134: #include <nbinclude/sys/bootblock.h>
                    135: #else
1.3       lukem     136: #include <sys/bootblock.h>
1.8       dyoung    137: #endif /* HAVE_NBTOOL_CONFIG_H */
1.1       fvdl      138:
                    139: /*
                    140:  * Structure describing disk info as seen by the BIOS.
                    141:  */
                    142: struct bi_biosgeom_entry {
1.2       dsl       143:        int             sec, head, cyl;         /* geometry */
1.9       junyoung  144:        uint64_t        totsec;                 /* LBA sectors from ext int13 */
1.2       dsl       145:        int             flags, dev;             /* flags, BIOS device # */
                    146: #define BI_GEOM_INVALID                0x000001
                    147: #define BI_GEOM_EXTINT13       0x000002
1.9       junyoung  148: #ifdef BIOSDISK_EXTINFO_V3
1.2       dsl       149: #define BI_GEOM_BADCKSUM       0x000004        /* v3.x checksum invalid */
                    150: #define BI_GEOM_BUS_MASK       0x00ff00        /* connecting bus type */
                    151: #define BI_GEOM_BUS_ISA                0x000100
                    152: #define BI_GEOM_BUS_PCI                0x000200
                    153: #define BI_GEOM_BUS_OTHER      0x00ff00
                    154: #define BI_GEOM_IFACE_MASK     0xff0000        /* interface type */
                    155: #define BI_GEOM_IFACE_ATA      0x010000
                    156: #define BI_GEOM_IFACE_ATAPI    0x020000
                    157: #define BI_GEOM_IFACE_SCSI     0x030000
                    158: #define BI_GEOM_IFACE_USB      0x040000
                    159: #define BI_GEOM_IFACE_1394     0x050000        /* Firewire */
                    160: #define BI_GEOM_IFACE_FIBRE    0x060000        /* Fibre channel */
1.9       junyoung  161: #define BI_GEOM_IFACE_OTHER    0xff0000
1.2       dsl       162:        unsigned int    cksum;                  /* MBR checksum */
1.9       junyoung  163:        unsigned int    interface_path;         /* ISA iobase PCI bus/dev/fun */
                    164:        uint64_t        device_path;
1.2       dsl       165:        int             res0;                   /* future expansion; 0 now */
                    166: #else
                    167:        unsigned int    cksum;                  /* MBR checksum */
                    168:        int             res0, res1, res2, res3; /* future expansion; 0 now */
                    169: #endif
1.20      christos  170:        struct mbr_partition mbrparts[MBR_PART_COUNT]; /* MBR itself */
1.12      perry     171: } __packed;
1.1       fvdl      172:
                    173: struct btinfo_biosgeom {
                    174:        struct btinfo_common common;
                    175:        int num;
                    176:        struct bi_biosgeom_entry disk[1]; /* var len */
                    177: };
                    178:
1.13      ad        179: struct bi_modulelist_entry {
                    180:        char path[80];
                    181:        int type;
                    182:        int len;
                    183:        uint32_t base;
                    184: };
                    185: #define        BI_MODULE_NONE          0x00
                    186: #define        BI_MODULE_ELF           0x01
1.17      jmcneill  187: #define        BI_MODULE_IMAGE         0x02
1.19      tls       188: #define BI_MODULE_RND          0x03
1.23      jmcneill  189: #define BI_MODULE_FS           0x04
1.13      ad        190:
                    191: struct btinfo_modulelist {
                    192:        struct btinfo_common common;
                    193:        int num;
                    194:        uint32_t endpa;
                    195:        /* bi_modulelist_entry list follows */
                    196: };
                    197:
1.15      jmcneill  198: struct btinfo_framebuffer {
                    199:        struct btinfo_common common;
                    200:        uint64_t physaddr;
                    201:        uint32_t flags;
                    202:        uint32_t width;
                    203:        uint32_t height;
                    204:        uint16_t stride;
                    205:        uint8_t depth;
                    206:        uint8_t rnum;
                    207:        uint8_t gnum;
                    208:        uint8_t bnum;
                    209:        uint8_t rpos;
                    210:        uint8_t gpos;
                    211:        uint8_t bpos;
1.16      jmcneill  212:        uint16_t vbemode;
                    213:        uint8_t reserved[14];
1.15      jmcneill  214: };
                    215:
1.18      uebayasi  216: struct bi_userconfcommand {
                    217:        char text[80];
                    218: };
                    219:
                    220: struct btinfo_userconfcommands {
                    221:        struct btinfo_common common;
                    222:        int num;
                    223:        /* bi_userconfcommand list follows */
                    224: };
                    225:
1.24      christos  226: /* EFI Information */
                    227: struct btinfo_efi {
                    228:        struct btinfo_common common;
1.25      nonaka    229:        uint64_t systblpa;      /* Physical address of the EFI System Table */
                    230:        uint32_t flags;
                    231: #define BI_EFI_32BIT   __BIT(0)        /* 32bit UEFI */
                    232:        uint8_t reserved[12];
                    233: };
                    234:
                    235: struct btinfo_efimemmap {
                    236:        struct btinfo_common common;
                    237:        uint32_t num;           /* number of memory descriptor */
                    238:        uint32_t version;       /* version of memory descriptor */
                    239:        uint32_t size;          /* size of memory descriptor */
                    240:        uint8_t memmap[1];      /* whole memory descriptors */
1.24      christos  241: };
                    242:
1.10      jmmv      243: #endif /* _LOCORE */
                    244:
1.1       fvdl      245: #ifdef _KERNEL
1.10      jmmv      246:
                    247: #define BOOTINFO_MAXSIZE 4096
                    248:
                    249: #ifndef _LOCORE
                    250: /*
                    251:  * Structure that holds the information passed by the boot loader.
                    252:  */
                    253: struct bootinfo {
                    254:        /* Number of bootinfo_* entries in bi_data. */
                    255:        uint32_t        bi_nentries;
                    256:
                    257:        /* Raw data of bootinfo entries.  The first one (if any) is
                    258:         * found at bi_data[0] and can be casted to (bootinfo_common *).
                    259:         * Once this is done, the following entry is found at 'len'
                    260:         * offset as specified by the previous entry. */
                    261:        uint8_t         bi_data[BOOTINFO_MAXSIZE - sizeof(uint32_t)];
                    262: };
                    263:
1.14      tron      264: extern struct bootinfo bootinfo;
                    265:
1.4       junyoung  266: void *lookup_bootinfo(int);
1.24      christos  267: void  aprint_bootinfo(void);
1.1       fvdl      268: #endif /* _LOCORE */
                    269:
1.10      jmmv      270: #endif /* _KERNEL */

CVSweb <webmaster@jp.NetBSD.org>