main() { struct open_file f; char *addr; int n, error; bootdev_type = BUGDEV_DISK; printf("Boot: bug device: ctrl=%d, dev=%d\n", bugargs.ctrl_lun, bugargs.dev_lun); printf("\nbootxx: first level bootstrap program [%s]\n\n", version); f.f_flags = F_RAW; if (devopen(&f, 0, &addr)) { printf("bootxx: open failed\n"); _rtt(); } addr = (char *)STAGE2_RELOC; error = copyboot(&f, addr); f.f_dev->dv_close(&f); if (!error) { bugexec((void (*)())addr); } /* copyboot had a problem... */ _rtt(); }
void setup(void) { u_int chosen; if ((chosen = OF_finddevice("/chosen")) == -1) _rtt(); if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) != sizeof(stdin) || OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) != sizeof(stdout) || OF_getprop(chosen, "mmu", &mmuh, sizeof(mmuh)) != sizeof(mmuh) || OF_getprop(chosen, "memory", &memh, sizeof(memh)) != sizeof(memh)) _rtt(); }
// TODO: falta lo de lista invertida para desc TServicio* Servicio_new( unsigned int dni_prov, char* nombre, char* desc, char tipo ){ unsigned int last_id = servicios_last_id; size_t size = 0; uint8_t* buf = _servBufDesdeData( last_id+1, dni_prov, nombre, desc, tipo, &size ); if(HashExtensible_insertar(hash_servicios, buf, size)){ free(buf); return NULL; } TServicio* serv = _servicioDesdeBuf(buf, size); free(buf); TRtt* rtt = _rtt(); Rtt_agregar_texto(rtt, last_id+1, desc); Rtt_generar_indice(rtt); Rtt_destruir(rtt); servicios_last_id++; return serv; }
main() { int io; char *file; prom_init(); printf(">> OpenBSD BOOT %s\n", version); file = prom_bootfile; if (file == 0 || *file == 0) file = DEFAULT_KERNEL; for (;;) { if (prom_boothow & RB_ASKNAME) { printf("device[%s]: ", prom_bootdevice); gets(dbuf); if (dbuf[0]) prom_bootdevice = dbuf; printf("boot: "); gets(fbuf); if (fbuf[0]) file = fbuf; } if ((io = open(file, 0)) >= 0) break; printf("open: %s: %s\n", file, strerror(errno)); prom_boothow |= RB_ASKNAME; } printf("Booting %s @ 0x%x\n", file, LOADADDR); loadfile(io, LOADADDR); _rtt(); }
void gzcopy(void *dst, const void *src, size_t srclen) { struct state state; unsigned char *cp = dst; ssize_t len; bzero(&state, sizeof(state)); state.z_err = Z_OK; state.srcbuf = src; state.srcsize = srclen; if (inflateInit2(&state.stream, -15) != Z_OK) { printf("FATAL: inflateInit2 failed\n"); _rtt(); } state.stream.next_in = state.inbuf = alloc(Z_BUFSIZE); if (state.inbuf == NULL) { inflateEnd(&state.stream); printf("FATAL: unable to allocate Z buffer\n"); _rtt(); } /* Skip the Gzip header. */ if (check_header(&state)) { inflateEnd(&state.stream); dealloc(state.inbuf, Z_BUFSIZE); _rtt(); } /* Uncompress the image! */ while ((len = readgz(&state, cp, Z_BUFSIZE)) > 0) cp += len; if (len == -1) _rtt(); /* All done! */ inflateEnd(&state.stream); dealloc(state.inbuf, Z_BUFSIZE); }
void gdium_abort() { /* Here's a nickel, kid. Get yourself a better firmware */ printf("\n\nSorry, OpenBSD boot blocks do not work on Gdium, " "because of dire firmware limitations.\n" "Also, the firmware has reset the USB controller so you " "will need to power cycle.\n" "We would apologize for this inconvenience, but we have " "no control about the firmware of your machine.\n\n"); rd_invalidate(); _rtt(); }
static void parseargs(char *str, int *howtop) { char *cp; /* Allow user to drop back to the PROM. */ if (strcmp(str, "exit") == 0) _rtt(); *howtop = 0; if (str[0] == '\0') return; cp = str; while (*cp != 0) { /* check for - */ if (*cp == '-') break; /* start of options found */ while (*cp != 0 && *cp != ' ') cp++; /* character in the middle of the name, skip */ while (*cp == ' ') *cp++ = 0; } if (!*cp) return; *cp++ = 0; while (*cp) { switch (*cp++) { case 'a': *howtop |= RB_ASKNAME; break; case 'c': *howtop |= RB_CONFIG; break; case 's': *howtop |= RB_SINGLE; break; case 'd': *howtop |= RB_KDB; debug = 1; break; } } }
void run_loadfile(u_long *marks, int howto) { int32_t newargc; int32_t *newargv; char kernelflags[8]; char *c; const char *arg; /* * Build a new commandline: * boot <device kernel is loaded from> -<kernel options> */ newargc = howto == 0 ? 2 : 3; newargv = alloc(newargc * sizeof(int32_t)); if (newargv == NULL) panic("out of memory"); arg = "boot"; /* kernel needs this. */ newargv[0] = PTR_TO_CKSEG1(arg); newargv[1] = PTR_TO_CKSEG1(&pmon_bootdev); if (howto != 0) { c = kernelflags; *c++ = '-'; if (howto & RB_ASKNAME) *c++ = 'a'; if (howto & RB_CONFIG) *c++ = 'c'; if (howto & RB_KDB) *c++ = 'd'; if (howto & RB_SINGLE) *c++ = 's'; *c = '\0'; newargv[2] = PTR_TO_CKSEG1(&kernelflags); } pmon_cacheflush(); (*(program)(marks[MARK_ENTRY]))(newargc, PTR_TO_CKSEG1(newargv), pmon_envp, pmon_callvec, (uint64_t *)PHYS_TO_CKSEG0(marks[MARK_END])); rd_invalidate(); _rtt(); }
int main(int argc, char *argv[]) { char *dummy; register void (*entry)(caddr_t) = (void (*)(caddr_t))PROM_LOADADDR; prom_init(); io.f_flags = F_RAW; if (devopen(&io, 0, &dummy)) { panic("%s: can't open device", progname); } (void)loadboot(&io, (caddr_t)PROM_LOADADDR); (io.f_dev->dv_close)(&io); (*entry)(cputyp == CPU_SUN4 ? (caddr_t)PROM_LOADADDR : (caddr_t)promvec); _rtt(); }
__dead void panic(const char *fmt, ...) { extern void closeall(void); va_list ap; static int paniced; if (!paniced) { paniced = 1; closeall(); } va_start(ap, fmt); vprintf(fmt, ap); printf("\n"); va_end(ap); _rtt(); /*NOTREACHED*/ }
/* * This is the boot code entry point. * Note that we do not bother to set r31, and use the default value supplied * by the PROM, which is the top of memory, minus the PROM data area (usually * 128KB). */ void start(const char *args, int dev, int unit, int part) { extern int edata, end; /* * This code enables the SFU1 and is used for single stage * bootstraps or the first stage of a two stage bootstrap. * Do not use any low register to enable the SFU1. This wipes out * the args. Not cool at all... r25 seems free. */ asm("| enable SFU1"); asm(" ldcr r25,cr1" ::: "r25"); asm(" clr r25,r25,1<3>"); /* bit 3 is SFU1D */ asm(" stcr r25,cr1"); memset(&edata, 0, ((int)&end - (int)&edata)); netboot(args, dev, unit, part); _rtt(); /* NOTREACHED */ }
int run_loadfile(u_long *marks, int howto) { char bootline[512]; /* Should check size? */ u_int32_t entry; char *cp; void *ssym, *esym; strlcpy(bootline, opened_name, sizeof bootline); cp = bootline + strlen(bootline); *cp++ = ' '; *cp = '-'; if (howto & RB_ASKNAME) *++cp = 'a'; if (howto & RB_CONFIG) *++cp = 'c'; if (howto & RB_SINGLE) *++cp = 's'; if (howto & RB_KDB) *++cp = 'd'; if (*cp == '-') *--cp = 0; else *++cp = 0; entry = marks[MARK_ENTRY]; ssym = (void *)marks[MARK_SYM]; esym = (void *)marks[MARK_END]; { u_int32_t lastpage; lastpage = roundup(marks[MARK_END], NBPG); OF_release((void*)lastpage, CLAIM_LIMIT - lastpage); } chain((void *)entry, bootline, ssym, esym); _rtt(); return 0; }
void main(void) { extern char bootprog_name[], bootprog_rev[], bootprog_maker[], bootprog_date[]; void (*loadaddr)(void) = (void *) md_root_loadaddr; cons_init(); printf("\n"); printf(">> %s, Revision %s\n", bootprog_name, bootprog_rev); printf(">> (%s, %s)\n", bootprog_maker, bootprog_date); board_init(); printf(">> Load address: 0x%x\n", md_root_loadaddr); /* * If md_root_size is 0, then it means that we are simply * decompressing from an image which was concatenated onto * the end of the gzboot binary. */ if (md_root_size != 0) printf(">> Image size: %u\n", md_root_size); printf("Uncompressing image..."); gzcopy((void *) loadaddr, md_root_image, md_root_size); printf("done.\n"); printf("Jumping to image @ 0x%x...\n", md_root_loadaddr); board_fini(); (*loadaddr)(); _rtt(); }
int main() { char *cp, *file; int ask = 0, howto, ret; board_setup(); printf("\n>> OpenBSD/mvme88k netboot [%s]\n", version); ret = parse_args(&file, &howto); for (;;) { if (ask) { printf("boot: "); gets(line); if (line[0]) { bugargs.arg_start = line; cp = line; while (cp < (line + sizeof(line) - 1) && *cp) cp++; bugargs.arg_end = cp; ret =parse_args(&file, &howto); } } if (ret) { printf("boot: -q returning to MVME-Bug\n"); break; } exec_mvme(file, howto); printf("boot: %s: %s\n", file, strerror(errno)); ask = 1; } _rtt(); return (0); }
void main(int argc, char *argv[], char *bootargs_start, char *bootargs_end) { unsigned long marks[MARK_MAX]; struct brdprop *brdprop; char *new_argv[MAX_ARGS]; char *bname; ssize_t len; int err, fd, howto, i, n; printf("\n>> %s altboot, revision %s\n", bootprog_name, bootprog_rev); brdprop = brd_lookup(brdtype); printf(">> %s, cpu %u MHz, bus %u MHz, %dMB SDRAM\n", brdprop->verbose, cpuclock / 1000000, busclock / 1000000, bi_mem.memsize >> 20); nata = pcilookup(PCI_CLASS_IDE, lata, 2); if (nata == 0) nata = pcilookup(PCI_CLASS_RAID, lata, 2); if (nata == 0) nata = pcilookup(PCI_CLASS_MISCSTORAGE, lata, 2); if (nata == 0) nata = pcilookup(PCI_CLASS_SCSI, lata, 2); nnif = pcilookup(PCI_CLASS_ETH, lnif, 2); nusb = pcilookup(PCI_CLASS_USB, lusb, 3); #ifdef DEBUG if (nata == 0) printf("No IDE/SATA found\n"); else for (n = 0; n < nata; n++) { int b, d, f, bdf, pvd; bdf = lata[n].bdf; pvd = lata[n].pvd; pcidecomposetag(bdf, &b, &d, &f); printf("%04x.%04x DSK %02d:%02d:%02d\n", PCI_VENDOR(pvd), PCI_PRODUCT(pvd), b, d, f); } if (nnif == 0) printf("no NET found\n"); else for (n = 0; n < nnif; n++) { int b, d, f, bdf, pvd; bdf = lnif[n].bdf; pvd = lnif[n].pvd; pcidecomposetag(bdf, &b, &d, &f); printf("%04x.%04x NET %02d:%02d:%02d\n", PCI_VENDOR(pvd), PCI_PRODUCT(pvd), b, d, f); } if (nusb == 0) printf("no USB found\n"); else for (n = 0; n < nusb; n++) { int b, d, f, bdf, pvd; bdf = lusb[0].bdf; pvd = lusb[0].pvd; pcidecomposetag(bdf, &b, &d, &f); printf("%04x.%04x USB %02d:%02d:%02d\n", PCI_VENDOR(pvd), PCI_PRODUCT(pvd), b, d, f); } #endif pcisetup(); pcifixup(); /* * When argc is too big then it is probably a pointer, which could * indicate that we were launched as a Linux kernel module using * "bootm". */ if (argc > MAX_ARGS) { if (argv != NULL) { /* * initrd image was loaded: * check if it contains a valid altboot command line */ char *p = (char *)argv; if (strncmp(p, "altboot:", 8) == 0) { *p = 0; for (p = p + 8; *p >= ' '; p++); argc = parse_cmdline(new_argv, MAX_ARGS, ((char *)argv) + 8, p); argv = new_argv; } else argc = 0; /* boot default */ } else { /* parse standard Linux bootargs */ argc = parse_cmdline(new_argv, MAX_ARGS, bootargs_start, bootargs_end); argv = new_argv; } } /* look for a PATA drive configuration string under the arguments */ for (n = 1; n < argc; n++) { if (strncmp(argv[n], "ide:", 4) == 0 && argv[n][4] >= '0' && argv[n][4] <= '2') { drive_config = &argv[n][4]; break; } } /* intialize a disk driver */ for (i = 0, n = 0; i < nata; i++) n += dskdv_init(&lata[i]); if (n == 0) printf("IDE/SATA device driver was not found\n"); /* initialize a network interface */ for (n = 0; n < nnif; n++) if (netif_init(&lnif[n]) != 0) break; if (n >= nnif) printf("no NET device driver was found\n"); /* wait 2s for user to enter interactive mode */ for (n = 200; n >= 0; n--) { if (n % 100 == 0) printf("\rHit any key to enter interactive mode: %d", n / 100); if (tstchar()) { #ifdef DEBUG unsigned c; c = toupper(getchar()); if (c == 'C') { /* controller test terminal */ sat_test(); n = 200; continue; } else if (c == 'F') { /* find strings in Flash ROM */ findflash(); n = 200; continue; } #else (void)getchar(); #endif /* enter command line */ argv = new_argv; argc = input_cmdline(argv, MAX_ARGS); break; } delay(10000); } putchar('\n'); howto = RB_AUTOBOOT; /* default is autoboot = 0 */ /* get boot options and determine bootname */ for (n = 1; n < argc; n++) { if (strncmp(argv[n], "ide:", 4) == 0) continue; /* ignore drive configuration argument */ for (i = 0; i < sizeof(bootargs) / sizeof(bootargs[0]); i++) { if (strncasecmp(argv[n], bootargs[i].name, strlen(bootargs[i].name)) == 0) { howto |= bootargs[i].value; break; } } if (i >= sizeof(bootargs) / sizeof(bootargs[0])) break; /* break on first unknown string */ } /* * If no device name is given, we construct a list of drives * which have valid disklabels. */ if (n >= argc) { static const size_t blen = sizeof("wdN:"); n = 0; argc = 0; argv = alloc(MAX_UNITS * (sizeof(char *) + blen)); bname = (char *)(argv + MAX_UNITS); for (i = 0; i < MAX_UNITS; i++) { if (!dlabel_valid(i)) continue; snprintf(bname, blen, "wd%d:", i); argv[argc++] = bname; bname += blen; } /* use default drive if no valid disklabel is found */ if (argc == 0) { argc = 1; argv[0] = BNAME_DEFAULT; } } /* try to boot off kernel from the drive list */ while (n < argc) { bname = argv[n++]; if (check_bootname(bname) == 0) { printf("%s not a valid bootname\n", bname); continue; } if ((fd = open(bname, 0)) < 0) { if (errno == ENOENT) printf("\"%s\" not found\n", bi_path.bootpath); continue; } printf("loading \"%s\" ", bi_path.bootpath); marks[MARK_START] = 0; if (howto == -1) { /* load another altboot binary and replace ourselves */ len = read(fd, (void *)0x100000, 0x1000000 - 0x100000); if (len == -1) goto loadfail; close(fd); netif_shutdown_all(); memcpy((void *)0xf0000, newaltboot, newaltboot_end - newaltboot); __syncicache((void *)0xf0000, newaltboot_end - newaltboot); printf("Restarting...\n"); run((void *)1, argv, (void *)0x100000, (void *)len, (void *)0xf0000); } err = fdloadfile(fd, marks, LOAD_KERNEL); close(fd); if (err < 0) continue; printf("entry=%p, ssym=%p, esym=%p\n", (void *)marks[MARK_ENTRY], (void *)marks[MARK_SYM], (void *)marks[MARK_END]); bootinfo = (void *)0x4000; bi_init(bootinfo); bi_add(&bi_cons, BTINFO_CONSOLE, sizeof(bi_cons)); bi_add(&bi_mem, BTINFO_MEMORY, sizeof(bi_mem)); bi_add(&bi_clk, BTINFO_CLOCK, sizeof(bi_clk)); bi_add(&bi_path, BTINFO_BOOTPATH, sizeof(bi_path)); bi_add(&bi_rdev, BTINFO_ROOTDEVICE, sizeof(bi_rdev)); bi_add(&bi_fam, BTINFO_PRODFAMILY, sizeof(bi_fam)); if (brdtype == BRD_SYNOLOGY || brdtype == BRD_DLINKDSM) { /* need to pass this MAC address to kernel */ bi_add(&bi_net, BTINFO_NET, sizeof(bi_net)); } if (modules_enabled) { if (fsmod != NULL) module_add(fsmod); kmodloadp = marks[MARK_END]; btinfo_modulelist = NULL; module_load(bname); if (btinfo_modulelist != NULL && btinfo_modulelist->num > 0) bi_add(btinfo_modulelist, BTINFO_MODULELIST, btinfo_modulelist_size); } launchfixup(); netif_shutdown_all(); __syncicache((void *)marks[MARK_ENTRY], (u_int)marks[MARK_SYM] - (u_int)marks[MARK_ENTRY]); run((void *)marks[MARK_SYM], (void *)marks[MARK_END], (void *)howto, bootinfo, (void *)marks[MARK_ENTRY]); /* should never come here */ printf("exec returned. Restarting...\n"); _rtt(); } loadfail: printf("load failed. Restarting...\n"); _rtt(); }
int main(int argc, char *argv[]) { int error; char *file; u_long marks[MARK_MAX]; extern char start[]; /* top of stack (see srt0.S) */ vaddr_t bstart_va; prom_init(); mmu_init(); printf(">> OpenBSD BOOT %s\n", version); /* * Find the physical memory area that's in use by the boot loader. * Our stack grows down from label `start'; assume we need no more * than 16K of stack space. * The top of the boot loader is the next 4MB boundary. */ bstart_va = (vaddr_t)start - LOWSTACK; if (pmap_extract(bstart_va, &bstart) != 0) panic("can't figure out where we have been loaded"); if (bstart != bstart_va) compat = 0; bend = roundup(bstart, FOURMB); #ifdef DEBUG printf("bstart %p bend %p\n", bstart, bend); #endif file = prom_bootfile; if (file == 0 || *file == 0) file = DEFAULT_KERNEL; for (;;) { if (prom_boothow & RB_ASKNAME) { printf("device[%s]: ", prom_bootdevice); gets(dbuf); if (dbuf[0]) prom_bootdevice = dbuf; printf("boot: "); gets(fbuf); if (fbuf[0]) file = fbuf; } printf("Booting %s\n", file); if ((error = loadk(file, marks)) == 0) break; printf("Cannot load %s: error=%d\n", file, error); prom_boothow |= RB_ASKNAME; } /* Note: args 2-4 not used due to conflicts with SunOS loaders */ (*(entry_t)marks[MARK_ENTRY])(cputyp == CPU_SUN4 ? PROM_LOADADDR : (u_long)promvec, 0, 0, 0, marks[MARK_END], DDB_MAGIC1); _rtt(); }
int main(void) { int error, i; char kernel[MAX_PROM_PATH]; const char *k; u_long marks[MARK_MAX], bootinfo; struct btinfo_symtab bi_sym; struct btinfo_boothowto bi_howto; void *arg; #ifdef HEAP_VARIABLE { extern char end[]; setheap((void *)ALIGN(end), (void *)0xffffffff); } #endif prom_init(); mmu_init(); printf(">> %s, Revision %s\n", bootprog_name, bootprog_rev); /* massage machine prom */ prom_patch(); /* * get default kernel. */ k = prom_getbootfile(); if (k != NULL && *k != '\0') { i = -1; /* not using the kernels */ strcpy(kernel, k); } else { i = 0; strcpy(kernel, kernels[i]); } k = prom_getbootpath(); if (k && *k) strcpy(prom_bootdevice, k); boothowto = bootoptions(prom_getbootargs()); for (;;) { /* * ask for a kernel first .. */ if (boothowto & RB_ASKNAME) { printf("device[%s] (\"halt\" to halt): ", prom_bootdevice); gets(dbuf); if (strcmp(dbuf, "halt") == 0) _rtt(); if (dbuf[0]) strcpy(prom_bootdevice, dbuf); printf("boot (press RETURN to try default list): "); gets(fbuf); if (fbuf[0]) strcpy(kernel, fbuf); else { boothowto &= ~RB_ASKNAME; i = 0; strcpy(kernel, kernels[i]); } } printf("Booting %s\n", kernel); if ((error = loadk(kernel, marks)) == 0) break; if (error != ENOENT) { printf("Cannot load %s: error=%d\n", kernel, error); boothowto |= RB_ASKNAME; } /* * if we have are not in askname mode, and we aren't using the * prom bootfile, try the next one (if it exits). otherwise, * go into askname mode. */ if ((boothowto & RB_ASKNAME) == 0 && i != -1 && kernels[++i]) { strcpy(kernel, kernels[i]); printf(": trying %s...\n", kernel); } else { printf("\n"); boothowto |= RB_ASKNAME; } } marks[MARK_END] = (((u_long)marks[MARK_END] + sizeof(u_long) - 1)) & (-sizeof(u_long)); arg = (prom_version() == PROM_OLDMON) ? (void *)PROM_LOADADDR : romp; /* Setup boot info structure at the end of the kernel image */ bootinfo = bi_init(marks[MARK_END] & loadaddrmask); /* Add kernel symbols to bootinfo */ bi_sym.nsym = marks[MARK_NSYM] & loadaddrmask; bi_sym.ssym = marks[MARK_SYM] & loadaddrmask; bi_sym.esym = marks[MARK_END] & loadaddrmask; bi_add(&bi_sym, BTINFO_SYMTAB, sizeof(bi_sym)); /* Add boothowto */ bi_howto.boothowto = boothowto; bi_add(&bi_howto, BTINFO_BOOTHOWTO, sizeof(bi_howto)); /* Add kernel path to bootinfo */ i = sizeof(struct btinfo_common) + strlen(kernel) + 1; /* Impose limit (somewhat arbitrary) */ if (i < BOOTINFO_SIZE / 2) { union { struct btinfo_kernelfile bi_file; char x[i]; } U; strcpy(U.bi_file.name, kernel); bi_add(&U.bi_file, BTINFO_KERNELFILE, i); } (*(entry_t)marks[MARK_ENTRY])(arg, 0, 0, 0, bootinfo, DDB_MAGIC2); _rtt(); }
void boot(uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t a4, uint32_t a5) { int fd, i; char *netbsd = ""; int maxmem; u_long marks[MARK_MAX]; char devname[32], file[32]; void (*entry)(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); struct btinfo_symtab bi_sym; struct btinfo_bootarg bi_arg; struct btinfo_bootpath bi_bpath; struct btinfo_systype bi_sys; int loadflag; /* Clear BSS. */ memset(_edata, 0, _end - _edata); /* * XXX a3 contains: * maxmem (nws-3xxx) * argv (apbus-based machine) */ if (a3 >= 0x80000000) apbus = 1; else apbus = 0; if (apbus) _sip = (void *)a4; printf("%s Secondary Boot, Revision %s\n", bootprog_name, bootprog_rev); if (apbus) { char *bootdev = (char *)a1; int argc = a2; char **argv = (char **)a3; DPRINTF("APbus-based system\n"); DPRINTF("argc = %d\n", argc); for (i = 0; i < argc; i++) { DPRINTF("argv[%d] = %s\n", i, argv[i]); if (argv[i][0] != '-' && *netbsd == 0) netbsd = argv[i]; } maxmem = _sip->apbsi_memsize; maxmem -= 0x100000; /* reserve 1MB for ROM monitor */ DPRINTF("howto = 0x%x\n", a0); DPRINTF("bootdev = %s\n", (char *)a1); DPRINTF("bootname = %s\n", netbsd); DPRINTF("maxmem = 0x%x\n", maxmem); /* XXX use "sonic()" instead of "tftp()" */ if (strncmp(bootdev, "tftp", 4) == 0) bootdev = "sonic"; strcpy(devname, bootdev); if (strchr(devname, '(') == NULL) strcat(devname, "()"); } else { int bootdev = a1; char *bootname = (char *)a2; int ctlr, unit, part, type; DPRINTF("HB system.\n"); /* bootname is "/boot" by default on HB system. */ if (bootname && strcmp(bootname, "/boot") != 0) netbsd = bootname; maxmem = a3; DPRINTF("howto = 0x%x\n", a0); DPRINTF("bootdev = 0x%x\n", a1); DPRINTF("bootname = %s\n", netbsd); DPRINTF("maxmem = 0x%x\n", maxmem); ctlr = BOOTDEV_CTLR(bootdev); unit = BOOTDEV_UNIT(bootdev); part = BOOTDEV_PART(bootdev); type = BOOTDEV_TYPE(bootdev); if (devs[type] == NULL) { printf("unknown bootdev (0x%x)\n", bootdev); _rtt(); } snprintf(devname, sizeof(devname), "%s(%d,%d,%d)", devs[type], ctlr, unit, part); } printf("Booting %s%s\n", devname, netbsd); /* use user specified kernel name if exists */ if (*netbsd) { kernels[0] = netbsd; kernels[1] = NULL; } loadflag = LOAD_KERNEL; if (devname[0] == 'f') /* XXX */ loadflag &= ~LOAD_BACKWARDS; marks[MARK_START] = 0; for (i = 0; kernels[i]; i++) { snprintf(file, sizeof(file), "%s%s", devname, kernels[i]); DPRINTF("trying %s...\n", file); fd = loadfile(file, marks, loadflag); if (fd != -1) break; } if (kernels[i] == NULL) _rtt(); DPRINTF("entry = 0x%x\n", (int)marks[MARK_ENTRY]); DPRINTF("ssym = 0x%x\n", (int)marks[MARK_SYM]); DPRINTF("esym = 0x%x\n", (int)marks[MARK_END]); bi_init(BOOTINFO_ADDR); bi_sym.nsym = marks[MARK_NSYM]; bi_sym.ssym = marks[MARK_SYM]; bi_sym.esym = marks[MARK_END]; bi_add(&bi_sym, BTINFO_SYMTAB, sizeof(bi_sym)); bi_arg.howto = a0; bi_arg.bootdev = a1; bi_arg.maxmem = maxmem; bi_arg.sip = (int)_sip; bi_add(&bi_arg, BTINFO_BOOTARG, sizeof(bi_arg)); strcpy(bi_bpath.bootpath, file); bi_add(&bi_bpath, BTINFO_BOOTPATH, sizeof(bi_bpath)); bi_sys.type = apbus ? NEWS5000 : NEWS3400; /* XXX */ bi_add(&bi_sys, BTINFO_SYSTYPE, sizeof(bi_sys)); entry = (void *)marks[MARK_ENTRY]; if (apbus) apcall_flushcache(); else mips1_flushicache(entry, marks[MARK_SYM] - marks[MARK_ENTRY]); printf("\n"); (*entry)(a0, a1, a2, a3, a4, a5); }