Browse Source

fix up the SATA CD-ROM sometimes can not load file on 7A and 2K

Change-Id: Ib9d709187c8fefb705f993e39b8c2397374d9b89
master
zhangbaoqi 6 years ago
parent
commit
0ba3770554
  1. 2
      pmon/fs/dev_part.c
  2. 12
      pmon/fs/iso9660fs.c
  3. 12
      sys/dev/pci/ahcisata.c

2
pmon/fs/dev_part.c

@ -782,7 +782,7 @@ static int _DevPartOpen(DeviceDisk* dev, const char* dev_name)
//dev->part = NULL;
char *p_name = dev_name+2;
int ide_cd_index = *p_name - '0';
#if defined(LOONGSON_3A2H) || defined(LS7A) || defined(LS2K)
#if defined(LOONGSON_3A2H) || defined(LS7A) || defined(LOONGSON_2K)
if(1){
#else
if(is_ide_cd_ready(ide_cd_index)){

12
pmon/fs/iso9660fs.c

@ -169,6 +169,7 @@ iso9660_open(int fd, const char *path, int flags, int mode)
struct iso_directory_record *dp;
int rc;
int showdir,lookupdir;
char retry_times = 0;
showdir=0;
if(path[strlen(path)-1]=='/')lookupdir=1;
/* Try to get to the physical device */
@ -194,6 +195,7 @@ iso9660_open(int fd, const char *path, int flags, int mode)
opath = strchr(opath, '/') + 1;
if(opath[0]==0){opath="/";}
again:
/* Try to open the physical device */
rc = devio_open(fd, dpath, flags, mode);
if (rc < 0)
@ -212,7 +214,15 @@ iso9660_open(int fd, const char *path, int flags, int mode)
}
errno = ENOENT; /* In case of error */
if (bcmp(vd->id, ISO_STANDARD_ID, sizeof vd->id) != 0)
goto out;
if (retry_times < 50) {
retry_times++;
//printf("retry_times %d.\n",retry_times);
free(buf);
(void)devio_close(fd);
delay(10000);
goto again;
} else
goto out;
if (isonum_711(vd->type) == ISO_VD_END)
goto out;
if (isonum_711(vd->type) == ISO_VD_PRIMARY)

12
sys/dev/pci/ahcisata.c

@ -743,16 +743,16 @@ static int get_ahci_device_data(u8 port, u8 * fis, int fis_len, u8 * buf,
};
writel_with_flush(1, port_mmio + PORT_CMD_ISSUE);
if (waiting_for_cmd_completed(port_mmio + PORT_CMD_ISSUE, 2000000, 0x1)) {
printf("%s <line%d>: timeout exit! %d bytes transferred.\n", __func__, __LINE__,
pp->cmd_slot->status);
// printf("%s <line%d>: timeout exit! %d bytes transferred.\n", __func__, __LINE__,
// pp->cmd_slot->status);
printf("PxIS: 0x%08x, PxSERR: 0x%08x\n", readl(port_mmio + PORT_IRQ_STAT), readl(port_mmio + PORT_SCR_ERR));
printf("PxTFD: 0x%08x, PxSSTS: 0x%08x\n", readl(port_mmio + PORT_TFDATA), readl(port_mmio + PORT_SCR_STAT));
// printf("PxIS: 0x%08x, PxSERR: 0x%08x\n", readl(port_mmio + PORT_IRQ_STAT), readl(port_mmio + PORT_SCR_ERR));
// printf("PxTFD: 0x%08x, PxSSTS: 0x%08x\n", readl(port_mmio + PORT_TFDATA), readl(port_mmio + PORT_SCR_STAT));
if (waiting_for_cmd_completed(port_mmio + PORT_CMD_ISSUE, 2000000, 0x1)) {
printf("Waiting another 2s is useless.\n");
// printf("Waiting another 2s is useless.\n");
}else{
printf("Waiting another 2s is usefull.\n");
// printf("Waiting another 2s is usefull.\n");
}
return -1;

Loading…
Cancel
Save