From owner-freebsd-bugs Thu Feb 22 00:51:44 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id AAA04587 for bugs-outgoing; Thu, 22 Feb 1996 00:51:44 -0800 (PST) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id AAA04555 for ; Thu, 22 Feb 1996 00:50:32 -0800 (PST) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id JAA20729 for bugs@freebsd.org; Thu, 22 Feb 1996 09:46:44 +0100 From: Luigi Rizzo Message-Id: <199602220846.JAA20729@labinfo.iet.unipi.it> Subject: netboot patches To: bugs@freebsd.org Date: Thu, 22 Feb 1996 09:46:43 +0100 (MET) X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-bugs@freebsd.org Precedence: bulk Hi, I enclose a set of patches to netboot. Some of them are bugfixes, some of them add functionalities to the system. Possibly more will come in the future, but I am not sure to have time for it in the next few days. List of changes: BUGS ---- + tabs were incorrectly dealt with in the configuration file. + when compiled for multiple card, detection of a WD card type did not prevent subsequent probing for NE boards ENHANCEMENTS ------------ + now probes multiple NE cards. Probes are invasive, but since the alternative is failure... if NE_BASE is specified, that card is probed first; + looks for different configuration files, namely /tftpboot/cfg.X.Y.Z.T cfg.X.Y.Z.T /tftpboot/cfg cfg note the last two, which are global configuration files. I find this quite convenient, to avoid having to write a different configuration file containing essentialy the same data. + if the configuration file is not found, the program "guesses" the rootfs as SERVERIP:/usr/diskless_root There might be better ways to do this. I still have a problem with old WD cards, the program fails right after writing the Ethernet address. I'll investigate on this, might just be a timing problem. Luigi ------------------------ diff -cbwr netboot/bootmenu.c netboot.new/bootmenu.c *** netboot/bootmenu.c Sat Oct 7 05:31:20 1995 --- netboot.new/bootmenu.c Wed Feb 21 13:13:25 1996 *************** *** 287,293 **** if ((!(*q)) && ((*p == ' ') || (*p == '\t') || (!(*p)))) { if (!cmd->func) return(1); ! while (*p == ' ') p++; (cmd->func)(p); return(0); --- 287,293 ---- if ((!(*q)) && ((*p == ' ') || (*p == '\t') || (!(*p)))) { if (!cmd->func) return(1); ! while (*p == ' ' || *p == '\t') p++; (cmd->func)(p); return(0); diff -cbwr netboot/main.c netboot.new/main.c *** netboot/main.c Tue May 30 09:59:00 1995 --- netboot.new/main.c Thu Feb 22 09:30:27 1996 *************** *** 113,129 **** #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); ! } ! } #ifdef MDEBUG printf("\n=>>"); getchar(); #endif --- 113,130 ---- #endif /* Now use TFTP to load configuration file */ sprintf(cfg,"/tftpboot/cfg.%I",arptable[ARP_CLIENT].ipaddr); ! if (tftp(cfg) || tftp(cfg+10)) ! goto cfg_done; ! cfg[13]='\0'; ! 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,411 **** --- 407,413 ---- 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 -cbwr netboot/ns8390.c netboot.new/ns8390.c *** netboot/ns8390.c Tue May 30 09:59:02 1995 --- netboot.new/ns8390.c Thu Feb 22 09:26:11 1996 *************** *** 46,51 **** --- 46,59 ---- char packet[ETH_MAX_PACKET]; int packetlen; + #ifdef INCLUDE_NE + static unsigned short ne_base_list[]= { + #ifdef NE_BASE + NE_BASE, + #endif + 0x280, 0x300, 0x320, 0xff80, 0xff40, 0 + }; + #endif /************************************************************************** ETH_PROBE - Look for an adapter **************************************************************************/ *************** *** 133,140 **** WD_LAAR_M16EN | WD_LAAR_L16EN | 1)); } } ! printf("\r\n"); ! } #endif #ifdef INCLUDE_3COM --- 141,147 ---- WD_LAAR_M16EN | WD_LAAR_L16EN | 1)); } } ! goto found_board; } #endif #ifdef INCLUDE_3COM *************** *** 256,262 **** outb(eth_asic_base + _3COM_PSTR, eth_tx_start); outb(eth_asic_base + _3COM_PSPR, eth_memsize); ! printf ("\r\n"); } #endif --- 263,269 ---- outb(eth_asic_base + _3COM_PSTR, eth_tx_start); outb(eth_asic_base + _3COM_PSPR, eth_memsize); ! goto found_board; } #endif *************** *** 267,275 **** if (eth_vendor == VENDOR_NONE) { char romdata[16], testbuf[32]; char test[] = "NE1000/2000 memory"; eth_bmem = (char *)0; /* No shared memory */ ! eth_asic_base = NE_BASE + NE_ASIC_OFFSET; ! eth_nic_base = NE_BASE; eth_vendor = VENDOR_NOVELL; eth_flags = FLAG_PIO; eth_memsize = MEM_16384; --- 274,285 ---- 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 */ ! 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,301 **** 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); } eth_pio_read(0, romdata, 16); printf("\r\nNE1000/NE2000 base 0x%x, addr ", eth_nic_base); --- 305,315 ---- 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))) ! 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,312 **** + ((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; --- 318,328 ---- + ((eth_flags & FLAG_16BIT) ? i : 0)])); if (i < 5) printf (":"); } ! 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; ************************** ==================================================================== Luigi Rizzo Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it Universita' di Pisa tel: +39-50-568533 via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 http://www.iet.unipi.it/~luigi/ ====================================================================