Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145058384
D5312.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D5312.diff
View Options
Index: head/sys/boot/common/Makefile.inc
===================================================================
--- head/sys/boot/common/Makefile.inc
+++ head/sys/boot/common/Makefile.inc
@@ -20,6 +20,8 @@
SRCS+= load_elf64.c reloc_elf64.c
.elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el"
SRCS+= load_elf64.c reloc_elf64.c
+.elif ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mipsel"
+SRCS+= load_elf32.c reloc_elf32.c
.endif
.if defined(LOADER_NET_SUPPORT)
Index: head/sys/boot/common/dev_net.c
===================================================================
--- head/sys/boot/common/dev_net.c
+++ head/sys/boot/common/dev_net.c
@@ -164,8 +164,7 @@
* info from bootp or other sources.
*/
d = socktodesc(netdev_sock);
- sprintf(temp, "%6D", d->myea, ":");
- setenv("boot.netif.hwaddr", temp, 1);
+ setenv("boot.netif.hwaddr", ether_sprintf(d->myea), 1);
setenv("boot.netif.ip", inet_ntoa(myip), 1);
setenv("boot.netif.netmask", intoa(netmask), 1);
setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
Index: head/sys/boot/fdt/fdt_loader_cmd.c
===================================================================
--- head/sys/boot/fdt/fdt_loader_cmd.c
+++ head/sys/boot/fdt/fdt_loader_cmd.c
@@ -296,8 +296,8 @@
/* If we were given the address of a valid blob in memory, use it. */
if (fdt_to_load != NULL) {
if (fdt_load_dtb_addr(fdt_to_load) == 0) {
- printf("Using DTB from memory address 0x%08X.\n",
- (unsigned int)fdt_to_load);
+ printf("Using DTB from memory address 0x%p.\n",
+ fdt_to_load);
return (0);
}
}
@@ -427,6 +427,7 @@
}
}
+#ifdef notyet
static int
fdt_reg_valid(uint32_t *reg, int len, int addr_cells, int size_cells)
{
@@ -458,6 +459,7 @@
}
return (0);
}
+#endif
void
fdt_fixup_memory(struct fdt_mem_region *region, size_t num)
Index: head/sys/boot/uboot/common/main.c
===================================================================
--- head/sys/boot/uboot/common/main.c
+++ head/sys/boot/uboot/common/main.c
@@ -132,8 +132,8 @@
for (i = 0; i < 3; i++) {
size = memsize(si, t[i]);
if (size > 0)
- printf("%s: %lldMB\n", ub_mem_type(t[i]),
- size / 1024 / 1024);
+ printf("%s: %juMB\n", ub_mem_type(t[i]),
+ (uintmax_t)(size / 1024 / 1024));
}
}
@@ -426,7 +426,7 @@
* Set up console.
*/
cons_probe();
- printf("Compatible U-Boot API signature found @%x\n", (uint32_t)sig);
+ printf("Compatible U-Boot API signature found @%p\n", sig);
printf("\n");
printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
@@ -511,7 +511,7 @@
command_heap(int argc, char *argv[])
{
- printf("heap base at %p, top at %p, used %d\n", end, sbrk(0),
+ printf("heap base at %p, top at %p, used %td\n", end, sbrk(0),
sbrk(0) - end);
return (CMD_OK);
Index: head/sys/boot/uboot/lib/disk.c
===================================================================
--- head/sys/boot/uboot/lib/disk.c
+++ head/sys/boot/uboot/lib/disk.c
@@ -156,7 +156,8 @@
}
if (size % SI(dev).bsize) {
- stor_printf("size=%d not multiple of device block size=%d\n",
+ stor_printf("size=%zu not multiple of device "
+ "block size=%d\n",
size, SI(dev).bsize);
return (EIO);
}
Index: head/sys/boot/uboot/lib/elf_freebsd.c
===================================================================
--- head/sys/boot/uboot/lib/elf_freebsd.c
+++ head/sys/boot/uboot/lib/elf_freebsd.c
@@ -31,6 +31,10 @@
#include <sys/param.h>
#include <sys/linker.h>
+#ifdef __mips__
+#include <sys/proc.h>
+#include <machine/frame.h>
+#endif
#include <machine/md_var.h>
#include <machine/metadata.h>
#include <machine/elf.h>
@@ -81,7 +85,7 @@
return (error);
entry = (void *)e->e_entry;
- printf("Kernel entry at 0x%x...\n", (unsigned)entry);
+ printf("Kernel entry at 0x%p...\n", entry);
dev_cleanup();
printf("Kernel args: %s\n", fp->f_args);
Index: head/sys/boot/uboot/lib/glue.h
===================================================================
--- head/sys/boot/uboot/lib/glue.h
+++ head/sys/boot/uboot/lib/glue.h
@@ -35,6 +35,26 @@
#include "api_public.h"
+/*
+ * Mask used to align the start address for API signature search to 1MiB
+ */
+#define API_SIG_SEARCH_MASK ~0x000fffff
+
+#ifdef __mips__
+/*
+ * On MIPS, U-Boot passes us a hint address, which is very close to the end of
+ * RAM (less than 1MiB), so searching for the API signature within more than
+ * that leads to exception.
+ */
+#define API_SIG_SEARCH_LEN 0x00100000
+#else
+/*
+ * Search for the API signature within 3MiB of the 1MiB-aligned address that
+ * U-Boot has hinted us.
+ */
+#define API_SIG_SEARCH_LEN 0x00300000
+#endif
+
int syscall(int, int *, ...);
void *syscall_ptr;
Index: head/sys/boot/uboot/lib/glue.c
===================================================================
--- head/sys/boot/uboot/lib/glue.c
+++ head/sys/boot/uboot/lib/glue.c
@@ -83,8 +83,9 @@
if (uboot_address == 0)
uboot_address = 255 * 1024 * 1024;
- sp = (void *)(uboot_address & ~0x000fffff);
- spend = sp + 0x00300000 - API_SIG_MAGLEN;
+ sp = (void *)(uboot_address & API_SIG_SEARCH_MASK);
+ spend = sp + API_SIG_SEARCH_LEN - API_SIG_MAGLEN;
+
while (sp < spend) {
if (!bcmp(sp, API_SIG_MAGIC, API_SIG_MAGLEN)) {
*sig = (struct api_signature *)sp;
@@ -109,7 +110,7 @@
{
int c;
- if (!syscall(API_GETC, NULL, (uint32_t)&c))
+ if (!syscall(API_GETC, NULL, &c))
return (-1);
return (c);
@@ -120,24 +121,24 @@
{
int t;
- if (!syscall(API_TSTC, NULL, (uint32_t)&t))
+ if (!syscall(API_TSTC, NULL, &t))
return (-1);
return (t);
}
void
-ub_putc(char c)
+ub_putc(const char c)
{
- syscall(API_PUTC, NULL, (uint32_t)&c);
+ syscall(API_PUTC, NULL, &c);
}
void
ub_puts(const char *s)
{
- syscall(API_PUTS, NULL, (uint32_t)s);
+ syscall(API_PUTS, NULL, s);
}
/****************************************
@@ -166,7 +167,7 @@
si.mr_no = UB_MAX_MR;
memset(&mr, 0, sizeof(mr));
- if (!syscall(API_GET_SYS_INFO, &err, (u_int32_t)&si))
+ if (!syscall(API_GET_SYS_INFO, &err, &si))
return (NULL);
return ((err) ? NULL : &si);
@@ -433,7 +434,7 @@
int i;
printf("device info (%d):\n", handle);
- printf(" cookie\t= 0x%08x\n", (uint32_t)di->cookie);
+ printf(" cookie\t= 0x%p\n", di->cookie);
printf(" type\t\t= 0x%08x\n", di->type);
if (di->type == DEV_TYP_NET) {
@@ -483,7 +484,7 @@
{
char *value;
- if (!syscall(API_ENV_GET, NULL, (uint32_t)name, (uint32_t)&value))
+ if (!syscall(API_ENV_GET, NULL, name, &value))
return (NULL);
return (value);
@@ -493,7 +494,7 @@
ub_env_set(const char *name, char *value)
{
- syscall(API_ENV_SET, NULL, (uint32_t)name, (uint32_t)value);
+ syscall(API_ENV_SET, NULL, name, value);
}
static char env_name[256];
@@ -510,7 +511,7 @@
* internally, which handles such case
*/
env = NULL;
- if (!syscall(API_ENV_ENUM, NULL, (uint32_t)last, (uint32_t)&env))
+ if (!syscall(API_ENV_ENUM, NULL, last, &env))
return (NULL);
if (env == NULL || last == env)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 16, 12:25 PM (17 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28778244
Default Alt Text
D5312.diff (6 KB)
Attached To
Mode
D5312: Prepare sys/boot for MIPS (32 and 64 bit) ubldr support
Attached
Detach File
Event Timeline
Log In to Comment