[BACK]Return to cdboot.c CVS log [TXT][DIR] Up to [local] / sys / arch / hppa64 / stand / cdboot

Annotation of sys/arch/hppa64/stand/cdboot/cdboot.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: cdboot.c,v 1.1 2005/04/01 10:40:48 mickey Exp $       */
                      2:
                      3: /*
                      4:  * Copyright (c) 2005 Michael Shalayeff
                      5:  * All rights reserved.
                      6:  *
                      7:  * Permission to use, copy, modify, and distribute this software for any
                      8:  * purpose with or without fee is hereby granted, provided that the above
                      9:  * copyright notice and this permission notice appear in all copies.
                     10:  *
                     11:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     12:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     13:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     14:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     15:  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
                     16:  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
                     17:  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     18:  */
                     19:
                     20: #include <sys/param.h>
                     21: #include <sys/reboot.h>
                     22: #include <sys/stat.h>
                     23: #include <libsa.h>
                     24: #include <lib/libsa/cd9660.h>
                     25: #include <lib/libsa/loadfile.h>
                     26: #include <dev/cons.h>
                     27: #include <machine/pdc.h>
                     28: #include <stand/boot/bootarg.h>
                     29: #include "dev_hppa64.h"
                     30: #include "cmd.h"
                     31:
                     32: dev_t bootdev;
                     33: int debug = 1;
                     34: int bootprompt = 1;
                     35:
                     36: struct fs_ops file_system[] = {
                     37:        { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
                     38:          cd9660_stat, cd9660_readdir },
                     39: };
                     40: int nfsys = NENTS(file_system);
                     41:
                     42: struct devsw devsw[] = {
                     43:        { "dk", iodcstrategy, dkopen, dkclose, noioctl },
                     44: };
                     45: int    ndevs = NENTS(devsw);
                     46:
                     47: struct consdev constab[] = {
                     48:        { ite_probe, ite_init, ite_getc, ite_putc },
                     49:        { NULL }
                     50: };
                     51: struct consdev *cn_tab;
                     52:
                     53: typedef void (*startfuncp)(int, int, int, int, int, int, caddr_t)
                     54:     __attribute__ ((noreturn));
                     55:
                     56: void
                     57: boot(dev_t dev)
                     58: {
                     59:        u_long marks[MARK_MAX];
                     60:        char path[128];
                     61:
                     62:        pdc_init();
                     63:        cninit();
                     64:        devboot(dev, path);
                     65:        strncpy(path + strlen(path), ":/bsd.rd", 9);
                     66:        printf(">> OpenBSD/" MACHINE " CDBOOT 0.1\n"
                     67:            "booting %s: ", path);
                     68:
                     69:        marks[MARK_START] = (u_long)DEFAULT_KERNEL_ADDRESS;
                     70:        if (!loadfile(path, marks, LOAD_KERNEL)) {
                     71:                marks[MARK_END] = ALIGN(marks[MARK_END] -
                     72:                    (u_long)DEFAULT_KERNEL_ADDRESS);
                     73:                fcacheall();
                     74:
                     75:                __asm("mtctl %r0, %cr17");
                     76:                __asm("mtctl %r0, %cr17");
                     77:                (*(startfuncp)(marks[MARK_ENTRY]))((int)(long)pdc, 0, bootdev,
                     78:                    marks[MARK_END], BOOTARG_APIVER, BOOTARG_LEN,
                     79:                    (caddr_t)BOOTARG_OFF);
                     80:                /* not reached */
                     81:        }
                     82: }

CVSweb