mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
Improvementss to netboot
Initial but not yet functional PCI support. Reviewed by: phk Submitted by: Luigi Rizzo <luigi@labinfo.iet.unipi.it>
This commit is contained in:
parent
d3d20ad196
commit
506c540bbb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15029
6 changed files with 77 additions and 26 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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++);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue