xref: /openbsd-src/sys/arch/amd64/stand/pxeboot/conf.c (revision 126dac3c2c98b3b1c49d967526012b1e532e0396)
1*126dac3cSjsg /*	$OpenBSD: conf.c,v 1.56 2023/07/22 10:11:20 jsg Exp $	*/
28641b11fStom 
38641b11fStom /*
48641b11fStom  * Copyright (c) 2004 Tom Cosgrove
58641b11fStom  * Copyright (c) 1996 Michael Shalayeff
68641b11fStom  * All rights reserved.
78641b11fStom  *
88641b11fStom  * Redistribution and use in source and binary forms, with or without
98641b11fStom  * modification, are permitted provided that the following conditions
108641b11fStom  * are met:
118641b11fStom  * 1. Redistributions of source code must retain the above copyright
128641b11fStom  *    notice, this list of conditions and the following disclaimer.
138641b11fStom  * 2. Redistributions in binary form must reproduce the above copyright
148641b11fStom  *    notice, this list of conditions and the following disclaimer in the
158641b11fStom  *    documentation and/or other materials provided with the distribution.
168641b11fStom  *
178641b11fStom  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
188641b11fStom  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
198641b11fStom  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
208641b11fStom  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
218641b11fStom  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
228641b11fStom  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
238641b11fStom  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
248641b11fStom  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
258641b11fStom  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
268641b11fStom  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
278641b11fStom  * SUCH DAMAGE.
288641b11fStom  */
298641b11fStom 
30cf92b8d0Sjasper #include <sys/param.h>
318641b11fStom #include <netinet/in.h>
328641b11fStom #include <libsa.h>
338641b11fStom #include <lib/libsa/ufs.h>
3417a1c5d6Sotto #include <lib/libsa/ufs2.h>
358641b11fStom #ifdef notdef
368641b11fStom #include <lib/libsa/cd9660.h>
378641b11fStom #include <lib/libsa/fat.h>
388641b11fStom #endif
398641b11fStom #include <lib/libsa/nfs.h>
408641b11fStom #include <lib/libsa/tftp.h>
418641b11fStom #include <lib/libsa/netif.h>
428641b11fStom #include <biosdev.h>
438641b11fStom #include <dev/cons.h>
448641b11fStom #include "pxeboot.h"
458641b11fStom #include "pxe_net.h"
468641b11fStom 
47*126dac3cSjsg const char version[] = "3.65";
488641b11fStom int	debug = 0;
498641b11fStom 
508641b11fStom void (*sa_cleanup)(void) = pxe_shutdown;
518641b11fStom 
528641b11fStom 
538641b11fStom void (*i386_probe1[])(void) = {
548641b11fStom 	gateA20on, cninit, pxeprobe, memprobe
558641b11fStom };
568641b11fStom void (*i386_probe2[])(void) = {
578641b11fStom 	diskprobe
588641b11fStom };
598641b11fStom void (*i386_probe3[])(void) = {
608641b11fStom 	pxeinfo
618641b11fStom /*	netprobe_pxe, netprobe_mac, netprobe_inet4, netprobe_bootdev */
628641b11fStom };
638641b11fStom 
648641b11fStom struct i386_boot_probes probe_list[] = {
65cf92b8d0Sjasper 	{ "probing", i386_probe1, nitems(i386_probe1) },
66cf92b8d0Sjasper 	{ "disk",    i386_probe2, nitems(i386_probe2) },
67cf92b8d0Sjasper 	{ "net",     i386_probe3, nitems(i386_probe3) },
688641b11fStom };
69cf92b8d0Sjasper int nibprobes = nitems(probe_list);
708641b11fStom 
718641b11fStom /* This next list must match file_system[]. */
728641b11fStom char *fs_name[] = {
7369cbd442Slandry 	NULL, NULL, "tftp", "nfs"
748641b11fStom };
75cf92b8d0Sjasper int nfsname = nitems(fs_name);
768641b11fStom 
778641b11fStom struct fs_ops file_system[] = {
788641b11fStom 	{ ufs_open,    ufs_close,    ufs_read,    ufs_write,    ufs_seek,
79044dcf88Sderaadt 	  ufs_stat,    ufs_readdir,  ufs_fchmod },
8017a1c5d6Sotto 	{ ufs2_open,   ufs2_close,   ufs2_read,   ufs2_write,   ufs2_seek,
8117a1c5d6Sotto 	  ufs2_stat,   ufs2_readdir, ufs2_fchmod },
828641b11fStom 	{ tftp_open,   tftp_close,   tftp_read,   tftp_write,   tftp_seek,
838641b11fStom 	  tftp_stat,   tftp_readdir   },
848641b11fStom 	{ nfs_open,    nfs_close,    nfs_read,    nfs_write,    nfs_seek,
858641b11fStom 	  nfs_stat,    nfs_readdir    },
868641b11fStom #ifdef notdef
878641b11fStom 	{ fat_open,    fat_close,    fat_read,    fat_write,    fat_seek,
888641b11fStom 	  fat_stat,    fat_readdir    },
898641b11fStom 	{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
908641b11fStom 	  cd9660_stat, cd9660_readdir },
918641b11fStom #endif
928641b11fStom };
93cf92b8d0Sjasper int nfsys = nitems(file_system);
948641b11fStom 
958641b11fStom struct devsw	devsw[] = {
968641b11fStom 	{ "BIOS", biosstrategy, biosopen, biosclose, biosioctl },
978641b11fStom };
98cf92b8d0Sjasper int ndevs = nitems(devsw);
998641b11fStom 
1008641b11fStom struct devsw	netsw[] = {
1018641b11fStom 	{ "net",  net_strategy, net_open, net_close, net_ioctl },
1028641b11fStom };
1038641b11fStom 
1048641b11fStom struct netif_driver	*netif_drivers[] = {
1058641b11fStom };
106cf92b8d0Sjasper int n_netif_drivers = nitems(netif_drivers);
1078641b11fStom 
1088641b11fStom struct consdev constab[] = {
1098641b11fStom 	{ pc_probe, pc_init, pc_getc, pc_putc },
1108641b11fStom 	{ com_probe, com_init, com_getc, com_putc },
1118641b11fStom 	{ NULL }
1128641b11fStom };
1138641b11fStom struct consdev *cn_tab = constab;
114