xref: /openbsd-src/sys/arch/loongson/stand/boot/libsa.h (revision a4f11372d5ec16405c3947a49e9200b89358d82d)
1 /*	$OpenBSD: libsa.h,v 1.8 2023/02/23 19:48:22 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 /* where the initrd is loaded */
22 #define	INITRD_BASE	PHYS_TO_CKSEG0(0x04000000)
23 
24 /*
25  * MD interfaces for MI boot(9)
26  */
27 void	devboot(dev_t, char *);
28 void	machdep(void);
29 void	run_loadfile(uint64_t *, int);
30 
31 /*
32  * PMON console
33  */
34 void	pmon_cnprobe(struct consdev *);
35 void	pmon_cninit(struct consdev *);
36 int	pmon_cngetc(dev_t);
37 void	pmon_cnputc(dev_t, int);
38 
39 /*
40  * PMON I/O
41  */
42 int	pmon_iostrategy(void *, int, daddr_t, size_t, void *, size_t *);
43 int	pmon_ioopen(struct open_file *, ...);
44 int	pmon_ioclose(struct open_file *);
45 
46 /*
47  * INITRD I/O
48  */
49 int	rd_iostrategy(void *, int, daddr_t, size_t, void *, size_t *);
50 int	rd_ioopen(struct open_file *, ...);
51 int	rd_ioclose(struct open_file *);
52 int	rd_isvalid(void);
53 void	rd_invalidate(void);
54 
55 /*
56  * INITRD ``filesystem''
57  */
58 int	rdfs_open(char *path, struct open_file *f);
59 int	rdfs_close(struct open_file *f);
60 int	rdfs_read(struct open_file *f, void *buf, size_t size, size_t *resid);
61 int	rdfs_write(struct open_file *f, void *buf, size_t size, size_t *resid);
62 off_t	rdfs_seek(struct open_file *f, off_t offset, int where);
63 int	rdfs_stat(struct open_file *f, struct stat *sb);
64 int	rdfs_readdir(struct open_file *f, char *name);
65 
66 extern int pmon_argc;
67 extern int32_t *pmon_argv;
68 extern int32_t *pmon_envp;
69 extern int32_t pmon_callvec;
70 
71 extern char pmon_bootdev[];
72 
73 extern char *kernelfile;
74