xref: /openbsd/sys/arch/loongson/stand/boot/libsa.h (revision 17df1aa7)
1 /*	$OpenBSD: libsa.h,v 1.4 2010/04/03 19:13:27 miod Exp $	*/
2 
3 /*
4  * Copyright (c) 2010 Miodrag Vallat.
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #include <lib/libsa/stand.h>
20 
21 #define	DEFAULT_KERNEL_ADDRESS	0
22 
23 /* where the initrd is loaded */
24 #define	INITRD_BASE	PHYS_TO_CKSEG0(0x04000000)
25 
26 /*
27  * MD interfaces for MI boot(9)
28  */
29 void	devboot(dev_t, char *);
30 void	machdep(void);
31 void	run_loadfile(u_long *, int);
32 
33 /*
34  * PMON console
35  */
36 void	pmon_cnprobe(struct consdev *);
37 void	pmon_cninit(struct consdev *);
38 int	pmon_cngetc(dev_t);
39 void	pmon_cnputc(dev_t, int);
40 
41 /*
42  * PMON I/O
43  */
44 int	pmon_iostrategy(void *, int, daddr_t, size_t, void *, size_t *);
45 int	pmon_ioopen(struct open_file *, ...);
46 int	pmon_ioclose(struct open_file *);
47 
48 /*
49  * INITRD I/O
50  */
51 int	rd_iostrategy(void *, int, daddr_t, size_t, void *, size_t *);
52 int	rd_ioopen(struct open_file *, ...);
53 int	rd_ioclose(struct open_file *);
54 int	rd_isvalid(void);
55 void	rd_invalidate(void);
56 
57 /*
58  * INITRD ``filesystem''
59  */
60 int	rdfs_open(char *path, struct open_file *f);
61 int	rdfs_close(struct open_file *f);
62 int	rdfs_read(struct open_file *f, void *buf, size_t size, size_t *resid);
63 int	rdfs_write(struct open_file *f, void *buf, size_t size, size_t *resid);
64 off_t	rdfs_seek(struct open_file *f, off_t offset, int where);
65 int	rdfs_stat(struct open_file *f, struct stat *sb);
66 int	rdfs_readdir(struct open_file *f, char *name);
67 
68 extern int pmon_argc;
69 extern int32_t *pmon_argv;
70 extern int32_t *pmon_envp;
71 extern int32_t pmon_callvec;
72 
73 extern char pmon_bootdev[];
74 
75 extern char *kernelfile;
76