From owner-p4-projects@FreeBSD.ORG Mon Apr 1 19:30:41 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2C847BE6; Mon, 1 Apr 2013 19:30:41 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E23DCBE4 for ; Mon, 1 Apr 2013 19:30:40 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id D2646B54 for ; Mon, 1 Apr 2013 19:30:40 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r31JUexj024395 for ; Mon, 1 Apr 2013 19:30:40 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r31JUeJ8024392 for perforce@freebsd.org; Mon, 1 Apr 2013 19:30:40 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 1 Apr 2013 19:30:40 GMT Message-Id: <201304011930.r31JUeJ8024392@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 227282 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Apr 2013 19:30:41 -0000 http://p4web.freebsd.org/@@227282?ac=10 Change 227282 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/04/01 19:29:41 Various boot2 improvements: Teach MIPS boot2 to pass on information on the boot-time environment to loader using bootinfo. In particular, if we get passed a dtb, send it on to loader. Abstract the flash read interface very slightly so that we can more easily interpose a device switch later, and rename the flash-level read interface to cfi_read() to make it more reusable in loader. Scrub bootinfo a bit more of things that, at higher levels in the stack, will be handled by loader meta-data. Affected files ... .. //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/boot2/boot2.c#8 edit .. //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/common/drv.h#2 edit .. //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/common/flash.c#2 edit .. //depot/projects/ctsrd/beribsd/src/sys/mips/include/bootinfo.h#4 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/boot2/boot2.c#8 (text+ko) ==== @@ -56,9 +56,12 @@ #include +#include #include #include +extern register_t beri_argc, beri_argv, beri_envv, beri_memsize; + #define IO_KEYBOARD 1 #define IO_SERIAL 2 @@ -160,8 +163,8 @@ static uint32_t opts; #if 0 static int comspeed = SIOSPD; -static struct bootinfo bootinfo; #endif +struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; void exit(int); @@ -252,9 +255,9 @@ dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; dsk.unit = dsk.drive & DRV_MASK; dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1; +#endif bootinfo.bi_version = BOOTINFO_VERSION; bootinfo.bi_size = sizeof(bootinfo); -#endif /* Process configuration file */ @@ -391,8 +394,14 @@ MAKEBOOTDEV(dev_maj[dsk.type], dsk.slice, dsk.unit, dsk.part), 0, 0, 0, VTOP(&bootinfo)); #endif - ((void(*)(int, int, int, int))addr)(opts & RBX_MASK, /* board_id */ 0, 0, - 0); + bootinfo.bi_kernelname = kname; + bootinfo.bi_boot2opts = opts & RBX_MASK; + if (beri_memsize <= BERI_MEMVSDTB) + bootinfo.bi_memsize = beri_memsize; + else + bootinfo.bi_dtb = beri_memsize; + ((void(*)(int, int, int, void *))addr)(beri_argc, beri_argv, beri_envv, + &bootinfo); } static int @@ -455,6 +464,7 @@ #endif } else { for (q = arg--; *q && *q != '('; q++); +#if 0 if (*q) { drv = -1; if (arg[1] == ':') { @@ -494,6 +504,7 @@ ? DRV_HARD : 0) + drv; dsk_meta = 0; } +#endif if ((i = ep - arg)) { if ((size_t)i >= sizeof(knamebuf)) return -1; @@ -507,6 +518,14 @@ } static int +drvread(void *buf, unsigned lba, unsigned nblk) +{ + + /* XXXRW: Eventually, a device switch. */ + return (cfi_read(buf, lba, nblk)); +} + +static int dskread(void *buf, unsigned lba, unsigned nblk) { #if 0 ==== //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/common/drv.h#2 (text+ko) ==== @@ -31,7 +31,6 @@ #ifndef _DRV_H_ #define _DRV_H_ -struct dsk; -int drvread(void *buf, unsigned lba, unsigned nblk); +int cfi_read(void *buf, unsigned lba, unsigned blk); #endif ==== //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/common/flash.c#2 (text+ko) ==== @@ -49,7 +49,7 @@ #define CHERI_BOOTFS_LENGTH ((uintptr_t)&__cheri_flash_bootfs_len__) int -drvread(void *buf, unsigned lba, unsigned nblk) +cfi_read(void *buf, unsigned lba, unsigned nblk) { if ((lba << 9) + (nblk << 9) > CHERI_BOOTFS_LENGTH) ==== //depot/projects/ctsrd/beribsd/src/sys/mips/include/bootinfo.h#4 (text+ko) ==== @@ -56,20 +56,13 @@ /* bootinfo meta-data. */ uint32_t bi_version; uint32_t bi_size; - uint32_t bi_bootopts; - uint32_t _bi_pad0; /* bootinfo contents. */ + uint64_t bi_boot2opts; /* boot2 flags to loader. */ bi_ptr_t bi_kernelname; /* Pointer to name. */ bi_ptr_t bi_nfs_diskless;/* Pointer to NFS data. */ bi_ptr_t bi_dtb; /* Pointer to dtb. */ - bi_ptr_t bi_physmem; /* Physical memory size in bytes. */ - - /* Kernel bits. */ - bi_ptr_t bi_symtab; /* Symbol table... */ - bi_ptr_t bi_esymtab; /* ... */ - bi_ptr_t bi_kernend; /* End of kernel address space. */ - bi_ptr_t bi_envp; /* Kernel environment. */ + bi_ptr_t bi_memsize; /* Physical memory size in bytes. */ bi_ptr_t bi_modulep; /* Preloaded modules. */ };