Changeset View
Changeset View
Standalone View
Standalone View
stand/mips/beri/boot2/boot2.c
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
#include <sys/diskmbr.h> | #include <sys/diskmbr.h> | ||||
#include <sys/dirent.h> | #include <sys/dirent.h> | ||||
#include <sys/endian.h> | #include <sys/endian.h> | ||||
#include <sys/reboot.h> | #include <sys/reboot.h> | ||||
#include <machine/bootinfo.h> | #include <machine/bootinfo.h> | ||||
#include <machine/elf.h> | #include <machine/elf.h> | ||||
#include <ufs/ffs/fs.h> | |||||
#include <stand.h> | #include <stand.h> | ||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <beri.h> | #include <beri.h> | ||||
#include <cfi.h> | #include <cfi.h> | ||||
#include <cons.h> | #include <cons.h> | ||||
#include <mips.h> | #include <mips.h> | ||||
#include <sdcard.h> | #include <sdcard.h> | ||||
#include "paths.h" | #include "paths.h" | ||||
#include "rbx.h" | #include "rbx.h" | ||||
#include "ufsread.h" | |||||
static int beri_argc; | static int beri_argc; | ||||
static const char **beri_argv, **beri_envv; | static const char **beri_argv, **beri_envv; | ||||
static uint64_t beri_memsize; | static uint64_t beri_memsize; | ||||
#define IO_KEYBOARD 1 | #define IO_KEYBOARD 1 | ||||
#define IO_SERIAL 2 | #define IO_SERIAL 2 | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
uint32_t opts; | uint32_t opts; | ||||
#if 0 | #if 0 | ||||
static int comspeed = SIOSPD; | static int comspeed = SIOSPD; | ||||
#endif | #endif | ||||
struct bootinfo bootinfo; | struct bootinfo bootinfo; | ||||
static uint8_t ioctrl = IO_KEYBOARD; | static uint8_t ioctrl = IO_KEYBOARD; | ||||
void putchar(int); | void putchar(int); | ||||
int dskread(void *, unsigned, unsigned); | |||||
static void boot_fromdram(void); | static void boot_fromdram(void); | ||||
static void boot_fromfs(void); | static void boot_fromfs(void); | ||||
static void load(void); | static void load(void); | ||||
static int parse(void); | static int parse(void); | ||||
static int dskread(void *, unsigned, unsigned); | |||||
static int xputc(int); | static int xputc(int); | ||||
static int xgetc(int); | static int xgetc(int); | ||||
#define UFS_SMALL_CGBASE | |||||
#include "ufsread.c" | |||||
static struct dmadat __dmadat; | static struct dmadat __dmadat; | ||||
static inline int | static inline int | ||||
xfsread(ufs_ino_t inode, void *buf, size_t nbyte) | xfsread(ufs_ino_t inode, void *buf, size_t nbyte) | ||||
{ | { | ||||
if ((size_t)fsread(inode, buf, nbyte) != nbyte) { | if ((size_t)fsread(inode, buf, nbyte) != nbyte) { | ||||
printf("Invalid %s\n", "format"); | printf("Invalid %s\n", "format"); | ||||
return -1; | return -1; | ||||
▲ Show 20 Lines • Show All 378 Lines • ▼ Show 20 Lines | drvread(void *buf, unsigned lba, unsigned nblk) | ||||
case BOOTINFO_DEV_TYPE_SDCARD: | case BOOTINFO_DEV_TYPE_SDCARD: | ||||
return (altera_sdcard_read(buf, lba, nblk)); | return (altera_sdcard_read(buf, lba, nblk)); | ||||
default: | default: | ||||
return (-1); | return (-1); | ||||
} | } | ||||
} | } | ||||
static int | int | ||||
dskread(void *buf, unsigned lba, unsigned nblk) | dskread(void *buf, unsigned lba, unsigned nblk) | ||||
{ | { | ||||
#if 0 | #if 0 | ||||
/* | /* | ||||
* XXXRW: For now, assume no partition table around the file system; it's | * XXXRW: For now, assume no partition table around the file system; it's | ||||
* just in raw flash. | * just in raw flash. | ||||
*/ | */ | ||||
struct dos_partition *dp; | struct dos_partition *dp; | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |