xref: /openbsd-src/sys/arch/amd64/stand/efiboot/conf.c (revision 21bf816991a3b5196f38a4dddabfce9ceb990bbb)
1*21bf8169Skrw /*	$OpenBSD: conf.c,v 1.44 2024/06/04 21:48:20 krw Exp $	*/
27b5f1cbeSyasuoka 
37b5f1cbeSyasuoka /*
47b5f1cbeSyasuoka  * Copyright (c) 1996 Michael Shalayeff
57b5f1cbeSyasuoka  * All rights reserved.
67b5f1cbeSyasuoka  *
77b5f1cbeSyasuoka  * Redistribution and use in source and binary forms, with or without
87b5f1cbeSyasuoka  * modification, are permitted provided that the following conditions
97b5f1cbeSyasuoka  * are met:
107b5f1cbeSyasuoka  * 1. Redistributions of source code must retain the above copyright
117b5f1cbeSyasuoka  *    notice, this list of conditions and the following disclaimer.
127b5f1cbeSyasuoka  * 2. Redistributions in binary form must reproduce the above copyright
137b5f1cbeSyasuoka  *    notice, this list of conditions and the following disclaimer in the
147b5f1cbeSyasuoka  *    documentation and/or other materials provided with the distribution.
157b5f1cbeSyasuoka  *
167b5f1cbeSyasuoka  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
177b5f1cbeSyasuoka  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
187b5f1cbeSyasuoka  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
197b5f1cbeSyasuoka  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
207b5f1cbeSyasuoka  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
217b5f1cbeSyasuoka  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
227b5f1cbeSyasuoka  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
237b5f1cbeSyasuoka  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
247b5f1cbeSyasuoka  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
257b5f1cbeSyasuoka  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
267b5f1cbeSyasuoka  * SUCH DAMAGE.
277b5f1cbeSyasuoka  */
287b5f1cbeSyasuoka 
297b5f1cbeSyasuoka #include <sys/param.h>
307b5f1cbeSyasuoka #include <sys/disklabel.h>
317b5f1cbeSyasuoka #include <libsa.h>
327b5f1cbeSyasuoka #include <lib/libsa/ufs.h>
3317a1c5d6Sotto #include <lib/libsa/ufs2.h>
34a6132e4fSpatrick #include <lib/libsa/tftp.h>
35055ff051Syasuoka #include <lib/libsa/cd9660.h>
367b5f1cbeSyasuoka #include <dev/cons.h>
377b5f1cbeSyasuoka 
387b5f1cbeSyasuoka #include "disk.h"
397b5f1cbeSyasuoka #include "efiboot.h"
407b5f1cbeSyasuoka #include "efidev.h"
41a6132e4fSpatrick #include "efipxe.h"
427b5f1cbeSyasuoka 
43*21bf8169Skrw const char version[] = "3.67";
447b5f1cbeSyasuoka 
457b5f1cbeSyasuoka #ifdef EFI_DEBUG
467b5f1cbeSyasuoka int	debug = 0;
477b5f1cbeSyasuoka #endif
487b5f1cbeSyasuoka 
497b5f1cbeSyasuoka void (*sa_cleanup)(void) = NULL;
507b5f1cbeSyasuoka 
517b5f1cbeSyasuoka 
527b5f1cbeSyasuoka void (*i386_probe1[])(void) = {
537b5f1cbeSyasuoka 	cninit, efi_memprobe
547b5f1cbeSyasuoka };
557b5f1cbeSyasuoka void (*i386_probe2[])(void) = {
56a6132e4fSpatrick 	efi_pxeprobe, efi_diskprobe, diskprobe
577b5f1cbeSyasuoka };
587b5f1cbeSyasuoka 
597b5f1cbeSyasuoka struct i386_boot_probes probe_list[] = {
607b5f1cbeSyasuoka 	{ "probing",  i386_probe1, nitems(i386_probe1) },
617b5f1cbeSyasuoka 	{ "disk",     i386_probe2, nitems(i386_probe2) }
627b5f1cbeSyasuoka };
637b5f1cbeSyasuoka int nibprobes = nitems(probe_list);
647b5f1cbeSyasuoka 
657b5f1cbeSyasuoka 
667b5f1cbeSyasuoka struct fs_ops file_system[] = {
67a6132e4fSpatrick 	{ tftp_open,   tftp_close,   tftp_read,   tftp_write,   tftp_seek,
68a6132e4fSpatrick 	  tftp_stat,   tftp_readdir   },
697b5f1cbeSyasuoka 	{ ufs_open,    ufs_close,    ufs_read,    ufs_write,    ufs_seek,
70044dcf88Sderaadt 	  ufs_stat,    ufs_readdir,  ufs_fchmod },
7117a1c5d6Sotto 	{ ufs2_open,   ufs2_close,   ufs2_read,   ufs2_write,   ufs2_seek,
7217a1c5d6Sotto 	  ufs2_stat,   ufs2_readdir, ufs2_fchmod },
73055ff051Syasuoka 	{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
74055ff051Syasuoka 	  cd9660_stat, cd9660_readdir },
757b5f1cbeSyasuoka #ifdef notdef
767b5f1cbeSyasuoka 	{ fat_open,    fat_close,    fat_read,    fat_write,    fat_seek,
777b5f1cbeSyasuoka 	  fat_stat,    fat_readdir    },
787b5f1cbeSyasuoka 	{ nfs_open,    nfs_close,    nfs_read,    nfs_write,    nfs_seek,
797b5f1cbeSyasuoka 	  nfs_stat,    nfs_readdir    },
807b5f1cbeSyasuoka #endif
817b5f1cbeSyasuoka };
827b5f1cbeSyasuoka int nfsys = nitems(file_system);
837b5f1cbeSyasuoka 
847b5f1cbeSyasuoka struct devsw	devsw[] = {
857b5f1cbeSyasuoka 	{ "TFTP", tftpstrategy, tftpopen, tftpclose, tftpioctl },
86a6132e4fSpatrick 	{ "EFI", efistrategy, efiopen, eficlose, efiioctl },
877b5f1cbeSyasuoka };
887b5f1cbeSyasuoka int ndevs = nitems(devsw);
897b5f1cbeSyasuoka 
907b5f1cbeSyasuoka struct consdev constab[] = {
917b5f1cbeSyasuoka 	{ efi_cons_probe, efi_cons_init, efi_cons_getc, efi_cons_putc },
921ef2c5dfSyasuoka 	{ efi_com_probe, efi_com_init, efi_com_getc, efi_com_putc },
937b5f1cbeSyasuoka 	{ NULL }
947b5f1cbeSyasuoka };
957b5f1cbeSyasuoka struct consdev *cn_tab = constab;
96