⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1006.ide.patch

📁 sm86xx内核源包括补丁( GPL )的
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+#ifdef CONFIG_SD_CDROM_DMAPACKET+/*+ * end_buffer_io_sync() is not exported+ */+static void cdrom_end_buffer_io_sync(struct buffer_head *bh, int uptodate)+{+}+#endif+ static-int cdrom_queue_packet_command(ide_drive_t *drive, struct packet_command *pc)+int cdrom_queue_packet_command(ide_drive_t *drive, struct packet_command *pc, u32 paddr) { 	struct request_sense sense; 	struct request req; 	int retries = 10; -	if (pc->sense == NULL)+	if (pc->sense == NULL) {+		memset(&sense, 0, sizeof(struct request_sense)); 		pc->sense = &sense;+	}  	/* Start of retry loop. */ 	do {+#ifdef CONFIG_SD_CDROM_DMAPACKET+		struct buffer_head bh;+#endif 		ide_init_drive_cmd (&req);+#ifdef CONFIG_SD_CDROM_DMAPACKET+		if (pc->do_dma) {+			/* Hack up a buffer_head for IDE DMA's use */+			memset(&bh, 0, sizeof(bh));+			bh.b_size = pc->buflen;+			bh.b_data = paddr ? (void *)paddr : pc->buffer;+			bh.b_state = (1 << BH_Lock) | (1 << BH_Mapped) |+					(1 << BH_Req);+			bh.b_end_io = cdrom_end_buffer_io_sync;+#if 0		/* Needed by end_buffer_io_sync, but not cdrom_end_buffer_io_sync */+			atomic_set(&bh.b_count, 1);+			init_waitqueue_head(&bh.b_wait);+#endif+			req.bh = &bh;+		}+#endif 		req.cmd = PACKET_COMMAND; 		req.buffer = (char *)pc; 		ide_do_drive_cmd(drive, &req, ide_wait);@@ -1971,7 +2082,7 @@         pc.c[7] = cdi->sanyo_slot % 3; #endif /* not STANDARD_ATAPI */ -	return cdrom_queue_packet_command(drive, &pc);+	return cdrom_queue_packet_command(drive, &pc, 0); }  @@ -1994,7 +2105,7 @@ 		pc.sense = sense; 		pc.c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL; 		pc.c[4] = lockflag ? 1 : 0;-		stat = cdrom_queue_packet_command(drive, &pc);+		stat = cdrom_queue_packet_command(drive, &pc, 0); 	}  	/* If we got an illegal field error, the drive@@ -2035,10 +2146,11 @@  	memset(&pc, 0, sizeof (pc)); 	pc.sense = sense;+	pc.timeout = 5 * WAIT_CMD;  	pc.c[0] = GPCMD_START_STOP_UNIT; 	pc.c[4] = 0x02 + (ejectflag != 0);-	return cdrom_queue_packet_command(drive, &pc);+	return cdrom_queue_packet_command(drive, &pc, 0); }  static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,@@ -2059,7 +2171,7 @@ 	pc.buffer = (char *)&capbuf; 	pc.buflen = sizeof(capbuf); -	stat = cdrom_queue_packet_command(drive, &pc);+	stat = cdrom_queue_packet_command(drive, &pc, 0); 	if (stat == 0) 		*capacity = 1 + be32_to_cpu(capbuf.lba); @@ -2087,7 +2199,7 @@ 	if (msf_flag) 		pc.c[1] = 2; -	return cdrom_queue_packet_command(drive, &pc);+	return cdrom_queue_packet_command(drive, &pc, 0); }  @@ -2102,6 +2214,7 @@ 		struct atapi_toc_header hdr; 		struct atapi_toc_entry  ent; 	} ms_tmp;+	unsigned long lastwritten;  	if (toc == NULL) { 		/* Try to allocate space. */@@ -2236,11 +2349,29 @@ 	/* Now try to get the total cdrom capacity. */ 	minor = (drive->select.b.unit) << PARTN_BITS; 	dev = MKDEV(HWIF(drive)->major, minor);++#if 1	/* inspired by kernel 2.6.20 */+	/* +		This way toc->capacity is not initialized by cdrom_get_last_written(),+		and we can choose the greater of the two values+	*/+	stat = cdrom_get_last_written(dev, &lastwritten);+	if(stat)+		lastwritten = 0;+	+	stat = cdrom_read_capacity(drive, &toc->capacity, sense);+	if (stat)+		toc->capacity = 0x1fffff;+	+	if(lastwritten > toc->capacity)+		toc->capacity = lastwritten;+#else /* original code */	 	stat = cdrom_get_last_written(dev, &toc->capacity); 	if (stat || !toc->capacity) 		stat = cdrom_read_capacity(drive, &toc->capacity, sense); 	if (stat) 		toc->capacity = 0x1fffff;+#endif  	HWIF(drive)->gd->sizes[drive->select.b.unit << PARTN_BITS] = (toc->capacity * SECTORS_PER_FRAME) >> (BLOCK_SIZE_BITS - 9); 	drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME;@@ -2268,7 +2399,7 @@ 	pc.c[3] = format; 	pc.c[7] = (buflen >> 8); 	pc.c[8] = (buflen & 0xff);-	return cdrom_queue_packet_command(drive, &pc);+	return cdrom_queue_packet_command(drive, &pc, 0); }  /* ATAPI cdrom drives are free to select the speed you request or any slower@@ -2299,7 +2430,7 @@ 		pc.c[5] = speed & 0xff;        } -	return cdrom_queue_packet_command(drive, &pc);+	return cdrom_queue_packet_command(drive, &pc, 0); }  static int cdrom_play_audio(ide_drive_t *drive, int lba_start, int lba_end)@@ -2314,7 +2445,7 @@ 	lba_to_msf(lba_start, &pc.c[3], &pc.c[4], &pc.c[5]); 	lba_to_msf(lba_end-1, &pc.c[6], &pc.c[7], &pc.c[8]); -	return cdrom_queue_packet_command(drive, &pc);+	return cdrom_queue_packet_command(drive, &pc, 0); }  static int cdrom_get_toc_entry(ide_drive_t *drive, int track,@@ -2366,7 +2497,20 @@ 	pc.quiet = cgc->quiet; 	pc.timeout = cgc->timeout; 	pc.sense = cgc->sense;-	return cgc->stat = cdrom_queue_packet_command(drive, &pc);+#ifdef CONFIG_SD_CDROM_DMAPACKET+	if (cgc->do_dma && drive->using_dma)+		pc.do_dma = 1;+	if (pc.c[0] != GPCMD_READ_10 && pc.c[0] != GPCMD_READ_CD &&+			pc.c[0] != GPCMD_WRITE_10 && pc.c[0] != GPCMD_VERIFY_10 &&+			pc.c[0] != GPCMD_WRITE_AND_VERIFY_10)+		pc.do_dma = 0;+	cgc->stat = cdrom_queue_packet_command(drive, &pc, (u32)cgc->reserved[0]);+	if (pc.stat == 2)	/* DMA error: fall back to lower mode */+		cgc->dma_error = 1;+	return cgc->stat;+#else+	return cgc->stat = cdrom_queue_packet_command(drive, &pc, 0);+#endif }  static@@ -2554,34 +2698,48 @@ static int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr) {-	ide_drive_t *drive = (ide_drive_t*) cdi->handle;+        ide_drive_t *drive = (ide_drive_t*) cdi->handle;+        struct media_event_desc med;+        struct request_sense sense;+        int stat; -	if (slot_nr == CDSL_CURRENT) {-		struct request_sense sense;-		int stat = cdrom_check_status(drive, &sense);-		if (stat == 0 || sense.sense_key == UNIT_ATTENTION)-			return CDS_DISC_OK;--		if (sense.sense_key == NOT_READY && sense.asc == 0x04 &&-		    sense.ascq == 0x04)-			return CDS_DISC_OK;  -		/*-		 * If not using Mt Fuji extended media tray reports,-		 * just return TRAY_OPEN since ATAPI doesn't provide-		 * any other way to detect this...-		 */-		if (sense.sense_key == NOT_READY) {-			if (sense.asc == 0x3a && sense.ascq == 1)-				return CDS_NO_DISC;-			else-				return CDS_TRAY_OPEN;-		}+        if (slot_nr != CDSL_CURRENT)+                return -EINVAL;++        stat = cdrom_check_status(drive, &sense);+        if (!stat || sense.sense_key == UNIT_ATTENTION)+                return CDS_DISC_OK;++        if (!cdrom_get_media_event(cdi, &med)) {+                if (med.media_present)+                        return CDS_DISC_OK;+                else if (med.door_open)+                        return CDS_TRAY_OPEN;+                else+                        return CDS_NO_DISC;+        }++        if (sense.sense_key == NOT_READY && sense.asc == 0x04 && sense.ascq == 0x04)+                return CDS_DISC_OK;++        /*+         * If not using Mt Fuji extended media tray reports,+         * just return TRAY_OPEN since ATAPI doesn't provide+         * any other way to detect this...+         */+        if (sense.sense_key == NOT_READY) {+                if (sense.asc == 0x3a) {+                        if (sense.ascq == 1)+                                return CDS_NO_DISC;+                        else if (sense.ascq == 0 || sense.ascq == 2)+                                return CDS_TRAY_OPEN;+                }+        }++        return CDS_DRIVE_NOT_READY; -		return CDS_DRIVE_NOT_READY;-	}-	return -EINVAL; }  staticdiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/ide/ide-cd.h linuxmips-2.4.30/drivers/ide/ide-cd.h--- linuxmips-2.4.30.ref/drivers/ide/ide-cd.h	2003-02-25 14:03:06.000000000 -0800+++ linuxmips-2.4.30/drivers/ide/ide-cd.h	2007-05-08 10:41:54.000000000 -0700@@ -111,6 +111,9 @@ 	int quiet; 	int timeout; 	struct request_sense *sense;+#ifdef CONFIG_SD_CDROM_DMAPACKET+	int do_dma;+#endif 	unsigned char c[12]; }; diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/ide/ide-disk.c linuxmips-2.4.30/drivers/ide/ide-disk.c--- linuxmips-2.4.30.ref/drivers/ide/ide-disk.c	2004-08-14 11:38:49.000000000 -0700+++ linuxmips-2.4.30/drivers/ide/ide-disk.c	2007-05-08 10:41:54.000000000 -0700@@ -1854,6 +1854,9 @@ 			DRIVER(drive)->busy--; 			continue; 		}+#ifdef MODULE+                idedisk_revalidate (drive);+#endif 		DRIVER(drive)->busy--; 		failed--; 	}@@ -1866,12 +1869,13 @@  ide_startstop_t panic_box(ide_drive_t *drive) {-#if 0+#if 1 	panic("%s: Attempted to corrupt something: ide operation "+		"was pending accross suspend/resume.\n", drive->name); #else 	printk(KERN_ERR "%s: Attempted to corrupt something: ide operation "-#endif 		"was pending accross suspend/resume.\n", drive->name);+#endif 	return ide_stopped; } diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/ide/ide-iops.c linuxmips-2.4.30/drivers/ide/ide-iops.c--- linuxmips-2.4.30.ref/drivers/ide/ide-iops.c	2004-01-20 07:10:31.000000000 -0800+++ linuxmips-2.4.30/drivers/ide/ide-iops.c	2007-05-08 10:41:54.000000000 -0700@@ -1217,6 +1217,10 @@ 		if (drive->current_speed >= XFER_SW_DMA_0) 			(void) HWIF(drive)->ide_dma_on(drive); 	} else {+#ifdef CONFIG_SD_CDROM_KEEP_DMA+		/* Turn off DMA only for HDD */+		if (drive->media == ide_disk) +#endif 		(void) HWIF(drive)->ide_dma_off(drive); 	} }diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/ide/ide-lib.c linuxmips-2.4.30/drivers/ide/ide-lib.c--- linuxmips-2.4.30.ref/drivers/ide/ide-lib.c	2003-02-25 14:03:06.000000000 -0800+++ linuxmips-2.4.30/drivers/ide/ide-lib.c	2007-05-08 10:41:54.000000000 -0700@@ -171,7 +171,7 @@ 		BUG(); 	return min(speed, speed_max[mode]); #else /* !CONFIG_BLK_DEV_IDEDMA */-	return min(speed, XFER_PIO_4);+	return min(speed, (u8)XFER_PIO_4); #endif /* CONFIG_BLK_DEV_IDEDMA */ } diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/ide/ide-probe.c linuxmips-2.4.30/drivers/ide/ide-probe.c--- linuxmips-2.4.30.ref/drivers/ide/ide-probe.c	2004-04-15 20:14:15.000000000 -0700+++ linuxmips-2.4.30/drivers/ide/ide-probe.c	2007-05-08 10:41:54.000000000 -0700@@ -56,6 +56,43 @@ #include <asm/uaccess.h> #include <asm/io.h> +#if defined(CONFIG_SD_IDE_FASTPROBE) || defined(CONFIG_BLK_DEV_TANGO2_ISAIDENOIRQ)++#define IDE_WAIT_TIMEOUT_SECS           12++int ide_wait_stat_sd(struct hwif_s *hwif, int reg, int mask, int waitmask, int usetimeout)+{+        int status;+        int timeout = jiffies + (IDE_WAIT_TIMEOUT_SECS * HZ);+	static int first_done = 0;++        for (;;) {+                status = hwif->INB(reg);++                /*+                * Western Digital specific hack - when drive is erasing, there is a small window (~5ms)+                * after spinup before it will report busy.  Account for that on the very first wait.+                */+                if(((status & mask) == waitmask) && !first_done){+                        first_done = 1;+                        udelay(50*1000);+                        continue;+                }++                if ((status & mask) == waitmask)+                        break;+                if (usetimeout) {+                        if (jiffies > timeout){+                                return 1;+                        }+                }+                udelay(50);+        }+        return 0;+}+#endif++ /**  *	generic_id		-	add a generic drive id  *	@drive:	drive to make an ID block for@@ -216,6 +253,10 @@ 					break; 				} #endif+#if defined(CONFIG_BLK_DEV_TANGO2_ISAIDEDMA) || defined(CONFIG_BLK_DEV_TANGO2_BMIDEDMA)+                               // We may want to limit numbers of bhs to 2 for ATAPI devices+                               // max_sectors[hwif->major][drive->select.b.unit] = 8;+#endif 				printk ("CD/DVD-ROM"); 				break; 			case ide_tape:@@ -295,7 +336,9 @@ 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -