aboutsummaryrefslogtreecommitdiff
path: root/common/prom.h
blob: 9f81e768f53671e05701a6d684bfc58bc60dcb3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56


/*
 * Gets called before anything else - even the first printf
 *
 */
void prom_init(void );

void prom_restart(void );
void prom_return_interactive(void );
void prom_flush_cache_all(void );

void prom_fatal(const char *message, ...);
void prom_wait(const char *prompt);

/*
 * Gets called shortly after prom_init to intialize the malloc
 * subsystem based on the proms information about memory layout
 *
 */
void prom_init_malloc(void );

/*
 * Open may be used to open "partitions" passed in by name from the prom. It is the
 * proms abstraction layers responsibility to associate a file which associates to the
 * block device
 *
 */
int prom_open(char *name, int mode, FILE *stream);
int prom_close(FILE stream);
/*
 * Seek on the e.g. partition to a specific block indicated by a byte offset.
 *
 */
int prom_seek(FILE stream, long long position, int whence);

enum {
	O_RDONLY,
	O_RDWR,
};

enum {
	SEEK_SET,
	SEEK_CUR,
};

int prom_write(FILE stream, char *buf, unsigned long len, unsigned long *rlen);
int prom_read(FILE stream, char *buf, unsigned long len, unsigned long *rlen);


int prom_parse_args(int argc, char **argv);
void prom_add_arg(char *arg);
char *prom_get_label(void );
char *prom_get_partition(void );
char *prom_get_options(void );
void prom_get_karg(int *argc, char ***argv);