Skip to content

Commit 7c60423

Browse files
sgalabovtrini
authored andcommitted
api: Add FreeBSD API support for MIPS platforms
This patch adds U-Boot API support (used by FreeBSD loader) for MIPS platforms. Signed-off-by: Stanislav Galabov <sgalabov@gmail.com>
1 parent e4c1b4d commit 7c60423

4 files changed

Lines changed: 60 additions & 0 deletions

File tree

api/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
obj-y += api.o api_display.o api_net.o api_storage.o
88
obj-$(CONFIG_ARM) += api_platform-arm.o
99
obj-$(CONFIG_PPC) += api_platform-powerpc.o
10+
obj-$(CONFIG_MIPS) += api_platform-mips.o

api/api_platform-mips.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* (C) Copyright 2007 Stanislav Galabov <sgalabov@gmail.com>
3+
*
4+
* SPDX-License-Identifier: GPL-2.0+
5+
*
6+
* This file contains routines that fetch data from bd_info sources
7+
*/
8+
9+
#include <config.h>
10+
#include <linux/types.h>
11+
#include <api_public.h>
12+
13+
#include <asm/u-boot.h>
14+
#include <asm/global_data.h>
15+
16+
#include "api_private.h"
17+
18+
DECLARE_GLOBAL_DATA_PTR;
19+
20+
/*
21+
* Important notice: handling of individual fields MUST be kept in sync with
22+
* include/asm-generic/u-boot.h, so any changes
23+
* need to reflect their current state and layout of structures involved!
24+
*/
25+
int platform_sys_info(struct sys_info *si)
26+
{
27+
28+
platform_set_mr(si, gd->bd->bi_memstart,
29+
gd->bd->bi_memsize, MR_ATTR_DRAM);
30+
31+
return 1;
32+
}

examples/api/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ endif
1010
ifeq ($(ARCH),arm)
1111
LOAD_ADDR = 0x1000000
1212
endif
13+
ifeq ($(ARCH),mips)
14+
LOAD_ADDR = 0x80200000
15+
endif
1316

1417
# Resulting ELF and binary exectuables will be named demo and demo.bin
1518
extra-y = demo

examples/api/crt0.S

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,30 @@ syscall:
4040
ldr ip, =syscall_ptr
4141
ldr pc, [ip]
4242

43+
#elif defined(CONFIG_MIPS)
44+
.text
45+
.globl __start
46+
.ent __start
47+
__start:
48+
sw $sp, search_hint
49+
b main
50+
.end __start
51+
52+
.globl syscall
53+
.ent syscall
54+
syscall:
55+
sw $ra, return_addr
56+
lw $t9, syscall_ptr
57+
jalr $t9
58+
nop
59+
lw $ra, return_addr
60+
jr $ra
61+
nop
62+
.end syscall
63+
64+
return_addr:
65+
.align 4
66+
.long 0
4367
#else
4468
#error No support for this arch!
4569
#endif

0 commit comments

Comments
 (0)