summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-04-03 19:01:37 +0000
committerphk <phk@FreeBSD.org>1996-04-03 19:01:37 +0000
commit1b40c12e76d946acf86215e95e837494ed9042d8 (patch)
tree77212826cff0056071c4ad86a7f146c261b45366 /sys
parenta9ce2b638f2d218ab691fb131561706e13571ba3 (diff)
downloadFreeBSD-src-1b40c12e76d946acf86215e95e837494ed9042d8.zip
FreeBSD-src-1b40c12e76d946acf86215e95e837494ed9042d8.tar.gz
Improvementss to netboot
Initial but not yet functional PCI support. Reviewed by: phk Submitted by: Luigi Rizzo <luigi@labinfo.iet.unipi.it>
Diffstat (limited to 'sys')
-rw-r--r--sys/i386/boot/netboot/Makefile19
-rw-r--r--sys/i386/boot/netboot/bootmenu.c2
-rw-r--r--sys/i386/boot/netboot/main.c29
-rw-r--r--sys/i386/boot/netboot/misc.c7
-rw-r--r--sys/i386/boot/netboot/ns8390.c31
-rw-r--r--sys/i386/boot/netboot/start2.S17
6 files changed, 78 insertions, 27 deletions
diff --git a/sys/i386/boot/netboot/Makefile b/sys/i386/boot/netboot/Makefile
index 5fb1b61..2238bfd 100644
--- a/sys/i386/boot/netboot/Makefile
+++ b/sys/i386/boot/netboot/Makefile
@@ -19,17 +19,26 @@
# changing an option.
#
+### options for PCI cards
+###
+PCI_VENDOR=0x10ec
+PCI_DEVICE=0x8029
+PCI_CLASS=0x02,0x00,0x00
+
PROG= nb8390.com nb3c509.com nb8390.rom nb3c509.rom
# Order is very important on the SRCS line for this prog
SRCS= start2.S main.c misc.c bootmenu.c rpc.c
BINDIR= /usr/mdec
BINMODE= 555
-CFLAGS= -O2 -fno-strength-reduce \
- -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR} -DASK_BOOT
-NS8390= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000
-NS8390+= -DINCLUDE_NE -DNE_BASE=0x320
-NS8390+= -DINCLUDE_3COM -D_3COM_BASE=0x300
+#CFLAGS= -O2 -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR} -DASK_BOOT
+CFLAGS= -O2 -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR} # -DASK_BOOT
+CFLAGS += -DPCI -DPCI_VENDOR=${PCI_VENDOR} -DPCI_DEVICE=${PCI_DEVICE}
+CFLAGS += -DPCI_CLASS=${PCI_CLASS} -DASK_BOOT
+#NS8390= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000
+#NS8390= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000
+NS8390= -DINCLUDE_NE
+#NS8390+= -DINCLUDE_3COM -D_3COM_BASE=0x300
CLEANFILES+= netboot.com
CLEANFILES+= makerom start2.ro 3c509.o ns8390.o
LDFLAGS+= -N -T ${RELOCADDR} -e _start -nostdlib
diff --git a/sys/i386/boot/netboot/bootmenu.c b/sys/i386/boot/netboot/bootmenu.c
index 1c3621b..a67ac93 100644
--- a/sys/i386/boot/netboot/bootmenu.c
+++ b/sys/i386/boot/netboot/bootmenu.c
@@ -302,7 +302,7 @@ execute(buf)
if ((!(*q)) && ((*p == ' ') || (*p == '\t') || (!(*p)))) {
if (!cmd->func)
return(1);
- while (*p == ' ')
+ while (*p == ' ' || *p == '\t')
p++;
(cmd->func)(p);
return(0);
diff --git a/sys/i386/boot/netboot/main.c b/sys/i386/boot/netboot/main.c
index a815382..051e9ea 100644
--- a/sys/i386/boot/netboot/main.c
+++ b/sys/i386/boot/netboot/main.c
@@ -112,18 +112,22 @@ load()
printf("\n=>>"); getchar();
#endif
- /* Now use TFTP to load configuration file */
- sprintf(cfg,"cfg.%I",arptable[ARP_CLIENT].ipaddr);
- printf("Loading %s...\r\n",cfg);
- if (!tftp(cfg)) {
- sprintf(cfg,"/tftpboot/cfg.%I",arptable[ARP_CLIENT].ipaddr);
- printf("Loading %s...\r\n",cfg);
- if (!tftp(cfg)) {
- printf("Unable to load config file.\r\n");
- longjmp(jmp_bootmenu,1);
- }
- }
-
+ /* Now use TFTP to load configuration file */
+ sprintf(cfg,"/tftpboot/freebsd.%I",arptable[ARP_CLIENT].ipaddr);
+ if (tftp(cfg) || tftp(cfg+10))
+ goto cfg_done;
+ cfg[17]='\0';
+ if (tftp(cfg) || tftp(cfg+10))
+ goto cfg_done;
+ sprintf(cfg,"/tftpboot/cfg.%I",arptable[ARP_CLIENT].ipaddr);
+ if (tftp(cfg) || tftp(cfg+10))
+ goto cfg_done;
+ sprintf(config_buffer,"rootfs %I:/usr/diskless_root",
+ arptable[ARP_SERVER].ipaddr);
+ printf("Unable to load config file, guessing:\r\n\t%s\r\n",
+ config_buffer);
+
+cfg_done:
#ifdef MDEBUG
printf("\n=>>"); getchar();
#endif
@@ -406,6 +410,7 @@ tftp(name)
unsigned short len, block=1;
struct tftp_t tp;
int code;
+ printf("Loading %s...\r\n",name);
isocket++;
tp.opcode = htons(TFTP_RRQ);
len = (sprintf((char *)tp.u.rrq,"%s%c%s",name,0,"octet")
diff --git a/sys/i386/boot/netboot/misc.c b/sys/i386/boot/netboot/misc.c
index 954c40b..5dc7f4e 100644
--- a/sys/i386/boot/netboot/misc.c
+++ b/sys/i386/boot/netboot/misc.c
@@ -200,10 +200,13 @@ printf(fmt,data)
char *fmt;
int data;
{
- char buf[80],*p;
+ char buf[1024],*p;
p = buf;
do_printf(buf,fmt,&data);
- while (*p) putchar(*p++);
+ while (*p) {
+ if (*p=='\n') putchar('\r');
+ putchar(*p++);
+ }
}
/**************************************************************************
diff --git a/sys/i386/boot/netboot/ns8390.c b/sys/i386/boot/netboot/ns8390.c
index 14cca17..9fb328d 100644
--- a/sys/i386/boot/netboot/ns8390.c
+++ b/sys/i386/boot/netboot/ns8390.c
@@ -46,6 +46,15 @@ char eth_driver[] = "ed0";
char packet[ETH_MAX_PACKET];
int packetlen;
+#ifdef INCLUDE_NE
+static unsigned short ne_base_list[]= {
+#ifdef NE_BASE
+ NE_BASE,
+#endif
+ 0xff80, 0xff40, 0xff00, 0xfec0,
+ 0x280, 0x300, 0
+};
+#endif
/**************************************************************************
ETH_PROBE - Look for an adapter
**************************************************************************/
@@ -133,8 +142,7 @@ eth_probe()
WD_LAAR_M16EN | WD_LAAR_L16EN | 1));
}
}
- printf("\r\n");
-
+ goto found_board;
}
#endif
#ifdef INCLUDE_3COM
@@ -256,7 +264,7 @@ eth_probe()
outb(eth_asic_base + _3COM_PSTR, eth_tx_start);
outb(eth_asic_base + _3COM_PSPR, eth_memsize);
- printf ("\r\n");
+ goto found_board;
}
#endif
@@ -267,9 +275,12 @@ eth_probe()
if (eth_vendor == VENDOR_NONE) {
char romdata[16], testbuf[32];
char test[] = "NE1000/2000 memory";
+ unsigned short *tent_base=ne_base_list;
eth_bmem = (char *)0; /* No shared memory */
- eth_asic_base = NE_BASE + NE_ASIC_OFFSET;
- eth_nic_base = NE_BASE;
+ne_again:
+ eth_asic_base = *tent_base + NE_ASIC_OFFSET;
+ eth_nic_base = *tent_base;
+
eth_vendor = VENDOR_NOVELL;
eth_flags = FLAG_PIO;
eth_memsize = MEM_16384;
@@ -295,7 +306,11 @@ 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)))
+ if (*++tent_base)
+ goto ne_again;
+ else
+ return (0);
}
eth_pio_read(0, romdata, 16);
printf("\r\nNE1000/NE2000 base 0x%x, addr ", eth_nic_base);
@@ -304,9 +319,11 @@ eth_probe()
+ ((eth_flags & FLAG_16BIT) ? i : 0)]));
if (i < 5) printf (":");
}
- printf("\r\n");
+ goto found_board;
}
#endif
+found_board:
+ printf("\r\n");
if (eth_vendor == VENDOR_NONE) return(0);
if (eth_vendor != VENDOR_3COM) eth_rmem = eth_bmem;
diff --git a/sys/i386/boot/netboot/start2.S b/sys/i386/boot/netboot/start2.S
index dd249c7..5bbc96c 100644
--- a/sys/i386/boot/netboot/start2.S
+++ b/sys/i386/boot/netboot/start2.S
@@ -17,6 +17,23 @@
.byte (ROMSIZE>>9) /* no. of 512B blocks */
jmp 1f /* enter from bios here */
.byte 0 /* checksum */
+#ifdef PCI
+ .ascii "FreeBSD boot ROM.." /* 18 bytes total */
+ .word 0x1a
+/* PCI rom data structure format */
+ .ascii "PCIR" /* signature */
+ .word PCI_VENDOR /* vendor ID */
+ .word PCI_DEVICE /* device ID */
+ .word 0 /* vital product data */
+ .word 0x0018 /* PCI data structure */
+ .byte 0 /* PCI data struct. rev -- 0 */
+ .byte PCI_CLASS /* Class code */
+ .word (ROMSIZE>>9) /* no. of 512B blocks */
+ .byte 0,0 /* rev. level */
+ .byte 0 /* code type - 0 =x86 */
+ .byte 0x80 /* indicator of last block */
+ .word 0 /* reserved */
+#endif
1: push %eax
push %ds
xor %eax,%eax
OpenPOWER on IntegriCloud