summaryrefslogtreecommitdiffstats
path: root/sys/i386/boot/netboot
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1994-11-17 12:16:07 +0000
committerjkh <jkh@FreeBSD.org>1994-11-17 12:16:07 +0000
commit3a795fa5fffc4cab496478e77bb2d0173099d867 (patch)
treefaa98b5d8aa8c4538777de0cc21b389d080bf724 /sys/i386/boot/netboot
parent403695a4c201383ec258529d32e21762769c1567 (diff)
downloadFreeBSD-src-3a795fa5fffc4cab496478e77bb2d0173099d867.zip
FreeBSD-src-3a795fa5fffc4cab496478e77bb2d0173099d867.tar.gz
Many fixes from Bill Paul:
Smack the netboot program around so that it will allow the user to specify mount options. [So that you can boot from a privileged port] Change the default boot image name in netboot to /kernel, then strip the leading slash when actually going out to get the NFS file handle. Added support for 3Com 3c503 cards. Also added another command to the (trans) that allows you to switch the 3Com's on-board transceiver on and off. (ether.c, ether.h, bootmenu.c) Modified the Makefile to support new compile-time options for 3c503 cards: -DINCLUDE_3COM Include support for 3c503 -D_3COM_BASE=0x300 Define 3c503 base i/o address (if not specified, 0x300 is the default) -D_3COM_USE_AUI Disable the 3c503's transceiver by default (without this flag the transceiver is on by default)
Diffstat (limited to 'sys/i386/boot/netboot')
-rw-r--r--sys/i386/boot/netboot/Makefile8
-rw-r--r--sys/i386/boot/netboot/bootmenu.c116
-rw-r--r--sys/i386/boot/netboot/ether.c172
-rw-r--r--sys/i386/boot/netboot/ether.h79
-rw-r--r--sys/i386/boot/netboot/main.c30
-rw-r--r--sys/i386/boot/netboot/misc.c22
-rw-r--r--sys/i386/boot/netboot/netboot.h2
7 files changed, 407 insertions, 22 deletions
diff --git a/sys/i386/boot/netboot/Makefile b/sys/i386/boot/netboot/Makefile
index f8a1b54..bce4acf 100644
--- a/sys/i386/boot/netboot/Makefile
+++ b/sys/i386/boot/netboot/Makefile
@@ -1,4 +1,4 @@
-# $Id$
+# $Id: Makefile,v 1.2 1994/10/28 22:13:22 phk Exp $
#
# Makefile for NETBOOT
#
@@ -9,7 +9,10 @@
# -DRELOC - Relocation address (usually 0x90000)
# -DINCLUDE_WD - Include Western Digital/SMC support
# -DINCLUDE_NE - Include NE1000/NE2000 support
+# -DINCLUDE_3COM - Include 3c503 support
+# -D_3COM_USE_AUI - Disable transceiver on 3c503 by default
# -DNE_BASE - Base I/O address for NE1000/NE2000
+# -D_3COM_BASE - Base I/O address for 3c503
# -DWD_DEFAULT_MEM- Default memory location for WD/SMC cards
#
@@ -20,8 +23,9 @@ SRCS= start2.S main.c misc.c ether.c bootmenu.c rpc.c
BINDIR= /usr/mdec
BINMODE= 555
CFLAGS= -O2 -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR}
-CFLAGS+= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000
+#CFLAGS+= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000
#CFLAGS+= -DINCLUDE_NE -DNE_BASE=0x320
+CFLAGS+= -DINCLUDE_3COM -D_3COM_BASE=0x300
CLEANFILES+= netboot.com.nohdr netboot.com.strip
CLEANFILES+= netboot.rom.nohdr netboot.rom.strip netboot.rom
CLEANFILES+= makerom start2.ro
diff --git a/sys/i386/boot/netboot/bootmenu.c b/sys/i386/boot/netboot/bootmenu.c
index 19c13d8..807786d 100644
--- a/sys/i386/boot/netboot/bootmenu.c
+++ b/sys/i386/boot/netboot/bootmenu.c
@@ -13,7 +13,10 @@ extern unsigned long netmask;
int cmd_ip(), cmd_server(), cmd_kernel(), cmd_help(), exit();
int cmd_rootfs(), cmd_swapfs(), cmd_interface(), cmd_hostname();
-int cmd_netmask(), cmd_swapsize();
+int cmd_netmask(), cmd_swapsize(), cmd_swapopts(), cmd_rootopts();
+#ifdef INCLUDE_3COM
+int cmd_aui();
+#endif
#ifdef SMALL_ROM
struct bootcmds_t {
@@ -25,6 +28,9 @@ struct bootcmds_t {
{"bootfile", cmd_bootfile},
{"diskboot", exit},
{"autoboot", NULL},
+#ifdef INCLUDE_3COM
+ ("trans", cmd_aui},
+#endif
{NULL, NULL}
};
@@ -45,8 +51,13 @@ struct bootcmds_t {
{"rootfs", cmd_rootfs, "ip:/fs set root filesystem"},
{"swapfs", cmd_swapfs, "ip:/fs set swap filesystem"},
{"swapsize", cmd_swapsize, "<nblks> set swap size"},
+ {"swapopts", cmd_swapopts, "<options> swap mount options"},
+ {"rootopts", cmd_rootopts, "<options> root mount options"},
{"diskboot", exit, " boot from disk"},
{"autoboot", NULL, " continue"},
+#ifdef INCLUDE_3COM
+ {"trans", cmd_aui, "<on|off> turn transceiver on|off"},
+#endif
{NULL, NULL, NULL}
};
@@ -77,6 +88,29 @@ cmd_ip(p)
} else default_netmask();
}
+#ifdef INCLUDE_3COM
+extern short aui;
+extern eth_reset();
+/**************************************************************************
+CMD_AUI - Turn on-board transceiver on or off
+**************************************************************************/
+cmd_aui(p)
+ char *p;
+{
+ if (*(p+1) == 'f') {
+ aui = 1;
+ eth_reset();
+ return(0);
+ }
+ if (*(p+1) == 'n') {
+ aui = 0;
+ eth_reset();
+ return(0);
+ }
+ printf ("Transceiver is %s\r\n",aui ? "off" : "on");
+}
+#endif
+
/**************************************************************************
CMD_SERVER - Set server's IP address
**************************************************************************/
@@ -148,7 +182,7 @@ cmd_rootfs(p)
}
/**************************************************************************
-CMD_SWAPFS - Set root filesystem name
+CMD_SWAPFS - Set swap filesystem name
**************************************************************************/
cmd_swapfs(p)
char *p;
@@ -177,7 +211,85 @@ cmd_hostname(p)
(char*)&nfsdiskless.my_hostnam) + 3) & ~3;
else printf("Hostname is: %s\r\n",nfsdiskless.my_hostnam);
}
+/**************************************************************************
+CMD_ROOTOPTS - Set root mount options
+**************************************************************************/
+cmd_rootopts(p)
+ char *p;
+{
+ char *tmp;
+ if (*p) {
+ nfsdiskless.root_args.flags = NFSMNT_RSIZE | NFSMNT_WSIZE;
+ if ((tmp = (char *)substr(p,"rsize=")))
+ nfsdiskless.root_args.rsize=getdec(&tmp);
+ if ((tmp = (char *)substr(p,"wsize=")))
+ nfsdiskless.root_args.wsize=getdec(&tmp);
+ if ((tmp = (char *)substr(p,"resvport")))
+ nfsdiskless.root_args.flags |= NFSMNT_RESVPORT;
+ if ((tmp = (char *)substr(p,"intr")))
+ nfsdiskless.root_args.flags |= NFSMNT_INT;
+ if ((tmp = (char *)substr(p,"soft")))
+ nfsdiskless.root_args.flags |= NFSMNT_SOFT;
+ if ((tmp = (char *)substr(p, "tcp")))
+ nfsdiskless.root_args.sotype = SOCK_STREAM;
+ } else {
+ printf("rootfs mount options: rsize=%d,wsize=%d",
+ nfsdiskless.root_args.rsize,
+ nfsdiskless.root_args.wsize);
+ if (nfsdiskless.root_args.flags & NFSMNT_RESVPORT)
+ printf (",resvport");
+ if (nfsdiskless.root_args.flags & NFSMNT_SOFT)
+ printf (",soft");
+ if (nfsdiskless.root_args.flags & NFSMNT_INT)
+ printf (",intr");
+ if (nfsdiskless.root_args.sotype == SOCK_STREAM)
+ printf (",tcp");
+ else
+ printf (",udp");
+ printf ("\r\n");
+ }
+}
+
+/**************************************************************************
+CMD_SWAPOPTS - Set swap mount options
+**************************************************************************/
+cmd_swapopts(p)
+ char *p;
+{
+ char *tmp;
+
+ if (*p) {
+ nfsdiskless.swap_args.flags = NFSMNT_RSIZE | NFSMNT_WSIZE;
+ if ((tmp = (char *)substr(p,"rsize=")))
+ nfsdiskless.swap_args.rsize=getdec(&tmp);
+ if ((tmp = (char *)substr(p,"wsize=")))
+ nfsdiskless.swap_args.wsize=getdec(&tmp);
+ if ((tmp = (char *)substr(p,"resvport")))
+ nfsdiskless.swap_args.flags |= NFSMNT_RESVPORT;
+ if ((tmp = (char *)substr(p,"intr")))
+ nfsdiskless.swap_args.flags |= NFSMNT_INT;
+ if ((tmp = (char *)substr(p,"soft")))
+ nfsdiskless.swap_args.flags |= NFSMNT_SOFT;
+ if ((tmp = (char *)substr(p, "tcp")))
+ nfsdiskless.swap_args.sotype = SOCK_STREAM;
+ } else {
+ printf("swapfs mount options: rsize=%d,wsize=%d",
+ nfsdiskless.swap_args.rsize,
+ nfsdiskless.swap_args.wsize);
+ if (nfsdiskless.swap_args.flags & NFSMNT_RESVPORT)
+ printf (",resrvport");
+ if (nfsdiskless.swap_args.flags & NFSMNT_SOFT)
+ printf (",soft");
+ if (nfsdiskless.swap_args.flags & NFSMNT_INT)
+ printf (",intr");
+ if (nfsdiskless.swap_args.sotype == SOCK_STREAM)
+ printf (",tcp");
+ else
+ printf (",udp");
+ printf ("\r\n");
+ }
+}
/**************************************************************************
EXECUTE - Decode command
diff --git a/sys/i386/boot/netboot/ether.c b/sys/i386/boot/netboot/ether.c
index 41d0680..f61123d 100644
--- a/sys/i386/boot/netboot/ether.c
+++ b/sys/i386/boot/netboot/ether.c
@@ -14,12 +14,14 @@ Author: Martin Renters
the proper functioning of this software, nor do the authors assume any
responsibility for damages incurred with its use.
+3c503 support added by Bill Paul (wpaul@ctr.columbia.edu) on 11/15/94
**************************************************************************/
#include "netboot.h"
#include "ether.h"
+extern short aui;
unsigned short eth_nic_base;
unsigned short eth_asic_base;
unsigned char eth_tx_start;
@@ -28,6 +30,7 @@ unsigned char eth_flags;
unsigned char eth_vendor;
unsigned char eth_memsize;
unsigned char *eth_bmem;
+unsigned char *eth_rmem;
unsigned char *eth_node_addr;
/**************************************************************************
@@ -87,9 +90,11 @@ eth_probe()
outb(eth_asic_base + WD_MSR, 0x80); /* Reset */
printf("\r\n%s base 0x%x, memory 0x%X, addr ",
brd->name, eth_asic_base, eth_bmem);
- for (i=0; i<6; i++)
+ for (i=0; i<6; i++) {
printf("%b",(int)(arptable[ARP_CLIENT].node[i] =
inb(i+eth_asic_base+WD_LAR)));
+ if (i < 5) printf (":");
+ }
if (eth_flags & FLAG_790) {
outb(eth_asic_base+WD_MSR, WD_MSR_MENB);
outb(eth_asic_base+0x04, (inb(eth_asic_base+0x04) |
@@ -118,11 +123,134 @@ eth_probe()
}
#endif
+#ifdef INCLUDE_3COM
+ /******************************************************************
+ Search for 3Com 3c503 if no WD/SMC cards
+ ******************************************************************/
+ if (eth_vendor == VENDOR_NONE) {
+ eth_asic_base = _3COM_BASE + _3COM_ASIC_OFFSET;
+ eth_nic_base = _3COM_BASE;
+ eth_vendor = VENDOR_3COM;
+ /*
+ * Note that we use the same settings for both 8 and 16 bit cards:
+ * both have an 8K bank of memory at page 1 while only the 16 bit
+ * cards have a bank at page 0.
+ */
+ eth_memsize = MEM_16384;
+ eth_tx_start = 32;
+
+ /* Check our base address */
+
+ switch(inb(eth_asic_base + _3COM_BCFR)) {
+ case _3COM_BCFR_300:
+ if ((int)eth_nic_base != 0x300)
+ return(0);
+ break;
+ case _3COM_BCFR_310:
+ if ((int)eth_nic_base != 0x310)
+ return(0);
+ break;
+ case _3COM_BCFR_330:
+ if ((int)eth_nic_base != 0x330)
+ return(0);
+ break;
+ case _3COM_BCFR_350:
+ if ((int)eth_nic_base != 0x350)
+ return(0);
+ break;
+ case _3COM_BCFR_250:
+ if ((int)eth_nic_base != 0x250)
+ return(0);
+ break;
+ case _3COM_BCFR_280:
+ if ((int)eth_nic_base != 0x280)
+ return(0);
+ break;
+ case _3COM_BCFR_2A0:
+ if ((int)eth_nic_base != 0x2a0)
+ return(0);
+ break;
+ case _3COM_BCFR_2E0:
+ if ((int)eth_nic_base != 0x2e0)
+ return(0);
+ break;
+ default:
+ return (0);
+ }
+
+ /* Now get the shared memory address */
+
+ switch (inb(eth_asic_base + _3COM_PCFR)) {
+ case _3COM_PCFR_DC000:
+ eth_bmem = (char *)0xdc000;
+ break;
+ case _3COM_PCFR_D8000:
+ eth_bmem = (char *)0xd8000;
+ break;
+ case _3COM_PCFR_CC000:
+ eth_bmem = (char *)0xcc000;
+ break;
+ case _3COM_PCFR_C8000:
+ eth_bmem = (char *)0xc8000;
+ break;
+ default:
+ return (0);
+ }
+
+ /* Need this to make eth_poll() happy. */
+
+ eth_rmem = eth_bmem - 0x2000;
+
+ /* Reset NIC and ASIC */
+
+ outb (eth_asic_base + _3COM_CR , _3COM_CR_RST | _3COM_CR_XSEL);
+ outb (eth_asic_base + _3COM_CR , _3COM_CR_XSEL);
+
+ /* Get our ethernet address */
+
+ outb(eth_asic_base + _3COM_CR, _3COM_CR_EALO | _3COM_CR_XSEL);
+ printf("\r\n3Com 3c503 base 0x%x, memory 0x%X addr ",
+ eth_nic_base, eth_bmem);
+ for (i=0; i<6; i++) {
+ printf("%b",(int)(arptable[ARP_CLIENT].node[i] =
+ inb(eth_nic_base+i)));
+ if (i < 5) printf (":");
+ }
+ outb(eth_asic_base + _3COM_CR, _3COM_CR_XSEL);
+ /*
+ * Initialize GA configuration register. Set bank and enable shared
+ * mem. We always use bank 1.
+ */
+ outb(eth_asic_base + _3COM_GACFR, _3COM_GACFR_RSEL |
+ _3COM_GACFR_MBS0);
+
+ outb(eth_asic_base, _3COM_VPTR2, 0xff);
+ outb(eth_asic_base, _3COM_VPTR1, 0xff);
+ outb(eth_asic_base, _3COM_VPTR0, 0x00);
+ /*
+ * Clear memory and verify that it worked (we use only 8K)
+ */
+ bzero(eth_bmem, 0x2000);
+ for(i = 0; i < 0x2000; ++i)
+ if (*((eth_bmem)+i)) {
+ printf ("Failed to clear 3c503 shared mem.\r\n");
+ return (0);
+ }
+ /*
+ * Initialize GA page/start/stop registers.
+ */
+ outb(eth_asic_base + _3COM_PSTR, eth_tx_start);
+ outb(eth_asic_base + _3COM_PSPR, eth_memsize);
+
+ printf ("\r\n");
+
+ }
+#endif
#ifdef INCLUDE_NE
/******************************************************************
- Search for NE1000/2000 if no WD/SMC cards
+ Search for NE1000/2000 if no WD/SMC or 3com cards
******************************************************************/
- if (eth_vendor != VENDOR_WD) {
+ if (eth_vendor == VENDOR_NONE) {
char romdata[16], testbuf[32];
char test[] = "NE1000/2000 memory";
eth_bmem = (char *)0; /* No shared memory */
@@ -153,18 +281,21 @@ eth_probe()
outb(eth_nic_base + D8390_P0_PSTOP, MEM_32768);
eth_pio_write(test, 16384, sizeof(test));
eth_pio_read(16384, testbuf, sizeof(test));
- if (!bcompare(testbuf, test, sizeof(test))) return(0);
+ if (!bcompare(testbuf, test, sizeof(test))) return (0);
}
eth_pio_read(0, romdata, 16);
printf("\r\nNE1000/NE2000 base 0x%x, addr ", eth_nic_base);
- for (i=0; i<6; i++)
+ for (i=0; i<6; i++) {
printf("%b",(int)(arptable[ARP_CLIENT].node[i] = romdata[i
+ ((eth_flags & FLAG_16BIT) ? i : 0)]));
+ if (i < 5) printf (":");
+ }
printf("\r\n");
}
#endif
if (eth_vendor == VENDOR_NONE) return(0);
+ if (eth_vendor != VENDOR_3COM) eth_rmem = eth_bmem;
eth_node_addr = arptable[ARP_CLIENT].node;
eth_reset();
return(eth_vendor);
@@ -217,6 +348,20 @@ eth_reset()
D8390_COMMAND_RD2 | D8390_COMMAND_STA);
outb(eth_nic_base+D8390_P0_ISR, 0xFF);
outb(eth_nic_base+D8390_P0_TCR, 0);
+#ifdef INCLUDE_3COM
+ if (eth_vendor == VENDOR_3COM) {
+ /*
+ * No way to tell whether or not we're supposed to use
+ * the 3Com's transceiver unless the user tells us.
+ * 'aui' should have some compile time default value
+ * which can be changed from the command menu.
+ */
+ if (aui)
+ outb(eth_asic_base + _3COM_CR, 0);
+ else
+ outb(eth_asic_base + _3COM_CR, _3COM_CR_XSEL);
+ }
+#endif
return(1);
}
@@ -230,6 +375,17 @@ eth_transmit(d,t,s,p)
char *p; /* Packet */
{
unsigned char c;
+#ifdef INCLUDE_3COM
+ if (eth_vendor == VENDOR_3COM) {
+ bcopy(d, eth_bmem, 6); /* dst */
+ bcopy(eth_node_addr, eth_bmem+6, ETHER_ADDR_SIZE); /* src */
+ *(eth_bmem+12) = t>>8; /* type */
+ *(eth_bmem+13) = t;
+ bcopy(p, eth_bmem+14, s);
+ s += 14;
+ while (s < ETH_MIN_PACKET) *(eth_bmem+(s++)) = 0;
+ }
+#endif
#ifdef INCLUDE_WD
if (eth_vendor == VENDOR_WD) { /* Memory interface */
if (eth_flags & FLAG_16BIT) {
@@ -330,7 +486,7 @@ eth_poll()
if (eth_flags & FLAG_PIO)
eth_pio_read(pktoff, &pkthdr, 4);
else
- bcopy(eth_bmem + pktoff, &pkthdr, 4);
+ bcopy(eth_rmem + pktoff, &pkthdr, 4);
len = pkthdr.len - 4; /* sub CRC */
pktoff += 4;
if (len > 1514) len = 1514;
@@ -343,7 +499,7 @@ eth_poll()
if (eth_flags & FLAG_PIO)
eth_pio_read(pktoff, p, len);
else
- bcopy(eth_bmem + pktoff, p, len);
+ bcopy(eth_rmem + pktoff, p, len);
pktoff = (eth_tx_start + D8390_TXBUF_SIZE) << 8;
p += len;
packetlen -= len;
@@ -351,7 +507,7 @@ eth_poll()
if (eth_flags & FLAG_PIO)
eth_pio_read(pktoff, p, packetlen);
else
- bcopy(eth_bmem + pktoff, p, packetlen);
+ bcopy(eth_rmem + pktoff, p, packetlen);
type = (packet[12]<<8) | packet[13];
ret = 1;
diff --git a/sys/i386/boot/netboot/ether.h b/sys/i386/boot/netboot/ether.h
index 586a35c..e4996c2 100644
--- a/sys/i386/boot/netboot/ether.h
+++ b/sys/i386/boot/netboot/ether.h
@@ -15,6 +15,7 @@ Author: Martin Renters
#define VENDOR_NONE 0
#define VENDOR_WD 1
#define VENDOR_NOVELL 2
+#define VENDOR_3COM 3
#define FLAG_PIO 0x01
#define FLAG_16BIT 0x02
@@ -96,6 +97,83 @@ struct wd_board {
{NULL, 0, 0}
};
#endif
+/**************************************************************************
+3com 3c503 definitions
+**************************************************************************/
+
+#ifndef _3COM_BASE
+#define _3COM_BASE 0x300
+#endif
+
+#define _3COM_TX_PAGE_OFFSET_8BIT 0x20
+#define _3COM_TX_PAGE_OFFSET_16BIT 0x0
+#define _3COM_RX_PAGE_OFFSET_16BIT 0x20
+
+#define _3COM_ASIC_OFFSET 0x400
+#define _3COM_NIC_OFFSET 0x0
+
+#define _3COM_PSTR 0
+#define _3COM_PSPR 1
+
+#define _3COM_BCFR 3
+#define _3COM_BCFR_2E0 0x01
+#define _3COM_BCFR_2A0 0x02
+#define _3COM_BCFR_280 0x04
+#define _3COM_BCFR_250 0x08
+#define _3COM_BCFR_350 0x10
+#define _3COM_BCFR_330 0x20
+#define _3COM_BCFR_310 0x40
+#define _3COM_BCFR_300 0x80
+#define _3COM_PCFR 4
+#define _3COM_PCFR_C8000 0x10
+#define _3COM_PCFR_CC000 0x20
+#define _3COM_PCFR_D8000 0x40
+#define _3COM_PCFR_DC000 0x80
+#define _3COM_CR 6
+#define _3COM_CR_RST 0x01 /* Reset GA and NIC */
+#define _3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */
+#define _3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */
+#define _3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */
+#define _3COM_CR_SHARE 0x10 /* select interrupt sharing option */
+#define _3COM_CR_DBSEL 0x20 /* Double buffer select */
+#define _3COM_CR_DDIR 0x40 /* DMA direction select */
+#define _3COM_CR_START 0x80 /* Start DMA controller */
+#define _3COM_GACFR 5
+#define _3COM_GACFR_MBS0 0x01
+#define _3COM_GACFR_MBS1 0x02
+#define _3COM_GACFR_MBS2 0x04
+#define _3COM_GACFR_RSEL 0x08 /* enable shared memory */
+#define _3COM_GACFR_TEST 0x10 /* for GA testing */
+#define _3COM_GACFR_OWS 0x20 /* select 0WS access to GA */
+#define _3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */
+#define _3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */
+#define _3COM_STREG 7
+#define _3COM_STREG_REV 0x07 /* GA revision */
+#define _3COM_STREG_DIP 0x08 /* DMA in progress */
+#define _3COM_STREG_DTC 0x10 /* DMA terminal count */
+#define _3COM_STREG_OFLW 0x20 /* Overflow */
+#define _3COM_STREG_UFLW 0x40 /* Underflow */
+#define _3COM_STREG_DPRDY 0x80 /* Data port ready */
+#define _3COM_IDCFR 8
+#define _3COM_IDCFR_DRQ0 0x01 /* DMA request 1 select */
+#define _3COM_IDCFR_DRQ1 0x02 /* DMA request 2 select */
+#define _3COM_IDCFR_DRQ2 0x04 /* DMA request 3 select */
+#define _3COM_IDCFR_UNUSED 0x08 /* not used */
+#define _3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */
+#define _3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */
+#define _3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */
+#define _3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */
+#define _3COM_IRQ2 2
+#define _3COM_IRQ3 3
+#define _3COM_IRQ4 4
+#define _3COM_IRQ5 5
+#define _3COM_DAMSB 9
+#define _3COM_DALSB 0x0a
+#define _3COM_VPTR2 0x0b
+#define _3COM_VPTR1 0x0c
+#define _3COM_VPTR0 0x0d
+#define _3COM_RFMSB 0x0e
+#define _3COM_RFLSB 0x0f
/**************************************************************************
NE1000/2000 definitions
@@ -170,6 +248,7 @@ NE1000/2000 definitions
#define D8390_TXBUF_SIZE 6
#define D8390_RXBUF_END 32
+#define D8390_PAGE_SIZE 256
struct ringbuffer {
unsigned char status;
diff --git a/sys/i386/boot/netboot/main.c b/sys/i386/boot/netboot/main.c
index 9604d24..3116d13 100644
--- a/sys/i386/boot/netboot/main.c
+++ b/sys/i386/boot/netboot/main.c
@@ -14,6 +14,13 @@ struct exec head;
char *loadpoint;
char *kernel;
char kernel_buf[128];
+#ifdef INCLUDE_3COM
+#ifdef _3COM_USE_AUI
+short aui = 1;
+#else
+short aui = 0;
+#endif
+#endif
void (*kernelentry)();
struct nfs_diskless nfsdiskless;
int hostnamelen;
@@ -80,6 +87,18 @@ load()
int err, offset, read_size;
long addr, broadcast;
+/* Initialize this early on */
+
+ nfsdiskless.root_args.rsize = 8192;
+ nfsdiskless.root_args.wsize = 8192;
+ nfsdiskless.swap_args.rsize = 8192;
+ nfsdiskless.swap_args.wsize = 8192;
+ nfsdiskless.root_args.sotype = SOCK_DGRAM;
+ nfsdiskless.root_args.flags = (NFSMNT_WSIZE | NFSMNT_RSIZE);
+ nfsdiskless.swap_args.sotype = SOCK_DGRAM;
+ nfsdiskless.swap_args.flags = (NFSMNT_WSIZE | NFSMNT_RSIZE);
+
+
/* Find a server to get BOOTP reply from */
if (!arptable[ARP_CLIENT].ipaddr || !arptable[ARP_SERVER].ipaddr) {
printf("\r\nSearching for server...\r\n");
@@ -172,12 +191,8 @@ load()
nfsdiskless.swap_saddr.sin_port = htons(swap_nfs_port);
nfsdiskless.swap_saddr.sin_addr.s_addr =
htonl(arptable[ARP_SWAPSERVER].ipaddr);
- nfsdiskless.swap_args.sotype = SOCK_DGRAM;
- nfsdiskless.swap_args.flags = (NFSMNT_WSIZE | NFSMNT_RSIZE);
nfsdiskless.swap_args.timeo = 10;
nfsdiskless.swap_args.retrans = 100;
- nfsdiskless.swap_args.rsize = 8192;
- nfsdiskless.swap_args.wsize = 8192;
}
/* Lookup NFS/MOUNTD ports for ROOT using PORTMAP */
@@ -198,16 +213,13 @@ load()
nfsdiskless.root_saddr.sin_port = htons(root_nfs_port);
nfsdiskless.root_saddr.sin_addr.s_addr =
htonl(arptable[ARP_ROOTSERVER].ipaddr);
- nfsdiskless.root_args.sotype = SOCK_DGRAM;
- nfsdiskless.root_args.flags = (NFSMNT_WSIZE | NFSMNT_RSIZE);
nfsdiskless.root_args.timeo = 10;
nfsdiskless.root_args.retrans = 100;
- nfsdiskless.root_args.rsize = 8192;
- nfsdiskless.root_args.wsize = 8192;
nfsdiskless.root_time = 0;
if (err = nfs_lookup(ARP_ROOTSERVER, root_nfs_port,
- &nfsdiskless.root_fh, kernel, &kernel_handle)) {
+ &nfsdiskless.root_fh, *kernel == '/' ? kernel+1 : kernel,
+ &kernel_handle)) {
printf("Unable to open %s: ",kernel);
nfs_err(err);
longjmp(jmp_bootmenu,1);
diff --git a/sys/i386/boot/netboot/misc.c b/sys/i386/boot/netboot/misc.c
index 814ddbf..954c40b 100644
--- a/sys/i386/boot/netboot/misc.c
+++ b/sys/i386/boot/netboot/misc.c
@@ -55,6 +55,28 @@ bcompare(d,s,n)
}
/**************************************************************************
+SUBSTR (slightly wacky but functional)
+**************************************************************************/
+char *substr(a,b)
+char *a,*b;
+{
+char *loc1;
+char *loc2;
+
+ while (*a != '\0') {
+ loc1 = a;
+ loc2 = b;
+ while (*loc1 == *loc2++) {
+ if (*loc1 == '\0') return (0);
+ loc1++;
+ if (*loc2 == '\0') return (loc1);
+ }
+ a++;
+ }
+ return (0);
+}
+
+/**************************************************************************
PRINTF and friends
Formats:
diff --git a/sys/i386/boot/netboot/netboot.h b/sys/i386/boot/netboot/netboot.h
index b54319d..cf264cd 100644
--- a/sys/i386/boot/netboot/netboot.h
+++ b/sys/i386/boot/netboot/netboot.h
@@ -22,7 +22,7 @@ Author: Martin Renters
#define ESC 0x1B
#ifndef DEFAULT_BOOTFILE
-#define DEFAULT_BOOTFILE "kernel"
+#define DEFAULT_BOOTFILE "/kernel"
#endif
#ifndef MAX_TFTP_RETRIES
OpenPOWER on IntegriCloud