[BACK]Return to biosvar.h CVS log [TXT][DIR] Up to [local] / sys / arch / amd64 / include

Annotation of sys/arch/amd64/include/biosvar.h, Revision 1.1

1.1     ! nbrk        1: /* XXX - DSR */
        !             2: /*     $OpenBSD: biosvar.h,v 1.7 2006/05/20 22:36:33 deraadt Exp $     */
        !             3:
        !             4: /*
        !             5:  * Copyright (c) 1997-1999 Michael Shalayeff
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * Redistribution and use in source and binary forms, with or without
        !             9:  * modification, are permitted provided that the following conditions
        !            10:  * are met:
        !            11:  * 1. Redistributions of source code must retain the above copyright
        !            12:  *    notice, this list of conditions and the following disclaimer.
        !            13:  * 2. Redistributions in binary form must reproduce the above copyright
        !            14:  *    notice, this list of conditions and the following disclaimer in the
        !            15:  *    documentation and/or other materials provided with the distribution.
        !            16:  * 3. The name of the author may not be used to endorse or promote products
        !            17:  *    derived from this software without specific prior written permission.
        !            18:  *
        !            19:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
        !            20:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
        !            21:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        !            22:  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
        !            23:  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
        !            24:  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        !            25:  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            26:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
        !            27:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
        !            28:  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
        !            29:  * THE POSSIBILITY OF SUCH DAMAGE.
        !            30:  */
        !            31:
        !            32: #ifndef _I386_BIOSVAR_H_
        !            33: #define _I386_BIOSVAR_H_
        !            34: #pragma pack(1)
        !            35:
        !            36:        /* some boxes put apm data seg in the 2nd page */
        !            37: #define        BOOTARG_OFF     (NBPG*2)
        !            38: #define        BOOTARG_LEN     (NBPG*1)
        !            39: #define        BOOTBIOS_ADDR   (0x7c00)
        !            40:
        !            41:        /* BIOS configure flags */
        !            42: #define        BIOSF_BIOS32    0x0001
        !            43: #define        BIOSF_PCIBIOS   0x0002
        !            44: #define        BIOSF_PROMSCAN  0x0004
        !            45: #define BIOSF_SMBIOS   0x0006
        !            46:
        !            47: /* BIOS media ID */
        !            48: #define BIOSM_F320K    0xff    /* floppy ds/sd  8 spt */
        !            49: #define        BIOSM_F160K     0xfe    /* floppy ss/sd  8 spt */
        !            50: #define        BIOSM_F360K     0xfd    /* floppy ds/sd  9 spt */
        !            51: #define        BIOSM_F180K     0xfc    /* floppy ss/sd  9 spt */
        !            52: #define        BIOSM_ROMD      0xfa    /* ROM disk */
        !            53: #define        BIOSM_F120M     0xf9    /* floppy ds/hd 15 spt 5.25" */
        !            54: #define        BIOSM_F720K     0xf9    /* floppy ds/dd  9 spt 3.50" */
        !            55: #define        BIOSM_HD        0xf8    /* hard drive */
        !            56: #define        BIOSM_F144K     0xf0    /* floppy ds/hd 18 spt 3.50" */
        !            57: #define        BIOSM_OTHER     0xf0    /* any other */
        !            58:
        !            59: /*
        !            60:  * BIOS memory maps
        !            61:  */
        !            62: #define        BIOS_MAP_END    0x00    /* End of array XXX - special */
        !            63: #define        BIOS_MAP_FREE   0x01    /* Usable memory */
        !            64: #define        BIOS_MAP_RES    0x02    /* Reserved memory */
        !            65: #define        BIOS_MAP_ACPI   0x03    /* ACPI Reclaim memory */
        !            66: #define        BIOS_MAP_NVS    0x04    /* ACPI NVS memory */
        !            67:
        !            68: /*
        !            69:  * Optional ROM header
        !            70:  */
        !            71: typedef
        !            72: struct bios_romheader {
        !            73:        u_int16_t       signature;      /* 0xaa55 */
        !            74:        u_int8_t        len;            /* length in pages (512 bytes) */
        !            75:        u_int32_t       entry;          /* initialization entry point */
        !            76:        u_int8_t        reserved[19];
        !            77:        u_int16_t       pnpheader;      /* offset to PnP expansion header */
        !            78: } *bios_romheader_t;
        !            79:
        !            80: /*
        !            81:  * BIOS32
        !            82:  */
        !            83: typedef
        !            84: struct bios32_header {
        !            85:        u_int32_t       signature;      /* 00: signature "_32_" */
        !            86:        u_int32_t       entry;          /* 04: entry point */
        !            87:        u_int8_t        rev;            /* 08: revision */
        !            88:        u_int8_t        length;         /* 09: header length */
        !            89:        u_int8_t        cksum;          /* 0a: modulo 256 checksum */
        !            90:        u_int8_t        reserved[5];
        !            91: } *bios32_header_t;
        !            92:
        !            93: typedef
        !            94: struct bios32_entry_info {
        !            95:        paddr_t bei_base;
        !            96:        psize_t bei_size;
        !            97:        paddr_t bei_entry;
        !            98: } *bios32_entry_info_t;
        !            99:
        !           100: typedef
        !           101: struct bios32_entry {
        !           102:        u_int32_t offset;
        !           103:        u_int16_t segment;
        !           104: } *bios32_entry_t;
        !           105:
        !           106: #define        BIOS32_START    0xe0000
        !           107: #define        BIOS32_SIZE     0x20000
        !           108: #define        BIOS32_END      (BIOS32_START + BIOS32_SIZE - 0x10)
        !           109:
        !           110: #define        BIOS32_MAKESIG(a, b, c, d) \
        !           111:        ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
        !           112: #define        BIOS32_SIGNATURE        BIOS32_MAKESIG('_', '3', '2', '_')
        !           113: #define        PCIBIOS_SIGNATURE       BIOS32_MAKESIG('$', 'P', 'C', 'I')
        !           114: #define        SMBIOS_SIGNATURE        BIOS32_MAKESIG('_', 'S', 'M', '_')
        !           115:
        !           116: /*
        !           117:  * CTL_BIOS definitions.
        !           118:  */
        !           119: #define        BIOS_DEV                1       /* int: BIOS boot device */
        !           120: #define        BIOS_DISKINFO           2       /* struct: BIOS boot device info */
        !           121: #define BIOS_CKSUMLEN          3       /* int: disk cksum block count */
        !           122: #define        BIOS_MAXID              4       /* number of valid machdep ids */
        !           123:
        !           124: #define        CTL_BIOS_NAMES { \
        !           125:        { 0, 0 }, \
        !           126:        { "biosdev", CTLTYPE_INT }, \
        !           127:        { "diskinfo", CTLTYPE_STRUCT }, \
        !           128:        { "cksumlen", CTLTYPE_INT }, \
        !           129: }
        !           130:
        !           131: #define        BOOTARG_MEMMAP 0
        !           132: typedef struct _bios_memmap {
        !           133:        u_int64_t addr;         /* Beginning of block */
        !           134:        u_int64_t size;         /* Size of block */
        !           135:        u_int32_t type;         /* Type of block */
        !           136: } bios_memmap_t;
        !           137:
        !           138: /* Info about disk from the bios, plus the mapping from
        !           139:  * BIOS numbers to BSD major (driver?) number.
        !           140:  *
        !           141:  * Also, do not bother with BIOSN*() macros, just parcel
        !           142:  * the info out, and use it like this.  This makes for less
        !           143:  * of a dependance on BIOSN*() macros having to be the same
        !           144:  * across /boot, /bsd, and userland.
        !           145:  */
        !           146: #define        BOOTARG_DISKINFO 1
        !           147: typedef struct _bios_diskinfo {
        !           148:        /* BIOS section */
        !           149:        int bios_number;        /* BIOS number of drive (or -1) */
        !           150:        u_int bios_cylinders;   /* BIOS cylinders */
        !           151:        u_int bios_heads;       /* BIOS heads */
        !           152:        u_int bios_sectors;     /* BIOS sectors */
        !           153:        int bios_edd;           /* EDD support */
        !           154:
        !           155:        /* BSD section */
        !           156:        dev_t bsd_dev;          /* BSD device */
        !           157:
        !           158:        /* Checksum section */
        !           159:        u_int32_t checksum;     /* Checksum for drive */
        !           160:
        !           161:        /* Misc. flags */
        !           162:        u_int32_t flags;
        !           163: #define BDI_INVALID    0x00000001      /* I/O error during checksumming */
        !           164: #define BDI_GOODLABEL  0x00000002      /* Had SCSI or ST506/ESDI disklabel */
        !           165: #define BDI_BADLABEL   0x00000004      /* Had another disklabel */
        !           166: #define BDI_EL_TORITO  0x00000008      /* 2,048-byte sectors */
        !           167: #define BDI_PICKED     0x80000000      /* kernel-only: cksum matched */
        !           168:
        !           169: } bios_diskinfo_t;
        !           170:
        !           171: #define        BOOTARG_APMINFO 2
        !           172: typedef struct _bios_apminfo {
        !           173:        /* APM_CONNECT returned values */
        !           174:        u_int   apm_detail;
        !           175:        u_int   apm_code32_base;
        !           176:        u_int   apm_code16_base;
        !           177:        u_int   apm_code_len;
        !           178:        u_int   apm_data_base;
        !           179:        u_int   apm_data_len;
        !           180:        u_int   apm_entry;
        !           181:        u_int   apm_code16_len;
        !           182: } bios_apminfo_t;
        !           183:
        !           184: #define        BOOTARG_CKSUMLEN 3              /* u_int32_t */
        !           185:
        !           186: #define        BOOTARG_PCIINFO 4
        !           187: typedef struct _bios_pciinfo {
        !           188:        /* PCI BIOS v2.0+ - Installation check values */
        !           189:        u_int32_t       pci_chars;      /* Characteristics (%eax) */
        !           190:        u_int32_t       pci_rev;        /* BCD Revision (%ebx) */
        !           191:        u_int32_t       pci_entry32;    /* PM entry point for PCI BIOS */
        !           192:        u_int32_t       pci_lastbus;    /* Number of last PCI bus */
        !           193: } bios_pciinfo_t;
        !           194:
        !           195: #define        BOOTARG_CONSDEV 5
        !           196: typedef struct _bios_consdev {
        !           197:        dev_t   consdev;
        !           198:        int     conspeed;
        !           199: } bios_consdev_t;
        !           200:
        !           201: #define BOOTARG_BOOTMAC        7
        !           202: typedef struct _bios_bootmac {
        !           203:        char    mac[6];
        !           204: } bios_bootmac_t;
        !           205:
        !           206: #if defined(_KERNEL) || defined (_STANDALONE)
        !           207:
        !           208: #ifdef _LOCORE
        !           209: #define        DOINT(n)        int     $0x20+(n)
        !           210: #else
        !           211: #define        DOINT(n)        "int $0x20+(" #n ")"
        !           212:
        !           213: extern volatile struct BIOS_regs {
        !           214:        u_int32_t       biosr_ax;
        !           215:        u_int32_t       biosr_cx;
        !           216:        u_int32_t       biosr_dx;
        !           217:        u_int32_t       biosr_bx;
        !           218:        u_int32_t       biosr_bp;
        !           219:        u_int32_t       biosr_si;
        !           220:        u_int32_t       biosr_di;
        !           221:        u_int32_t       biosr_ds;
        !           222:        u_int32_t       biosr_es;
        !           223: }      BIOS_regs;
        !           224:
        !           225: #ifdef _KERNEL
        !           226: #include <machine/bus.h>
        !           227:
        !           228: struct bios_attach_args {
        !           229:        char *bios_dev;
        !           230:        u_int bios_func;
        !           231:        bus_space_tag_t bios_iot;
        !           232:        bus_space_tag_t bios_memt;
        !           233:        union {
        !           234:                void *_p;
        !           235:                bios_apminfo_t *_bios_apmp;
        !           236:        } _;
        !           237: };
        !           238:
        !           239: #define        bios_apmp       _._bios_apmp
        !           240:
        !           241: struct consdev;
        !           242: struct proc;
        !           243:
        !           244: int bios_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
        !           245:
        !           246: void bioscnprobe(struct consdev *);
        !           247: void bioscninit(struct consdev *);
        !           248: void bioscnputc(dev_t, int);
        !           249: int bioscngetc(dev_t);
        !           250: void bioscnpollc(dev_t, int);
        !           251: void bios_getopt(void);
        !           252: bios_diskinfo_t *bios_getdiskinfo(dev_t);
        !           253:
        !           254: /* bios32.c */
        !           255: int  bios32_service(u_int32_t, bios32_entry_t, bios32_entry_info_t);
        !           256:
        !           257: extern u_int bootapiver;
        !           258: extern bios_memmap_t *bios_memmap;
        !           259:
        !           260: #endif /* _KERNEL */
        !           261: #endif /* _LOCORE */
        !           262: #endif /* _KERNEL || _STANDALONE */
        !           263:
        !           264: #pragma pack()
        !           265: #endif /* _I386_BIOSVAR_H_ */

CVSweb