Browse Source

change firetest,add setmac in e100 driver.

master
root 16 years ago
parent
commit
84435dc2d2
  1. 2
      pmon/cmds/memtst.c
  2. 2
      pmon/cmds/mycmd.c
  3. 73
      pmon/cmds/test/hd.c
  4. 9
      sys/dev/pci/atpsata.c
  5. 6
      sys/dev/pci/e100.c

2
pmon/cmds/memtst.c

@ -136,7 +136,7 @@ cmd_memtst(int ac, char **av)
printf ("There were %d errors.\n", err);
return (1);
}
printf ("Test passed with no errors.\n");
printf ("Test passed ok.\n");
return (0);
}

2
pmon/cmds/mycmd.c

@ -2242,7 +2242,7 @@ static const Cmd Cmds[] =
{"testst","n",0,"",cmd_testst,0,99,CMD_REPEAT},
#endif
#endif
{"ifconfig","ifname",0,"ifconig fx0 [up|down|remove|stat|addr [netmask]",cmd_ifconfig,2,99,CMD_REPEAT},
{"ifconfig","ifname",0,"ifconig fx0 [up|down|remove|stat|setmac|readrom|setrom|addr [netmask]",cmd_ifconfig,2,99,CMD_REPEAT},
{"ifup","ifname",0,"ifup fxp0",cmd_ifup,2,99,CMD_REPEAT},
{"ifdown","ifname",0,"ifdown fxp0",cmd_ifdown,2,99,CMD_REPEAT},
{"rtlist","",0,"rtlist",cmd_rtlist,0,99,CMD_REPEAT},

73
pmon/cmds/test/hd.c

@ -128,15 +128,16 @@ return 0;
}
extern char *devclass[];
#define TEST_SIZE 512*16
int disktest()
{
struct device *dev, *next_dev;
FILE *fp;
int fd;
char fname[0x40];
int j,found=0;
int errors;
static unsigned char _buf[512*16+511],*buf;
static unsigned char _buf1[512*16+512],*buf1;
int i,j,found=0;
int errors,ret;
static unsigned char _buf[TEST_SIZE+511],*buf;
static unsigned char _buf1[TEST_SIZE+512],*buf1;
buf=(long)(_buf+511)&~511;
buf1=(long)(_buf1+511)&~511;
for (dev = TAILQ_FIRST(&alldevs); dev != NULL; dev = next_dev) {
@ -154,38 +155,56 @@ buf1=(long)(_buf1+511)&~511;
continue;
}
printf("test %s ...", &dev->dv_xname);
errors=0;
sprintf(fname,"/dev/disk/%s",&dev->dv_xname);
fp=fopen(fname,"r+");
fseek(fp,1024,SEEK_SET);
fread(buf,512*16,1,fp);
fclose(fp);
fd=open(fname,O_RDWR);
lseek(fd,1024,SEEK_SET);
ret=read(fd,buf,TEST_SIZE);
close(fd);
if((errors=(ret!=TEST_SIZE)))goto error;
memset(buf1,0x5a,512*16);
fp=fopen(fname,"r+");
fseek(fp,1024,SEEK_SET);
fwrite(buf1,512*16,1,fp);
fclose(fp);
memset(buf1,0x5a,TEST_SIZE);
fd=open(fname,O_RDWR);
lseek(fd,1024,SEEK_SET);
ret=write(fd,buf1,TEST_SIZE);
close(fd);
if((errors=(ret!=TEST_SIZE)))goto error;
memset(buf1,0,512*16);
memset(buf1,0,TEST_SIZE);
fp=fopen(fname,"r+");
fseek(fp,1024,SEEK_SET);
fread(buf1,512*16,1,fp);
fclose(fp);
fd=open(fname,O_RDWR);
lseek(fd,1024,SEEK_SET);
ret=read(fd,buf1,TEST_SIZE);
close(fd);
if((errors=(ret!=TEST_SIZE)))goto error;
fp=fopen(fname,"r+");
fseek(fp,1024,SEEK_SET);
fwrite(buf,512*16,1,fp);
fclose(fp);
fd=open(fname,O_RDWR);
lseek(fd,1024,SEEK_SET);
ret=write(fd,buf,TEST_SIZE);
close(fd);
if((errors=(ret!=TEST_SIZE)))goto error;
errors=0;
for(j=0;j<512;j++)
for(j=0;j<TEST_SIZE;j++)
if(buf1[j]!=0x5a)
{
printf("read write test error,write 0x5a read %x\n",buf1[j]);
errors++;
break;
}
if(!errors)printf("ok\n");
if(!errors)goto error;
printf("error\n");
for(i=j&511;i<(j&511)+512;i++)
{
if((i&15)==0)printf("\n%02x: ",i);
printf("%02x ",buf[i]);
}
printf("\n");
continue;
error:
printf(errors?"error\n":"ok\n");
}
return 0;
}

9
sys/dev/pci/atpsata.c

@ -109,6 +109,7 @@ extern vm_offset_t _pci_dmamap __P((vm_offset_t, u32));
#include "etherboot.h"
/* to get the interface to the body of the program */
static int ioaddr;
static int fault_timeout;
static int atp_match (struct device *, void *, void *);
static void atp_attach (struct device *, struct device *, void *);
@ -593,6 +594,7 @@ static int atp_ata_exec_ata_cmd(struct atp_sata *sata, struct cfis *cfis,
}
if(i >= 1000)
{
fault_timeout ++;
printf("\n0x0038 not cleared,time out\n");
return -2;
}
@ -708,6 +710,7 @@ static void atp_sata_identify(int dev, u16 *id,int tag)
}
if (i >= 1000)
{
fault_timeout ++;
printf("\n0x0038 not cleared,time out\n");
// time out
outb(sata->reg_base + 0x0018,0x16);
@ -1349,15 +1352,17 @@ void atp_sata_strategy(struct buf *bp)
goto done;
if(bp->b_flags & B_READ){
fault_timeout = 0;
ret=atp_sata_read(minor(bp->b_dev),blkno,blkcnt,bp->b_data);
if(ret != blkcnt)
if(ret != blkcnt||fault_timeout)
bp->b_flags |= B_ERROR;
dotik(30000, 0);
}
else
{
fault_timeout = 0;
ret=atp_sata_write(minor(bp->b_dev),blkno,blkcnt,bp->b_data);
if(ret != blkcnt)
if(ret != blkcnt||fault_timeout)
bp->b_flags |= B_ERROR;
dotik(30000, 0);
}

6
sys/dev/pci/e100.c

@ -384,7 +384,7 @@ extern int ticks;
#define HZ 100
static inline void msleep(int microseconds){
int i;
for(i=0;i<microseconds*10;i++)delay(microseconds);
for(i=0;i<microseconds;i++)delay(1000);
}
#define le32_to_cpu(x) (x)
#define cpu_to_le32(x) (x)
@ -1837,7 +1837,7 @@ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count)
for(addr = 0; addr < nic->eeprom_wc - 1; addr++)
checksum += cpu_to_le16(nic->eeprom[addr]);
nic->eeprom[nic->eeprom_wc - 1] = le16_to_cpu(0xBABA - checksum);
printf("checksum %x\n",le16_to_cpu(0xBABA - checksum));
printf("checksum %x\n",(unsigned)le16_to_cpu(0xBABA - checksum));
e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1,
nic->eeprom[nic->eeprom_wc - 1]);
@ -4097,7 +4097,7 @@ int cmd_wrprom_fxp0(int ac,char *av)
rom[2] = eeprom_data;
printf("eeprom_data [2] = 0x%4x\n",eeprom_data);
#endif
memcpy(nic->eeprom,rom,EEPROM_CHECKSUM_REG);
memcpy(nic->eeprom,rom,EEPROM_CHECKSUM_REG*2);
e100_eeprom_save(nic,0,EEPROM_CHECKSUM_REG);
printf("Write the whole eeprom OK!\n");

Loading…
Cancel
Save