From owner-svn-src-projects@FreeBSD.ORG Sat Jun 23 19:49:19 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6134D1065674; Sat, 23 Jun 2012 19:49:19 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A7488FC0A; Sat, 23 Jun 2012 19:49:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NJnJRn061373; Sat, 23 Jun 2012 19:49:19 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NJnJoL061363; Sat, 23 Jun 2012 19:49:19 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201206231949.q5NJnJoL061363@svn.freebsd.org> From: Tim Kientzle Date: Sat, 23 Jun 2012 19:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237506 - in projects/armv6/sys/boot: arm/uboot fdt uboot/common uboot/lib X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 19:49:19 -0000 Author: kientzle Date: Sat Jun 23 19:49:18 2012 New Revision: 237506 URL: http://svn.freebsd.org/changeset/base/237506 Log: Merge from -CURRENT: Fix ubldr to work correctly on the TI AM335x-based BeagleBone. In particular: * Query U-Boot's memory map to automatically determine where to load the kernel, * rework a lot of the loader FDT code to correctly use copyin()/copyout() to access the in-kernel FDT, * allow ubldr to be easily rebuilt with different load addresses, * fix a few NULL pointer dereferences, * support MBR partitions Modified: projects/armv6/sys/boot/arm/uboot/Makefile projects/armv6/sys/boot/arm/uboot/ldscript.arm projects/armv6/sys/boot/fdt/fdt_loader_cmd.c projects/armv6/sys/boot/uboot/common/metadata.c projects/armv6/sys/boot/uboot/lib/copy.c projects/armv6/sys/boot/uboot/lib/devicename.c projects/armv6/sys/boot/uboot/lib/disk.c projects/armv6/sys/boot/uboot/lib/elf_freebsd.c projects/armv6/sys/boot/uboot/lib/libuboot.h Directory Properties: projects/armv6/sys/boot/ (props changed) Modified: projects/armv6/sys/boot/arm/uboot/Makefile ============================================================================== --- projects/armv6/sys/boot/arm/uboot/Makefile Sat Jun 23 19:46:07 2012 (r237505) +++ projects/armv6/sys/boot/arm/uboot/Makefile Sat Jun 23 19:49:18 2012 (r237506) @@ -7,6 +7,9 @@ NEWVERSWHAT= "U-Boot loader" ${MACHINE_A BINDIR?= /boot INSTALLFLAGS= -b WARNS?= 1 +# Address at which ubldr will be loaded. +# This varies for different boards and SOCs. +UBLDR_LOADADDR?= 0x1000000 # Architecture-specific loader code SRCS= start.S conf.c vers.c @@ -77,7 +80,9 @@ CLEANFILES+= vers.c loader.help CFLAGS+= -ffreestanding -LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} +LDFLAGS= -nostdlib -static +LDFLAGS+= -T ldscript.generated +LDFLAGS+= -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} # Pull in common loader code .PATH: ${.CURDIR}/../../uboot/common @@ -102,6 +107,18 @@ loader.help: help.common help.uboot cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} +${PROG}: ldscript.generated ${.CURDIR}/ldscript.${MACHINE_CPUARCH} + +ldscript.generated:: + rm -f ldscript.generated.tmp + echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >ldscript.generated.tmp + if diff ldscript.generated ldscript.generated.tmp > /dev/null; then \ + true; \ + else \ + rm -f ldscript.generated; \ + mv ldscript.generated.tmp ldscript.generated; \ + fi + .PATH: ${.CURDIR}/../../forth FILES= loader.help Modified: projects/armv6/sys/boot/arm/uboot/ldscript.arm ============================================================================== --- projects/armv6/sys/boot/arm/uboot/ldscript.arm Sat Jun 23 19:46:07 2012 (r237505) +++ projects/armv6/sys/boot/arm/uboot/ldscript.arm Sat Jun 23 19:49:18 2012 (r237506) @@ -5,7 +5,7 @@ ENTRY(_start) SECTIONS { /* Read-only sections, merged into text segment: */ - . = 0x1000000 + SIZEOF_HEADERS; + . = UBLDR_LOADADDR + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } Modified: projects/armv6/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- projects/armv6/sys/boot/fdt/fdt_loader_cmd.c Sat Jun 23 19:46:07 2012 (r237505) +++ projects/armv6/sys/boot/fdt/fdt_loader_cmd.c Sat Jun 23 19:49:18 2012 (r237506) @@ -57,11 +57,17 @@ __FBSDID("$FreeBSD$"); #define STR(number) #number #define STRINGIFY(number) STR(number) -#define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) +#define COPYOUT(s,d,l) archsw.arch_copyout(s, d, l) +#define COPYIN(s,d,l) archsw.arch_copyin(s, d, l) #define FDT_STATIC_DTB_SYMBOL "fdt_static_dtb" +/* Local copy of FDT */ static struct fdt_header *fdtp = NULL; +/* Size of FDT blob */ +static size_t fdtp_size = 0; +/* Location of FDT in kernel or module */ +static vm_offset_t fdtp_va = 0; static int fdt_cmd_nyi(int argc, char *argv[]); @@ -98,21 +104,19 @@ static const struct cmdtab commands[] = static char cwd[FDT_CWD_LEN] = "/"; static vm_offset_t -fdt_find_static_dtb(void) +fdt_find_static_dtb() { + Elf_Dyn dyn; Elf_Sym sym; - vm_offset_t dyntab, esym; + vm_offset_t dyntab, esym, strtab, symtab, fdt_start; uint64_t offs; struct preloaded_file *kfp; struct file_metadata *md; - Elf_Sym *symtab; - Elf_Dyn *dyn; - char *strtab, *strp; - int i, sym_count; - - symtab = NULL; - dyntab = esym = 0; - strtab = strp = NULL; + char *strp; + int sym_count; + + symtab = strtab = dyntab = esym = 0; + strp = NULL; offs = __elfN(relocation_offset); @@ -123,28 +127,29 @@ fdt_find_static_dtb(void) md = file_findmetadata(kfp, MODINFOMD_ESYM); if (md == NULL) return (0); - COPYOUT(md->md_data, &esym, sizeof(esym)); + bcopy(md->md_data, &esym, sizeof(esym)); + // esym is already offset md = file_findmetadata(kfp, MODINFOMD_DYNAMIC); if (md == NULL) return (0); - COPYOUT(md->md_data, &dyntab, sizeof(dyntab)); - + bcopy(md->md_data, &dyntab, sizeof(dyntab)); dyntab += offs; /* Locate STRTAB and DYNTAB */ - for (dyn = (Elf_Dyn *)dyntab; dyn->d_tag != DT_NULL; dyn++) { - if (dyn->d_tag == DT_STRTAB) { - strtab = (char *)(uintptr_t)(dyn->d_un.d_ptr + offs); - continue; - } else if (dyn->d_tag == DT_SYMTAB) { - symtab = (Elf_Sym *)(uintptr_t) - (dyn->d_un.d_ptr + offs); - continue; + for (;;) { + COPYOUT(dyntab, &dyn, sizeof(dyn)); + if (dyn.d_tag == DT_STRTAB) { + strtab = (vm_offset_t)(dyn.d_un.d_ptr) + offs; + } else if (dyn.d_tag == DT_SYMTAB) { + symtab = (vm_offset_t)(dyn.d_un.d_ptr) + offs; + } else if (dyn.d_tag == DT_NULL) { + break; } + dyntab += sizeof(dyn); } - if (symtab == NULL || strtab == NULL) { + if (symtab == 0 || strtab == 0) { /* * No symtab? No strtab? That should not happen here, * and should have been verified during __elfN(loadimage). @@ -153,7 +158,7 @@ fdt_find_static_dtb(void) return (0); } - sym_count = (int)((Elf_Sym *)esym - symtab) / sizeof(Elf_Sym); + sym_count = (int)(esym - symtab) / sizeof(Elf_Sym); /* * The most efficent way to find a symbol would be to calculate a @@ -165,26 +170,27 @@ fdt_find_static_dtb(void) * we are eliminating symbols type of which is not STT_NOTYPE, or(and) * those which binding attribute is not STB_GLOBAL. */ - for (i = 0; i < sym_count; i++) { - COPYOUT(symtab + i, &sym, sizeof(sym)); + fdt_start = 0; + while (sym_count > 0 && fdt_start == 0) { + COPYOUT(symtab, &sym, sizeof(sym)); + symtab += sizeof(sym); + --sym_count; if (ELF_ST_BIND(sym.st_info) != STB_GLOBAL || ELF_ST_TYPE(sym.st_info) != STT_NOTYPE) continue; - - strp = strdupout((vm_offset_t)(strtab + sym.st_name)); - if (strcmp(strp, FDT_STATIC_DTB_SYMBOL) == 0) { - /* Found a match ! */ - free(strp); - return ((vm_offset_t)(sym.st_value + offs)); - } + strp = strdupout(strtab + sym.st_name); + if (strcmp(strp, FDT_STATIC_DTB_SYMBOL) == 0) + fdt_start = (vm_offset_t)sym.st_value + offs; free(strp); } - return (0); + printf("fdt_start: 0x%08jX\n", (intmax_t)fdt_start); + return (fdt_start); } static int fdt_setup_fdtp() { + struct fdt_header header; struct preloaded_file *bfp; int err; @@ -193,15 +199,26 @@ fdt_setup_fdtp() */ bfp = file_findfile(NULL, "dtb"); if (bfp == NULL) { - if ((fdtp = (struct fdt_header *)fdt_find_static_dtb()) == 0) { + if ((fdtp_va = fdt_find_static_dtb()) == 0) { command_errmsg = "no device tree blob found!"; + printf("%s\n", command_errmsg); return (CMD_ERROR); } } else { /* Dynamic blob has precedence over static. */ - fdtp = (struct fdt_header *)bfp->f_addr; + fdtp_va = bfp->f_addr; } + COPYOUT(fdtp_va, &header, sizeof(header)); + fdtp_size = fdt_totalsize(&header); + fdtp = malloc(fdtp_size); + if (fdtp == NULL) { + command_errmsg = "can't allocate memory for device tree copy"; + printf("%s\n", command_errmsg); + return (CMD_ERROR); + } + COPYOUT(fdtp_va, fdtp, fdtp_size); + /* * Validate the blob. */ @@ -317,6 +334,8 @@ fixup_cpubusfreqs(unsigned long cpufreq, /* We want to modify every subnode of /cpus */ o = fdt_path_offset(fdtp, "/cpus"); + if (o < 0) + return; /* maxo should contain offset of node next to /cpus */ depth = 0; @@ -545,7 +564,7 @@ fixup_stdout(const char *env) /* * Locate the blob, fix it up and return its location. */ -void * +vm_offset_t fdt_fixup(void) { const char *env; @@ -561,7 +580,7 @@ fdt_fixup(void) err = fdt_setup_fdtp(); if (err) { sprintf(command_errbuf, "No valid device tree blob found!"); - return (NULL); + return (0); } /* Create /chosen node (if not exists) */ @@ -616,7 +635,9 @@ fdt_fixup(void) fdt_setprop(fdtp, chosen, "fixup-applied", NULL, 0); success: - return (fdtp); + /* Overwrite the FDT with the fixed version. */ + COPYIN(fdtp, fdtp_va, fdtp_size); + return (fdtp_va); } int @@ -634,7 +655,7 @@ command_fdt_internal(int argc, char *arg /* * Check if uboot env vars were parsed already. If not, do it now. */ - if (fdt_fixup() == NULL) + if (fdt_fixup() == 0) return (CMD_ERROR); /* @@ -1151,6 +1172,8 @@ fdt_modprop(int nodeoff, char *propname, else sprintf(command_errbuf, "Could not add/modify property!\n"); + } else { + COPYIN(fdtp, fdtp_va, fdtp_size); } return (rv); } @@ -1371,6 +1394,8 @@ fdt_cmd_rm(int argc, char *argv[]) if (rv) { sprintf(command_errbuf, "could not delete node"); return (CMD_ERROR); + } else { + COPYIN(fdtp, fdtp_va, fdtp_size); } return (CMD_OK); } @@ -1401,6 +1426,8 @@ fdt_cmd_mknode(int argc, char *argv[]) sprintf(command_errbuf, "Could not add node!\n"); return (CMD_ERROR); + } else { + COPYIN(fdtp, fdtp_va, fdtp_size); } return (CMD_OK); } Modified: projects/armv6/sys/boot/uboot/common/metadata.c ============================================================================== --- projects/armv6/sys/boot/uboot/common/metadata.c Sat Jun 23 19:46:07 2012 (r237505) +++ projects/armv6/sys/boot/uboot/common/metadata.c Sat Jun 23 19:49:18 2012 (r237506) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include "glue.h" #if defined(LOADER_FDT_SUPPORT) -extern int fdt_fixup(void); +extern vm_offset_t fdt_fixup(void); #endif /* @@ -72,6 +72,7 @@ static int md_getboothowto(char *kargs) { char *cp; + char *p; int howto; int active; int i; @@ -132,10 +133,12 @@ md_getboothowto(char *kargs) if (getenv(howto_names[i].ev) != NULL) howto |= howto_names[i].mask; } - if (!strcmp(getenv("console"), "comconsole")) - howto |= RB_SERIAL; - if (!strcmp(getenv("console"), "nullconsole")) - howto |= RB_MUTE; + if ((p = getenv("console"))) { + if (!strcmp(p, "comconsole")) + howto |= RB_SERIAL; + if (!strcmp(p, "nullconsole")) + howto |= RB_MUTE; + } return(howto); } @@ -334,7 +337,7 @@ md_load(char *args, vm_offset_t *modulep #if defined(LOADER_FDT_SUPPORT) /* Handle device tree blob */ dtbp = fdt_fixup(); - if (dtbp != (vm_offset_t)NULL) + if (dtbp != 0) file_addmetadata(kfp, MODINFOMD_DTBP, sizeof dtbp, &dtbp); else pager_output("WARNING! Trying to fire up the kernel, but no " Modified: projects/armv6/sys/boot/uboot/lib/copy.c ============================================================================== --- projects/armv6/sys/boot/uboot/lib/copy.c Sat Jun 23 19:46:07 2012 (r237505) +++ projects/armv6/sys/boot/uboot/lib/copy.c Sat Jun 23 19:49:18 2012 (r237506) @@ -29,32 +29,64 @@ __FBSDID("$FreeBSD$"); #include +#include + +#include "api_public.h" +#include "glue.h" /* * MD primitives supporting placement of module data - * - * XXX should check load address/size against memory top. */ +void * +uboot_vm_translate(vm_offset_t o) { + struct sys_info *si; + static uintptr_t start = 0; + static size_t size = 0; + int i; + + if (size == 0) { + if ((si = ub_get_sys_info()) == NULL) + panic("could not retrieve system info"); + + /* Find start/size of largest DRAM block. */ + for (i = 0; i < si->mr_no; i++) { + if (si->mr[i].flags == MR_ATTR_DRAM + && si->mr[i].size > size) { + start = si->mr[i].start; + size = si->mr[i].size; + } + } + + if (size <= 0) + panic("No suitable DRAM?\n"); + /* + printf("Loading into memory region 0x%08X-0x%08X (%d MiB)\n", + start, start + size, size / 1024 / 1024); + */ + } + if (o > size) + panic("Address 0x%08jX bigger than size 0x%08X\n", + (intmax_t)o, size); + return (void *)(start + o); +} + ssize_t uboot_copyin(const void *src, vm_offset_t dest, const size_t len) { - - bcopy(src, (void *)dest, len); + bcopy(src, uboot_vm_translate(dest), len); return (len); } ssize_t uboot_copyout(const vm_offset_t src, void *dest, const size_t len) { - - bcopy((void *)src, dest, len); + bcopy(uboot_vm_translate(src), dest, len); return (len); } ssize_t uboot_readin(const int fd, vm_offset_t dest, const size_t len) { - - return (read(fd, (void *) dest, len)); + return (read(fd, uboot_vm_translate(dest), len)); } Modified: projects/armv6/sys/boot/uboot/lib/devicename.c ============================================================================== --- projects/armv6/sys/boot/uboot/lib/devicename.c Sat Jun 23 19:46:07 2012 (r237505) +++ projects/armv6/sys/boot/uboot/lib/devicename.c Sat Jun 23 19:49:18 2012 (r237506) @@ -131,6 +131,10 @@ uboot_parsedev(struct uboot_devdesc **de *(cp + 1) != ':') { pnum = strtol(cp + 1, &cp, 10); ptype = PTYPE_GPT; + } else if (*cp == 's' && *(cp + 1) && + *(cp + 1) != ':') { + pnum = strtol(cp + 1, &cp, 10); + ptype = PTYPE_MBR; } else { pnum = *cp - 'a'; ptype = PTYPE_BSDLABEL; @@ -218,6 +222,9 @@ uboot_fmtdev(void *vdev) else if (dev->d_kind.disk.ptype == PTYPE_GPT) cp += sprintf(cp, "p%i", dev->d_kind.disk.pnum); + else if (dev->d_kind.disk.ptype == PTYPE_MBR) + cp += sprintf(cp, "s%i", + dev->d_kind.disk.pnum); } strcat(cp, ":"); Modified: projects/armv6/sys/boot/uboot/lib/disk.c ============================================================================== --- projects/armv6/sys/boot/uboot/lib/disk.c Sat Jun 23 19:46:07 2012 (r237505) +++ projects/armv6/sys/boot/uboot/lib/disk.c Sat Jun 23 19:49:18 2012 (r237506) @@ -398,6 +398,94 @@ out: } static int +stor_open_mbr(struct open_dev *od, struct uboot_devdesc *dev) +{ + char *buf = NULL; + struct dos_partition *dp; + int err, i, part; + + od->od_nparts = 0; + od->od_partitions = NULL; + + /* Block size must be at least 512 bytes. */ + if (od->od_bsize < 512) + return (ENXIO); + + /* Read MBR */ + buf = malloc(od->od_bsize); + if (!buf) { + stor_printf("could not allocate memory for MBR\n"); + return (ENOMEM); + } + err = stor_readdev(dev, 0, 1, buf); + if (err) { + stor_printf("MBR read error=%d\n", err); + err = EIO; + goto out; + } + + /* Check the slice table magic. */ + if (le16toh(*((uint16_t *)(buf + DOSMAGICOFFSET))) != DOSMAGIC) { + err = ENXIO; + goto out; + } + + /* Save information about partitions. */ + dp = (struct dos_partition *)(buf + DOSPARTOFF); + od->od_partitions = calloc(NDOSPART, sizeof(struct gpt_part)); + if (!od->od_partitions) { + stor_printf("could not allocate memory for MBR partitions\n"); + err = ENOMEM; + goto out; + } + + part = 0; + for (i = 0; i < NDOSPART; i++) { + u_int32_t start = le32dec(&dp[i].dp_start); + u_int32_t size = le32dec(&dp[i].dp_size); + uuid_t *u = NULL; + + /* Map MBR partition types to GPT partition types. */ + switch (dp[i].dp_typ) { + case DOSPTYP_386BSD: + u = &freebsd_ufs; + break; + /* XXX Other types XXX */ + } + + if (u) { + od->od_partitions[part].gp_type = *u; + od->od_partitions[part].gp_index = i + 1; + od->od_partitions[part].gp_start = start; + od->od_partitions[part].gp_end = start + size; + part += 1; + } + } + od->od_nparts = part; + + if (od->od_nparts == 0) { + err = EINVAL; + goto out; + } + + dev->d_disk.ptype = PTYPE_MBR; + + /* XXX Be smarter here? XXX */ + if (dev->d_disk.pnum == 0) + dev->d_disk.pnum = od->od_partitions[0].gp_index; + + for (i = 0; i < od->od_nparts; i++) + if (od->od_partitions[i].gp_index == dev->d_disk.pnum) + od->od_bstart = od->od_partitions[i].gp_start; + +out: + if (err && od->od_partitions) + free(od->od_partitions); + free(buf); + return (err); +} + +static int stor_open_bsdlabel(struct open_dev *od, struct uboot_devdesc *dev) { char *buf; @@ -443,7 +531,7 @@ stor_readdev(struct uboot_devdesc *dev, lbasize_t real_size; int err, handle; - debugf("reading size=%d @ 0x%08x\n", size, (uint32_t)buf); + debugf("reading blk=%d size=%d @ 0x%08x\n", (int)blk, size, (uint32_t)buf); handle = stor_info[dev->d_unit]; err = ub_dev_read(handle, buf, size, blk, &real_size); @@ -495,7 +583,10 @@ stor_opendev(struct open_dev **odp, stru od->od_bsize = di->di_stor.block_size; od->od_bstart = 0; - if ((err = stor_open_gpt(od, dev)) != 0) + err = stor_open_gpt(od, dev); + if (err != 0) + err = stor_open_mbr(od, dev); + if (err != 0) err = stor_open_bsdlabel(od, dev); if (err != 0) @@ -517,6 +608,8 @@ stor_closedev(struct uboot_devdesc *dev) od = (struct open_dev *)dev->d_disk.data; if (dev->d_disk.ptype == PTYPE_GPT && od->od_nparts != 0) free(od->od_partitions); + if (dev->d_disk.ptype == PTYPE_MBR && od->od_nparts != 0) + free(od->od_partitions); free(od); dev->d_disk.data = NULL; Modified: projects/armv6/sys/boot/uboot/lib/elf_freebsd.c ============================================================================== --- projects/armv6/sys/boot/uboot/lib/elf_freebsd.c Sat Jun 23 19:46:07 2012 (r237505) +++ projects/armv6/sys/boot/uboot/lib/elf_freebsd.c Sat Jun 23 19:49:18 2012 (r237506) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" +#include "libuboot.h" extern vm_offset_t md_load(char *, vm_offset_t *); @@ -69,6 +70,7 @@ __elfN(uboot_exec)(struct preloaded_file vm_offset_t mdp; Elf_Ehdr *e; int error; + void (*entry)(void *); if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) return (EFTYPE); @@ -78,11 +80,12 @@ __elfN(uboot_exec)(struct preloaded_file if ((error = md_load(fp->f_args, &mdp)) != 0) return (error); - printf("Kernel entry at 0x%x ...\n", e->e_entry); + entry = uboot_vm_translate(e->e_entry); + printf("Kernel entry at 0x%x...\n", (unsigned)entry); dev_cleanup(); - (*(void (*)())e->e_entry)((void *)mdp); + (*entry)((void *)mdp); panic("exec returned"); } Modified: projects/armv6/sys/boot/uboot/lib/libuboot.h ============================================================================== --- projects/armv6/sys/boot/uboot/lib/libuboot.h Sat Jun 23 19:46:07 2012 (r237505) +++ projects/armv6/sys/boot/uboot/lib/libuboot.h Sat Jun 23 19:49:18 2012 (r237506) @@ -45,6 +45,7 @@ struct uboot_devdesc #define PTYPE_BSDLABEL 1 #define PTYPE_GPT 2 +#define PTYPE_MBR 3 /* * Default network packet alignment in memory @@ -59,6 +60,7 @@ extern int devs_no; extern struct netif_driver uboot_net; extern struct devsw uboot_storage; +void *uboot_vm_translate(vm_offset_t); ssize_t uboot_copyin(const void *src, vm_offset_t dest, const size_t len); ssize_t uboot_copyout(const vm_offset_t src, void *dest, const size_t len); ssize_t uboot_readin(const int fd, vm_offset_t dest, const size_t len);