Deleted Added
full compact
29c29
< __FBSDID("$FreeBSD: head/sys/boot/uboot/lib/copy.c 177152 2008-03-13 17:54:21Z obrien $");
---
> __FBSDID("$FreeBSD: head/sys/boot/uboot/lib/copy.c 235694 2012-05-20 18:07:35Z kientzle $");
31a32
> #include <stdint.h>
32a34,36
> #include "api_public.h"
> #include "glue.h"
>
35,36d38
< *
< * XXX should check load address/size against memory top.
38a41,73
> 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);
> }
>
42,43c77
<
< bcopy(src, (void *)dest, len);
---
> bcopy(src, uboot_vm_translate(dest), len);
50,51c84
<
< bcopy((void *)src, dest, len);
---
> bcopy(uboot_vm_translate(src), dest, len);
58,59c91
<
< return (read(fd, (void *) dest, len));
---
> return (read(fd, uboot_vm_translate(dest), len));