Skip to contentSkip to conversation

Linux 2.5.8-pre2

PATCH New Linus Torvalds 20 participants 74 messages Apr 6, 2002 – Apr 19, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

More merging with various people, USB+ARM+more network drivers etc.

The actual patch is pretty huge, because the USB changes moves USB files around a lot. The BK diffs (and actual "real changes") are smaller than the patch would imply (here Larry pipes up with number of deltas ;)

Linus

---

Summary of changes from v2.5.8-pre1 to v2.5.8-pre2
============================================

<[email protected]> (02/03/13 1.384.11.1)

	[PATCH] 1054/1: Fixes security problem with static i/o mapping.
	
	
	For 2.5.x only.  (Patch 1042/1 is for 2.4.x)
	
	(replaces patch 1041/1.)
	
	Christopher Hoover
	mailto:[email protected]
	mailto:[email protected]

<[email protected]> (02/03/13 1.384.11.2)
[PATCH] 964/1: Consus led patches

+++ linux/arch/arm/mach-sa1100/leds.c Wed Feb 13 13:55:33 2002
+++ linux/arch/arm/mach-sa1100/leds.h Wed Feb 13 13:55:52 2002
+++ linux/include/asm-arm/leds.h Wed Feb 13 13:01:31 2002

Additions for consus_leds_event (parallels assabet_leds_event). Added led_start_time_mode and led_stop_timer_mode for heartbeat led. Added led_blue_on and led_blue_off for Blue led support.

<[email protected]> (02/03/13 1.388.3.2)
Miscellaneous compiler warning fixes, other small fixes and cleanups for ARM.

<[email protected]> (02/03/13 1.388.3.4)
Fix scope of init/exit functions in ds1620.c
NetWinder flash driver should use ioremap, not the private __ioremap.

<[email protected]> (02/03/13 1.388.3.5)
Update ARM related video drivers:
- cyber2000fb
- sa1100fb
Add new ARM video drivers:
- anakinfb
- clps711xfb

<[email protected]> (02/03/17 1.526)
SA1100 IrDA driver updates.

<[email protected]> (02/03/19 1.528)
Convert ARM92x/ARM1020 specific configuration symbols to generic CPU symbols. Remove unused flush_page_to_ram in ARM code.

<[email protected]> (02/03/22 1.384.11.3)
[PATCH] 1079/1: recognize PXA250 revision B0 and hier

<[email protected]> (02/03/22 1.384.11.4)
[PATCH] 1080/1: Addition of new files for the Intel PXA250/210 architecture

This only populates the linux/arch/arm/mach-pxa directory.

<[email protected]> (02/03/22 1.384.11.5)
[PATCH] 1081/1: addition of new header files for the Intel PXA250/210 architecture

This patch populates the linux/include/asm-arm/arch-pxa directory.

<[email protected]> (02/03/22 1.384.11.6)
[PATCH] 1082/1: changes to linux/arch/arm/kernel/* for PXA architecture Actually only debug.S and entry-armv.S

<[email protected]> (02/03/22 1.384.11.7)
[PATCH] 1083/1: 64-bit unsigned modulo arithmetic support
I've added support for 64-bit modulo arithmetic on ARM. This is needed for the video4linux API to function properly and since there's already support for 64-bit divides, I think there shouldn't be any reason for the absence of this.

<[email protected]> (02/03/23 1.384.11.8)
[PATCH] 1092/1: Avoid unbalanced IRQ from LCD on SA1100

Remove "enable_irq(IRQ_LCD)" call from video/sa1100fb.c

<[email protected]> (02/03/24 1.384.11.9)
[PATCH] 1094/1: 2.4.18-rmk3: fix for build failure with no video 2.4.18-rmk3 fails to build on the EBSA285 if there is no video stuff enabled with a missing symbol. For me the linker lied and told me it was in irq.c but it was actually in the previous file in the link, mach-footbridge/arch.c ; the symbol is screen_info which is what the ORIG_* macros use.

Note I haven't yet tested this booting, just building.

<[email protected]> (02/03/24 1.529)
Miscellaneous build corrections/warning fixes.

<[email protected]> (02/03/25 1.524.11.1)
Break an include loop by moving cache flushing routines from asm/pgtable.h and/or asm/pgalloc.h to asm/cacheflush.h, and tlb flushing routines to asm/tlbflush.h.

<[email protected]> (02/03/26 1.524.12.1)
Add concept of system bus, so system devices (CPUs, PICs, etc) can have a common home in the device tree. Add helper functions for {un,}registering.

<[email protected]> (02/03/26 1.524.12.2)
Ok, really add drivers/base/sys.c

<[email protected]> (02/03/26 1.524.12.3)
Driver model update:
Create global list in which all devices are inserted. Done by Kai Germaschewski.

<[email protected]> (02/03/26 1.524.12.4)
Add device_{suspend,resume,shutdown} calls.

<[email protected]> (02/03/28 1.531)
Miscellaneous build/bug fixes.

<[email protected]> (02/04/01 1.524.13.1)

	Fix the kernel build when we have multi-part objects both in $(obj-y)
	and $(obj-m).
	
	Before, we would have built (though not linked) the individual objects
	for multi-part modules even when building vmlinux and vice versa.

<[email protected]> (02/04/03 1.524.7.39)
Tigon3 driver pci_unmap_foo changes were half complete, fix things up. Noted by Jeff Garzik.

<[email protected]> (02/04/03 1.524.21.1)
kernel/time.c needs linux/errno.h

<[email protected]> (02/04/03 1.524.21.2)
drivers/usb/hub.c needs linux/errno.h

<[email protected]> (02/04/03 1.524.21.3)
drivers/media/video/videodev.c needs linux/slab.h

<[email protected]> (02/04/03 1.524.22.1)
sparc64/kernel/semaphore.c needs errno.h
add forward decl of struct page to asm-sparc64/pgtable.h

<[email protected]> (02/04/03 1.524.22.2)
sparc64/kernel/binfmt_elf32.c:ELF_CORE_COPY_REGS needs final semi-colon.

<[email protected]> (02/04/03 1.524.22.3)
sparc64/math-emu/math.c needs linux/errno.h

<[email protected]> (02/04/03 1.524.23.1)
Update pcnet_cs net driver for recent removal of rmem_{start,end} from struct net_device. (actually, for this driver, the functionality was simply moved to 8390.h)

<[email protected]> (02/04/04 1.524.24.2)

	Remove unused references to dev->rmem_{start,end}
	from wavelan_cs net driver.

<[email protected]> (02/04/04 1.524.24.3)
olympic tokenring driver compile fix

<[email protected]> (02/04/04 1.524.24.4)
Add missing MODULE_LICENSE tags to several net drivers.

Also... surprise! Andrew Morton's aic7xxx build fix is also included. Ah well, 1001 people probably applied the same patch by hand, and it's easy to merge, so oh well.

<[email protected]> (02/04/04 1.524.24.5)
Merge ioc3-eth net drvr changes from 2.4.x:
- Improved MAC address discovery.
- endian fixes

<[email protected]> (02/04/04 1.524.24.6)
Merge gt96100 mips net drvr updates from 2.4.x:
* Moved to 2.4.14, [email protected]. Modified driver to add proper gt96100A support.
* Moved eth port 0 to irq 3 (mapped to GT_SERINT0 on EV96100A) in order for both ports to work. Also cleaned up boot option support (mac address string parsing), fleshed out gt96100_cleanup_module(), and other general code cleanups <[email protected]>.

<[email protected]> (02/04/04 1.524.24.7)
Merge au1000_eth net drvr updates from 2.4.x:
* add support for LSI 10/100 phy
* other minor cleanups

<[email protected]> (02/04/04 1.524.24.8)
com20020 arcnet drvr build fix (add missing comma)

<[email protected]> (02/04/04 1.524.24.9)
Merge ariadne2 net drvr updates from 2.4.x:
* use Zorro-specific z_{read,write}[bwl] routines
* remove superfluous include

<[email protected]> (02/04/04 1.524.24.10)
Merge a2065 net drvr update from 2.4.x:
* make sure to stop chip before enabling interrupt via request_irq

<[email protected]> (02/04/04 1.524.25.1)
IrDA: Fix w83977af_ir FIR drivers for new DMA API

<[email protected]> (02/04/04 1.524.25.2)
IrDA trivial fixes:
o [CORRECT] Handle signals while IrSock is blocked on Tx
o [CORRECT] Fix race condition in LAP when receiving with pf bit
o [CRITICA] Prevent queuing Tx data before IrComm is ready
o [FEATURE] Warn user of common misuse of IrLPT

<[email protected]> (02/04/04 1.524.25.3)
IrDA: Allow tuning of Max Tx MTU to workaround spec contradiction

<[email protected]> (02/04/04 1.524.25.4)
IrDA: Correct fix for IrNET disconnect indication :
if socket is not connected, don't hangup, to allow passive operation

<[email protected]> (02/04/04 1.524.25.5)
IrDA discovery fixes:
o [FEATURE] Propagate mode of discovery to higher protocols
o [CORRECT] Disable passive discovery in ircomm and irlan Prevent client and server to simultaneously connect to each other
o [CORRECT] Force expiry of discovery log on LAP disconnect

<[email protected]> (02/04/04 1.524.25.6)
IrDA USB disconnect changes:
o [CRITICA] Fix race condition between disconnect and the rest
o [CRITICA] Force synchronous unlink of URBs in disconnect
o [CRITICA] Cleanup instance if disconnect before close <Following patch from Martin Diehl>
o [CRITICA] Call usb_submit_urb() with GPF_ATOMIC

<[email protected]> (02/04/04 1.524.25.7)
IrDA: handle new NSC chip variant

<[email protected]> (02/04/04 1.524.25.8)
IrDA: Correct location of dev tx stats update

<[email protected]> (02/04/04 1.524.24.11)

	Merge hydra net drvr conversion to Zorro-specific
	z_{read,write}[bwl] routines from 2.4.x.

<[email protected]> (02/04/04 1.524.26.1)
This fixes the "i_blocks went wrong when the disk filled up" problem.

In ext3_new_block() we increment i_blocks early, so the quota operation can be performed outside lock_super(). But if the block allocation ends up failing, we forget to undo the allocation.

This is not a serious bug, and probably does not warrant an upgrade for production machines. Its effects are:

1) errors are generated from e2fsck and

2) users could appear to be over quota when they really aren't.

The patch undoes the accounting operation if the allocation ends up failing.

<[email protected]> (02/04/04 1.524.24.12)
Merge some new PCI ids from e100 to eepro100 net driver.

<[email protected]> (02/04/04 1.524.24.13)
Various minor bug fixes for 3c59x net driver.

<[email protected]> (02/04/04 1.524.24.14)
Fix jiffies-comparison timeout bug in arlan net driver.

<[email protected]> (02/04/04 1.524.26.2)
Andrew Morton's ext2 sync mount speedup. Description:

At present, when mounted synchronously or with `chattr +S' in effect, ext2 syncs the indirect blocks for every new block when extending a file.

This is not necessary, because a sync is performed on the way out of generic_file_write(). This will pick up all necessary data from inode->i_dirty_buffers and inode->i_dirty_data_buffers, and is sufficient.

The patch removes all the syncing of indirect blocks.

On a non-write-caching scsi disk, an untar of the util-linux tarball runs three times faster. Writing a 100 megabyte file in one megabyte chunks speeds up ten times.

The patch also removes the intermediate indirect block syncing on the truncate() path. Instead, we sync the indirects at a single place, via inode->i_dirty_buffers. This not only means that the writes (may) cluster better. It means that we perform much, much less actual I/O during truncate, because most or all of the indirects will no longer be needed for the file, and will be invalidated.

fsync() and msync() still work correctly. One side effect of this patch is that VM-initiated writepage() against a file hole will no longer block on writeout of indirect blocks. This is good.

<[email protected]> (02/04/04 1.524.26.3)
ext3 filesystem sync mount speedup:
Again, we don't need to sync indirects as we dirty them because we run a commit if IS_SYNC(inode) prior to returning to the caller of write(2).

Writing a 10 meg file in 0.1 meg chunks is sped up by, err, a factor of fifty. That's a best case.

<[email protected]> (02/04/04 1.524.24.15)
e100 net driver update 1/3:
The patch separates max busy wait constants making in max of 100 usec for wait scb and max of 50 usec for wait cus idle. These constants found sufficient using heavy traffic tests.

<[email protected]> (02/04/04 1.524.24.16)

	e100 net driver update 2/3:
	Adding missing pci write flush to the procedure e100_exec_cmd

<[email protected]> (02/04/04 1.524.24.17)

	e100 net driver update 3/3:
	Adding proper print level qualifier to the printk calls.

<[email protected]> (02/04/04 1.524.28.1)
Detect bad JFS directory to avoid infinite loop

<[email protected]> (02/04/04 1.524.28.2)
JFS include cleanup

Remove redundant include of slab.h
Submitted by Christoph Hellwig

<[email protected]> (02/04/04 1.524.28.3)
JFS: remove dead code

Submitted by Christoph Hellwig

<[email protected]> (02/04/04 1.524.28.4)
Add support for external JFS journal

Submitted by Christoph Hellwig & Dave Kleikamp

<[email protected]> (02/04/04 1.524.28.5)
JFS: simplify sync_metapage

Submitted by Christoph Hellwig

<[email protected]> (02/04/04 1.524.28.6)
Remove register keyword from JFS code

Submitted by Christoph Hellwig

<[email protected]> (02/04/04 1.524.28.7)
No need to handle regular files in jfs_mknod Submitted by Christoph Hellwig

<[email protected]> (02/04/04 1.524.28.8)
Make JFS licence boilerplate uniform, update copyright dates Submitted by Christoph Hellwig and Dave Kleikamp

<[email protected]> (02/04/04 1.524.29.1)
Don't allow preemption to change task state.

<[email protected]> (02/04/04 1.524.29.2)
[PATCH] kjournald exits with nonzero preempt_count

The preempt_count debug check that went into 2.5.8-pre1 already caught a simple case in kjournald. Specifically, kjournald does not drop the BKL when it exits as it knows schedule will do so for it.

For the sake of clarity and exiting with a preempt_count of zero, the attached patch explicitly calls unlock_kernel when kjournald is exiting.

<[email protected]> (02/04/04 1.524.29.4)
Fix up bad time compare from the -dj merge

<[email protected]> (02/04/04 1.534)

	Cset exclude: [email protected]|ChangeSet|20020403195622

<[email protected]> (02/04/04 1.524.7.40)
In linux/skbuff.h, always use unsigned long for flags.

<[email protected]> (02/04/04 1.524.22.4)
On sparc64, flush_thread needs to setup the PGD cache for 64-bit apps too.

<[email protected]> (02/04/04 1.524.30.1)
USB visor driver

Added support for the Sony OS 4.1 devices. Thanks to Hiroyuki ARAKI <[email protected]> for the information.

<[email protected]> (02/04/04 1.535)
Update kernel version

<[email protected]> (02/04/04 1.536)
[PATCH] cleanup list usage in dquot

From the kernel janitor folks

<[email protected]> (02/04/04 1.537)
[PATCH] list_for_each is fs/

From the kernel janitor folks

<[email protected]> (02/04/04 1.538)
[PATCH] Improved allocator for NTFS

Originally by Anton Altaparmakov.
I think Anton is going to submit his rewritten NTFS soon making this null and void, but in the interim, it fixes a known problem with NTFS and large allocations.

<[email protected]> (02/04/04 1.539)
[PATCH] increase number of transaction locks in JFS txnmgr

Original fix from Andi Kleen

<[email protected]> (02/04/04 1.540)
[PATCH] MSDOS fs option parser cleanup

Original from Rene Scharfe
This fixes a problem where MSDOS fs's ignore their 'check' mount option.

<[email protected]> (02/04/04 1.541)
[PATCH] bss bits for isofs

Originally from the kernel janitor folks

<[email protected]> (02/04/04 1.542)
[PATCH] QNX4fs sync

Brings QNX4FS back in sync with 2.4

<[email protected]> (02/04/04 1.543)
[PATCH] better dquot accounting

<[email protected]> (02/04/04 1.544)
[PATCH] ext3 inode generation improvements.

Originally from Andrew Morton

<[email protected]> (02/04/04 1.545)
[PATCH] named structure initialisers for fs/

Originally by Grant R.Guenther
Has had a quick once over by Al, who weeded out one chunk that was unrelated.

<[email protected]> (02/04/04 1.546)
[PATCH] struct super_block cleanup - reiserfs

Original from: Brian Gerst <[email protected]> Has had a once over by Chris Mason and Al.

Seperates reiserfs_sb_info from struct super_block.

Brian Gerst

<[email protected]> (02/04/04 1.555)
[PATCH] EFI GUID partition support update.

More bits from Matt Domsch. Fixes GUID printing, and updates to what's in the IA64 tree. Other cleanups are mentioned in the changelog in the patch.

<[email protected]> (02/04/04 1.524.30.2)
USB

moved files to different subdirectories to make try to make sense of the current mess, and to allow usb client drivers to integrate into the tree easier.

<[email protected]> (02/04/04 1.556)
[PATCH] IS_DEADDIR checks (2.5)

2.4 variant will go to Marcelo in a couple of minutes.

Patch moves IS_DEADDIR() checks into may_delete().

<[email protected]> (02/04/04 1.524.30.3)
usb subsystem now builds as modules.
dependancies still seem broken.

<[email protected]> (02/04/04 1.557)
update x86 defconfig

<[email protected]> (02/04/04 1.558)
Fix tlbflush header file dependencies

<[email protected]> (02/04/04 1.559)
uhhuh. Fix duplicate merge from -dj tree

<[email protected]> (02/04/04 1.560)
[PATCH] preemptive kernel behavior change: don't be rude

- do not manually set task->state
- instead, in preempt_schedule, set a flag in preempt_count that denotes that this task is entering schedule off a kernel preemption.
- use this flag in schedule to jump to pick_next_task
- in preempt_schedule, upon return from schedule, unset the flag
- have entry.S just call preempt_schedule and not duplicate this work, as Linus suggested. I agree. Note this makes debugging easier as we keep a single point of entry for kernel preemptions.

The result: we can safely preempt non-TASK_RUNNING tasks. If one is preempted, we can safely survive schedule because we won't handle the special casing of non-TASK_RUNNING at the top of schedule. Thus other tasks can run as desired and our non-TASK_RUNNING task will eventually be rescheduled, in its original state, and complete happily.

This is the behavior we have in the 2.4 patches and 2.5 until ~2.5.6-pre. This works. It requires no other changes elsewhere (it actually removes some special-casing Ingo did in the signal code).

<[email protected]> (02/04/04 1.524.30.4)
USB

moved lots of the Config.in info into the subdirectories. fixed up the makefiles to work nicer.

<[email protected]> (02/04/04 1.561)
Scheduler preempt fixes and cleanups

<[email protected]> (02/04/04 1.562)
Make the assembly-level code match the preempt_sched changes

<[email protected]> (02/04/04 1.563)
More fixups for tlbflush.h header split

<[email protected]> (02/04/04 1.564)
Fix exit_notify() to actually do what the comment says it should do - lock out preemption.

<[email protected]> (02/04/04 1.524.30.5)
USB

moved some files from misc to image
cleaned up makefile some more.

<[email protected]> (02/04/04 1.524.30.6)
USB

fixed lib Makefile problem with usb files moving moved drivers/usb/scanner/ to drivers/usb/image/

<[email protected]> (02/04/05 1.524.30.7)
USB

moved the host drivers help to the host directory

<[email protected]> (02/04/05 1.524.30.8)
USB

more file movement cleanups. Now handles misc drivers compiled into the kernel corectly.

<[email protected]> (02/04/05 1.566)
Add device_shutdown() calls to reboot and power off transitions (and let the user know)

<[email protected]> (02/04/05 1.567)
compile fix for drivers/base/sys.c

<[email protected]> (02/04/05 1.568)
Add platform driver object

<[email protected]> (02/04/05 1.524.30.9)
USB

moved class/storage/ back to storage/ created input/
orderd the makefiles and config.in menus better.

<[email protected]> (02/04/05 1.570)
Duh. Use "device_lock", not "device_root" for locking.

<[email protected]> (02/04/05 1.524.30.10)
USB

added a README file to explain what the different subdirectories are for.

<[email protected]> (02/04/05 1.524.30.11)
USB

moved the USB_STORAGE Config.help items into the drivers/usb/storage directory.

<[email protected]> (02/04/05 1.572)
[PATCH] elevator 'buglet'

Lets just kill this check -- it usually only catches drivers queueing something in front of a started request on their own (such as shoving a request sense in front of a failed packet command, for instance). So it's either working around this detection in some drivers, or killing it. I vote for the latter, patch attached against 2.5.8-pre1 :-)

<[email protected]> (02/04/05 1.573)
[PATCH] PATCH 1 of 4 : knfsd : Use symbols for size calculation for response sizes.

Use symbolic names for some common size components in the response size calculation for the NFSD. This makes it easier to get the numbers right and to review them.
This patch also fixes a few number for nfsv3 that were wrong.

<[email protected]> (02/04/05 1.574)
[PATCH] PATCH 2 of 4 : knfsd : Allow exporting of deviceless filesystems if fsid= given

Previously we could only export FS_REQUIRES_DEV filesystems as we need a devno to put in the filehandle.
Now that we have fsid= (NFSEXP_FSID) we don't need a devno to put in the filehandle so we can relax this requirement.

<[email protected]> (02/04/05 1.575)
[PATCH] PATCH 3 of 4 : knfsd : Store the fsid in the returned attributes instead of the device number

When a filesystem is exported with fsid= we should use that fsid instead of the i_dev number when returning NFS attributes, so that there is no chance of clients that depend on the filesys id in the attributes getting confused by device numbers changing.

We only do this if the reference filehandle uses fsid to identify the filesystem, so that a server can be converted from non-fsid= to using fsid= without confusing active clients.

<[email protected]> (02/04/05 1.576)
[PATCH] PATCH 4 of 4 : knfsd : Increase the max block size for NFS replies.

This increases the max read/write size for nfsd from 8K to 32K.

This requires making NFSv2 return the right number in statfs requests. NFSv3 already does that.

<[email protected]> (02/04/05 1.577)
[PATCH] PATCH 4a or 4 : knfs : typo...

typo in that last patch, sorry.

<[email protected]> (02/04/05 1.578)
[PATCH] shift BKL out of notify_change

Moved i_sem down into notify_change() and out of the UMSDOS function. Moved BKL down from notify_change into filesystems.

<[email protected]> (02/04/05 1.579)
Make legacy drivers who use "virt_to_bus()" and friends work on x86.

It's up to other architectures to worry about portability for now.

<[email protected]> (02/04/05 1.581)
Oops, remove remnants of old attribute lock

<[email protected]> (02/04/05 1.582)
Force some semblance of workingness onto qla1280 driver

<[email protected]> (02/04/05 1.583)
Clean up do_truncate due notify_change() locking change

#1 lore raw
Quoted 6 lines · Linus Torvalds

More merging with various people, USB+ARM+more network drivers etc.

The actual patch is pretty huge, because the USB changes moves USB files around a lot. The BK diffs (and actual "real changes") are smaller than the patch would imply (here Larry pipes up with number of deltas ;)

Here ya go.

takepatch: 991 new revisions, 0 conflicts in 578 files 206734 bytes uncompressed to 954854, 4.62X expansion Running resolve to apply new work ...
Using lm.bitmover.com:0 as graphical display Verifying consistency of the RESYNC tree...
resolve: found 103 renames in pass 1
resolve: resolved 103 renames in pass 2
resolve: applied 578 files in pass 4

I love how much people move around files when the SCM system actually handles it properly. I used to worry that people who were trained to not move files by CVS would never figure out that BK handles it; I was wrong and glad of it :)

Signature · 2 lines
---
Larry McVoy            	 lm at bitmover.com           http://www.bitmover.com/lm 
#2 lore raw
In reply to Linus Torvalds
Quoted 7 lines · Linus Torvalds

<[email protected]> (02/03/13 1.388.3.5)
Update ARM related video drivers:
- cyber2000fb
- sa1100fb
Add new ARM video drivers:
- anakinfb
- clps711xfb

Please either add resource management code to anakinfb and clps711xfb, or apply the patch below.

drivers/video/fbmem.c renamed from drivers/video/fbmem.c.orig +6 -6
@@ -157,12 +157,6 @@
 #ifdef CONFIG_FB_AMIGA
 	{ "amifb", amifb_init, amifb_setup },
 #endif
-#ifdef CONFIG_FB_ANAKIN
-	{ "anakinfb", anakinfb_init, NULL },
-#endif
-#ifdef CONFIG_FB_CLPS711X
-	{ "clps711xfb", clps711xfb_init, NULL },
-#endif
 #ifdef CONFIG_FB_CYBER
 	{ "cyber", cyberfb_init, cyberfb_setup },
 #endif
@@ -293,6 +287,12 @@
 #endif
 #ifdef CONFIG_FB_VOODOO1
 	{ "sst", sstfb_init, sstfb_setup },
+#endif
+#ifdef CONFIG_FB_ANAKIN
+	{ "anakinfb", anakinfb_init, NULL },
+#endif
+#ifdef CONFIG_FB_CLPS711X
+	{ "clps711xfb", clps711xfb_init, NULL },
 #endif
 	/*
 	 * Generic drivers that don't use resource management (yet)

Gr{oetje,eeting}s,

Geert (fbdev init order watchdog^H^H^Hpenguin)

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw
In reply to Linus Torvalds
Quoted 2 lines · Geert Uytterhoeven

Please either add resource management code to anakinfb and clps711xfb, or apply the patch below.

They're not ISA nor PCI - in fact, they're specific system-on-a-chip framebuffers. I therefore don't see the point of your patch.

(Oh, and a bugbear - people go running around adding checks for the return value of request_region and friends on embedded devices where there can't be the possibility of a clash waste memory needlessly.)

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#4 lore raw
Quoted 6 lines · Russell King
Quoted 2 lines · Geert Uytterhoeven

Please either add resource management code to anakinfb and clps711xfb, or apply the patch below.

They're not ISA nor PCI - in fact, they're specific system-on-a-chip framebuffers. I therefore don't see the point of your patch.

Even then, please don't add them to the section marked with the comment Chipset specific drivers that use resource management'. My patch just moves their initialization to the section marked with the comment Chipset specific drivers that don't use resource management (yet)'. So it's still valid.

Quoted 3 lines

(Oh, and a bugbear - people go running around adding checks for the return value of request_region and friends on embedded devices where there can't be the possibility of a clash waste memory needlessly.)

Perhaps you want to modularize the driver later? Resource management also prevents you from insmoding two drivers for the same hardware.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#5 lore raw
In reply to Russell King
Quoted 2 lines · Geert Uytterhoeven

Perhaps you want to modularize the driver later? Resource management also prevents you from insmoding two drivers for the same hardware.

I doubt I'll be doing anything with those two drivers - up to other people. I'm prodding them now, but not expecting any immediate reaction.

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#6 lore raw
In reply to Russell King
Quoted 5 lines · Geert Uytterhoeven
Quoted 4 lines · Russell King
Quoted 2 lines · Geert Uytterhoeven

Please either add resource management code to anakinfb and clps711xfb, or apply the patch below.

Quoted 7 lines
Quoted 2 lines

They're not ISA nor PCI - in fact, they're specific system-on-a-chip framebuffers. I therefore don't see the point of your patch.

Even then, please don't add them to the section marked with the comment Chipset specific drivers that use resource management'. My patch just moves their initialization to the section marked with the comment Chipset specific drivers that don't use resource management (yet)'. So it's still valid.

Ok, I agree the clps711x can be moved. As for Anakin, that's up to the anakin people to sort out - I've mailed them directly. There's a bunch of other stuff in there as well that needs to be fixed up.

Quoted 6 lines
Quoted 3 lines

(Oh, and a bugbear - people go running around adding checks for the return value of request_region and friends on embedded devices where there can't be the possibility of a clash waste memory needlessly.)

Perhaps you want to modularize the driver later? Resource management also prevents you from insmoding two drivers for the same hardware.

Point 1: You can't perform resource management on the System RAM since
they're already claimed.
Point 2: You can't perform resource management on bits in a control
register that performs many other random functions; resource management is byte based not bit based.

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#7 lore raw
Quoted 11 lines · Russell King
Quoted 7 lines · Geert Uytterhoeven
Quoted 3 lines · Russell King

(Oh, and a bugbear - people go running around adding checks for the return value of request_region and friends on embedded devices where there can't be the possibility of a clash waste memory needlessly.)

Perhaps you want to modularize the driver later? Resource management also prevents you from insmoding two drivers for the same hardware.

Point 1: You can't perform resource management on the System RAM since
they're already claimed.

Hmmm... Just guessing: perhaps because you created the System RAM resource using request_mem_region() instead of request_resource()?

On Amiga the Chip RAM allocator uses the resource management system, and both the whole bunch of Chip RAM (parent) and all allocated blocks (children) show up in /proc/iomem.

Quoted 3 lines

Point 2: You can't perform resource management on bits in a control
register that performs many other random functions; resource management is byte based not bit based.

That's indeed more nasty.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#8 lore raw
In reply to Linus Torvalds
Quoted 4 lines · Russell King

(Oh, and a bugbear - people go running around adding checks for the return value of request_region and friends on embedded devices where there can't be the possibility of a clash waste memory needlessly.)

If you do:

#define request_region(start, n, name)
	({
		__request_region(start, n, name);
		(struct resource *)1;
	})

#define release_region(start, n) do { } while (0)

then the compiler will remove all those error checks for you, as well as the release_region calls.

Of course if you actually want to use the innards of the returned resource * then that's not so good.

However, you can make it:

#define request_region()                                \
        ({                                              \
                struct resource *r;                     \
                r = __request_region();                 \
                (struct resource *)((long)r | 1);       \
        })

and, amazingly, the compiler still knows that the value is non-zero, and still will elide those tests. You'll need to mask that bit off again to use the pointer.

Whether you'll stoop this low depends upon how much you want those bytes back :)

-

#9 lore raw

PATCH 1/1 2.5.8-pre2 IDE 29b

In reply to Linus Torvalds

Sun Mar 31 01:13:30 CET 2002 ide-clean-29a

- Synchronize with 2.5.8-pre2.

- Eliminate the mate member of the ata_channel structure. The information provided by it is already present. This patch may have undesirable effects on the ns87415.c and trm290.c host chip drivers, but it's worth for structural reasons to have it.

- Kill unused code, which was "fixing" interrupt routing from ide-pci.c Don't pass any "mate" between the functions there.

- Don't define SUPPORT_VLB_SYNC unconditionally in ide-taskfile.c

- Apply Vojtech Pavliks fix for piix host-chip driver crashes.

- Add linux/types.h to ide-pnp.c.

- Apply latest sis5513 host chip driver patch from by Lionel Bouton by hand.

- Apply patch by Jens Axboe for ide_dma_off which makes it to have the desired effect. This may result in a small conflict with the current BK tree, but can be just ignored.

- Apply patch by Paul Macerras for power-mac.

- Try to make the ns87415 driver a bit more reentrant.

OK patch generation threshold reached.

MAINTAINERS +7 -0
diff -urN linux-2.5.8-pre2/MAINTAINERS linux/MAINTAINERS
@@ -1386,6 +1386,13 @@
 M:	[email protected]
 S:	Maintained
 
+SIS 5513 IDE CONTROLLER DRIVER
+P:      Lionel Bouton
+M:      [email protected]
+W:      http://inet6.dyn.dhs.org/sponsoring/sis5513/index.html
+W:      http://gyver.homeip.net/sis5513/index.html
+S:      Maintained
+
 SIS 900/7016 FAST ETHERNET DRIVER
 P:	Ollie Lho
 M:	[email protected]
drivers/ide/ali14xx.c +2 -3
diff -urN linux-2.5.8-pre2/drivers/ide/ali14xx.c linux/drivers/ide/ali14xx.c
@@ -212,9 +212,8 @@
 	ide_hwifs[1].chipset = ide_ali14xx;
 	ide_hwifs[0].tuneproc = &ali14xx_tune_drive;
 	ide_hwifs[1].tuneproc = &ali14xx_tune_drive;
-	ide_hwifs[0].mate = &ide_hwifs[1];
-	ide_hwifs[1].mate = &ide_hwifs[0];
-	ide_hwifs[1].unit = 1;
+	ide_hwifs[0].unit = ATA_PRIMARY;
+	ide_hwifs[1].unit = ATA_SECONDARY;
 
 	/* initialize controller registers */
 	if (!initRegisters()) {
drivers/ide/cmd640.c +4 -6
diff -urN linux-2.5.8-pre2/drivers/ide/cmd640.c linux/drivers/ide/cmd640.c
@@ -689,7 +689,7 @@
 /*
  * Probe for a cmd640 chipset, and initialize it if found.  Called from ide.c
  */
-int __init ide_probe_for_cmd640x (void)
+int __init ide_probe_for_cmd640x(void)
 {
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
 	int second_port_toggled = 0;
@@ -793,9 +793,7 @@
 		cmd_hwif0->serialized = 1;
 		cmd_hwif1->serialized = 1;
 		cmd_hwif1->chipset = ide_cmd640;
-		cmd_hwif0->mate = cmd_hwif1;
-		cmd_hwif1->mate = cmd_hwif0;
-		cmd_hwif1->unit = 1;
+		cmd_hwif1->unit = ATA_SECONDARY;
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
 		cmd_hwif1->tuneproc = &cmd640_tune_drive;
 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
@@ -811,8 +809,8 @@
 		ide_drive_t *drive = cmd_drives[index];
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
 		if (drive->autotune || ((index > 1) && second_port_toggled)) {
-	 		/*
-	 		 * Reset timing to the slowest speed and turn off prefetch.
+			/*
+			 * Reset timing to the slowest speed and turn off prefetch.
 			 * This way, the drive identify code has a better chance.
 			 */
 			setup_counts    [index] = 4;	/* max possible */
drivers/ide/cs5530.c +1 -2
diff -urN linux-2.5.8-pre2/drivers/ide/cs5530.c linux/drivers/ide/cs5530.c
@@ -346,8 +346,7 @@
  */
 void __init ide_init_cs5530(struct ata_channel *hwif)
 {
-	if (hwif->mate)
-		hwif->serialized = hwif->mate->serialized = 1;
+	hwif->serialized = 1;
 	if (!hwif->dma_base) {
 		hwif->autodma = 0;
 	} else {
drivers/ide/dtc2278.c +2 -3
diff -urN linux-2.5.8-pre2/drivers/ide/dtc2278.c linux/drivers/ide/dtc2278.c
@@ -124,7 +124,6 @@
 	ide_hwifs[0].drives[1].no_unmask = 1;
 	ide_hwifs[1].drives[0].no_unmask = 1;
 	ide_hwifs[1].drives[1].no_unmask = 1;
-	ide_hwifs[0].mate = &ide_hwifs[1];
-	ide_hwifs[1].mate = &ide_hwifs[0];
-	ide_hwifs[1].unit = 1;
+	ide_hwifs[0].unit = ATA_PRIMARY;
+	ide_hwifs[1].unit = ATA_SECONDARY;
 }
drivers/ide/hpt366.c +3 -3
diff -urN linux-2.5.8-pre2/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
@@ -1125,13 +1125,13 @@
 
 	if (n_hpt_devs < HPT366_MAX_DEVS)
 		hpt_devs[n_hpt_devs++] = dev;
-	
+
 #if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
 	if (!hpt366_proc) {
 		hpt366_proc = 1;
 		hpt366_display_info = &hpt366_get_info;
 	}
-#endif /* DISPLAY_HPT366_TIMINGS && CONFIG_PROC_FS */
+#endif
 
 	return dev->irq;
 }
@@ -1146,7 +1146,7 @@
 	printk("HPT366: reg5ah=0x%02x ATA-%s Cable Port%d\n",
 		ata66, (ata66 & regmask) ? "33" : "66",
 		PCI_FUNC(hwif->pci_dev->devfn));
-#endif /* DEBUG */
+#endif
 	return ((ata66 & regmask) ? 0 : 1);
 }
 
drivers/ide/ht6560b.c +3 -4
diff -urN linux-2.5.8-pre2/drivers/ide/ht6560b.c linux/drivers/ide/ht6560b.c
@@ -319,10 +319,9 @@
 			ide_hwifs[1].tuneproc = &tune_ht6560b;
 			ide_hwifs[0].serialized = 1;  /* is this needed? */
 			ide_hwifs[1].serialized = 1;  /* is this needed? */
-			ide_hwifs[0].mate = &ide_hwifs[1];
-			ide_hwifs[1].mate = &ide_hwifs[0];
-			ide_hwifs[1].unit = 1;
-			
+			ide_hwifs[0].unit = ATA_PRIMARY;
+			ide_hwifs[1].unit = ATA_SECONDARY;
+
 			/*
 			 * Setting default configurations for drives
 			 */
drivers/ide/ide-dma.c +2 -2
diff -urN linux-2.5.8-pre2/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
@@ -421,7 +421,7 @@
 	return 0;
 }
 
-static int report_drive_dmaing (ide_drive_t *drive)
+int report_drive_dmaing (ide_drive_t *drive)
 {
 	struct hd_driveid *id = drive->id;
 
@@ -562,8 +562,8 @@
 	switch (func) {
 		case ide_dma_off:
 			printk("%s: DMA disabled\n", drive->name);
-			set_high = 0;
 		case ide_dma_off_quietly:
+			set_high = 0;
 			outb(inb(dma_base+2) & ~(1<<(5+unit)), dma_base+2);
 		case ide_dma_on:
 			ide_toggle_bounce(drive, set_high);
drivers/ide/ide-pci.c +59 -75

258 lines not on this page · raw message

drivers/ide/ide-pmac.c +816 -411

1,762 lines not on this page · raw message

drivers/ide/ide-pnp.c +1 -0
diff -urN linux-2.5.8-pre2/drivers/ide/ide-pnp.c linux/drivers/ide/ide-pnp.c
@@ -16,6 +16,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/types.h>
 #include <linux/ide.h>
 #include <linux/init.h>
 
drivers/ide/ide-probe.c +9 -11
diff -urN linux-2.5.8-pre2/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -140,7 +140,7 @@
 				/* kludge for Apple PowerBook internal zip */
 				if (!strstr(id->model, "CD-ROM") && strstr(id->model, "ZIP")) {
 					printk ("FLOPPY");
-					type = ide_floppy;
+					type = ATA_FLOPPY;
 					break;
 				}
 #endif
@@ -666,13 +666,12 @@
 				hwif->sharing_irq = h->sharing_irq = 1;
 				if (hwif->chipset != ide_pci || h->chipset != ide_pci)
 					save_match(hwif, h, &match);
-			}
-			if (hwif->serialized) {
-				if (hwif->mate && hwif->mate->irq == h->irq)
-					save_match(hwif, h, &match);
-			}
-			if (h->serialized) {
-				if (h->mate && hwif->irq == h->mate->irq)
+
+				/* FIXME: This is still confusing. What would
+				 * happen if we match-ed two times?
+				 */
+
+				if (hwif->serialized || h->serialized)
 					save_match(hwif, h, &match);
 			}
 		}
@@ -823,12 +822,11 @@
 
 	for (unit = 0; unit < MAX_DRIVES; ++unit) {
 		char name[80];
+
 		ide_add_generic_settings(hwif->drives + unit);
 		hwif->drives[unit].dn = ((hwif->unit ? 2 : 0) + unit);
 		sprintf (name, "host%d/bus%d/target%d/lun%d",
-			(hwif->unit && hwif->mate) ?
-			hwif->mate->index : hwif->index,
-			hwif->unit, unit, hwif->drives[unit].lun);
+			hwif->index, hwif->unit, unit, hwif->drives[unit].lun);
 		if (hwif->drives[unit].present)
 			hwif->drives[unit].de = devfs_mk_dir(ide_devfs_handle, name, NULL);
 	}
drivers/ide/ide-proc.c +0 -14
diff -urN linux-2.5.8-pre2/drivers/ide/ide-proc.c linux/drivers/ide/ide-proc.c
@@ -164,19 +164,6 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-static int proc_ide_read_mate
-	(char *page, char **start, off_t off, int count, int *eof, void *data)
-{
-	struct ata_channel *hwif = data;
-	int		len;
-
-	if (hwif && hwif->mate && hwif->mate->present)
-		len = sprintf(page, "%s\n", hwif->mate->name);
-	else
-		len = sprintf(page, "(none)\n");
-	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
-}
-
 static int proc_ide_read_channel
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
@@ -493,7 +480,6 @@
 
 static ide_proc_entry_t hwif_entries[] = {
 	{ "channel",	S_IFREG|S_IRUGO,	proc_ide_read_channel,	NULL },
-	{ "mate",	S_IFREG|S_IRUGO,	proc_ide_read_mate,	NULL },
 	{ "model",	S_IFREG|S_IRUGO,	proc_ide_read_imodel,	NULL },
 	{ NULL,	0, NULL, NULL }
 };
drivers/ide/ide.c +8 -4
diff -urN linux-2.5.8-pre2/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -2177,7 +2177,7 @@
 		}
 		for (h = 0; h < MAX_HWIFS; ++h) {
 			hwif = &ide_hwifs[h];
-			if ((!hwif->present && !hwif->mate && !initializing) ||
+			if ((!hwif->present && (hwif->unit == ATA_PRIMARY) && !initializing) ||
 			    (!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing))
 				goto found;
 		}
@@ -3052,9 +3052,13 @@
 				goto done;
 			case -2: /* "serialize" */
 			do_serialize:
-				hwif->mate = &ide_hwifs[hw^1];
-				hwif->mate->mate = hwif;
-				hwif->serialized = hwif->mate->serialized = 1;
+				{
+					struct ata_channel *mate;
+
+					mate = &ide_hwifs[hw ^ 1];
+					hwif->serialized = 1;
+					mate->serialized = 1;
+				}
 				goto done;
 
 			case -1: /* "noprobe" */
drivers/ide/ns87415.c +30 -10
diff -urN linux-2.5.8-pre2/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
@@ -141,11 +141,21 @@
 	using_inta = progif & (1 << (hwif->unit << 1));
 	if (!using_inta)
 		using_inta = ctrl & (1 << (4 + hwif->unit));
-	if (hwif->mate) {
-		hwif->select_data = hwif->mate->select_data;
+	if (hwif->unit == ATA_SECONDARY) {
+
+		/* FIXME: If we are initializing the secondary channel, let us
+		 * assume that the primary channel got initialized just a tad
+		 * bit before now.  It would be much cleaner if the data in
+		 * ns87415_control just got duplicated.
+		 */
+
+		if (!hwif->select_data)
+		    hwif->select_data = (unsigned long)
+			&ns87415_control[ns87415_count - 1];
 	} else {
-		hwif->select_data = (unsigned long)
-					&ns87415_control[ns87415_count++];
+		if (!hwif->select_data)
+		    hwif->select_data = (unsigned long)
+			&ns87415_control[ns87415_count++];
 		ctrl |= (1 << 8) | (1 << 9);	/* mask both IRQs */
 		if (using_inta)
 			ctrl &= ~(1 << 6);	/* unmask INTA */
@@ -170,9 +180,9 @@
 		do {
 			udelay(50);
 			stat = inb(hwif->io_ports[IDE_STATUS_OFFSET]);
-                	if (stat == 0xff)
-                        	break;
-        	} while ((stat & BUSY_STAT) && --timeout);
+			if (stat == 0xff)
+				break;
+		} while ((stat & BUSY_STAT) && --timeout);
 #endif
 	}
 
@@ -181,13 +191,23 @@
 
 	if (!using_inta)
 		hwif->irq = hwif->unit ? 15 : 14;	/* legacy mode */
-	else if (!hwif->irq && hwif->mate && hwif->mate->irq)
-		hwif->irq = hwif->mate->irq;	/* share IRQ with mate */
+	else {
+		static int primary_irq = 0;
+
+		/* Ugly way to let the primary and secondary channel on the
+		 * chip use the same IRQ line.
+		 */
+
+		if (hwif->unit == ATA_PRIMARY)
+			primary_irq = hwif->irq;
+		else if (!hwif->irq)
+			hwif->irq = primary_irq;
+	}
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (hwif->dma_base)
 		hwif->dmaproc = &ns87415_dmaproc;
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 
 	hwif->selectproc = &ns87415_selectproc;
 }
drivers/ide/pdc4030.c +3 -4
diff -urN linux-2.5.8-pre2/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
@@ -162,7 +162,7 @@
 	struct dc_ident ident;
 	int i;
 	ide_startstop_t startstop;
-	
+
 	if (!hwif) return 0;
 
 	drive = &hwif->drives[0];
@@ -224,9 +224,8 @@
 	 */
 
 	hwif->chipset	= hwif2->chipset = ide_pdc4030;
-	hwif->mate	= hwif2;
-	hwif2->mate	= hwif;
-	hwif2->unit	= 1;
+	hwif->unit	= ATA_PRIMARY;
+	hwif2->unit	= ATA_SECONDARY;
 	hwif->selectproc = hwif2->selectproc = &promise_selectproc;
 	hwif->serialized = hwif2->serialized = 1;
 
drivers/ide/piix.c +3 -3
diff -urN linux-2.5.8-pre2/drivers/ide/piix.c linux/drivers/ide/piix.c
@@ -1,5 +1,5 @@
 /*
- * $Id: piix.c,v 1.2 2002/03/13 22:50:43 vojtech Exp $
+ * $Id: piix.c,v 1.3 2002/03/29 16:06:06 vojtech Exp $
  *
  *  Copyright (c) 2000-2002 Vojtech Pavlik
  *
@@ -128,7 +128,7 @@
 
 	piix_print("----------PIIX BusMastering IDE Configuration---------------");
 
-	piix_print("Driver Version:                     1.2");
+	piix_print("Driver Version:                     1.3");
 	piix_print("South Bridge:                       %s", bmide_dev->name);
 
 	pci_read_config_byte(dev, PCI_REVISION_ID, &t);
@@ -331,7 +331,7 @@
 		umul = 2;
 
 	T = 1000000000 / piix_clock;
-	UT = T / umul;
+	UT = umul ? (T / umul) : 0;
 
 	ata_timing_compute(drive, speed, &t, T, UT);
 
drivers/ide/qd65xx.c +5 -4
diff -urN linux-2.5.8-pre2/drivers/ide/qd65xx.c linux/drivers/ide/qd65xx.c
@@ -411,22 +411,23 @@
 
 			return 1;
 		} else {
-			int i,j;
+			int i;
+
 			/* secondary enabled */
 			printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n",
 					ide_hwifs[0].name,ide_hwifs[1].name);
 
-			for (i=0;i<2;i++) {
+			for (i = 0; i < 2; i++) {
+				int j;
 
 				ide_hwifs[i].chipset = ide_qd65xx;
-				ide_hwifs[i].mate = &ide_hwifs[i^1];
 				ide_hwifs[i].unit = i;
 
 				ide_hwifs[i].select_data = base;
 				ide_hwifs[i].config_data = config | (control <<8);
 				ide_hwifs[i].tuneproc = &qd6580_tune_drive;
 
-				for (j=0;j<2;j++) {
+				for (j = 0; j < 2; j++) {
 					ide_hwifs[i].drives[j].drive_data =
 					       i?QD6580_DEF_DATA2:QD6580_DEF_DATA;
 					ide_hwifs[i].drives[j].io_32bit = 1;
drivers/ide/sis5513.c +54 -71

297 lines not on this page · raw message

drivers/ide/trm290.c +13 -2
diff -urN linux-2.5.8-pre2/drivers/ide/trm290.c linux/drivers/ide/trm290.c
@@ -248,8 +248,19 @@
 
 	if ((reg & 0x10))
 		hwif->irq = hwif->unit ? 15 : 14;	/* legacy mode */
-	else if (!hwif->irq && hwif->mate && hwif->mate->irq)
-		hwif->irq = hwif->mate->irq;		/* sharing IRQ with mate */
+	else {
+		static int primary_irq = 0;
+
+		/* Ugly way to let the primary and secondary channel on the
+		 * chip use the same IRQ line.
+		 */
+
+		if (hwif->unit == ATA_PRIMARY)
+			primary_irq = hwif->irq;
+		else if (!hwif->irq)
+			hwif->irq = primary_irq;
+	}
+
 	ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->unit ? 0x0080 : 0x0000), 3);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
drivers/ide/umc8672.c +3 -4
diff -urN linux-2.5.8-pre2/drivers/ide/umc8672.c linux/drivers/ide/umc8672.c
@@ -146,7 +146,7 @@
 	{
 		__restore_flags(flags);	/* local CPU only */
 		printk ("umc8672: not found\n");
-		return;  
+		return;
 	}
 	outb_p (0xa5,0x108); /* disable umc */
 
@@ -158,7 +158,6 @@
 	ide_hwifs[1].chipset = ide_umc8672;
 	ide_hwifs[0].tuneproc = &tune_umc;
 	ide_hwifs[1].tuneproc = &tune_umc;
-	ide_hwifs[0].mate = &ide_hwifs[1];
-	ide_hwifs[1].mate = &ide_hwifs[0];
-	ide_hwifs[1].unit = 1;
+	ide_hwifs[0].unit = ATA_PRIMARY;
+	ide_hwifs[1].unit = ATA_SECONDARY;
 }
include/linux/ide.h +6 -8
diff -urN linux-2.5.8-pre2/include/linux/ide.h linux/include/linux/ide.h
@@ -433,10 +433,10 @@
 typedef void (ide_maskproc_t) (ide_drive_t *, int);
 typedef void (ide_rw_proc_t) (ide_drive_t *, ide_dma_action_t);
 
-/*
- * ide soft-power support
- */
-typedef int (ide_busproc_t) (ide_drive_t *, int);
+enum {
+	ATA_PRIMARY	= 0,
+	ATA_SECONDARY	= 1
+};
 
 struct ata_channel {
 	struct device	dev;		/* device handle */
@@ -467,7 +467,6 @@
 	struct scatterlist *sg_table;	/* Scatter-gather list used to build the above */
 	int sg_nents;			/* Current number of entries in it */
 	int sg_dma_direction;		/* dma transfer direction */
-	struct ata_channel *mate;	/* other hwif from same PCI chip */
 	unsigned long	dma_base;	/* base addr for dma ports */
 	unsigned	dma_extra;	/* extra addr for dma ports */
 	unsigned long	config_data;	/* for use by chipset-specific code */
@@ -480,7 +479,7 @@
 	hwif_chipset_t	chipset;	/* sub-module for tuning.. */
 	unsigned	noprobe    : 1;	/* don't probe for this interface */
 	unsigned	present    : 1;	/* there is a device on this interface */
-	unsigned	serialized : 1;	/* serialized operation with mate hwif */
+	unsigned	serialized : 1;	/* serialized operation between channels */
 	unsigned	sharing_irq: 1;	/* 1 = sharing irq with another hwif */
 	unsigned	reset      : 1;	/* reset after probe */
 	unsigned	autodma    : 1;	/* automatically try to enable DMA at boot */
@@ -490,7 +489,7 @@
 	unsigned long	last_time;	/* time when previous rq was done */
 #endif
 	byte		straight8;	/* Alan's straight 8 check */
-	ide_busproc_t	*busproc;	/* driver soft-power interface */
+	int (*busproc)(ide_drive_t *, int);	/* driver soft-power interface */
 	byte		bus_state;	/* power state of the IDE bus */
 };
 
@@ -513,7 +512,6 @@
  */
 typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *);
 typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
-typedef ide_startstop_t (ide_post_handler_t)(ide_drive_t *);
 
 /*
  * when ide_timer_expiry fires, invoke a handler of this type
#10 lore raw

PATCH 1/1 2.5.8-pre3 IDE 30

In reply to Linus Torvalds

Tought this was patched against 2.5.8-pre2 it still applyes cleanly to 2.5.8-pre3.

Tue Apr 9 01:02:05 CEST 2002 ide-clean-30

- Sync up with 2.5.8-pre3 patch.

- Eliminate ide_task_t and rename struct ide_task_s to struct ata_taskfile. This should become the entity which is holding all data for a request in the future. If this turns out to be the case, we will just rename it to ata_request.

- Reduce the number of arguments for the ata_taskfile() function. This helps to wipe quite a lot of code out as well.

This stage is not sensitive, so let's make a patch before we start to integrate the last work of Jens Axboe.

drivers/ide/ide-disk.c +41 -57
diff -urN linux-2.5.8-pre2/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
@@ -154,7 +154,7 @@
 {
 	struct hd_drive_task_hdr	taskfile;
 	struct hd_drive_hob_hdr		hobfile;
-	ide_task_t			args;
+	struct ata_taskfile		args;
 	int				sectors;
 
 	unsigned int track	= (block / drive->sect);
@@ -193,19 +193,14 @@
 	ide_cmd_type_parser(&args);
 	rq->special = &args;
 
-	return ata_taskfile(drive,
-			&args.taskfile,
-			&args.hobfile,
-			args.handler,
-			args.prehandler,
-			rq);
+	return ata_taskfile(drive, &args, rq);
 }
 
 static ide_startstop_t lba28_do_request(ide_drive_t *drive, struct request *rq, unsigned long block)
 {
 	struct hd_drive_task_hdr	taskfile;
 	struct hd_drive_hob_hdr		hobfile;
-	ide_task_t			args;
+	struct ata_taskfile		args;
 	int				sectors;
 
 	sectors = rq->nr_sectors;
@@ -239,12 +234,7 @@
 	ide_cmd_type_parser(&args);
 	rq->special = &args;
 
-	return ata_taskfile(drive,
-			&args.taskfile,
-			&args.hobfile,
-			args.handler,
-			args.prehandler,
-			rq);
+	return ata_taskfile(drive, &args, rq);
 }
 
 /*
@@ -257,7 +247,7 @@
 {
 	struct hd_drive_task_hdr	taskfile;
 	struct hd_drive_hob_hdr		hobfile;
-	ide_task_t			args;
+	struct ata_taskfile		args;
 	int				sectors;
 
 	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
@@ -302,12 +292,7 @@
 	ide_cmd_type_parser(&args);
 	rq->special = &args;
 
-	return ata_taskfile(drive,
-			&args.taskfile,
-			&args.hobfile,
-			args.handler,
-			args.prehandler,
-			rq);
+	return ata_taskfile(drive, &args, rq);
 }
 
 /*
@@ -426,7 +411,8 @@
  */
 static unsigned long idedisk_read_native_max_address(ide_drive_t *drive)
 {
-	ide_task_t args;
+	/* FIXME: This is on stack! */
+	struct ata_taskfile args;
 	unsigned long addr = 0;
 
 	if (!(drive->id->command_set_1 & 0x0400) &&
@@ -434,7 +420,7 @@
 		return addr;
 
 	/* Create IDE/ATA command request structure */
-	memset(&args, 0, sizeof(ide_task_t));
+	memset(&args, 0, sizeof(args));
 	args.taskfile.device_head = 0x40;
 	args.taskfile.command = WIN_READ_NATIVE_MAX;
 	args.handler = task_no_data_intr;
@@ -457,11 +443,11 @@
 
 static unsigned long long idedisk_read_native_max_address_ext(ide_drive_t *drive)
 {
-	ide_task_t args;
+	struct ata_taskfile args;
 	unsigned long long addr = 0;
 
 	/* Create IDE/ATA command request structure */
-	memset(&args, 0, sizeof(ide_task_t));
+	memset(&args, 0, sizeof(args));
 
 	args.taskfile.device_head = 0x40;
 	args.taskfile.command = WIN_READ_NATIVE_MAX_EXT;
@@ -493,12 +479,12 @@
  */
 static unsigned long idedisk_set_max_address(ide_drive_t *drive, unsigned long addr_req)
 {
-	ide_task_t args;
+	struct ata_taskfile args;
 	unsigned long addr_set = 0;
 
 	addr_req--;
 	/* Create IDE/ATA command request structure */
-	memset(&args, 0, sizeof(ide_task_t));
+	memset(&args, 0, sizeof(args));
 
 	args.taskfile.sector_number = (addr_req >> 0);
 	args.taskfile.low_cylinder = (addr_req >> 8);
@@ -522,12 +508,12 @@
 
 static unsigned long long idedisk_set_max_address_ext(ide_drive_t *drive, unsigned long long addr_req)
 {
-	ide_task_t args;
+	struct ata_taskfile args;
 	unsigned long long addr_set = 0;
 
 	addr_req--;
 	/* Create IDE/ATA command request structure */
-	memset(&args, 0, sizeof(ide_task_t));
+	memset(&args, 0, sizeof(args));
 
 	args.taskfile.sector_number = (addr_req >>  0);
 	args.taskfile.low_cylinder = (addr_req >>= 8);
@@ -667,47 +653,45 @@
 	special_t *s = &drive->special;
 
 	if (s->b.set_geometry) {
-		struct hd_drive_task_hdr taskfile;
-		struct hd_drive_hob_hdr hobfile;
-		ide_handler_t *handler = NULL;
-
-		memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-		memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
+		struct ata_taskfile args;
 
 		s->b.set_geometry	= 0;
-		taskfile.sector_number	= drive->sect;
-		taskfile.low_cylinder	= drive->cyl;
-		taskfile.high_cylinder	= drive->cyl>>8;
-		taskfile.device_head	= ((drive->head-1)|drive->select.all)&0xBF;
+
+		memset(&args, 0, sizeof(args));
+		args.taskfile.sector_number	= drive->sect;
+		args.taskfile.low_cylinder	= drive->cyl;
+		args.taskfile.high_cylinder	= drive->cyl>>8;
+		args.taskfile.device_head	= ((drive->head-1)|drive->select.all)&0xBF;
 		if (!IS_PDC4030_DRIVE) {
-			taskfile.sector_count = drive->sect;
-			taskfile.command = WIN_SPECIFY;
-			handler	= set_geometry_intr;;
+			args.taskfile.sector_count = drive->sect;
+			args.taskfile.command = WIN_SPECIFY;
+			args.handler = set_geometry_intr;;
 		}
-		ata_taskfile(drive, &taskfile, &hobfile, handler, NULL, NULL);
+		ata_taskfile(drive, &args, NULL);
 	} else if (s->b.recalibrate) {
 		s->b.recalibrate = 0;
 		if (!IS_PDC4030_DRIVE) {
-			struct hd_drive_task_hdr taskfile;
-			struct hd_drive_hob_hdr hobfile;
-			memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-			memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
-			taskfile.sector_count	= drive->sect;
-			taskfile.command	= WIN_RESTORE;
-			ata_taskfile(drive, &taskfile, &hobfile, recal_intr, NULL, NULL);
+			struct ata_taskfile args;
+
+			memset(&args, 0, sizeof(args));
+			args.taskfile.sector_count = drive->sect;
+			args.taskfile.command = WIN_RESTORE;
+			args.handler = recal_intr;
+			ata_taskfile(drive, &args, NULL);
 		}
 	} else if (s->b.set_multmode) {
 		s->b.set_multmode = 0;
 		if (drive->id && drive->mult_req > drive->id->max_multsect)
 			drive->mult_req = drive->id->max_multsect;
 		if (!IS_PDC4030_DRIVE) {
-			struct hd_drive_task_hdr taskfile;
-			struct hd_drive_hob_hdr hobfile;
-			memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-			memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
-			taskfile.sector_count	= drive->mult_req;
-			taskfile.command	= WIN_SETMULT;
-			ata_taskfile(drive, &taskfile, &hobfile, set_multmode_intr, NULL, NULL);
+			struct ata_taskfile args;
+
+			memset(&args, 0, sizeof(args));
+			args.taskfile.sector_count = drive->mult_req;
+			args.taskfile.command = WIN_SETMULT;
+			args.handler = set_multmode_intr;
+
+			ata_taskfile(drive, &args, NULL);
 		}
 	} else if (s->all) {
 		int special = s->all;
drivers/ide/ide-dma.c +15 -11
diff -urN linux-2.5.8-pre2/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
@@ -82,6 +82,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/ide.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -238,29 +239,33 @@
 	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
 }
 
-static int ide_raw_build_sglist(struct ata_channel *hwif, struct request *rq)
+/*
+ * FIXME: taskfiles should be a map of pages, not a long virt address... /jens
+ * FIXME: I agree with Jens --mdcki!
+ */
+static int raw_build_sglist(struct ata_channel *ch, struct request *rq)
 {
-	struct scatterlist *sg = hwif->sg_table;
+	struct scatterlist *sg = ch->sg_table;
 	int nents = 0;
-	ide_task_t *args = rq->special;
+	struct ata_taskfile *args = rq->special;
 #if 1
 	unsigned char *virt_addr = rq->buffer;
 	int sector_count = rq->nr_sectors;
 #else
-        nents = blk_rq_map_sg(rq->q, rq, hwif->sg_table);
+        nents = blk_rq_map_sg(rq->q, rq, ch->sg_table);
 
 	if (nents > rq->nr_segments)
 		printk("ide-dma: received %d segments, build %d\n", rq->nr_segments, nents);
 #endif
 
 	if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
-		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
+		ch->sg_dma_direction = PCI_DMA_TODEVICE;
 	else
-		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
+		ch->sg_dma_direction = PCI_DMA_FROMDEVICE;
 
-#if 1	
 	if (sector_count > 128) {
 		memset(&sg[nents], 0, sizeof(*sg));
+
 		sg[nents].page = virt_to_page(virt_addr);
 		sg[nents].offset = (unsigned long) virt_addr & ~PAGE_MASK;
 		sg[nents].length = 128  * SECTOR_SIZE;
@@ -273,9 +278,8 @@
 	sg[nents].offset = (unsigned long) virt_addr & ~PAGE_MASK;
 	sg[nents].length =  sector_count  * SECTOR_SIZE;
 	nents++;
- #endif
 
-	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
+	return pci_map_sg(ch->pci_dev, sg, nents, ch->sg_dma_direction);
 }
 
 /*
@@ -297,7 +301,7 @@
 	struct scatterlist *sg;
 
 	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) {
-		hwif->sg_nents = i = ide_raw_build_sglist(hwif, HWGROUP(drive)->rq);
+		hwif->sg_nents = i = raw_build_sglist(hwif, HWGROUP(drive)->rq);
 	} else {
 		hwif->sg_nents = i = ide_build_sglist(hwif, HWGROUP(drive)->rq);
 	}
@@ -593,7 +597,7 @@
 			ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, dma_timer_expiry);	/* issue cmd to drive */
 			if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) &&
 			    (drive->addressing == 1)) {
-				ide_task_t *args = HWGROUP(drive)->rq->special;
+				struct ata_taskfile *args = HWGROUP(drive)->rq->special;
 				OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
 			} else if (drive->addressing) {
 				OUT_BYTE(reading ? WIN_READDMA_EXT : WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
drivers/ide/ide-features.c +2 -2
diff -urN linux-2.5.8-pre2/drivers/ide/ide-features.c linux/drivers/ide/ide-features.c
@@ -184,7 +184,7 @@
  * in combination with the device (usually a disk) properly detect
  * and acknowledge each end of the ribbon.
  */
-int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
+int ide_ata66_check (ide_drive_t *drive, struct ata_taskfile *args)
 {
 	if ((args->taskfile.command == WIN_SETFEATURES) &&
 	    (args->taskfile.sector_number > XFER_UDMA_2) &&
@@ -211,7 +211,7 @@
  * 1 : Safe to update drive->id DMA registers.
  * 0 : OOPs not allowed.
  */
-int set_transfer (ide_drive_t *drive, ide_task_t *args)
+int set_transfer (ide_drive_t *drive, struct ata_taskfile *args)
 {
 	if ((args->taskfile.command == WIN_SETFEATURES) &&
 	    (args->taskfile.sector_number >= XFER_SW_DMA_0) &&
drivers/ide/ide-pmac.c +4 -4
diff -urN linux-2.5.8-pre2/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
@@ -1055,13 +1055,13 @@
 }
 
 static int
-pmac_ide_raw_build_sglist (int ix, struct request *rq)
+pmac_raw_build_sglist (int ix, struct request *rq)
 {
 	struct ata_channel *hwif = &ide_hwifs[ix];
 	struct pmac_ide_hwif *pmif = &pmac_ide[ix];
 	struct scatterlist *sg = pmif->sg_table;
 	int nents = 0;
-	ide_task_t *args = rq->special;
+	struct ata_taskfile *args = rq->special;
 	unsigned char *virt_addr = rq->buffer;
 	int sector_count = rq->nr_sectors;
 
@@ -1111,7 +1111,7 @@
 
 	/* Build sglist */
 	if (rq->flags & REQ_DRIVE_TASKFILE) {
-		pmac_ide[ix].sg_nents = i = pmac_ide_raw_build_sglist(ix, rq);
+		pmac_ide[ix].sg_nents = i = pmac_raw_build_sglist(ix, rq);
 	} else {
 		pmac_ide[ix].sg_nents = i = pmac_ide_build_sglist(ix, rq);
 	}
@@ -1389,7 +1389,7 @@
 		ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
 		if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) &&
 		    (drive->addressing == 1)) {
-			ide_task_t *args = HWGROUP(drive)->rq->special;
+			struct ata_taskfile *args = HWGROUP(drive)->rq->special;
 			OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
 		} else if (drive->addressing) {
 			OUT_BYTE(reading ? WIN_READDMA_EXT : WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
drivers/ide/ide-taskfile.c +33 -33

145 lines not on this page · raw message

drivers/ide/ide.c +18 -20
diff -urN linux-2.5.8-pre2/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -709,7 +709,7 @@
 /*
  * Clean up after success/failure of an explicit drive cmd
  */
-void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err)
+void ide_end_drive_cmd(ide_drive_t *drive, byte stat, byte err)
 {
 	unsigned long flags;
 	struct request *rq;
@@ -738,8 +738,8 @@
 			args[6] = IN_BYTE(IDE_SELECT_REG);
 		}
 	} else if (rq->flags & REQ_DRIVE_TASKFILE) {
-		ide_task_t *args = (ide_task_t *) rq->special;
-		rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
+		struct ata_taskfile *args = rq->special;
+		rq->errors = !OK_STAT(stat, READY_STAT, BAD_STAT);
 		if (args) {
 			args->taskfile.feature = err;
 			args->taskfile.sector_count = IN_BYTE(IDE_NSECTOR_REG);
@@ -1023,9 +1023,9 @@
 }
 
 /*
- * start_request() initiates handling of a new I/O request
+ * This initiates handling of a new I/O request.
  */
-static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
+static ide_startstop_t start_request(ide_drive_t *drive, struct request *rq)
 {
 	ide_startstop_t startstop;
 	unsigned long block;
@@ -1083,15 +1083,12 @@
 			 */
 
 			if (rq->flags & REQ_DRIVE_TASKFILE) {
-				ide_task_t *args = rq->special;
+				struct ata_taskfile *args = rq->special;
 
 				if (!(args))
 					goto args_error;
 
-				ata_taskfile(drive,
-						&args->taskfile,
-						&args->hobfile,
-						args->handler, NULL, NULL);
+				ata_taskfile(drive, args, NULL);
 
 				if (((args->command_type == IDE_DRIVE_TASK_RAW_WRITE) ||
 					(args->command_type == IDE_DRIVE_TASK_OUT)) &&
@@ -1185,7 +1182,7 @@
 	return ide_stopped;
 }
 
-ide_startstop_t restart_request (ide_drive_t *drive)
+ide_startstop_t restart_request(ide_drive_t *drive)
 {
 	ide_hwgroup_t *hwgroup = HWGROUP(drive);
 	unsigned long flags;
@@ -1417,9 +1414,9 @@
 }
 
 /*
- * ide_timer_expiry() is our timeout function for all drive operations.
- * But note that it can also be invoked as a result of a "sleep" operation
- * triggered by the mod_timer() call in ide_do_request.
+ * This is our timeout function for all drive operations.  But note that it can
+ * also be invoked as a result of a "sleep" operation triggered by the
+ * mod_timer() call in ide_do_request.
  */
 void ide_timer_expiry(unsigned long data)
 {
@@ -1478,7 +1475,7 @@
 			disable_irq_nosync(hwif->irq);
 #else
 			disable_irq(hwif->irq);	/* disable_irq_nosync ?? */
-#endif /* DISABLE_IRQ_NOSYNC */
+#endif
 			__cli();	/* local CPU only, as if we were handling an interrupt */
 			if (hwgroup->poll_timeout != 0) {
 				startstop = handler(drive);
@@ -1608,7 +1605,8 @@
 	drive = hwgroup->drive;
 	if (!drive) {
 		/*
-		 * This should NEVER happen, and there isn't much we could do about it here.
+		 * This should NEVER happen, and there isn't much we could do
+		 * about it here.
 		 */
 		goto out_lock;
 	}
@@ -1734,9 +1732,9 @@
 		if (action == ide_preempt)
 			hwgroup->rq = NULL;
 	} else {
-		if (action == ide_wait || action == ide_end) {
+		if (action == ide_wait || action == ide_end)
 			queue_head = queue_head->prev;
-		} else
+		else
 			queue_head = queue_head->next;
 	}
 	q->elevator.elevator_add_req_fn(q, rq, queue_head);
@@ -1848,7 +1846,7 @@
 
 	/* Request a particular device type module.
 	 *
-	 * FIXME: The function which should rather requests the drivers is
+	 * FIXME: The function which should rather requests the drivers in
 	 * ide_driver_module(), since it seems illogical and even a bit
 	 * dangerous to delay this until open time!
 	 */
@@ -2088,7 +2086,7 @@
 	 * it.
 	 */
 
-	old_hwif		= *channel;
+	old_hwif = *channel;
 	init_hwif_data(channel, channel->index);
 	channel->hwgroup = old_hwif.hwgroup;
 	channel->tuneproc = old_hwif.tuneproc;
drivers/ide/pdc4030.c +2 -2
diff -urN linux-2.5.8-pre2/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
@@ -551,7 +551,7 @@
  * already set up. It issues a READ or WRITE command to the Promise
  * controller, assuming LBA has been used to set up the block number.
  */
-ide_startstop_t do_pdc4030_io (ide_drive_t *drive, ide_task_t *task)
+ide_startstop_t do_pdc4030_io(ide_drive_t *drive, struct ata_taskfile *task)
 {
 	struct request *rq = HWGROUP(drive)->rq;
 	struct hd_drive_task_hdr *taskfile = &task->taskfile;
@@ -644,7 +644,7 @@
 ide_startstop_t promise_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
 {
 	struct hd_drive_task_hdr taskfile;
-	ide_task_t		 args;
+	struct ata_taskfile args;
 
 	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
 
include/linux/ide.h +26 -18

140 lines not on this page · raw message

#11 lore raw

PATCH 1/1 2.5.8-pre3 IDE 31

In reply to Linus Torvalds

Tought this patch was done against 2.5.8-pre2 it still applyes cleanly to 2.5.8-pre3

Tue Apr 9 20:53:16 CEST 2002 ide-clean-31

- Integrate the TCQ stuff from Jens Axboe. Deal with the conflicts, apply some cosmetic changes. We are still not at a stage where we could immediately integrate ata_request and ata_taskfile but we are no longer far away.

- Clean up the data transfer function in ide-disk to use ata_request structures directly.

- Kill useless leading version information in ide-disk.c

- Replace the ATA_AR_INIT macro with inline ata_ar_init() function.

- Replace IDE_CLEAR_TAG with ata_clear_tag().

- Replace IDE_SET_TAG with ata_set_tag().

- Kill georgeous ide_dmafunc_verbose().

- Fix typo in ide_enable_queued() (ide-tcq.c!)

Apparently there still problems with a TCQ enabled device and a not enabled device on the same channel, but let's first synchronize up with Jens.

OK more then enough for the next patch stage.

drivers/ide/Config.help +22 -0
diff -urN linux-2.5.8-pre2/drivers/ide/Config.help linux/drivers/ide/Config.help
@@ -744,6 +744,28 @@
 
   Generally say N here.
 
+CONFIG_BLK_DEV_IDE_TCQ
+  Support for tagged command queueing on ATA disk drives. This enables
+  the IDE layer to have multiple in-flight requests on hardware that
+  supports it. For now this includes the IBM Deskstar series drives,
+  such as the GXP75, 40GV, GXP60, and GXP120 (ie any Deskstar made in
+  the last couple of years).
+
+  If you have such a drive, say Y here.
+
+CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
+  Enabled tagged command queueing unconditionally on drives that report
+  support for it.
+
+  Generally say Y here.
+
+CONFIG_BLK_DEV_IDE_TCQ_DEPTH
+  Maximum size of commands to enable per-drive. Any value between 1
+  and 32 is valid, with 32 being the maxium that the hardware supports.
+
+  You probably just want the default of 32 here. If you enter an invalid
+  number, the default value will be used.
+
 CONFIG_BLK_DEV_IT8172
   Say Y here to support the on-board IDE controller on the Integrated
   Technology Express, Inc. ITE8172 SBC.  Vendor page at
drivers/ide/Config.in +5 -0
diff -urN linux-2.5.8-pre2/drivers/ide/Config.in linux/drivers/ide/Config.in
@@ -47,6 +47,11 @@
 	 dep_bool '      Use PCI DMA by default when available' CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI
          dep_bool '    Enable DMA only for disks ' CONFIG_IDEDMA_ONLYDISK $CONFIG_IDEDMA_PCI_AUTO
 	 define_bool CONFIG_BLK_DEV_IDEDMA $CONFIG_BLK_DEV_IDEDMA_PCI
+	 dep_bool '    ATA tagged command queueing' CONFIG_BLK_DEV_IDE_TCQ $CONFIG_BLK_DEV_IDEDMA_PCI
+	   dep_bool '      TCQ on by default' CONFIG_BLK_DEV_IDE_TCQ_DEFAULT $CONFIG_BLK_DEV_IDE_TCQ
+	   if [ $CONFIG_BLK_DEV_IDE_TCQ_DEFAULT != "n" ]; then
+		int '      Default queue depth' CONFIG_BLK_DEV_IDE_TCQ_DEPTH 32
+	   fi
 	 dep_bool '    ATA Work(s) In Progress (EXPERIMENTAL)' CONFIG_IDEDMA_PCI_WIP $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_EXPERIMENTAL
 	 dep_bool '    Good-Bad DMA Model-Firmware (WIP)' CONFIG_IDEDMA_NEW_DRIVE_LISTINGS $CONFIG_IDEDMA_PCI_WIP
 	 dep_bool '    AEC62XX chipset support' CONFIG_BLK_DEV_AEC62XX $CONFIG_BLK_DEV_IDEDMA_PCI
drivers/ide/Makefile +1 -0
diff -urN linux-2.5.8-pre2/drivers/ide/Makefile linux/drivers/ide/Makefile
@@ -45,6 +45,7 @@
 ide-obj-$(CONFIG_BLK_DEV_HT6560B)	+= ht6560b.o
 ide-obj-$(CONFIG_BLK_DEV_IDE_ICSIDE)	+= icside.o
 ide-obj-$(CONFIG_BLK_DEV_IDEDMA_PCI)	+= ide-dma.o
+ide-obj-$(CONFIG_BLK_DEV_IDE_TCQ)	+= ide-tcq.o
 ide-obj-$(CONFIG_BLK_DEV_IDEPCI)	+= ide-pci.o
 ide-obj-$(CONFIG_BLK_DEV_ISAPNP)	+= ide-pnp.o
 ide-obj-$(CONFIG_BLK_DEV_IDE_PMAC)	+= ide-pmac.o
drivers/ide/hpt366.c +2 -6
diff -urN linux-2.5.8-pre2/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
@@ -75,8 +75,6 @@
 #include <linux/proc_fs.h>
 #endif  /* defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS) */
 
-extern char *ide_dmafunc_verbose(ide_dma_action_t dmafunc);
-
 const char *quirk_drives[] = {
 	"QUANTUM FIREBALLlct08 08",
 	"QUANTUM FIREBALLP KA6.4",
@@ -815,10 +813,8 @@
 			pci_read_config_byte(drive->channel->pci_dev, 0x50, &reg50h);
 			pci_read_config_byte(drive->channel->pci_dev, 0x52, &reg52h);
 			pci_read_config_byte(drive->channel->pci_dev, 0x5a, &reg5ah);
-			printk("%s: (%s)  reg50h=0x%02x, reg52h=0x%02x, reg5ah=0x%02x\n",
-				drive->name,
-				ide_dmafunc_verbose(func),
-				reg50h, reg52h, reg5ah);
+			printk("%s: (ide_dma_lostirq)  reg50h=0x%02x, reg52h=0x%02x, reg5ah=0x%02x\n",
+				drive->name, reg50h, reg52h, reg5ah);
 			if (reg5ah & 0x10)
 				pci_write_config_byte(drive->channel->pci_dev, 0x5a, reg5ah & ~0x10);
 			/* fall through to a reset */
drivers/ide/icside.c +1 -3
diff -urN linux-2.5.8-pre2/drivers/ide/icside.c linux/drivers/ide/icside.c
@@ -27,7 +27,6 @@
 #include <asm/io.h>
 
 extern char *ide_xfer_verbose (byte xfer_rate);
-extern char *ide_dmafunc_verbose(ide_dma_action_t dmafunc);
 
 /*
  * Maximum number of interfaces per card
@@ -467,8 +466,7 @@
 
 	case ide_dma_timeout:
 	default:
-		printk("icside_dmaproc: unsupported %s func: %d\n",
-			ide_dmafunc_verbose(func), func);
+		printk("icside_dmaproc: unsupported function: %d\n", func);
 	}
 	return 1;
 }
drivers/ide/ide-disk.c +283 -158

617 lines not on this page · raw message

drivers/ide/ide-dma.c +123 -107

396 lines not on this page · raw message

drivers/ide/ide-features.c +3 -34
diff -urN linux-2.5.8-pre2/drivers/ide/ide-features.c linux/drivers/ide/ide-features.c
@@ -69,34 +69,6 @@
 	}
 }
 
-/*
- * A Verbose noise maker for debugging on the attempted dmaing calls.
- */
-char *ide_dmafunc_verbose (ide_dma_action_t dmafunc)
-{
-	switch (dmafunc) {
-		case ide_dma_read:		return("ide_dma_read");
-		case ide_dma_write:		return("ide_dma_write");
-		case ide_dma_begin:		return("ide_dma_begin");
-		case ide_dma_end:		return("ide_dma_end:");
-		case ide_dma_check:		return("ide_dma_check");
-		case ide_dma_on:		return("ide_dma_on");
-		case ide_dma_off:		return("ide_dma_off");
-		case ide_dma_off_quietly:	return("ide_dma_off_quietly");
-		case ide_dma_test_irq:		return("ide_dma_test_irq");
-		case ide_dma_bad_drive:		return("ide_dma_bad_drive");
-		case ide_dma_good_drive:	return("ide_dma_good_drive");
-		case ide_dma_verbose:		return("ide_dma_verbose");
-		case ide_dma_retune:		return("ide_dma_retune");
-		case ide_dma_lostirq:		return("ide_dma_lostirq");
-		case ide_dma_timeout:		return("ide_dma_timeout");
-		default:			return("unknown");
-	}
-}
-
-/*
- *
- */
 byte ide_auto_reduce_xfer (ide_drive_t *drive)
 {
 	if (!drive->crc_count)
@@ -122,9 +94,6 @@
 	}
 }
 
-/*
- * Update the 
- */
 int ide_driveid_update (ide_drive_t *drive)
 {
 	/*
@@ -195,10 +164,10 @@
 		}
 #ifndef CONFIG_IDEDMA_IVB
 		if ((drive->id->hw_config & 0x6000) == 0) {
-#else /* !CONFIG_IDEDMA_IVB */
+#else
 		if (((drive->id->hw_config & 0x2000) == 0) ||
 		    ((drive->id->hw_config & 0x4000) == 0)) {
-#endif /* CONFIG_IDEDMA_IVB */
+#endif
 			printk("%s: Speed warnings UDMA 3/4/5 is not functional.\n", drive->name);
 			return 1;
 		}
@@ -232,7 +201,7 @@
 	return ((byte) ((drive->channel->udma_four) &&
 #ifndef CONFIG_IDEDMA_IVB
 			(drive->id->hw_config & 0x4000) &&
-#endif /* CONFIG_IDEDMA_IVB */
+#endif
 			(drive->id->hw_config & 0x6000)) ? 1 : 0);
 }
 
drivers/ide/ide-pmac.c +2 -3
diff -urN linux-2.5.8-pre2/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
@@ -52,7 +52,6 @@
 #endif
 #include "ata-timing.h"
 
-extern char *ide_dmafunc_verbose(ide_dma_action_t dmafunc);
 extern spinlock_t ide_lock;
 
 #undef IDE_PMAC_DEBUG
@@ -1460,10 +1459,10 @@
 	case ide_dma_retune:
 	case ide_dma_lostirq:
 	case ide_dma_timeout:
-		printk(KERN_WARNING "ide_pmac_dmaproc: chipset supported %s func only: %d\n", ide_dmafunc_verbose(func),  func);
+		printk(KERN_WARNING "ide_pmac_dmaproc: chipset supported func only: %d\n", func);
 		return 1;
 	default:
-		printk(KERN_WARNING "ide_pmac_dmaproc: unsupported %s func: %d\n", ide_dmafunc_verbose(func), func);
+		printk(KERN_WARNING "ide_pmac_dmaproc: unsupported func: %d\n", func);
 		return 1;
 	}
 	return 0;
drivers/ide/ide-probe.c +17 -2
diff -urN linux-2.5.8-pre2/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -189,6 +189,21 @@
 	if (drive->channel->quirkproc)
 		drive->quirk_list = drive->channel->quirkproc(drive);
 
+	/*
+	 * it's an ata drive, build command list
+	 */
+#ifndef CONFIG_BLK_DEV_IDE_TCQ
+	drive->queue_depth = 1;
+#else
+	drive->queue_depth = drive->id->queue_depth + 1;
+	if (drive->queue_depth > CONFIG_BLK_DEV_IDE_TCQ_DEPTH)
+		drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH;
+	if (drive->queue_depth < 1 || drive->queue_depth > IDE_MAX_TAG)
+		drive->queue_depth = IDE_MAX_TAG;
+#endif
+	if (ide_build_commandlist(drive))
+		goto err_misc;
+
 	return;
 
 err_misc:
@@ -593,10 +608,10 @@
 	blk_queue_max_sectors(q, max_sectors);
 
 	/* IDE DMA can do PRD_ENTRIES number of segments. */
-	blk_queue_max_hw_segments(q, PRD_ENTRIES);
+	blk_queue_max_hw_segments(q, PRD_SEGMENTS);
 
 	/* This is a driver limit and could be eliminated. */
-	blk_queue_max_phys_segments(q, PRD_ENTRIES);
+	blk_queue_max_phys_segments(q, PRD_SEGMENTS);
 }
 
 #if MAX_HWIFS > 1
drivers/ide/ide-taskfile.c +52 -20

137 lines not on this page · raw message

drivers/ide/ide-tcq.c +594 -0

594 lines not on this page · raw message

drivers/ide/ide.c +205 -13

364 lines not on this page · raw message

drivers/ide/pdc202xx.c +6 -0
diff -urN linux-2.5.8-pre2/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
@@ -1057,6 +1057,12 @@
 		case ide_dma_timeout:
 			if (drive->channel->resetproc != NULL)
 				drive->channel->resetproc(drive);
+		/*
+		 * we cannot support queued operations on promise, so fail to
+		 * to enable it...
+		 */
+		case ide_dma_queued_on:
+			return 1;
 		default:
 			break;
 	}
include/linux/hdreg.h +8 -0
diff -urN linux-2.5.8-pre2/include/linux/hdreg.h linux/include/linux/hdreg.h
@@ -34,6 +34,7 @@
 #define ECC_STAT		0x04	/* Corrected error */
 #define DRQ_STAT		0x08
 #define SEEK_STAT		0x10
+#define SERVICE_STAT		SEEK_STAT
 #define WRERR_STAT		0x20
 #define READY_STAT		0x40
 #define BUSY_STAT		0x80
@@ -50,6 +51,13 @@
 #define ICRC_ERR		0x80	/* new meaning:  CRC error during transfer */
 
 /*
+ * bits of NSECTOR reg
+ */
+#define NSEC_CD			0x1
+#define NSEC_IO			0x2
+#define NSEC_REL		0x4
+
+/*
  * Command Header sizes for IOCTL commands
  *	HDIO_DRIVE_CMD and HDIO_DRIVE_TASK
  */
include/linux/ide.h +187 -39

359 lines not on this page · raw message

#12 lore raw

PATCH 1/1 2.5.8-pre3 IDE 32

In reply to Linus Torvalds

Wed Apr 10 16:48:32 CEST 2002 ide-clean-32

- Don't provide symbolic links in /proc/ide - they are redundant data.

- Try to use a more reasonable default capacity value in ata_capacity().

- Fix ata_put() ata_get() usage in ide_check_media_change().

- Small readability fixes to the option parsing code.

- Apply Vojtech Pavliks /proc PIIX output fix.

- Replace all occurrences of ide_wait_taskfile() with ide_raw_taskfile(). One duplicated code path fewer.

drivers/ide/ide-disk.c +88 -82
diff -urN linux-2.5.8-pre3/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
@@ -386,23 +386,22 @@
 {
 	MOD_INC_USE_COUNT;
 	if (drive->removable && drive->usage == 1) {
-		struct hd_drive_task_hdr taskfile;
-		struct hd_drive_hob_hdr hobfile;
-
-		memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-		memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
+		struct ata_taskfile args;
 
 		check_disk_change(inode->i_rdev);
 
-		taskfile.command = WIN_DOORLOCK;
+		memset(&args, 0, sizeof(args));
+
+		args.taskfile.command = WIN_DOORLOCK;
+		ide_cmd_type_parser(&args);
 
 		/*
-		 * Ignore the return code from door_lock,
-		 * since the open() has already succeeded,
-		 * and the door_lock is irrelevant at this point.
+		 * Ignore the return code from door_lock, since the open() has
+		 * already succeeded, and the door_lock is irrelevant at this
+		 * point.
 		 */
-		if (drive->doorlocking &&
-		    ide_wait_taskfile(drive, &taskfile, &hobfile, NULL))
+
+		if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL))
 			drive->doorlocking = 0;
 	}
 	return 0;
@@ -410,33 +409,33 @@
 
 static int idedisk_flushcache(ide_drive_t *drive)
 {
-	struct hd_drive_task_hdr taskfile;
-	struct hd_drive_hob_hdr hobfile;
+	struct ata_taskfile args;
+
+	memset(&args, 0, sizeof(args));
 
-	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-	memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
 	if (drive->id->cfs_enable_2 & 0x2400)
-		taskfile.command = WIN_FLUSH_CACHE_EXT;
+		args.taskfile.command = WIN_FLUSH_CACHE_EXT;
 	else
-		taskfile.command = WIN_FLUSH_CACHE;
+		args.taskfile.command = WIN_FLUSH_CACHE;
 
-	return ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
+	ide_cmd_type_parser(&args);
+
+	return ide_raw_taskfile(drive, &args, NULL);
 }
 
 static void idedisk_release (struct inode *inode, struct file *filp, ide_drive_t *drive)
 {
 	if (drive->removable && !drive->usage) {
-		struct hd_drive_task_hdr taskfile;
-		struct hd_drive_hob_hdr hobfile;
-
-		memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-		memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
+		struct ata_taskfile args;
 
 		invalidate_bdev(inode->i_bdev, 0);
 
-		taskfile.command = WIN_DOORUNLOCK;
+		memset(&args, 0, sizeof(args));
+		args.taskfile.command = WIN_DOORUNLOCK;
+		ide_cmd_type_parser(&args);
+
 		if (drive->doorlocking &&
-		    ide_wait_taskfile(drive, &taskfile, &hobfile, NULL))
+		    ide_raw_taskfile(drive, &args, NULL))
 			drive->doorlocking = 0;
 	}
 	if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
@@ -601,7 +600,7 @@
 	return flag;
 }
 
-#endif /* CONFIG_IDEDISK_STROKE */
+#endif
 
 /*
  * Compute drive->capacity, the full capacity of the drive
@@ -767,45 +766,50 @@
 
 static int smart_enable(ide_drive_t *drive)
 {
-	struct hd_drive_task_hdr taskfile;
-	struct hd_drive_hob_hdr hobfile;
-	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-	memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
-	taskfile.feature	= SMART_ENABLE;
-	taskfile.low_cylinder	= SMART_LCYL_PASS;
-	taskfile.high_cylinder	= SMART_HCYL_PASS;
-	taskfile.command	= WIN_SMART;
-	return ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
-}
-
-static int get_smart_values(ide_drive_t *drive, byte *buf)
-{
-	struct hd_drive_task_hdr taskfile;
-	struct hd_drive_hob_hdr hobfile;
-	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-	memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
-	taskfile.feature	= SMART_READ_VALUES;
-	taskfile.sector_count	= 0x01;
-	taskfile.low_cylinder	= SMART_LCYL_PASS;
-	taskfile.high_cylinder	= SMART_HCYL_PASS;
-	taskfile.command	= WIN_SMART;
+	struct ata_taskfile args;
+
+	memset(&args, 0, sizeof(args));
+	args.taskfile.feature = SMART_ENABLE;
+	args.taskfile.low_cylinder = SMART_LCYL_PASS;
+	args.taskfile.high_cylinder = SMART_HCYL_PASS;
+	args.taskfile.command = WIN_SMART;
+	ide_cmd_type_parser(&args);
+
+	return ide_raw_taskfile(drive, &args, NULL);
+}
+
+static int get_smart_values(ide_drive_t *drive, u8 *buf)
+{
+	struct ata_taskfile args;
+
+	memset(&args, 0, sizeof(args));
+	args.taskfile.feature = SMART_READ_VALUES;
+	args.taskfile.sector_count = 0x01;
+	args.taskfile.low_cylinder = SMART_LCYL_PASS;
+	args.taskfile.high_cylinder = SMART_HCYL_PASS;
+	args.taskfile.command = WIN_SMART;
+	ide_cmd_type_parser(&args);
+
 	smart_enable(drive);
-	return ide_wait_taskfile(drive, &taskfile, &hobfile, buf);
+
+	return ide_raw_taskfile(drive, &args, buf);
 }
 
-static int get_smart_thresholds(ide_drive_t *drive, byte *buf)
+static int get_smart_thresholds(ide_drive_t *drive, u8 *buf)
 {
-	struct hd_drive_task_hdr taskfile;
-	struct hd_drive_hob_hdr hobfile;
-	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-	memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
-	taskfile.feature	= SMART_READ_THRESHOLDS;
-	taskfile.sector_count	= 0x01;
-	taskfile.low_cylinder	= SMART_LCYL_PASS;
-	taskfile.high_cylinder	= SMART_HCYL_PASS;
-	taskfile.command	= WIN_SMART;
+	struct ata_taskfile args;
+
+	memset(&args, 0, sizeof(args));
+	args.taskfile.feature = SMART_READ_THRESHOLDS;
+	args.taskfile.sector_count = 0x01;
+	args.taskfile.low_cylinder = SMART_LCYL_PASS;
+	args.taskfile.high_cylinder = SMART_HCYL_PASS;
+	args.taskfile.command = WIN_SMART;
+	ide_cmd_type_parser(&args);
+
 	smart_enable(drive);
-	return ide_wait_taskfile(drive, &taskfile, &hobfile, buf);
+
+	return ide_raw_taskfile(drive, &args, buf);
 }
 
 static int proc_idedisk_read_cache
@@ -947,7 +951,7 @@
 	ide_init_drive_cmd (&rq);
 	drive->mult_req = arg;
 	drive->special.b.set_multmode = 1;
-	(void) ide_do_drive_cmd (drive, &rq, ide_wait);
+	ide_do_drive_cmd (drive, &rq, ide_wait);
 	return (drive->mult_count == arg) ? 0 : -EIO;
 }
 
@@ -963,44 +967,46 @@
 
 static int write_cache(ide_drive_t *drive, int arg)
 {
-	struct hd_drive_task_hdr taskfile;
-	struct hd_drive_hob_hdr hobfile;
-	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-	memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
-	taskfile.feature	= (arg) ? SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE;
-	taskfile.command	= WIN_SETFEATURES;
+	struct ata_taskfile args;
 
 	if (!(drive->id->cfs_enable_2 & 0x3000))
 		return 1;
 
-	ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
+	memset(&args, 0, sizeof(args));
+	args.taskfile.feature	= (arg) ? SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE;
+	args.taskfile.command	= WIN_SETFEATURES;
+	ide_cmd_type_parser(&args);
+	ide_raw_taskfile(drive, &args, NULL);
+
 	drive->wcache = arg;
+
 	return 0;
 }
 
 static int idedisk_standby(ide_drive_t *drive)
 {
-	struct hd_drive_task_hdr taskfile;
-	struct hd_drive_hob_hdr hobfile;
-	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-	memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
-	taskfile.command	= WIN_STANDBYNOW1;
-	return ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
+	struct ata_taskfile args;
+
+	memset(&args, 0, sizeof(args));
+	args.taskfile.command = WIN_STANDBYNOW1;
+	ide_cmd_type_parser(&args);
+
+	return ide_raw_taskfile(drive, &args, NULL);
 }
 
 static int set_acoustic(ide_drive_t *drive, int arg)
 {
-	struct hd_drive_task_hdr taskfile;
-	struct hd_drive_hob_hdr hobfile;
-	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-	memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
+	struct ata_taskfile args;
 
-	taskfile.feature	= (arg)?SETFEATURES_EN_AAM:SETFEATURES_DIS_AAM;
-	taskfile.sector_count	= arg;
+	memset(&args, 0, sizeof(args));
+	args.taskfile.feature = (arg)?SETFEATURES_EN_AAM:SETFEATURES_DIS_AAM;
+	args.taskfile.sector_count = arg;
+	args.taskfile.command = WIN_SETFEATURES;
+	ide_cmd_type_parser(&args);
+	ide_raw_taskfile(drive, &args, NULL);
 
-	taskfile.command	= WIN_SETFEATURES;
-	ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
 	drive->acoustic = arg;
+
 	return 0;
 }
 
drivers/ide/ide-proc.c +15 -20
diff -urN linux-2.5.8-pre3/drivers/ide/ide-proc.c linux/drivers/ide/ide-proc.c
@@ -1,10 +1,6 @@
 /*
- *  linux/drivers/ide/ide-proc.c	Version 1.03	January  2, 1998
- *
  *  Copyright (C) 1997-1998	Mark Lord
- */
-
-/*
+ *
  * This is the /proc/ide/ filesystem implementation.
  *
  * The major reason this exists is to provide sufficient access
@@ -176,26 +172,26 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-static int proc_ide_get_identify(ide_drive_t *drive, byte *buf)
+static int get_identify(ide_drive_t *drive, u8 *buf)
 {
-	struct hd_drive_task_hdr taskfile;
-	struct hd_drive_hob_hdr hobfile;
-	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
-	memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
+	struct ata_taskfile args;
 
-	taskfile.sector_count = 0x01;
-	taskfile.command = (drive->type == ATA_DISK) ? WIN_IDENTIFY : WIN_PIDENTIFY ;
+	memset(&args, 0, sizeof(args));
+	args.taskfile.sector_count = 0x01;
+	args.taskfile.command = (drive->type == ATA_DISK) ? WIN_IDENTIFY : WIN_PIDENTIFY ;
+	ide_cmd_type_parser(&args);
 
-	return ide_wait_taskfile(drive, &taskfile, &hobfile, buf);
+	return ide_raw_taskfile(drive, &args, buf);
 }
 
 static int proc_ide_read_identify
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-	ide_drive_t	*drive = data;
-	int		len = 0, i = 0;
+	ide_drive_t *drive = data;
+	int len = 0;
+	int i = 0;
 
-	if (drive && !proc_ide_get_identify(drive, page)) {
+	if (drive && !get_identify(drive, page)) {
 		unsigned short *val = (unsigned short *) page;
 		char *out = ((char *)val) + (SECTOR_WORDS * 4);
 		page = out;
@@ -204,8 +200,7 @@
 			val += 1;
 		} while (i < (SECTOR_WORDS * 2));
 		len = out - page;
-	}
-	else
+	} else
 		len = sprintf(page, "\n");
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
@@ -422,6 +417,8 @@
 	}
 }
 
+/* FIXME: we should iterate over the hwifs here as everywhere else.
+ */
 static void create_proc_ide_drives(struct ata_channel *hwif)
 {
 	int	d;
@@ -447,8 +444,6 @@
 			}
 		}
 		sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name);
-		ent = proc_symlink(drive->name, proc_ide_root, name);
-		if (!ent) return;
 	}
 }
 
drivers/ide/ide-taskfile.c +4 -37

71 lines not on this page · raw message

drivers/ide/ide-tcq.c +19 -12
diff -urN linux-2.5.8-pre3/drivers/ide/ide-tcq.c linux/drivers/ide/ide-tcq.c
@@ -396,11 +396,9 @@
  */
 static int ide_tcq_configure(ide_drive_t *drive)
 {
-	struct hd_drive_task_hdr taskfile;
+	struct ata_taskfile args;
 	int tcq_supp = 1 << 1 | 1 << 14;
 
-	memset(&taskfile, 0, sizeof(taskfile));
-
 	/*
 	 * bit 14 and 1 must be set in word 83 of the device id to indicate
 	 * support for dma queued protocol
@@ -410,9 +408,12 @@
 		return 1;
 	}
 
-	taskfile.feature = SETFEATURES_EN_WCACHE;
-	taskfile.command = WIN_SETFEATURES;
-	if (ide_wait_taskfile(drive, &taskfile, NULL, NULL)) {
+	memset(&args, 0, sizeof(args));
+	args.taskfile.feature = SETFEATURES_EN_WCACHE;
+	args.taskfile.command = WIN_SETFEATURES;
+	ide_cmd_type_parser(&args);
+
+	if (ide_raw_taskfile(drive, &args, NULL)) {
 		printk("%s: failed to enable write cache\n", drive->name);
 		return 1;
 	}
@@ -421,9 +422,12 @@
 	 * disable RELease interrupt, it's quicker to poll this after
 	 * having sent the command opcode
 	 */
-	taskfile.feature = SETFEATURES_DIS_RI;
-	taskfile.command = WIN_SETFEATURES;
-	if (ide_wait_taskfile(drive, &taskfile, NULL, NULL)) {
+	memset(&args, 0, sizeof(args));
+	args.taskfile.feature = SETFEATURES_DIS_RI;
+	args.taskfile.command = WIN_SETFEATURES;
+	ide_cmd_type_parser(&args);
+
+	if (ide_raw_taskfile(drive, &args, NULL)) {
 		printk("%s: disabling release interrupt fail\n", drive->name);
 		return 1;
 	}
@@ -432,9 +436,12 @@
 	/*
 	 * enable SERVICE interrupt
 	 */
-	taskfile.feature = SETFEATURES_EN_SI;
-	taskfile.command = WIN_SETFEATURES;
-	if (ide_wait_taskfile(drive, &taskfile, NULL, NULL)) {
+	memset(&args, 0, sizeof(args));
+	args.taskfile.feature = SETFEATURES_EN_SI;
+	args.taskfile.command = WIN_SETFEATURES;
+	ide_cmd_type_parser(&args);
+
+	if (ide_raw_taskfile(drive, &args, NULL)) {
 		printk("%s: enabling service interrupt fail\n", drive->name);
 		return 1;
 	}
drivers/ide/ide.c +72 -59

392 lines not on this page · raw message

drivers/ide/piix.c +1 -1
diff -urN linux-2.5.8-pre3/drivers/ide/piix.c linux/drivers/ide/piix.c
@@ -199,7 +199,7 @@
 
 		if (~piix_config->flags & PIIX_VICTORY) {
 			if ((piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_66 && (u & (1 << i))) umul = 2;
-			if ((piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_100 && (u & ((1 << i) + 12))) umul = 1;
+			if ((piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_100 && (u & (1 << (i + 12)))) umul = 1;
 			udma[i] = (4 - ((e >> (i << 2)) & 3)) * umul;
 		} else  udma[i] = (8 - ((e >> (i << 2)) & 7)) * 2;
 
include/linux/ide.h +3 -5
diff -urN linux-2.5.8-pre3/include/linux/ide.h linux/include/linux/ide.h
@@ -858,16 +858,14 @@
 extern ide_startstop_t set_multmode_intr(ide_drive_t *drive);
 extern ide_startstop_t task_no_data_intr(ide_drive_t *drive);
 
-int ide_wait_taskfile (ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile, byte *buf);
-
-int ide_raw_taskfile (ide_drive_t *drive, struct ata_taskfile *cmd, byte *buf);
 
 /* This is setting up all fields in args, which depend upon the command type.
  */
 extern void ide_cmd_type_parser(struct ata_taskfile *args);
+extern int ide_raw_taskfile(ide_drive_t *drive, struct ata_taskfile *cmd, byte *buf);
 
-int ide_cmd_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
-int ide_task_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+extern int ide_cmd_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+extern int ide_task_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
 
 void ide_delay_50ms (void);
 
#13 lore raw

PATCH 1/1 2.5.8-pre3 IDE 33

In reply to Linus Torvalds

Thu Apr 11 16:42:43 CEST 2002 ide-clean-33

- Kill unneded parameters to ide_cmd_ioctl() and ide_task_ioctl().

- Apply Petr Vendrovecs fix for 32bit ver 16bit transfers.

- Make CD-ROM usable again by guarding the generic routines against request field abuse found there. We will try to convert this driver to the just to be finished struct ata_request after the generic changes stabilize a bit. The strcut ata_taskfile and struct ata_request merge to be more preciese.

Therefore it's time for the next patch round.

drivers/ide/ide-cd.c +3 -2
diff -urN linux-2.5.8-pre3/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -512,7 +512,7 @@
 #endif /* not VERBOSE_IDE_CD_ERRORS */
 }
 
-static void cdrom_queue_request_sense(ide_drive_t *drive, 
+static void cdrom_queue_request_sense(ide_drive_t *drive,
 				      struct completion *wait,
 				      struct request_sense *sense,
 				      struct packet_command *failed_command)
@@ -536,7 +536,7 @@
 	rq->flags = REQ_SENSE;
 	rq->special = (char *) pc;
 	rq->waiting = wait;
-	(void) ide_do_drive_cmd(drive, rq, ide_preempt);
+	ide_do_drive_cmd(drive, rq, ide_preempt);
 }
 
 
@@ -554,6 +554,7 @@
 	if ((rq->flags & REQ_CMD) && !rq->current_nr_sectors)
 		uptodate = 1;
 
+	HWGROUP(drive)->rq->special = NULL;
 	ide_end_request(drive, uptodate);
 }
 
drivers/ide/ide-dma.c +6 -0
diff -urN linux-2.5.8-pre3/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
@@ -546,6 +546,12 @@
 	unsigned long dma_base = hwif->dma_base;
 	struct ata_request *ar = IDE_CUR_AR(drive);
 
+	/* This can happen with drivers abusing the special request field.
+	 */
+
+	if (!ar)
+		return 1;
+
 	if (rq_data_dir(ar->ar_rq) == READ)
 		reading = 1 << 3;
 
drivers/ide/ide-probe.c +3 -0
diff -urN linux-2.5.8-pre3/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -195,6 +195,9 @@
 #ifndef CONFIG_BLK_DEV_IDE_TCQ
 	drive->queue_depth = 1;
 #else
+# ifndef CONFIG_BLK_DEV_IDE_TCQ_DEPTH
+#  define CONFIG_BLK_DEV_IDE_TCQ_DEPTH 1
+# endif
 	drive->queue_depth = drive->id->queue_depth + 1;
 	if (drive->queue_depth > CONFIG_BLK_DEV_IDE_TCQ_DEPTH)
 		drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH;
drivers/ide/ide-taskfile.c +53 -41

156 lines not on this page · raw message

drivers/ide/ide.c +2 -2
diff -urN linux-2.5.8-pre3/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -2640,12 +2640,12 @@
 		case HDIO_DRIVE_CMD:
 			if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
 				return -EACCES;
-			return ide_cmd_ioctl(drive, inode, file, cmd, arg);
+			return ide_cmd_ioctl(drive, arg);
 
 		case HDIO_DRIVE_TASK:
 			if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
 				return -EACCES;
-			return ide_task_ioctl(drive, inode, file, cmd, arg);
+			return ide_task_ioctl(drive, arg);
 
 		case HDIO_SET_NICE:
 			if (!capable(CAP_SYS_ADMIN)) return -EACCES;
include/linux/ide.h +3 -3
diff -urN linux-2.5.8-pre3/include/linux/ide.h linux/include/linux/ide.h
@@ -864,10 +864,10 @@
 extern void ide_cmd_type_parser(struct ata_taskfile *args);
 extern int ide_raw_taskfile(ide_drive_t *drive, struct ata_taskfile *cmd, byte *buf);
 
-extern int ide_cmd_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
-extern int ide_task_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+extern int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg);
+extern int ide_task_ioctl(ide_drive_t *drive, unsigned long arg);
 
-void ide_delay_50ms (void);
+void ide_delay_50ms(void);
 
 byte ide_auto_reduce_xfer (ide_drive_t *drive);
 int ide_driveid_update (ide_drive_t *drive);
#14 lore raw

PATCH 1/1 2.5.8 IDE 35

In reply to Linus Torvalds

Mon Apr 15 16:33:24 CEST 2002 ide-clean-35

Just "raw" synchronization with Jens Axboe. This patch applies on top of ide-clean-34. The his changelog is included just for the record. All the credit for this work goes actually to Jens:

Updated the patch to 2.5.8 (painful). Changes:

- Expand configure help options a bit
- Fix xconfig bug (thanks to
- Decrease queue depth if a command takes too long to complete
- Test master/slave stuff. It works, but one device can heavily starve another. This is the simple approach right now, means that one device will wait until the other is completely idle before starting any commands This is not necessary since we can have queued commands on both devices at the same time. TODO.
- Add proc output for oldest command, just for testing.
- pci_dev compile fixes.
- Make sure ide-disk doesn't BUG if TCQ is not used, basically this was fixed by off-loading the using_tcq setting to ide-tcq.
- Remove warning about 'queued feature set not supported'
- Abstract ide_tcq_wait_dataphase() into a function

drivers/ide/Config.help +23 -3
diff -urN linux-2.5.8/drivers/ide/Config.help linux/drivers/ide/Config.help
@@ -753,9 +753,17 @@
 
   If you have such a drive, say Y here.
 
-CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
-  Enabled tagged command queueing unconditionally on drives that report
-  support for it.
+CONFIG_BLK_DEV_IDE_TCQ_FULL
+  When a command completes from the drive, the SERVICE bit is checked to
+  see if other queued commands are ready to be started. Doing this
+  immediately after a command completes has a tendency to 'starve' the
+  device hardware queue, since we risk emptying the queue completely
+  before starting any new commands. This shows up during stressing the
+  drive as a /\/\/\/\ queue size balance, where we could instead try and
+  maintain a minimum queue size and get a /---------\ graph instead.
+
+  Saying Y here will attempt to always keep the queue full when possible
+  at the cost of possibly increasing command turn-around latency.
 
   Generally say Y here.
 
@@ -766,6 +774,18 @@
   You probably just want the default of 32 here. If you enter an invalid
   number, the default value will be used.
 
+CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
+  Enabled tagged command queueing unconditionally on drives that report
+  support for it. Regardless of the chosen value here, tagging can be
+  controlled at run time:
+
+  echo "using_tcq:32" > /proc/ide/hdX/settings
+
+  where any value between 1-32 selects chosen queue depth and enables
+  TCQ, and 0 disables it.
+
+  Generally say Y here.
+
 CONFIG_BLK_DEV_IT8172
   Say Y here to support the on-board IDE controller on the Integrated
   Technology Express, Inc. ITE8172 SBC.  Vendor page at
drivers/ide/Config.in +5 -4
diff -urN linux-2.5.8/drivers/ide/Config.in linux/drivers/ide/Config.in
@@ -48,10 +48,11 @@
          dep_bool '    Enable DMA only for disks ' CONFIG_IDEDMA_ONLYDISK $CONFIG_IDEDMA_PCI_AUTO
 	 define_bool CONFIG_BLK_DEV_IDEDMA $CONFIG_BLK_DEV_IDEDMA_PCI
 	 dep_bool '    ATA tagged command queueing' CONFIG_BLK_DEV_IDE_TCQ $CONFIG_BLK_DEV_IDEDMA_PCI
-	   dep_bool '      TCQ on by default' CONFIG_BLK_DEV_IDE_TCQ_DEFAULT $CONFIG_BLK_DEV_IDE_TCQ
-	   if [ $CONFIG_BLK_DEV_IDE_TCQ_DEFAULT != "n" ]; then
-		int '      Default queue depth' CONFIG_BLK_DEV_IDE_TCQ_DEPTH 32
-	   fi
+	 dep_bool '      Attempt to keep queue full' CONFIG_BLK_DEV_IDE_TCQ_FULL $CONFIG_BLK_DEV_IDE_TCQ
+	 dep_bool '      TCQ on by default' CONFIG_BLK_DEV_IDE_TCQ_DEFAULT $CONFIG_BLK_DEV_IDE_TCQ
+	 if [ "$CONFIG_BLK_DEV_IDE_TCQ" != "n" ]; then
+	    int '      Default queue depth' CONFIG_BLK_DEV_IDE_TCQ_DEPTH 8
+	 fi
 	 dep_bool '    ATA Work(s) In Progress (EXPERIMENTAL)' CONFIG_IDEDMA_PCI_WIP $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_EXPERIMENTAL
 	 dep_bool '    Good-Bad DMA Model-Firmware (WIP)' CONFIG_IDEDMA_NEW_DRIVE_LISTINGS $CONFIG_IDEDMA_PCI_WIP
 	 dep_bool '    AEC62XX chipset support' CONFIG_BLK_DEV_AEC62XX $CONFIG_BLK_DEV_IDEDMA_PCI
drivers/ide/ide-disk.c +36 -35

109 lines not on this page · raw message

drivers/ide/ide-dma.c +3 -14
diff -urN linux-2.5.8/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
@@ -610,9 +610,6 @@
 		case ide_dma_check:
 			return config_drive_for_dma (drive);
 		case ide_dma_begin:
-#ifdef DEBUG
-			printk("ide_dma_begin: from %p\n", __builtin_return_address(0));
-#endif
 			if (test_and_set_bit(IDE_DMA, &HWGROUP(drive)->flags))
 				BUG();
 			/* Note that this is done *after* the cmd has
@@ -634,14 +631,13 @@
 		case ide_dma_read:
 			reading = 1 << 3;
 		case ide_dma_write:
-			ar = HWGROUP(drive)->rq->special;
+			ar = IDE_CUR_AR(drive);
 
 			if (ide_start_dma(hwif, drive, func))
 				return 1;
 
 			if (drive->type != ATA_DISK)
 				return 0;
-
 			BUG_ON(HWGROUP(drive)->handler);
 			ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, dma_timer_expiry);	/* issue cmd to drive */
 			if ((ar->ar_rq->flags & REQ_DRIVE_TASKFILE) &&
@@ -655,20 +651,13 @@
 			}
 			return hwif->dmaproc(ide_dma_begin, drive);
 		case ide_dma_end: /* returns 1 on error, 0 otherwise */
-#ifdef DEBUG
-			printk("ide_dma_end: from %p\n", __builtin_return_address(0));
-#endif
-			if (!test_and_clear_bit(IDE_DMA, &HWGROUP(drive)->flags)) {
-				printk("ide_dma_end: dma not going? %p\n", __builtin_return_address(0));
-				return 1;
-			}
+			if (!test_and_clear_bit(IDE_DMA, &HWGROUP(drive)->flags))
+				BUG();
 			drive->waiting_for_dma = 0;
 			outb(inb(dma_base)&~1, dma_base);	/* stop DMA */
 			dma_stat = inb(dma_base+2);	/* get DMA status */
 			outb(dma_stat|6, dma_base+2);	/* clear the INTR & ERROR bits */
 			ide_destroy_dmatable(drive);	/* purge DMA mappings */
-			if (drive->tcq)
-				IDE_SET_CUR_TAG(drive, -1);
 			return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;	/* verify good DMA status */
 		case ide_dma_test_irq: /* returns 1 if dma irq issued, 0 otherwise */
 			dma_stat = inb(dma_base+2);
drivers/ide/ide-probe.c +5 -8
diff -urN linux-2.5.8/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -192,19 +192,16 @@
 	/*
 	 * it's an ata drive, build command list
 	 */
-#ifndef CONFIG_BLK_DEV_IDE_TCQ
 	drive->queue_depth = 1;
+#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEPTH
+	drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH;
 #else
-# ifndef CONFIG_BLK_DEV_IDE_TCQ_DEPTH
-#  define CONFIG_BLK_DEV_IDE_TCQ_DEPTH 1
-# endif
 	drive->queue_depth = drive->id->queue_depth + 1;
-	if (drive->queue_depth > CONFIG_BLK_DEV_IDE_TCQ_DEPTH)
-		drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH;
+#endif
 	if (drive->queue_depth < 1 || drive->queue_depth > IDE_MAX_TAG)
 		drive->queue_depth = IDE_MAX_TAG;
-#endif
-	if (ide_build_commandlist(drive))
+
+	if (ide_init_commandlist(drive))
 		goto err_misc;
 
 	return;
drivers/ide/ide-tcq.c +112 -65

359 lines not on this page · raw message

drivers/ide/ide.c +235 -147

490 lines not on this page · raw message

drivers/ide/pdc4030.c +6 -0
diff -urN linux-2.5.8/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
@@ -648,6 +648,12 @@
 
 	memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
 
+	/* The four drives on the two logical (one physical) interfaces
+	   are distinguished by writing the drive number (0-3) to the
+	   Feature register.
+	   FIXME: Is promise_selectproc now redundant??
+	 */
+	taskfile.feature    = (drive->channel->unit << 1) + drive->select.b.unit;
 	taskfile.sector_count	= rq->nr_sectors;
 	taskfile.sector_number	= block;
 	taskfile.low_cylinder	= (block>>=8);
include/linux/ide.h +38 -8

109 lines not on this page · raw message

#15 lore raw

PATCH 1/1 2.5.8 IDE 36

In reply to Linus Torvalds

Tue Apr 16 01:02:47 CEST 2002 ide-clean-36

- Consolidate ide_choose_drive() and choose_drive() in to one function.

- Remove sector data byteswpapping support. Byte-swapping the data is supported on the file-system level where applicable. Byte-swapped interfaces are supported on a lower level anyway. And finally it was used inconsistently.

- Eliminate taskfile_input_data() and taskfile_output_data(). This allowed us to split up ideproc and eliminate the ugly action switch as well as the corresponding defines.

- Remove tons of unnecessary typedefs from ide.h

- Prepate the PIO read write code for soon overhaul.

- Misc small bits here and there :-).

arch/cris/drivers/ide.c +18 -14
diff -urN linux-2.5.8/arch/cris/drivers/ide.c linux/arch/cris/drivers/ide.c
@@ -272,13 +272,17 @@
 	printk("ide: ETRAX 100LX built-in ATA DMA controller\n");
 
 	/* first initialize the channel interface data */
-	
+
 	for(h = 0; h < MAX_HWIFS; h++) {
 		struct ata_channel *hwif = &ide_hwifs[h];
+
 		hwif->chipset = ide_etrax100;
 		hwif->tuneproc = &tune_e100_ide;
 		hwif->dmaproc = &e100_dmaproc;
-		hwif->ideproc = &e100_ideproc;
+		hwif->ata_read = e100_ide_input_data;
+		hwif->ata_write = e100_ide_input_data;
+		hwif->atapi_read = e100_atapi_read;
+		hwif->atapi_write = e100_atapi_write;
 	}
 	/* actually reset and configure the etrax100 ide/ata interface */
 
@@ -375,12 +379,12 @@
  * so if an odd bytecount is specified, be sure that there's at least one
  * extra byte allocated for the buffer.
  */
-static void 
-e100_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
+static void
+e100_atapi_read(ide_drive_t *drive, void *buffer, unsigned int bytecount)
 {
 	ide_ioreg_t data_reg = IDE_DATA_REG;
 
-	D(printk("atapi_input_bytes, dreg 0x%x, buffer 0x%x, count %d\n",
+	D(printk("atapi_read, dreg 0x%x, buffer 0x%x, count %d\n",
 		 data_reg, buffer, bytecount));
 	
 	if(bytecount & 1) {
@@ -454,12 +458,12 @@
 #endif
 }
 
-static void 
-e100_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
+static void
+e100_atapi_write(ide_drive_t *drive, void *buffer, unsigned int bytecount)
 {
 	ide_ioreg_t data_reg = IDE_DATA_REG;
 	
-	D(printk("atapi_output_bytes, dreg 0x%x, buffer 0x%x, count %d\n",
+	D(printk("atapi_write, dreg 0x%x, buffer 0x%x, count %d\n",
 		 data_reg, buffer, bytecount));
 
 	if(bytecount & 1) {
@@ -544,7 +548,7 @@
 static void 
 e100_ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
 {
-	e100_atapi_input_bytes(drive, buffer, wcount << 2);
+	e100_atapi_read(drive, buffer, wcount << 2);
 }
 
 /*
@@ -553,7 +557,7 @@
 static void
 e100_ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
 {
-	e100_atapi_output_bytes(drive, buffer, wcount << 2);
+	e100_atapi_write(drive, buffer, wcount << 2);
 }
 
 /*
@@ -570,11 +574,11 @@
 		case ideproc_ide_output_data:
 			e100_ide_input_data(drive, buffer, length);
 			break;
-		case ideproc_atapi_input_bytes:
-			e100_atapi_input_bytes(drive, buffer, length);
+		case ideproc_atapi_read:
+			e100_atapi_read(drive, buffer, length);
 			break;
-		case ideproc_atapi_output_bytes:
-			e100_atapi_output_bytes(drive, buffer, length);
+		case ideproc_atapi_write:
+			e100_atapi_write(drive, buffer, length);
 			break;
 		default:
 			printk("e100_ideproc: unsupported func %d!\n", func);
drivers/ide/ide-cd.c +13 -13
diff -urN linux-2.5.8/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -791,7 +791,7 @@
 	ide_set_handler(drive, handler, timeout, cdrom_timer_expiry);
 
 	/* Send the command to the device. */
-	atapi_output_bytes(drive, cmd, CDROM_PACKET_SIZE);
+	atapi_write(drive, cmd, CDROM_PACKET_SIZE);
 
 	return ide_started;
 }
@@ -830,7 +830,7 @@
 	/* Read the data into the buffer. */
 	dest = info->buffer + info->nsectors_buffered * SECTOR_SIZE;
 	while (sectors_to_buffer > 0) {
-		atapi_input_bytes (drive, dest, SECTOR_SIZE);
+		atapi_read(drive, dest, SECTOR_SIZE);
 		--sectors_to_buffer;
 		--sectors_to_transfer;
 		++info->nsectors_buffered;
@@ -840,7 +840,7 @@
 	/* Throw away any remaining data. */
 	while (sectors_to_transfer > 0) {
 		char dum[SECTOR_SIZE];
-		atapi_input_bytes (drive, dum, sizeof (dum));
+		atapi_read(drive, dum, sizeof (dum));
 		--sectors_to_transfer;
 	}
 }
@@ -866,7 +866,7 @@
 		   and quit this request. */
 		while (len > 0) {
 			int dum = 0;
-			atapi_output_bytes (drive, &dum, sizeof (dum));
+			atapi_write(drive, &dum, sizeof (dum));
 			len -= sizeof (dum);
 		}
 	} else  if (ireason == 1) {
@@ -963,7 +963,7 @@
 	while (nskip > 0) {
 		/* We need to throw away a sector. */
 		char dum[SECTOR_SIZE];
-		atapi_input_bytes (drive, dum, sizeof (dum));
+		atapi_read(drive, dum, SECTOR_SIZE);
 
 		--rq->current_nr_sectors;
 		--nskip;
@@ -994,7 +994,7 @@
 			/* Read this_transfer sectors
 			   into the current buffer. */
 			while (this_transfer > 0) {
-				atapi_input_bytes(drive, rq->buffer, SECTOR_SIZE);
+				atapi_read(drive, rq->buffer, SECTOR_SIZE);
 				rq->buffer += SECTOR_SIZE;
 				--rq->nr_sectors;
 				--rq->current_nr_sectors;
@@ -1290,13 +1290,14 @@
 	/* The drive wants to be written to. */
 	if ((ireason & 3) == 0) {
 		/* Transfer the data. */
-		atapi_output_bytes (drive, pc->buffer, thislen);
+		atapi_write(drive, pc->buffer, thislen);
 
 		/* If we haven't moved enough data to satisfy the drive,
 		   add some padding. */
 		while (len > thislen) {
 			int dum = 0;
-			atapi_output_bytes (drive, &dum, sizeof (dum));
+
+			atapi_write(drive, &dum, sizeof (dum));
 			len -= sizeof (dum);
 		}
 
@@ -1307,15 +1308,14 @@
 
 	/* Same drill for reading. */
 	else if ((ireason & 3) == 2) {
-
 		/* Transfer the data. */
-		atapi_input_bytes (drive, pc->buffer, thislen);
+		atapi_read(drive, pc->buffer, thislen);
 
 		/* If we haven't moved enough data to satisfy the drive,
 		   add some padding. */
 		while (len > thislen) {
 			int dum = 0;
-			atapi_input_bytes (drive, &dum, sizeof (dum));
+			atapi_read(drive, &dum, sizeof (dum));
 			len -= sizeof (dum);
 		}
 
@@ -1458,7 +1458,7 @@
 		   and quit this request. */
 		while (len > 0) {
 			int dum = 0;
-			atapi_output_bytes(drive, &dum, sizeof(dum));
+			atapi_write(drive, &dum, sizeof(dum));
 			len -= sizeof(dum);
 		}
 	} else {
@@ -1549,7 +1549,7 @@
 		this_transfer = MIN(sectors_to_transfer,rq->current_nr_sectors);
 
 		while (this_transfer > 0) {
-			atapi_output_bytes(drive, rq->buffer, SECTOR_SIZE);
+			atapi_write(drive, rq->buffer, SECTOR_SIZE);
 			rq->buffer += SECTOR_SIZE;
 			--rq->nr_sectors;
 			--rq->current_nr_sectors;
drivers/ide/ide-disk.c +7 -6
diff -urN linux-2.5.8/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
@@ -1051,7 +1051,6 @@
 	ide_add_setting(drive,	"bios_head",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	255,				1,	1,	&drive->bios_head,		NULL);
 	ide_add_setting(drive,	"bios_sect",		SETTING_RW,					-1,			-1,			TYPE_BYTE,	0,	63,				1,	1,	&drive->bios_sect,		NULL);
 	ide_add_setting(drive,	"address",		SETTING_RW,					HDIO_GET_ADDRESS,	HDIO_SET_ADDRESS,	TYPE_INTA,	0,	2,				1,	1,	&drive->addressing,	set_lba_addressing);
-	ide_add_setting(drive,	"bswap",		SETTING_READ,					-1,			-1,			TYPE_BYTE,	0,	1,				1,	1,	&drive->bswap,			NULL);
 	ide_add_setting(drive,	"multcount",		id ? SETTING_RW : SETTING_READ,			HDIO_GET_MULTCOUNT,	HDIO_SET_MULTCOUNT,	TYPE_BYTE,	0,	id ? id->max_multsect : 0,	1,	1,	&drive->mult_count,		set_multcount);
 	ide_add_setting(drive,	"nowerr",		SETTING_RW,					HDIO_GET_NOWERR,	HDIO_SET_NOWERR,	TYPE_BYTE,	0,	1,				1,	1,	&drive->nowerr,			set_nowerr);
 	ide_add_setting(drive,	"lun",			SETTING_RW,					-1,			-1,			TYPE_INT,	0,	7,				1,	1,	&drive->lun,			NULL);
@@ -1198,11 +1197,11 @@
 	if ((capacity >= (drive->bios_cyl * drive->bios_sect * drive->bios_head)) &&
 	    (!drive->forced_geom) && drive->bios_sect && drive->bios_head)
 		drive->bios_cyl = (capacity / drive->bios_sect) / drive->bios_head;
-	printk (KERN_INFO "%s: %ld sectors", drive->name, capacity);
+	printk(KERN_INFO "%s: %ld sectors", drive->name, capacity);
 
 	/* Give size in megabytes (MB), not mebibytes (MiB). */
 	/* We compute the exact rounded value, avoiding overflow. */
-	printk (" (%ld MB)", (capacity - capacity/625 + 974)/1950);
+	printk(" (%ld MB)", (capacity - capacity/625 + 974)/1950);
 
 	/* Only print cache size when it was specified */
 	if (id->buf_size)
@@ -1213,7 +1212,7 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (drive->using_dma)
 		(void) drive->channel->dmaproc(ide_dma_verbose, drive);
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 	printk("\n");
 
 	drive->mult_count = 0;
@@ -1223,15 +1222,17 @@
 		id->multsect_valid = id->multsect ? 1 : 0;
 		drive->mult_req = id->multsect_valid ? id->max_multsect : INITIAL_MULT_COUNT;
 		drive->special.b.set_multmode = drive->mult_req ? 1 : 0;
-#else	/* original, pre IDE-NFG, per request of AC */
+#else
+		/* original, pre IDE-NFG, per request of AC */
 		drive->mult_req = INITIAL_MULT_COUNT;
 		if (drive->mult_req > id->max_multsect)
 			drive->mult_req = id->max_multsect;
 		if (drive->mult_req || ((id->multsect_valid & 1) && id->multsect))
 			drive->special.b.set_multmode = 1;
-#endif	/* CONFIG_IDEDISK_MULTI_MODE */
+#endif
 	}
 	drive->no_io_32bit = id->dword_io ? 1 : 0;
+
 	if (drive->id->cfs_enable_2 & 0x3000)
 		write_cache(drive, (id->cfs_enable_2 & 0x3000));
 	probe_lba_addressing(drive, 1);
drivers/ide/ide-features.c +3 -3
diff -urN linux-2.5.8/drivers/ide/ide-features.c linux/drivers/ide/ide-features.c
@@ -130,8 +130,8 @@
 		__restore_flags(flags);	/* local CPU only */
 		return 0;
 	}
-	ata_input_data(drive, id, SECTOR_WORDS);
-	(void) GET_STAT();	/* clear drive IRQ */
+	ata_read(drive, id, SECTOR_WORDS);
+	GET_STAT();		/* clear drive IRQ */
 	ide__sti();		/* local CPU only */
 	__restore_flags(flags);	/* local CPU only */
 	ide_fix_driveid(id);
@@ -285,7 +285,7 @@
 	enable_irq(hwif->irq);
 
 	if (error) {
-		(void) ide_dump_status(drive, "set_drive_speed_status", stat);
+		ide_dump_status(drive, "set_drive_speed_status", stat);
 		return error;
 	}
 
drivers/ide/ide-floppy.c +6 -6
diff -urN linux-2.5.8/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
@@ -717,7 +717,7 @@
 			return;
 		}
 		count = IDEFLOPPY_MIN (bio->bi_size - pc->b_count, bcount);
-		atapi_input_bytes (drive, bio_data(bio) + pc->b_count, count);
+		atapi_read(drive, bio_data(bio) + pc->b_count, count);
 		bcount -= count; pc->b_count += count;
 	}
 }
@@ -744,7 +744,7 @@
 			return;
 		}
 		count = IDEFLOPPY_MIN (pc->b_count, bcount);
-		atapi_output_bytes (drive, pc->b_data, count);
+		atapi_write(drive, pc->b_data, count);
 		bcount -= count; pc->b_data += count; pc->b_count -= count;
 	}
 }
@@ -979,12 +979,12 @@
 	}
 	if (test_bit (PC_WRITING, &pc->flags)) {
 		if (pc->buffer != NULL)
-			atapi_output_bytes (drive,pc->current_position,bcount.all);	/* Write the current buffer */
+			atapi_write(drive,pc->current_position,bcount.all);	/* Write the current buffer */
 		else
 			idefloppy_output_buffers (drive, pc, bcount.all);
 	} else {
 		if (pc->buffer != NULL)
-			atapi_input_bytes (drive,pc->current_position,bcount.all);	/* Read the current buffer */
+			atapi_read(drive,pc->current_position,bcount.all);	/* Read the current buffer */
 		else
 			idefloppy_input_buffers (drive, pc, bcount.all);
 	}
@@ -1020,7 +1020,7 @@
 
 	BUG_ON(HWGROUP(drive)->handler);
 	ide_set_handler (drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);	/* Set the interrupt routine */
-	atapi_output_bytes (drive, floppy->pc->c, 12); /* Send the actual packet */
+	atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
 
 	return ide_started;
 }
@@ -1042,7 +1042,7 @@
 {
 	idefloppy_floppy_t *floppy = drive->driver_data;
 
-	atapi_output_bytes (drive, floppy->pc->c, 12); /* Send the actual packet */
+	atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
 	return IDEFLOPPY_WAIT_CMD;		/* Timeout for the packet command */
 }
 
drivers/ide/ide-probe.c +15 -6
diff -urN linux-2.5.8/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -57,9 +57,18 @@
 		printk(KERN_WARNING "(ide-probe::do_identify) Out of memory.\n");
 		goto err_kmalloc;
 	}
-	/* read 512 bytes of id info */
+
+	/* Read 512 bytes of id info.
+	 *
+	 * Please note that it is well known that some *very* old drives are
+	 * able to provide only 256 of them, since this was the amount read by
+	 * DOS.
+	 *
+	 * However let's try to get away with this...
+	 */
+
 #if 1
-	ata_input_data(drive, id, SECTOR_WORDS);		/* read 512 bytes of id info */
+	ata_read(drive, id, SECTOR_WORDS);
 #else
         {
                 unsigned long   *ptr = (unsigned long *)id ;
@@ -580,10 +589,10 @@
 	__restore_flags(flags);	/* local CPU only */
 	for (unit = 0; unit < MAX_DRIVES; ++unit) {
 		ide_drive_t *drive = &hwif->drives[unit];
-		if (drive->present) {
-			ide_tuneproc_t *tuneproc = drive->channel->tuneproc;
-			if (tuneproc != NULL && drive->autotune == 1)
-				tuneproc(drive, 255);	/* auto-tune PIO mode */
+
+		if (drive->present && (drive->autotune == 1)) {
+			if (drive->channel->tuneproc != NULL)
+				drive->channel->tuneproc(drive, 255);	/* auto-tune PIO mode */
 		}
 	}
 }
drivers/ide/ide-proc.c +0 -1
diff -urN linux-2.5.8/drivers/ide/ide-proc.c linux/drivers/ide/ide-proc.c
@@ -422,7 +422,6 @@
 static void create_proc_ide_drives(struct ata_channel *hwif)
 {
 	int	d;
-	struct proc_dir_entry *ent;
 	struct proc_dir_entry *parent = hwif->proc;
 	char name[64];
 
drivers/ide/ide-tape.c +6 -6
diff -urN linux-2.5.8/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
@@ -1503,9 +1503,9 @@
 			idetape_discard_data (drive, bcount);
 			return;
 		}
-#endif /* IDETAPE_DEBUG_BUGS */
+#endif
 		count = min(bio->bi_size - pc->b_count, bcount);
-		atapi_input_bytes (drive, bio_data(bio) + pc->b_count, count);
+		atapi_read(drive, bio_data(bio) + pc->b_count, count);
 		bcount -= count;
 		pc->b_count += bio->bi_size;
 		if (pc->b_count == bio->bi_size) {
@@ -1530,7 +1530,7 @@
 		}
 #endif /* IDETAPE_DEBUG_BUGS */
 		count = min(pc->b_count, bcount);
-		atapi_output_bytes (drive, bio_data(bio), count);
+		atapi_write(drive, bio_data(bio), count);
 		bcount -= count;
 		pc->b_data += count;
 		pc->b_count -= count;
@@ -2169,12 +2169,12 @@
 		if (pc->bio != NULL)
 			idetape_output_buffers (drive, pc, bcount.all);
 		else
-			atapi_output_bytes (drive,pc->current_position,bcount.all);	/* Write the current buffer */
+			atapi_write(drive,pc->current_position,bcount.all);	/* Write the current buffer */
 	} else {
 		if (pc->bio != NULL)
 			idetape_input_buffers (drive, pc, bcount.all);
 		else
-			atapi_input_bytes (drive,pc->current_position,bcount.all);	/* Read the current buffer */
+			atapi_read(drive,pc->current_position,bcount.all);	/* Read the current buffer */
 	}
 	pc->actually_transferred += bcount.all;					/* Update the current position */
 	pc->current_position+=bcount.all;
@@ -2259,7 +2259,7 @@
 	tape->cmd_start_time = jiffies;
 	BUG_ON(HWGROUP(drive)->handler);
 	ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);	/* Set the interrupt routine */
-	atapi_output_bytes (drive,pc->c,12);			/* Send the actual packet */
+	atapi_write(drive,pc->c,12);	/* Send the actual packet */
 	return ide_started;
 }
 
drivers/ide/ide-taskfile.c +117 -114

379 lines not on this page · raw message

drivers/ide/ide.c +51 -53

214 lines not on this page · raw message

drivers/ide/pdc202xx.c +4 -3
diff -urN linux-2.5.8/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
@@ -1270,9 +1270,10 @@
 #ifdef CONFIG_PDC202XX_32_UNMASK
 	hwif->drives[0].io_32bit = 1;
 	hwif->drives[1].io_32bit = 1;
+
 	hwif->drives[0].unmask = 1;
 	hwif->drives[1].unmask = 1;
-#endif /* CONFIG_PDC202XX_32_UNMASK */
+#endif
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (hwif->dma_base) {
@@ -1285,9 +1286,9 @@
 		hwif->drives[1].autotune = 1;
 		hwif->autodma = 0;
 	}
-#else /* !CONFIG_BLK_DEV_IDEDMA */
+#else
 	hwif->drives[0].autotune = 1;
 	hwif->drives[1].autotune = 1;
 	hwif->autodma = 0;
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 }
drivers/ide/pdc4030.c +3 -3
diff -urN linux-2.5.8/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
@@ -183,7 +183,7 @@
 			"%s: Failed Promise read config!\n",hwif->name);
 		return 0;
 	}
-	ata_input_data(drive, &ident, SECTOR_WORDS);
+	ata_read(drive, &ident, SECTOR_WORDS);
 	if (ident.id[1] != 'P' || ident.id[0] != 'T') {
 		return 0;
 	}
@@ -332,7 +332,7 @@
 		nsect = sectors_avail;
 	sectors_avail -= nsect;
 	to = bio_kmap_irq(rq->bio, &flags) + ide_rq_offset(rq);
-	ata_input_data(drive, to, nsect * SECTOR_WORDS);
+	ata_read(drive, to, nsect * SECTOR_WORDS);
 #ifdef DEBUG_READ
 	printk(KERN_DEBUG "%s:  promise_read: sectors(%ld-%ld), "
 	       "buf=0x%08lx, rem=%ld\n", drive->name, rq->sector,
@@ -460,7 +460,7 @@
 		 * Ok, we're all setup for the interrupt
 		 * re-entering us on the last transfer.
 		 */
-		taskfile_output_data(drive, buffer, nsect<<7);
+		ata_write(drive, buffer, nsect << 7);
 		bio_kunmap_irq(buffer, &flags);
 	} while (mcount);
 
drivers/scsi/ide-scsi.c +6 -6
diff -urN linux-2.5.8/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
@@ -140,7 +140,7 @@
 		}
 		count = min(pc->sg->length - pc->b_count, bcount);
 		buf = page_address(pc->sg->page) + pc->sg->offset;
-		atapi_input_bytes (drive, buf + pc->b_count, count);
+		atapi_read(drive, buf + pc->b_count, count);
 		bcount -= count; pc->b_count += count;
 		if (pc->b_count == pc->sg->length) {
 			pc->sg++;
@@ -162,7 +162,7 @@
 		}
 		count = min(pc->sg->length - pc->b_count, bcount);
 		buf = page_address(pc->sg->page) + pc->sg->offset;
-		atapi_output_bytes (drive, buf + pc->b_count, count);
+		atapi_write(drive, buf + pc->b_count, count);
 		bcount -= count; pc->b_count += count;
 		if (pc->b_count == pc->sg->length) {
 			pc->sg++;
@@ -363,7 +363,7 @@
 					if (pc->sg)
 						idescsi_input_buffers(drive, pc, temp);
 					else
-						atapi_input_bytes(drive, pc->current_position, temp);
+						atapi_read(drive, pc->current_position, temp);
 					printk(KERN_ERR "ide-scsi: transferred %d of %d bytes\n", temp, bcount);
 				}
 				pc->actually_transferred += temp;
@@ -382,13 +382,13 @@
 		if (pc->sg)
 			idescsi_input_buffers (drive, pc, bcount);
 		else
-			atapi_input_bytes (drive,pc->current_position,bcount);
+			atapi_read(drive,pc->current_position,bcount);
 	} else {
 		set_bit(PC_WRITING, &pc->flags);
 		if (pc->sg)
 			idescsi_output_buffers (drive, pc, bcount);
 		else
-			atapi_output_bytes (drive,pc->current_position,bcount);
+			atapi_write(drive,pc->current_position,bcount);
 	}
 	pc->actually_transferred+=bcount;				/* Update the current position */
 	pc->current_position+=bcount;
@@ -414,7 +414,7 @@
 		return ide_stopped;
 	}
 	ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL);	/* Set the interrupt routine */
-	atapi_output_bytes (drive, scsi->pc->c, 12);			/* Send the actual packet */
+	atapi_write(drive, scsi->pc->c, 12);			/* Send the actual packet */
 	return ide_started;
 }
 
include/linux/ide.h +55 -68

190 lines not on this page · raw message

#16 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Linus Torvalds
Quoted 7 lines · Martin Dalecki

Tue Apr 16 01:02:47 CEST 2002 ide-clean-36

- Consolidate ide_choose_drive() and choose_drive() in to one function.

- Remove sector data byteswpapping support. Byte-swapping the data is supported on the file-system level where applicable. Byte-swapped interfaces are supported on a lower level anyway. And finally it was used inconsistently.

Are you sure about this? I think file systems support LE/BE, but not byteswapping because of IDE being LE on a BE system.

Quoted 10 lines

- Eliminate taskfile_input_data() and taskfile_output_data(). This allowed us to split up ideproc and eliminate the ugly action switch as well as the corresponding defines.

- Remove tons of unnecessary typedefs from ide.h

- Prepate the PIO read write code for soon overhaul.

- Misc small bits here and there :-).

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#17 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Linus Torvalds
Quoted 6 lines · Vojtech Pavlik
Quoted 4 lines · Martin Dalecki

Tue Apr 16 01:02:47 CEST 2002 ide-clean-36

- Consolidate ide_choose_drive() and choose_drive() in to one function.

Quoted 7 lines
Quoted 3 lines

- Remove sector data byteswpapping support. Byte-swapping the data is supported on the file-system level where applicable. Byte-swapped interfaces are supported on a lower level anyway. And finally it was used inconsistently.

Are you sure about this? I think file systems support LE/BE, but not byteswapping because of IDE being LE on a BE system.

I'm sure about this. For the following reasons:

1. The removed functionality affected only sector data transfers.

2. The following code for interfaces with byte swapped BUS setups still remains intact:

#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
	if (MACH_IS_ATARI || MACH_IS_Q40) {
		/* Atari has a byte-swapped IDE interface */
		insw_swapw(IDE_DATA_REG, buffer, bytecount / 2);
		return;
	}

#endif

And indeed as you show - there was confusion about this issue throughout the whole driver, since the taskfile_in(out) functions where basically just the byteswapped variants and where not uses consistently.

#18 lore raw

Re: [PATCH] 2.5.8 IDE 36

The common thing I use byteswap for is to mount my tivo (kernel 2.1.x) drives on my PC (2.4/5.x). those drives are byteswapped throughout the entire drive, including the partition table.

It sounds as if you are removing this capability, am I misunderstaning you or is there some other way to do this? (and duplicating the drive to use dd to byteswap is not practical for 100G+)

David Lang

Quoted 41 lines · Martin Dalecki
Quoted 6 lines · Vojtech Pavlik
Quoted 4 lines · Martin Dalecki

Tue Apr 16 01:02:47 CEST 2002 ide-clean-36

- Consolidate ide_choose_drive() and choose_drive() in to one function.

Quoted 7 lines
Quoted 3 lines

- Remove sector data byteswpapping support. Byte-swapping the data is supported on the file-system level where applicable. Byte-swapped interfaces are supported on a lower level anyway. And finally it was used inconsistently.

Are you sure about this? I think file systems support LE/BE, but not byteswapping because of IDE being LE on a BE system.

I'm sure about this. For the following reasons:

1. The removed functionality affected only sector data transfers.

2. The following code for interfaces with byte swapped BUS setups still remains intact:

#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
	if (MACH_IS_ATARI || MACH_IS_Q40) {
		/* Atari has a byte-swapped IDE interface */
		insw_swapw(IDE_DATA_REG, buffer, bytecount / 2);
		return;
	}

#endif

And indeed as you show - there was confusion about this issue throughout the whole driver, since the taskfile_in(out) functions where basically just the byteswapped variants and where not uses consistently.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#19 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 7 lines · David Lang

The common thing I use byteswap for is to mount my tivo (kernel 2.1.x) drives on my PC (2.4/5.x). those drives are byteswapped throughout the entire drive, including the partition table.

It sounds as if you are removing this capability, am I misunderstaning you or is there some other way to do this? (and duplicating the drive to use dd to byteswap is not practical for 100G+)

Same problem as with SCSI disks, which are even more commonly moved between different system types - please look there for a solution. BTW.> I hardly beleve that your tivo is containing a DOS partition table - otherwise the partition table will handle it all autmagically.

#20 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 9 lines · Martin Dalecki
Quoted 7 lines · David Lang

The common thing I use byteswap for is to mount my tivo (kernel 2.1.x) drives on my PC (2.4/5.x). those drives are byteswapped throughout the entire drive, including the partition table.

It sounds as if you are removing this capability, am I misunderstaning you or is there some other way to do this? (and duplicating the drive to use dd to byteswap is not practical for 100G+)

Quoted 5 lines

Same problem as with SCSI disks, which are even more commonly moved between different system types - please look there for a solution. BTW. I hardly beleve that your tivo is containing a DOS partition table - otherwise the partition table will handle it all autmagically.

Well, there *is* a partition table on the drive, but the byte-swapping isn't handled automatically. Otherwise people wouldn't need to bswap their TiVo drives when plugging into an x86 box.

Having the bswap option is definately useful. With it, you can "bless" the drive and then mount the partitions and poke around. Please don't remove the bswap option. You'll make life harder for a bunch of people.

This gratuitous removal of features in the guise of "cleanups" is why you got flamed earlier this year. I thought you'd learned :-/

				Regards,

					Richard....
Permanent: [email protected]
Current:   [email protected]
#21 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 3 lines · Richard Gooch

This gratuitous removal of features in the guise of "cleanups" is why you got flamed earlier this year. I thought you'd learned :-/

Richard, have you looked at the IDE mess? That "feature" is a bug, the way it was implemented - and considering that it's implementable at a different level much more cleanly for the (few) people who actually need it...

Also note that performance is likely to _increase_ by removing that stupid feature - using DMA to do the actual IO and them byteswapping in some higher level than the driver is likely to be a _lot_ faster than doing PIO (and byteswap in-place, resulting in random mmap corruption).

Do you realize that because the current bswap writeback reverses the bytes in place, you can actually seriously corrupt your filesystem by just being unlucky in timing (ie a bswap on a dirty metadata block at the same time another process accesses it)?

It's a BUG guys, not a feature.

Linus

#22 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 7 lines · Linus Torvalds
Quoted 3 lines · Richard Gooch

This gratuitous removal of features in the guise of "cleanups" is why you got flamed earlier this year. I thought you'd learned :-/

Richard, have you looked at the IDE mess?

Yeah, years ago when I was adding devfs calls. I've tried to forget about it since then...

Quoted 5 lines

Also note that performance is likely to _increase_ by removing that stupid feature - using DMA to do the actual IO and them byteswapping in some higher level than the driver is likely to be a _lot_ faster than doing PIO (and byteswap in-place, resulting in random mmap corruption).

I'm actually not that concerned about performance for this case, because it's not a common operation. If we had some kind of loop driver that supported partitioning then I'd be satisfied. In fact, I agree that would probably be better.

What I object to is the removal of a feature that people depend on, *without a replacement being made available prior to removal*. If you want to remove a feature, build the replacement *first*. Don't remove the feature and say "the rest of you can pick up the pieces".

				Regards,

					Richard....
Permanent: [email protected]
Current:   [email protected]
#23 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 5 lines · Richard Gooch

What I object to is the removal of a feature that people depend on, *without a replacement being made available prior to removal*. If you want to remove a feature, build the replacement *first*. Don't remove the feature and say "the rest of you can pick up the pieces".

Hey, that happens all the time - look how many times VFS changes have made various filesystems unusable (including yours ;)

The fact is, many things are easier to fix afterwards. Particularly because that's the only time you'll find people motivated enough to bother about it. If you were to need to fix everything before-the-fact, nothing fundamental would ever get fixed, simply because the people who can fix one thing are not usually the same people who can fix another.

(Just to take an example that _isn't_ the IDE driver, this is exactly what the more generic bio changes have been an example of - it's just inconceivable to fix every use of the old request interface, so somebody has to take the first step and taker the heat about it. Otherwise it never gets anywhere)

Linus

#24 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 11 lines · Linus Torvalds
Quoted 4 lines · Richard Gooch

What I object to is the removal of a feature that people depend on, *without a replacement being made available prior to removal*. If you want to remove a feature, build the replacement *first*. Don't remove the feature and say "the rest of you can pick up the pieces".

Hey, that happens all the time - look how many times VFS changes have made various filesystems unusable (including yours ;)

Another example from the real world: Do you always have to elect democratically a new president, before you assult the bad dictator?

#25 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to David Lang
Quoted 19 lines · Richard Gooch
Quoted 10 lines · Martin Dalecki
Quoted 7 lines · David Lang

The common thing I use byteswap for is to mount my tivo (kernel 2.1.x) drives on my PC (2.4/5.x). those drives are byteswapped throughout the entire drive, including the partition table.

It sounds as if you are removing this capability, am I misunderstaning you or is there some other way to do this? (and duplicating the drive to use dd to byteswap is not practical for 100G+)

Quoted 5 lines

Same problem as with SCSI disks, which are even more commonly moved between different system types - please look there for a solution. BTW. I hardly beleve that your tivo is containing a DOS partition table - otherwise the partition table will handle it all autmagically.

Quoted 8 lines

Well, there *is* a partition table on the drive, but the byte-swapping isn't handled automatically. Otherwise people wouldn't need to bswap their TiVo drives when plugging into an x86 box.

Having the bswap option is definately useful. With it, you can "bless" the drive and then mount the partitions and poke around. Please don't remove the bswap option. You'll make life harder for a bunch of people.

Please note one sample from ext2 code:

	if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV)

And from partition handling code linux/fs/partitions/sun.c:

	/* All Sun disks have 8 partition entries */
	spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect);

You see those many le32_to_cpu() and reverse commands?
If there is something that has to be fixed for linux/fs/partition/whatever.c - please fix it there if you are actually *needing* it.

You also notice that the option was used only by the taskfile_(in|out)put_bytes() function, which in turn was only used for taks_in_intr, which in turn only matters for PIO mode but did NOTHING to DMA transfers for example? DMA transfers are those days the >> 90% most common on disks in PC systems. And you notice that the IDE driver sometimes starts in DMA and falls backs to DMA if it has for example to fill in a not full memmory page?

And you notice that the SCSI people are more likely to exchange disks regularly between some RISC big endian host and linux on intel? Please ask yourself why they don't have someting like the byteswap option.

Do you remember that byteswap was something introduced by the Atari people a long long time ago even before the fs code started to understand about native endianess issues and is today both: broken (it *may* work for someone but it *is* broken) unneccessary and not the proper way to deal with the problems in question?

You notice as well that the arch specific bytswapping for physically cross wired ata host chips on some historical archs is still there where it should be?

You don't? So please flame me now as much as you desire...

#26 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to David Lang
Quoted 33 lines · Martin Dalecki
Quoted 19 lines · Richard Gooch
Quoted 10 lines · Martin Dalecki
Quoted 7 lines · David Lang

The common thing I use byteswap for is to mount my tivo (kernel 2.1.x) drives on my PC (2.4/5.x). those drives are byteswapped throughout the entire drive, including the partition table.

It sounds as if you are removing this capability, am I misunderstaning you or is there some other way to do this? (and duplicating the drive to use dd to byteswap is not practical for 100G+)

Quoted 5 lines

Same problem as with SCSI disks, which are even more commonly moved between different system types - please look there for a solution. BTW. I hardly beleve that your tivo is containing a DOS partition table - otherwise the partition table will handle it all autmagically.

Quoted 8 lines

Well, there *is* a partition table on the drive, but the byte-swapping isn't handled automatically. Otherwise people wouldn't need to bswap their TiVo drives when plugging into an x86 box.

Having the bswap option is definately useful. With it, you can "bless" the drive and then mount the partitions and poke around. Please don't remove the bswap option. You'll make life harder for a bunch of people.

Please note one sample from ext2 code:

	if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV)
Quoted 8 lines

And from partition handling code linux/fs/partitions/sun.c:

	/* All Sun disks have 8 partition entries */
	spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect);

You see those many le32_to_cpu() and reverse commands?
If there is something that has to be fixed for linux/fs/partition/whatever.c - please fix it there if you are actually *needing* it.

Note that the above commands are no help in case of plugging TIVO drive into a PC. While they assure that all ext2 filesystems are LE on the media and all sun disklabels are BE on the media, still if you plug in a BE ext2 into the system (or a BE PC partition table), the kernel won't understand them.

Quoted 7 lines

You also notice that the option was used only by the taskfile_(in|out)put_bytes() function, which in turn was only used for taks_in_intr, which in turn only matters for PIO mode but did NOTHING to DMA transfers for example? DMA transfers are those days the >> 90% most common on disks in PC systems. And you notice that the IDE driver sometimes starts in DMA and falls backs to DMA if it has for example to fill in a not full memmory page?

I think you wanted to say 'falls back to PIO'. Oh, OK. But still I can disable DMA and access the damn TIVO drive data.

Quoted 3 lines

And you notice that the SCSI people are more likely to exchange disks regularly between some RISC big endian host and linux on intel? Please ask yourself why they don't have someting like the byteswap option.

Because for Linux filesystems it was decided some time ago (after people HAD huge byteswap problems) that ext2 is always LE, etc, etc. So filesystems are supposed to be the same on every system.

But IDE is used in some pretty weird hardware configurations, where you actually get one more byteswap on IDE, even when Linux takes care of the system itself being LE/BE. And furthermore, IDE is now used in stuff like TIVO or X-Box, where you can't really control what's on the drive, and thus you can't rely on that it'll be in a format you decided is the 'right' one.

Quoted 5 lines

Do you remember that byteswap was something introduced by the Atari people a long long time ago even before the fs code started to understand about native endianess issues and is today both: broken (it *may* work for someone but it *is* broken) unneccessary and not the proper way to deal with the problems in question?

It may be it's broken now. But IMO it should be fixed instead of removed. Limited to PIO perhaps (if you set bswap on a drive, then it the driver won't allow DMA on it), but still it's a feature that's useful now and then.

Quoted 5 lines

You notice as well that the arch specific bytswapping for physically cross wired ata host chips on some historical archs is still there where it should be?

You don't? So please flame me now as much as you desire...

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#27 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 6 lines · Vojtech Pavlik

Note that the above commands are no help in case of plugging TIVO drive into a PC. While they assure that all ext2 filesystems are LE on the media and all sun disklabels are BE on the media, still if you plug in a BE ext2 into the system (or a BE PC partition table), the kernel won't understand them.

Please use a the network block device, and teach the ndb deamon to just byteswap each word.

Problem solved, WITHOUT keeping bugs in the IDE driver.

Oh, and performance improved at the same time.

What are you guys thinging about? There are two rules here:
- optimize for the common case
- keep the code clean.

Both of them say that Martin is 100% right.

Linus

#28 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 2 lines

Please use a the network block device, and teach the ndb deamon to just byteswap each word.

You need to use loop not nbd - loopback nbd can deadlock. Byteswap as a new revolutionary crypto system for the loopback driver isnt hard

Alan

#29 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 5 lines · Alan Cox
Quoted 2 lines

Please use a the network block device, and teach the ndb deamon to just byteswap each word.

You need to use loop not nbd - loopback nbd can deadlock. Byteswap as a new revolutionary crypto system for the loopback driver isnt hard

Even better - I did indeed miss the "security" aspect of the byteswapping ;)

And I know from personal experience that allowing partitioning of a loopback thing would certainly have made some things a _lot_ easier (ie not having to figure out the damn offsets in order to mount a filesystem on a loopback volume), so having support for partitioning would be good.

Although I do have this suspicion that that partitioning support should be in user space (along with all the rest of the partitioning support, but that's another matter and has some rather more serious backwards compatibility issues, of course. Is anybody still working on the new early initrd?).

Linus

#30 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 2 lines

compatibility issues, of course. Is anybody still working on the new early initrd?).

Bits of it exist - the dhcp/bootp client in userspace initrd is out there and in real world use courtesy of the LTSP - who wrote it before anyone had even thought about the initrd stuff 8)

#31 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Linus Torvalds
Quoted 10 lines · Linus Torvalds
Quoted 5 lines · Alan Cox
Quoted 2 lines

Please use a the network block device, and teach the ndb deamon to just byteswap each word.

You need to use loop not nbd - loopback nbd can deadlock. Byteswap as a new revolutionary crypto system for the loopback driver isnt hard

Quoted 7 lines

Even better - I did indeed miss the "security" aspect of the byteswapping ;)

And I know from personal experience that allowing partitioning of a loopback thing would certainly have made some things a _lot_ easier (ie not having to figure out the damn offsets in order to mount a filesystem on a loopback volume), so having support for partitioning would be good.

gpart is good for this:
For e.g:

$gpart -vgd partitions.img

dev(partitions.img) mss(512)

Primary partition(1)
type: 131(0x83)(Linux ext2 filesystem)
size: 2mb #s(4576) s(32-4607)
chs: (0/1/1)-(8/15/32)d (0/0/0)-(0/0/0)r
hex: 00 01 01 00 83 0F 20 08 20 00 00 00 E0 11 00 00

Primary partition(2)
type: 131(0x83)(Linux ext2 filesystem)
size: 59mb #s(121856) s(4608-126463)
chs: (9/0/1)-(246/15/32)d (0/0/0)-(0/0/0)r
hex: 00 00 01 09 83 0F 20 F6 00 12 00 00 00 DC 01 00

The pertinent info here is s(32-4607) & s(4608-126463). Blocks are 512 bytes so in this e.g. the offsets for the first and second partitions respectively are:
16384 & 2359296

Quoted 7 lines

Although I do have this suspicion that that partitioning support should be in user space (along with all the rest of the partitioning support, but that's another matter and has some rather more serious backwards compatibility issues, of course. Is anybody still working on the new early initrd?).

Linus

Padraig.

#32 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Alan Cox
Quoted 4 lines · Linus Torvalds

And I know from personal experience that allowing partitioning of a loopback thing would certainly have made some things a _lot_ easier (ie not having to figure out the damn offsets in order to mount a filesystem on a loopback volume), so having support for partitioning would be good.

This can be done trivially in user-space without breaking any existing code and without having to enable partitioning of a single loop device. All that we need to do is take a tool like partx (from util-linux) to decode the partition table and find the partition offset+size, and then feed that to losetup (or call the loop setup ioctl directly) for each partition. You get a bunch of loop devices set up, one for each partition.

The only thing one might want to have is some option to losetup to list all of the loop devices currently set up ("losetup -a" or something) so you can see which loop device corresponds to what disk partition. Of course the partx tool would also print that out at setup time, but people have short memories for this sort of stuff.

Quoted 4 lines

Although I do have this suspicion that that partitioning support should be in user space (along with all the rest of the partitioning support, but that's another matter and has some rather more serious backwards compatibility issues, of course.

The partx tool (and GNU parted as well) _already_ can grok partitions from user-space and tell the kernel about them (I had set up some GPT/ia64 partitions on my ia32 box and mounted them just fine). All that needs to be done is run this in early setup before we need to mount the root filesystem.

Cheers, Andreas
--
Andreas Dilger
http://www-mddsp.enel.ucalgary.ca/People/adilger/
http://sourceforge.net/projects/ext2resize/

#33 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Vojtech Pavlik
Quoted 9 lines · Linus Torvalds
Quoted 6 lines · Vojtech Pavlik

Note that the above commands are no help in case of plugging TIVO drive into a PC. While they assure that all ext2 filesystems are LE on the media and all sun disklabels are BE on the media, still if you plug in a BE ext2 into the system (or a BE PC partition table), the kernel won't understand them.

Quoted 4 lines

Please use a the network block device, and teach the ndb deamon to just byteswap each word.

Problem solved, WITHOUT keeping bugs in the IDE driver.

Yeah, that's a pretty cool idea.

Quoted 5 lines

Oh, and performance improved at the same time.

What are you guys thinging about? There are two rules here:
- optimize for the common case
- keep the code clean.

There is also this one:

- don't remove existing features if you don't have an usable replacement or users will hate you.

Quoted 1 line

Both of them say that Martin is 100% right.

Now that you've come up with the NBD idea, I have to agree.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#34 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Vojtech Pavlik
Quoted 3 lines · Vojtech Pavlik

Because for Linux filesystems it was decided some time ago (after people HAD huge byteswap problems) that ext2 is always LE, etc, etc. So filesystems are supposed to be the same on every system.

In the case of Tivo they are useing a kernel from the time before the fix went in so even their ext2 partitions are incorrect (not to mention their other partitions that aren't ext2)

David Lang

#35 lore raw

Re: [PATCH] 2.5.8 IDE 36

From: David Lang <[email protected]>
Date: Tue, 16 Apr 2002 10:04:02 -0700 (PDT)

Quoted 3 lines · Vojtech Pavlik

Because for Linux filesystems it was decided some time ago (after people HAD huge byteswap problems) that ext2 is always LE, etc, etc. So filesystems are supposed to be the same on every system.

In the case of Tivo they are useing a kernel from the time before the fix went in so even their ext2 partitions are incorrect (not to mention their other partitions that aren't ext2)

That's absurd. I made the fix 6 years ago, I doubt they are using a kernel older than that.

#36 lore raw

Re: [PATCH] 2.5.8 IDE 36

I could be wrong, it's a 2.1.x kernel that they started with. I thought that was around the time the fix went in.

David Lang

Quoted 23 lines · David S. Miller

Date: Tue, 16 Apr 2002 10:00:55 -0700 (PDT)
From: David S. Miller <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected]
Subject: Re: [PATCH] 2.5.8 IDE 36

From: David Lang <[email protected]>
Date: Tue, 16 Apr 2002 10:04:02 -0700 (PDT)

Quoted 3 lines · Vojtech Pavlik

Because for Linux filesystems it was decided some time ago (after people HAD huge byteswap problems) that ext2 is always LE, etc, etc. So filesystems are supposed to be the same on every system.

In the case of Tivo they are useing a kernel from the time before the fix went in so even their ext2 partitions are incorrect (not to mention their other partitions that aren't ext2)

That's absurd. I made the fix 6 years ago, I doubt they are using a kernel older than that.

#37 lore raw

Re: [PATCH] 2.5.8 IDE 36

From: David Lang <[email protected]>
Date: Tue, 16 Apr 2002 10:09:38 -0700 (PDT)

I could be wrong, it's a 2.1.x kernel that they started with. I thought that was around the time the fix went in.

Again, I did the fix 6 years ago, thats pre-2.0.x days

EXT2 has been little-endian only with proper byte-swapping support across all architectures, since that time.

#38 lore raw

Re: [PATCH] 2.5.8 IDE 36

Ok, in that case it must be a wierd wiring of the IDE or something.

I thought it was something more logical (silly me :-)

David Lang

Quoted 18 lines · David S. Miller

Date: Tue, 16 Apr 2002 10:06:10 -0700 (PDT)
From: David S. Miller <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected]
Subject: Re: [PATCH] 2.5.8 IDE 36

From: David Lang <[email protected]>
Date: Tue, 16 Apr 2002 10:09:38 -0700 (PDT)

I could be wrong, it's a 2.1.x kernel that they started with. I thought that was around the time the fix went in.

Again, I did the fix 6 years ago, thats pre-2.0.x days

EXT2 has been little-endian only with proper byte-swapping support across all architectures, since that time.

#39 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 5 lines · David Lang

Ok, in that case it must be a wierd wiring of the IDE or something.

I thought it was something more logical (silly me :-)

David Lang

Please do me a favour - next time don't proclaim using some feature which you actually don't. I know that the grammatical conjunktiv form is nearly dead in english - but please intersperese the next time words like "could" "may be" OK?

#40 lore raw

Re: [PATCH] 2.5.8 IDE 36

I use the byteswap feature to access these disks. It appears I was wrong about the reason that I needed to use it, but the need is correct.

the fact is that for whatever reason the drives the tivo uses are byteswapped compared to what they need to be for me to read them on an x86 system.

if another way is available I will use it, in the meantime I will not be able to use 2.5 kernels to access those drives (since connecting and disconnecting the drives requires a reboot this isn't a fatal flaw)

David Lang

Quoted 20 lines · Martin Dalecki

Date: Wed, 17 Apr 2002 09:44:54 +0200
From: Martin Dalecki <[email protected]>
To: David Lang <[email protected]>
Cc: David S. Miller <[email protected]>, [email protected],
[email protected], [email protected], [email protected]
Subject: Re: [PATCH] 2.5.8 IDE 36

Quoted 5 lines · David Lang

Ok, in that case it must be a wierd wiring of the IDE or something.

I thought it was something more logical (silly me :-)

David Lang

Please do me a favour - next time don't proclaim using some feature which you actually don't. I know that the grammatical conjunktiv form is nearly dead in english - but please intersperese the next time words like "could" "may be" OK?

#41 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to David S. Miller
Quoted 7 lines

I could be wrong, it's a 2.1.x kernel that they started with. I thought that was around the time the fix went in.

Again, I did the fix 6 years ago, thats pre-2.0.x days

EXT2 has been little-endian only with proper byte-swapping support across all architectures, since that time.

My understanding it that Tivo behaves like some Amiga's here and has broken swapping of the IDE bus itself, not the ext2 filesystem.

On PPC, we still have some historical horrible macros redefinitions in asm/ide.h to let APUS (PPC Amiga) deal with these.

Now, the problem of dealing with DMA along with the swapping is something scary. I beleive the sanest solution that won't please affected people is to _not_ support DMA on these broken HW ;)

Another way would be, for such broken controllers, to break the request into 1 page max requests and let them all go through a bounce buffer.

Ben.

#42 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 11 lines · Benjamin Herrenschmidt
Quoted 7 lines

I could be wrong, it's a 2.1.x kernel that they started with. I thought that was around the time the fix went in.

Again, I did the fix 6 years ago, thats pre-2.0.x days

EXT2 has been little-endian only with proper byte-swapping support across all architectures, since that time.

My understanding it that Tivo behaves like some Amiga's here and has broken swapping of the IDE bus itself, not the ext2 filesystem.

You mean Ataris and Q40/Q60s?

I'm not aware if any Amiga IDE interface with byteswapped IDE interface. Or it must be a very rare interface not supported by Linux anyway ;-)

Quoted 2 lines

On PPC, we still have some historical horrible macros redefinitions in asm/ide.h to let APUS (PPC Amiga) deal with these.

In asm-ppc/ide.h? Didn't see them there.

The main problem is that IDE use[sd] `inb' et al. for accesses, which is not valid for I/O on something other than ISA/PCI I/O space. So for m68k and APUS we have to do weird things. The new IN_BYTE() etc. should help a bit there, though.

Quoted 3 lines

Now, the problem of dealing with DMA along with the swapping is something scary. I beleive the sanest solution that won't please affected people is to _not_ support DMA on these broken HW ;)

Agreed. And you have to disable DMA when accessing a disk that originates from such a system on a sane box.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#43 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines
Quoted 8 lines

I could be wrong, it's a 2.1.x kernel that they started with. I thought that was around the time the fix went in.

Again, I did the fix 6 years ago, thats pre-2.0.x days

EXT2 has been little-endian only with proper byte-swapping support across all architectures, since that time.

Quoted 7 lines
Quoted 3 lines

My understanding it that Tivo behaves like some Amiga's here and has broken swapping of the IDE bus itself, not the ext2 filesystem.

You mean Ataris and Q40/Q60s?

I'm not aware if any Amiga IDE interface with byteswapped IDE interface.

Or it

Quoted 1 line

must be a very rare interface not supported by Linux anyway ;-)

My confusion then. We used to have these in the PPC tree, and I suspected those were APUS related ;)

Quoted 4 lines
Quoted 2 lines

On PPC, we still have some historical horrible macros redefinitions in asm/ide.h to let APUS (PPC Amiga) deal with these.

In asm-ppc/ide.h? Didn't see them there.

Right, looks like they are gone lately. Well, the TiVO may have been one reason for these though I don't think the support for this box has ever made it into our main tree. It's possible that we had some broken PReP or whatever early boxes.

Quoted 4 lines

The main problem is that IDE use[sd] `inb' et al. for accesses, which is not valid for I/O on something other than ISA/PCI I/O space. So for m68k and APUS we have to do weird things. The new IN_BYTE() etc. should help a bit there, though.

We tweak on pmac by feeding the IDE layer with our controller virtual address minus _IO_BASE (for non-PPC people, _IO_BASE is the virtual address of the main PCI IO space, all inx/outx are relative to this). The pointer arithmetic does the magic. It sucks, but works without redefining everything around. I haven't looked at the new IN_BYTE stuff, though if it is IDE specific, I'd rather see it called IDE_IN_BYTE. The current scheme sucks also because inx/outx, at least on PPC, are a lot slower than normal MMIO access (one reason beeing their ability to recovert from machine checks). It would be nice for IDE to use it's own accessors on MMIO platforms. This has to be a per-controller things though. A global macro is no good. You can (and on some configs, you do have on the motherboard) both MMIO mapped controllers and old-style IO mapped ones. One example is the B&W mac G3 which has both the Apple MMIO mapped mac-io IDE controller and the CMD646 on the PCI bus.

Also, when applying the taskfile, I suspect we don't need strong barriers as we do currently have, only on IO write barrier before actually writing the command byte. But I would gladly leave the whole issue of redefining barriers especially regarding IOs to Anton Blanchard ;)

Maybe the entire function for writing a taskfile register state to the controller should be made a hwif indirect call. (On Darwin, they more or less do that, along with a bitmask indicating which register has to be applied, though I suspect the tests against this bitmask would eats pretty much all of the benefit of removing the useless barriers).

Quoted 5 lines
Quoted 3 lines

Now, the problem of dealing with DMA along with the swapping is something scary. I beleive the sanest solution that won't please affected people is to _not_ support DMA on these broken HW ;)

Agreed. And you have to disable DMA when accessing a disk that

originates from

Quoted 1 line

such a system on a sane box.

Agreed.

Ben.

#44 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Geert Uytterhoeven
Quoted 19 lines · Benjamin Herrenschmidt

We tweak on pmac by feeding the IDE layer with our controller virtual address minus _IO_BASE (for non-PPC people, _IO_BASE is the virtual address of the main PCI IO space, all inx/outx are relative to this). The pointer arithmetic does the magic. It sucks, but works without redefining everything around. I haven't looked at the new IN_BYTE stuff, though if it is IDE specific, I'd rather see it called IDE_IN_BYTE. The current scheme sucks also because inx/outx, at least on PPC, are a lot slower than normal MMIO access (one reason beeing their ability to recovert from machine checks). It would be nice for IDE to use it's own accessors on MMIO platforms. This has to be a per-controller things though. A global macro is no good. You can (and on some configs, you do have on the motherboard) both MMIO mapped controllers and old-style IO mapped ones. One example is the B&W mac G3 which has both the Apple MMIO mapped mac-io IDE controller and the CMD646 on the PCI bus.

Also, when applying the taskfile, I suspect we don't need strong barriers as we do currently have, only on IO write barrier before actually writing the command byte. But I would gladly leave the whole issue of redefining barriers especially regarding IOs to Anton Blanchard ;)

Quoted 5 lines

Maybe the entire function for writing a taskfile register state to the controller should be made a hwif indirect call. (On Darwin, they more or less do that, along with a bitmask indicating which register has to be applied, though I suspect the tests against this bitmask would eats pretty much all of the benefit of removing the useless barriers).

Thank you for the elaborated explanation. I think that some of your ideas presented here could be well pursued becouse they are indeed good. :-).

#45 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to David S. Miller
Quoted 10 lines · David S. Miller

From: David Lang <[email protected]>
Date: Tue, 16 Apr 2002 10:09:38 -0700 (PDT)

I could be wrong, it's a 2.1.x kernel that they started with. I thought that was around the time the fix went in.

Again, I did the fix 6 years ago, thats pre-2.0.x days

EXT2 has been little-endian only with proper byte-swapping support across all architectures, since that time.

On SPARC. M68k followed a bit later. But when I got my CHRP board, ext2 was still big endian on (at least some) PPC boxes, so PPC must have been switched over in 1997/1998.

I tried to find the exact date of the appearance of the `-s' option of e2fsck in the changelog og e2fsprogs, but apparently not all changes are mentioned there.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#46 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to David S. Miller
Quoted 13 lines · Benjamin Herrenschmidt
Quoted 7 lines

I could be wrong, it's a 2.1.x kernel that they started with. I thought that was around the time the fix went in.

Again, I did the fix 6 years ago, thats pre-2.0.x days

EXT2 has been little-endian only with proper byte-swapping support across all architectures, since that time.

My understanding it that Tivo behaves like some Amiga's here and has broken swapping of the IDE bus itself, not the ext2 filesystem.

Quoted 6 lines

On PPC, we still have some historical horrible macros redefinitions in asm/ide.h to let APUS (PPC Amiga) deal with these.

Now, the problem of dealing with DMA along with the swapping is something scary. I beleive the sanest solution that won't please affected people is to _not_ support DMA on these broken HW ;)

No: the sane sollution would be to not support swapping disks between those systems and other systems.

#47 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 10 lines · Martin Dalecki
Quoted 8 lines · Benjamin Herrenschmidt

My understanding it that Tivo behaves like some Amiga's here and has broken swapping of the IDE bus itself, not the ext2 filesystem.
On PPC, we still have some historical horrible macros redefinitions in asm/ide.h to let APUS (PPC Amiga) deal with these. Now, the problem of dealing with DMA along with the swapping is something scary. I beleive the sanest solution that won't please affected people is to _not_ support DMA on these broken HW ;)

Quoted 2 lines

No: the sane sollution would be to not support swapping disks between those systems and other systems.

<disclaimer: rant>

No it isn't. You can't just go removing features people use. Your attitude as the new IDE maintainer is a bit distressing.

In the sake of a cleanup you start throwing away one feature after the other. IMHO cleanups are not worth feature removal, obviously your opinion differs. Hopefully, we will see the features come back but still the interim is annoying for some people...

Also, even more distressing is that you seem to be almost completely unresponsive to bug reports about your IDE changes completely breaking IDE. My email reporting in detail how any post 2.5.7 kernel fails to boot due to hanging during IDE device discovery was left unanswered. Off-line I am told you responded to another similar bug report trying to shift the blame to someone else's code and when it became apparent it was the IDE code you just stopped responding. Do you expect everyone to understand IDE and find and fix your bugs? A maintainer of a subsystem should work with people to find bugs and fix them, not expect users to do that... Your IDE patches keep flowing in one after the other but you completely ignore the fact that you broke IDE for some people along the way and the chances of it fixing itself by accident are minute... and finding the bug is probably getting harder with every patch you submit...

This is _not_ what I would expect from a maintainer of such an important subsystem!

</rant>

Apologies for the rant but I feel a lot better now.

Best regards,

Anton

Signature · 5 lines
  "I've not lost my mind. It's backed up on tape somewhere." - Unknown
-- 
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
#48 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Martin Dalecki
Quoted 6 lines · Martin Dalecki
Quoted 3 lines

Now, the problem of dealing with DMA along with the swapping is something scary. I beleive the sanest solution that won't please affected people is to _not_ support DMA on these broken HW ;)

No: the sane sollution would be to not support swapping disks between those systems and other systems.

in this case please send me a system compatable with my tivo so that I can hack on it since you are telling me I'm not going to be able to swap disks between it and any sane system.

doing without DMA is very reasonable and not a significant problem (yes it slows me down if I am duplicating drives, but if I am mounting the drive so that I can go in and vi the startup files the speed difference doesn't matter)

David Lang

#49 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to David S. Miller
Quoted 6 lines · Martin Dalecki
Quoted 2 lines · Benjamin Herrenschmidt

something scary. I beleive the sanest solution that won't please affected people is to _not_ support DMA on these broken HW ;)

No: the sane sollution would be to not support swapping disks between those systems and other systems.

Martin,

Go ahead and remove the byte swaping code for now, since it is a development kernel after all...

*But*, make sure you put that on your to do list to add it back in a "sane" way.

#50 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to David Lang
Quoted 4 lines · David Lang

It sounds as if you are removing this capability, am I misunderstaning you or is there some other way to do this? (and duplicating the drive to use dd to byteswap is not practical for 100G+)

Doing it with a loopback like interface at a higher level is the much saner operation - I understand why Martin removed the byteswap support, and agree with it 100%. It just didn't make any sense from a driver standpoint.

In fact, the byteswapping was actively incorrect, in that it swapped data in-place - which means that it corrupts the data area while IO is in progress. It also only works for PIO.

The only reason byteswapping exists is a rather historical one: Linux did the wrong thing for "insw/outsw" on big-endian architectures at one point (it byteswapped the data).

(Oh, and coupled with the fact that the IDE ID string is in a "big-endian" word order, which may have been one more reason to add a "do byteswapped IO" thing).

Linus

#51 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 4 lines

Doing it with a loopback like interface at a higher level is the much saner operation - I understand why Martin removed the byteswap support, and agree with it 100%. It just didn't make any sense from a driver standpoint.

We need to support partitioning on loopback devices in that case.

Quoted 3 lines

The only reason byteswapping exists is a rather historical one: Linux did the wrong thing for "insw/outsw" on big-endian architectures at one point (it byteswapped the data).

A small number of other setups people wired the IDE the quick and easy way and their native format is indeed ass backwards - some M68K disks and the Tivo are examples of that. Interworking requires byteswapping and the ability to handle byteswapped partition tables.

Given the ability to see partitions on loop devices all works out I think

Alan

#52 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 2 lines · Alan Cox

We need to support partitioning on loopback devices in that case.

No, you just need to do the loopback over nbd - you need something to do the byte swapping anyway (ie you can't really use the normal "loop"
device: I really just meant the more generic "loop the data back" approach).

nbd devices already do partitioning, I'm fairly certain.

(But no, I've never tested it, obviously).

Btw, while I'm at it - who out there actually uses the new "enbd" (Enhanced NBD)? I have this feeling that that would be the better choice, since unlike plain nbd it should be deadlock-free on localhost (ie you don't need a remote machine).

Quoted 8 lines
Quoted 3 lines

The only reason byteswapping exists is a rather historical one: Linux did the wrong thing for "insw/outsw" on big-endian architectures at one point (it byteswapped the data).

A small number of other setups people wired the IDE the quick and easy way and their native format is indeed ass backwards - some M68K disks and the Tivo are examples of that. Interworking requires byteswapping and the ability to handle byteswapped partition tables.

Note that THAT case is an architecture issue, and should probably be handled by just making the IDE "insw" macro do the byteswapping natively. That way you don't get the current "it can actually corrupt your filesystem on SMP" behaviour.

(Although I suspect that none of the architectures in question have ever even jokingly considered SMP support ;)

Linus

#53 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 4 lines

No, you just need to do the loopback over nbd - you need something to do the byte swapping anyway (ie you can't really use the normal "loop"
device: I really just meant the more generic "loop the data back" approach).

nbd goes via the networking layer and deadlocks if looped. The loop driver is also much faster. Partitioned loop doesnt seem hard.

Quoted 1 line

nbd devices already do partitioning, I'm fairly certain.

Not when I checked.

Quoted 7 lines
Quoted 2 lines

the Tivo are examples of that. Interworking requires byteswapping and the ability to handle byteswapped partition tables.

Note that THAT case is an architecture issue, and should probably be handled by just making the IDE "insw" macro do the byteswapping natively. That way you don't get the current "it can actually corrupt your filesystem on SMP" behaviour.

Thats still not enough. If you have the ide insw macro then control transfers come out wrong. And to maximise the pain - some Amiga controllers are backwards some are not.
"The use of excessive force has been authorised in the ..."

And then people stick TiVo disks in their PC's in order to prep them for various TiVo hackery.

#54 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Linus Torvalds
Quoted 7 lines · Alan Cox
Quoted 4 lines

No, you just need to do the loopback over nbd - you need something to do the byte swapping anyway (ie you can't really use the normal "loop"
device: I really just meant the more generic "loop the data back" approach).

nbd goes via the networking layer and deadlocks if looped. The loop driver is also much faster. Partitioned loop doesnt seem hard.

And it'd be very cool for stuff like mounting Bochs disk images and similar.

Quoted 20 lines
Quoted 2 lines

nbd devices already do partitioning, I'm fairly certain.

Not when I checked.

Quoted 7 lines
Quoted 2 lines

the Tivo are examples of that. Interworking requires byteswapping and the ability to handle byteswapped partition tables.

Note that THAT case is an architecture issue, and should probably be handled by just making the IDE "insw" macro do the byteswapping natively. That way you don't get the current "it can actually corrupt your filesystem on SMP" behaviour.

Thats still not enough. If you have the ide insw macro then control transfers come out wrong. And to maximise the pain - some Amiga controllers are backwards some are not.
"The use of excessive force has been authorised in the ..."

And then people stick TiVo disks in their PC's in order to prep them for various TiVo hackery.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#55 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Alan Cox
Quoted 6 lines · Alan Cox
Quoted 1 line

Doing it with a loopback like interface at a higher level is the much saner operation - I understand why Martin removed the byteswap support, and agree with it 100%. It just didn't make any sense from a driver standpoint.

We need to support partitioning on loopback devices in that case.

Quoted 7 lines
Quoted 1 line

The only reason byteswapping exists is a rather historical one: Linux did the wrong thing for "insw/outsw" on big-endian architectures at one point (it byteswapped the data).

A small number of other setups people wired the IDE the quick and easy way and their native format is indeed ass backwards - some M68K disks and the Tivo are examples of that. Interworking requires byteswapping and the ability to handle byteswapped partition tables.

I said it already multiple times Alan - please note that the byte-swapping code for *physically* crosswired systems is *still there*. OK?

#56 lore raw

Re: [PATCH] 2.5.8 IDE 36

Quoted 7 lines
Quoted 4 lines

A small number of other setups people wired the IDE the quick and easy way and their native format is indeed ass backwards - some M68K disks and the Tivo are examples of that. Interworking requires byteswapping and the ability to handle byteswapped partition tables.

I said it already multiple times Alan - please note that the byte-swapping code for *physically* crosswired systems is *still there*. OK?

Thats not relevant to the discussion. I don't see why you brought it up. The loopback stuff is about handling backward disks for interchange between systems or dealing with historical weirdnesses much more than physical layer

#57 lore raw

eNBD on loopback [was Re: [PATCH] 2.5.8 IDE 36]

In reply to Alan Cox

Hi!

Quoted 4 lines

Btw, while I'm at it - who out there actually uses the new "enbd" (Enhanced NBD)? I have this feeling that that would be the better choice, since unlike plain nbd it should be deadlock-free on localhost (ie you don't need a remote machine).

How does eNBD manage to do that? It was pretty hard last time I checked...

What if their enbd server is swapped out, and all memory is in dirty pages waiting for writeback to eNBD?
Pavel

Signature · 2 lines
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
#58 lore raw

Re: eNBD on loopback [was Re: [PATCH] 2.5.8 IDE 36]

Quoted 8 lines · Pavel Machek
Quoted 5 lines

Btw, while I'm at it - who out there actually uses the new "enbd" (Enhanced NBD)? I have this feeling that that would be the better choice, since unlike plain nbd it should be deadlock-free on localhost (ie you don't need a remote machine).

How does eNBD manage to do that? It was pretty hard last time I checked...

Don't ask me, I'm not a user, I have just seen the patch submissions, and I just want to get real user feedback before I'd merge a new "extended nbd".

So far I haven't heard anything from any actual users..

Linus

#59 lore raw

regarding NFS

I was looking at the code and I couldnt find how NFS implements inode->i_mapping->a_ops->readpage(filp,page) in
used by generic_file_read in mm/filemapc.c. All I could find was inode->i_op->readpage(filp,page). But NFS uses generic_file_read....so how does it work out. Kernel 2.4.17??

Jehanzeb

#60 lore raw

Re: regarding NFS

In reply to Linus Torvalds
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

" " == Jehanzeb Hameed <[email protected]> writes:

     > I was looking at the code and I couldnt find how NFS implements
     > inode->i_mapping->a_ops->readpage(filp,page) in
     > used by generic_file_read in mm/filemapc.c. All I could find
     > was inode->i_op->readpage(filp,page). But NFS uses
     > generic_file_read....so how does it work out. Kernel 2.4.17??

Look again: there is no such thing as readpage() in the struct inode_operations in the 2.4.x kernels. Just grep for 'nfs_file_aops' in the source.

Cheers,
Trond

#61 lore raw

Re: regarding NFS

In reply to Linus Torvalds
Quoted 8 lines

Look again: there is no such thing as readpage() in the struct inode_operations in the 2.4.x kernels. Just grep for 'nfs_file_aops' in the source.

Cheers,
Trond

In inode.c inside code for NFS says :
inode->i_data.a_ops = &nfs_file_aops;

it's still not "inode->i_mapping->a_ops "!!!!!!

it should, somewhere, assign something to inode->i_mapping->a_ops ?????

#62 lore raw

Re: regarding NFS

In reply to Linus Torvalds
Quoted 6 lines · Jehanzeb Hameed

In inode.c inside code for NFS says :
inode->i_data.a_ops = &nfs_file_aops;

it's still not "inode->i_mapping->a_ops "!!!!!!

it should, somewhere, assign something to inode->i_mapping->a_ops ?????

No. inode->i_mapping is initialized by the VFS, not the NFS client filesystem. (see linux/fs/inode.c:clean_inode())

Cheers,
Trond

#63 lore raw

Re: regarding NFS

In reply to Linus Torvalds
Quoted 7 lines

No. inode->i_mapping is initialized by the VFS, not the NFS client filesystem. (see linux/fs/inode.c:clean_inode())

Cheers,
Trond

but then why does RAMFS assign it..??

#64 lore raw

Re: regarding NFS

In reply to Linus Torvalds
Quoted 7 lines · Jehanzeb Hameed
Quoted 5 lines

No. inode->i_mapping is initialized by the VFS, not the NFS client filesystem. (see linux/fs/inode.c:clean_inode())

Cheers,
Trond

but then why does RAMFS assign it..??

I didn't do RAMFS, so I have no idea. Perhaps they figured that the effect of the extra indirection was not too performance critical?

Cheers,
Trond

#65 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Linus Torvalds
Quoted 22 lines · Martin Dalecki
Quoted 6 lines · Vojtech Pavlik
Quoted 4 lines · Martin Dalecki

Tue Apr 16 01:02:47 CEST 2002 ide-clean-36

- Consolidate ide_choose_drive() and choose_drive() in to one function.

Quoted 7 lines
Quoted 3 lines

- Remove sector data byteswpapping support. Byte-swapping the data is supported on the file-system level where applicable. Byte-swapped interfaces are supported on a lower level anyway. And finally it was used inconsistently.

Are you sure about this? I think file systems support LE/BE, but not byteswapping because of IDE being LE on a BE system.

I'm sure about this. For the following reasons:

1. The removed functionality affected only sector data transfers.

2. The following code for interfaces with byte swapped BUS setups still remains intact:

Quoted 7 lines
#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
	if (MACH_IS_ATARI || MACH_IS_Q40) {
		/* Atari has a byte-swapped IDE interface */
		insw_swapw(IDE_DATA_REG, buffer, bytecount / 2);
		return;
	}

#endif

If this is kept, then OK.

Quoted 5 lines

And indeed as you show - there was confusion about this issue throughout the whole driver, since the taskfile_in(out) functions where basically just the byteswapped variants and where not uses consistently.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#66 lore raw

PATCH 1/1 2.5.8 IDE 37

In reply to Linus Torvalds

Tue Apr 16 07:10:23 CEST 2002 ide-clean-37

- Don't abuse the sense field for passing failed packet_commands in struct packet_command use a new field instead.

- Apply minor bits forwarded by Dave Jones to me.

- Fix ide_raw_taskfile() to flag the ar used there to be no subject of free_req list management. This solvs the "hang after /proc/ide read" problem, which was in fact a memory corruption problem.

drivers/ide/Config.help +13 -8
diff -urN linux-2.5.8/drivers/ide/Config.help linux/drivers/ide/Config.help
@@ -160,7 +160,7 @@
   you can then use this emulation together with an appropriate SCSI
   device driver. In order to do this, say Y here and to "SCSI support"
   and "SCSI generic support", below. You must then provide the kernel
-  command line "hdx=scsi" (try "man bootparam" or see the
+  command line "hdx=ide-scsi" (try "man bootparam" or see the
   documentation of your boot loader (lilo or loadlin) about how to
   pass options to the kernel at boot time) for devices if you want the
   native EIDE sub-drivers to skip over the native support, so that
@@ -543,13 +543,13 @@
 
 CONFIG_BLK_DEV_PDC4030
   This driver provides support for the secondary IDE interface and
-  cache of Promise IDE chipsets, e.g. DC4030 and DC5030.  This driver
-  is known to incur timeouts/retries during heavy I/O to drives
-  attached to the secondary interface.  CD-ROM and TAPE devices are
-  not supported yet.  This driver is enabled at runtime using the
-  "ide0=dc4030" kernel boot parameter.  See the
-  <file:Documentation/ide.txt> and <file:drivers/ide/pdc4030.c> files
-  for more info.
+  cache of the original Promise IDE chipsets, e.g. DC4030 and DC5030.
+  It is nothing to do with the later range of Promise UDMA chipsets -
+  see the PDC_202XX support for these. CD-ROM and TAPE devices are not
+  supported (and probably never will be since I don't think the cards
+  support them). This driver is enabled at runtime using the "ide0=dc4030"
+  or "ide1=dc4030" kernel boot parameter. See the
+  <file:drivers/ide/pdc4030.c> file for more info.
 
 CONFIG_BLK_DEV_QD65XX
   This driver is enabled at runtime using the "ide0=qd65xx" kernel
@@ -629,6 +629,11 @@
   devices (hard disks, CD-ROM drives, etc.) that are connected to the
   builtin IDE interface.
 
+CONFIG_BLK_DEV_Q40IDE
+  Enable the on-board IDE controller in the Q40/Q60.  This should
+  normally be on; disable it only if you are running a custom hard
+  drive subsystem through an expansion card.
+
 CONFIG_BLK_DEV_IDE_ICSIDE
   On Acorn systems, say Y here if you wish to use the ICS IDE
   interface card.  This is not required for ICS partition support.
drivers/ide/ide-cd.c +41 -32

195 lines not on this page · raw message

drivers/ide/ide-cd.h +9 -0
diff -urN linux-2.5.8/drivers/ide/ide-cd.h linux/drivers/ide/ide-cd.h
@@ -104,6 +104,15 @@
 	int quiet;
 	int timeout;
 	struct request_sense *sense;
+
+	/* This is currently used to pass failed commands through the request
+	 * queue.  Is this for asynchronos error reporting?
+	 *
+	 * Can we always be sure that this didn't valish from stack beneath us
+	 * - we can't!
+	 */
+
+	struct packet_command *failed_command;
 };
 
 /* Structure of a MSF cdrom address. */
drivers/ide/ide-dma.c +3 -3
diff -urN linux-2.5.8/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
@@ -372,10 +372,10 @@
 }
 
 /* Teardown mappings after DMA has completed.  */
-void ide_destroy_dmatable (ide_drive_t *drive)
+void ide_destroy_dmatable(struct ata_device *d)
 {
-	struct pci_dev *dev = drive->channel->pci_dev;
-	struct ata_request *ar = IDE_CUR_AR(drive);
+	struct pci_dev *dev = d->channel->pci_dev;
+	struct ata_request *ar = IDE_CUR_AR(d);
 
 	pci_unmap_sg(dev, ar->ar_sg_table, ar->ar_sg_nents, ar->ar_sg_ddir);
 }
drivers/ide/ide-floppy.c +9 -7
diff -urN linux-2.5.8/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
@@ -1,8 +1,8 @@
 /*
- * linux/drivers/ide/ide-floppy.c	Version 0.97.sv	Jan 14 2001
+ * linux/drivers/ide/ide-floppy.c	Version 0.99	Feb 24 2002
  *
  * Copyright (C) 1996 - 1999 Gadi Oxman <[email protected]>
- * Copyright (C) 2000 - 2001 Paul Bristow <[email protected]>
+ * Copyright (C) 2000 - 2002 Paul Bristow <[email protected]>
  */
 
 /*
@@ -13,7 +13,7 @@
  *
  * This driver supports the following IDE floppy drives:
  *
- * LS-120 SuperDisk
+ * LS-120/240 SuperDisk
  * Iomega Zip 100/250
  * Iomega PC Card Clik!/PocketZip
  *
@@ -76,9 +76,11 @@
  *                        bit was being deasserted by my IOMEGA ATAPI ZIP 100
  *                        drive before the drive was actually ready.
  * Ver 0.98a Oct 29 01   Expose delay value so we can play.
+ * Ver 0.99  Feb 24 02   Remove duplicate code, modify clik! detection code
+ *                       to support new PocketZip drives
  */
 
-#define IDEFLOPPY_VERSION "0.98a"
+#define IDEFLOPPY_VERSION "0.99"
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -1070,8 +1072,8 @@
 	 */
 	BUG_ON(HWGROUP(drive)->handler);
 	ide_set_handler (drive,
-	  &idefloppy_pc_intr,		/* service routine for packet command */
-	  floppy->ticks,			/* wait this long before "failing" */
+	  &idefloppy_pc_intr, 		/* service routine for packet command */
+	  floppy->ticks,		/* wait this long before "failing" */
 	  &idefloppy_transfer_pc2);	/* fail == transfer_pc2 */
 
 	return ide_started;
@@ -2005,7 +2007,7 @@
 	*      above fix.  It makes nasty clicking noises without
 	*      it, so please don't remove this.
 	*/
-	if (strcmp(drive->id->model, "IOMEGA Clik! 40 CZ ATAPI") == 0) {
+	if (strncmp(drive->id->model, "IOMEGA Clik!", 11) == 0) {
 		blk_queue_max_sectors(&drive->queue, 64);
 		set_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags);
 	}
drivers/ide/ide-m8xx.c +8 -2
diff -urN linux-2.5.8/drivers/ide/ide-m8xx.c linux/drivers/ide/ide-m8xx.c
@@ -1,8 +1,14 @@
 /*
- *
- *
  *  linux/drivers/ide/ide-m8xx.c
  *
+ *  Copyright (C) 2000, 2001 Wolfgang Denk, [email protected]
+ *  Modified for direct IDE interface
+ *	by Thomas Lange, [email protected]
+ *  Modified for direct IDE interface on 8xx without using the PCMCIA
+ *  controller
+ *	by [email protected]
+ *  Moved out of arch/ppc/kernel/m8xx_setup.c, other minor cleanups
+ *	by Mathew Locke <[email protected]>
  */
 
 #include <linux/config.h>
drivers/ide/ide-taskfile.c +10 -5
diff -urN linux-2.5.8/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
@@ -34,7 +34,7 @@
 #define DEBUG_TASKFILE	0	/* unset when fixed */
 
 #if DEBUG_TASKFILE
-#define DTF(x...) printk(x)
+#define DTF(x...) printk(##x)
 #else
 #define DTF(x...)
 #endif
@@ -901,20 +901,25 @@
 int ide_raw_taskfile(ide_drive_t *drive, struct ata_taskfile *args, byte *buf)
 {
 	struct request rq;
-	struct ata_request ar;
+	struct ata_request star;
+
+	ata_ar_init(drive, &star);
+
+	/* Don't put this request on free_req list after usage.
+	 */
+	star.ar_flags |= ATA_AR_STATIC;
 
-	ata_ar_init(drive, &ar);
 	init_taskfile_request(&rq);
 	rq.buffer = buf;
 
-	memcpy(&ar.ar_task, args, sizeof(*args));
+	memcpy(&star.ar_task, args, sizeof(*args));
 
 	if (args->command_type != IDE_DRIVE_TASK_NO_DATA)
 		rq.current_nr_sectors = rq.nr_sectors
 			= (args->hobfile.sector_count << 8)
 			| args->taskfile.sector_count;
 
-	rq.special = &ar;
+	rq.special = &star;
 
 	return ide_do_drive_cmd(drive, &rq, ide_wait);
 }
drivers/ide/ide.c +17 -13
diff -urN linux-2.5.8/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -1729,20 +1729,23 @@
 	 * handle the unexpected interrupt
 	 */
 	do {
-		if (hwif->irq == irq) {
-			stat = IN_BYTE(hwif->io_ports[IDE_STATUS_OFFSET]);
-			if (!OK_STAT(stat, READY_STAT, BAD_STAT)) {
-				/* Try to not flood the console with msgs */
-				static unsigned long last_msgtime, count;
-				++count;
-				if (0 < (signed long)(jiffies - (last_msgtime + HZ))) {
-					last_msgtime = jiffies;
-					printk("%s%s: unexpected interrupt, status=0x%02x, count=%ld\n",
-					 hwif->name, (hwif->next == hwgroup->hwif) ? "" : "(?)", stat, count);
-				}
+		if (hwif->irq != irq)
+			continue;
+
+		stat = IN_BYTE(hwif->io_ports[IDE_STATUS_OFFSET]);
+		if (!OK_STAT(stat, READY_STAT, BAD_STAT)) {
+			/* Try to not flood the console with msgs */
+			static unsigned long last_msgtime;
+			static int count;
+			++count;
+			if (time_after(jiffies, last_msgtime + HZ)) {
+				last_msgtime = jiffies;
+				printk("%s%s: unexpected interrupt, status=0x%02x, count=%d\n",
+						hwif->name, (hwif->next == hwgroup->hwif) ? "" : "(?)", stat, count);
 			}
 		}
-	} while ((hwif = hwif->next) != hwgroup->hwif);
+		hwif = hwif->next;
+	} while (hwif != hwgroup->hwif);
 }
 
 /*
@@ -1764,7 +1767,8 @@
 		goto out_lock;
 
 	if ((handler = hwgroup->handler) == NULL || hwgroup->poll_timeout != 0) {
-		printk("ide: unexpected interrupt\n");
+		printk(KERN_INFO "ide: unexpected interrupt %d %d\n", hwif->unit, irq);
+
 		/*
 		 * Not expecting an interrupt from this drive.
 		 * That means this could be:
drivers/ide/it8172.c +26 -19

88 lines not on this page · raw message

drivers/ide/pdc4030.c +14 -8
diff -urN linux-2.5.8/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
@@ -1,7 +1,7 @@
 /*  -*- linux-c -*-
- *  linux/drivers/ide/pdc4030.c		Version 0.90  May 27, 1999
+ *  linux/drivers/ide/pdc4030.c		Version 0.92  Jan 15, 2002
  *
- *  Copyright (C) 1995-1999  Linus Torvalds & authors (see below)
+ *  Copyright (C) 1995-2002  Linus Torvalds & authors (see below)
  */
 
 /*
@@ -37,6 +37,8 @@
  *			Autodetection code added.
  *
  *  Version 0.90	Transition to BETA code. No lost/unexpected interrupts
+ *  Version 0.91	Bring in line with new bio code in 2.5.1
+ *  Version 0.92	Update for IDE driver taskfile changes
  */
 
 /*
@@ -72,8 +74,8 @@
  * effects.
  */
 
-#define DEBUG_READ
-#define DEBUG_WRITE
+#undef DEBUG_READ
+#undef DEBUG_WRITE
 
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -91,6 +93,10 @@
 
 #include "pdc4030.h"
 
+#if SUPPORT_VLB_SYNC != 1
+#error This driver will not work unless SUPPORT_VLB_SYNC is 1
+#endif
+
 /*
  * promise_selectproc() is invoked by ide.c
  * in preparation for access to the specified drive.
@@ -229,12 +235,12 @@
 	hwif->selectproc = hwif2->selectproc = &promise_selectproc;
 	hwif->serialized = hwif2->serialized = 1;
 
-/* Shift the remaining interfaces down by one */
+/* Shift the remaining interfaces up by one */
 	for (i=MAX_HWIFS-1 ; i > hwif->index+1 ; i--) {
 		struct ata_channel *h = &ide_hwifs[i];
 
 #ifdef DEBUG
-		printk(KERN_DEBUG "Shifting i/f %d values to i/f %d\n",i-1,i);
+		printk(KERN_DEBUG "pdc4030: Shifting i/f %d values to i/f %d\n",i-1,i);
 #endif
 		ide_init_hwif_ports(&h->hw, (h-1)->io_ports[IDE_DATA_OFFSET], 0, NULL);
 		memcpy(h->io_ports, h->hw.io_ports, sizeof(h->io_ports));
@@ -652,8 +658,8 @@
 	   are distinguished by writing the drive number (0-3) to the
 	   Feature register.
 	   FIXME: Is promise_selectproc now redundant??
-	 */
-	taskfile.feature    = (drive->channel->unit << 1) + drive->select.b.unit;
+	*/
+	taskfile.feature	= (drive->channel->unit << 1) + drive->select.b.unit;
 	taskfile.sector_count	= rq->nr_sectors;
 	taskfile.sector_number	= block;
 	taskfile.low_cylinder	= (block>>=8);
include/linux/ide.h +3 -1
diff -urN linux-2.5.8/include/linux/ide.h linux/include/linux/ide.h
@@ -975,6 +975,7 @@
 #define ATA_AR_QUEUED	1
 #define ATA_AR_SETUP	2
 #define ATA_AR_RETURN	4
+#define ATA_AR_STATIC	8
 
 /*
  * if turn-around time is longer than this, halve queue depth
@@ -1015,7 +1016,8 @@
 
 static inline void ata_ar_put(ide_drive_t *drive, struct ata_request *ar)
 {
-	list_add(&ar->ar_queue, &drive->free_req);
+	if (!(ar->ar_flags & ATA_AR_STATIC))
+	    list_add(&ar->ar_queue, &drive->free_req);
 
 	if (ar->ar_flags & ATA_AR_QUEUED) {
 		/* clear the tag */
#67 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Linus Torvalds
Quoted 10 lines · Martin Dalecki

Tue Apr 16 01:02:47 CEST 2002 ide-clean-36

- Consolidate ide_choose_drive() and choose_drive() in to one function.

- Remove sector data byteswpapping support. Byte-swapping the data is supported
on the file-system level where applicable. Byte-swapped interfaces are supported on a lower level anyway. And finally it was used
inconsistently.

Quoted 4 lines

- Eliminate taskfile_input_data() and taskfile_output_data(). This allowed us
to split up ideproc and eliminate the ugly action switch as well as the corresponding defines.

There is a typo in the cris ide driver ata_write value. Also, e100_ideproc is now dead and can be removed. Patch attached (untested, but obvious).

Signature · 1 line
						Brian Gerst
arch/cris/drivers/ide.c +1 -29
diff -urN linux-ide/arch/cris/drivers/ide.c linux/arch/cris/drivers/ide.c
@@ -192,8 +192,6 @@
 #define ATA_PIO0_HOLD    4
 
 static int e100_dmaproc (ide_dma_action_t func, ide_drive_t *drive);
-static void e100_ideproc (ide_ide_action_t func, ide_drive_t *drive,
-			  void *buffer, unsigned int length);
 
 /*
  * good_dma_drives() lists the model names (from "hdparm -i")
@@ -280,7 +278,7 @@
 		hwif->tuneproc = &tune_e100_ide;
 		hwif->dmaproc = &e100_dmaproc;
 		hwif->ata_read = e100_ide_input_data;
-		hwif->ata_write = e100_ide_input_data;
+		hwif->ata_write = e100_ide_output_data;
 		hwif->atapi_read = e100_atapi_read;
 		hwif->atapi_write = e100_atapi_write;
 	}
@@ -560,32 +558,6 @@
 	e100_atapi_write(drive, buffer, wcount << 2);
 }
 
-/*
- * The multiplexor for ide_xxxput_data and atapi calls
- */
-static void 
-e100_ideproc (ide_ide_action_t func, ide_drive_t *drive,
-	      void *buffer, unsigned int length)
-{
-	switch (func) {
-		case ideproc_ide_input_data:
-			e100_ide_input_data(drive, buffer, length);
-			break;
-		case ideproc_ide_output_data:
-			e100_ide_input_data(drive, buffer, length);
-			break;
-		case ideproc_atapi_read:
-			e100_atapi_read(drive, buffer, length);
-			break;
-		case ideproc_atapi_write:
-			e100_atapi_write(drive, buffer, length);
-			break;
-		default:
-			printk("e100_ideproc: unsupported func %d!\n", func);
-			break;
-	}
-}
-
 /* we only have one DMA channel on the chip for ATA, so we can keep these statically */
 static etrax_dma_descr ata_descrs[MAX_DMA_DESCRS];
 static unsigned int ata_tot_size;
#68 lore raw

Re: [PATCH] 2.5.8 IDE 36

In reply to Linus Torvalds
Quoted 4 lines · Brian Gerst

There is a typo in the cris ide driver ata_write value. Also, e100_ideproc is now dead and can be removed. Patch attached (untested, but obvious).

You are right. And your patch does the proper thing. I thank you very much for looking in to this!

#69 lore raw

PATCH 1/1 2.5.8 IDE 38

In reply to Linus Torvalds

Wed Apr 17 12:23:52 CEST 2002 ide-clean-38

- Fix typo in ide_cmd_ioctl().

- Fix typo in cris driver.

- Don't retry operations on medium errors. (pointed out by Eric Andersen).

- Attach the no_io_32bit, io_32bit, no_unmask, unmask and slow fields to the ata_channel instead of the ata_device structure. They are a property of the channel and not just the devices attached to it. This allowed us to fix the set_io_32bit function by removing the CONFIG_BLK_DEV_DTC2278 conditional. In fact initialization shows that this is fixing many other host chipsets as well since all of them did expect sometimes particular values for those parameters in paralell on both drives attached to a channel but we where allowed to apply different values on a per drive basis.

- The keep_settings flag is now unconditional and we don't mess with any channel parameters before drive reset. Some chipsets really really expect unconditionally that the tweaks they apply are always present and this wasn't honoured thus far! We are expecting the user to have good reasons for manually tweaking the settings.

- Don't reset io_32bit in ata_pre_reset() unconditionally. There are chipsets out there which expect io_32bit to be *allways* enabled!

- Remove many obsolete and nawadays just confusing documentation from ide.txt

Documentation/ide.txt +40 -256
diff -urN linux-2.5.8/Documentation/ide.txt linux/Documentation/ide.txt
@@ -1,71 +1,16 @@
-ide.txt -- Information regarding the Enhanced IDE drive in Linux 2.2/2.3/2.4
-===============================================================================
 
-   +-----------------------------------------------------------------+
-   |  The hdparm utility for controlling various IDE features is     |
-   |  packaged separately.  Look for it on popular linux FTP sites.  |
-   +-----------------------------------------------------------------+
-
-See description later on below for handling BIG IDE drives with >1024 cyls.
-
-Major features of the 2.1/2.2 IDE driver ("NEW!" marks changes since 2.0.xx):
-
-NEW!	- support for IDE ATAPI *floppy* drives
-	- support for IDE ATAPI *tape* drives, courtesy of Gadi Oxman
-		(re-run MAKEDEV.ide to create the tape device entries in /dev/)
-	- support for up to *four* IDE interfaces on one or more IRQs
-	- support for any mix of up to *eight* IDE drives
-	- support for reading IDE ATAPI cdrom drives (NEC,MITSUMI,VERTOS,SONY)
-	- support for audio functions
-	- auto-detection of interfaces, drives, IRQs, and disk geometries
-		- "single" drives should be jumpered as "master", not "slave"
-		  (both are now probed for)
-	- support for BIOSs which report "more than 16 heads" on disk drives
-	- uses LBA (slightly faster) on disk drives which support it
-	- support for lots of fancy (E)IDE drive functions with hdparm utility
-	- optional (compile time) support for 32-bit VLB data transfers
-	- support for IDE multiple (block) mode (same as hd.c)
-	- support for interrupt unmasking during I/O (better than hd.c)
-	- improved handshaking and error detection/recovery
-	- can co-exist with hd.c controlling the first interface
-	- run-time selectable 32bit interface support (using hdparm-2.3)
-	- support for reliable operation of buggy RZ1000 interfaces
-		- PCI support is automatic when rz1000 support is configured
-	- support for reliable operation of buggy CMD-640 interfaces
-		- PCI support is automatic when cmd640 support is configured
-		- for VLB, use kernel command line option:   ide0=cmd640_vlb
-		- this support also enables the secondary i/f when needed
-		- interface PIO timing & prefetch parameter support
-	- experimental support for UMC 8672 interfaces
-	- support for secondary interface on the FGI/Holtek HT-6560B VLB i/f
-		- use kernel command line option:   ide0=ht6560b
-	- experimental support for various IDE chipsets
-		- use appropriate kernel command line option from list below
-	- support for drives with a stuck WRERR_STAT bit
-	- support for removable devices, including door lock/unlock
-	- transparent support for DiskManager 6.0x and "Dynamic Disk Overlay"
-	- works with Linux fdisk, LILO, loadlin, bootln, etc..
-	- mostly transparent support for EZ-Drive disk translation software
-		- to use LILO with EZ, install LILO on the linux partition
-		  rather than on the master boot record, and then mark the
-		  linux partition as "bootable" or "active" using fdisk.
-		  (courtesy of Juha Laiho <[email protected]>).
-	- auto-detect of disk translations by examining partition table
-	- ide-cd.c now compiles separate from ide.c
-	- ide-cd.c now supports door locking and auto-loading.
-		- Also preliminary support for multisession
-		  and direct reads of audio data.
-	- experimental support for Promise DC4030VL caching interface card
-		- email thanks/problems to: [email protected]
-	- the hdparm-3.1 package can be used to set PIO modes for some chipsets.
-NEW!	- support for setting PIO modes with the OPTi 82C621, courtesy of Jaromir Koutek.
-NEW!	- support for loadable modules
-NEW!	- optional SCSI host adapter emulation for ATAPI devices
-NEW!	- generic PCI Bus-Master DMA support
-NEW!		- works with most Pentium PCI systems, chipsets, add-on cards
-NEW!		- works with regular DMA as well as Ultra DMA
-NEW!		- automatically probes for all PCI IDE interfaces
-NEW!	- generic support for using BIOS-configured Ultra-DMA (UDMA) transfers
+
+
+	Information regarding the Enhanced IDE drive in Linux 2.5
+
+
+==============================================================================
+
+   
+   The hdparm utility can be used to controll various IDE features on a
+   running system. It is packaged separately.  Please Look for it on popular
+   linux FTP sites.
+   
 
 
 ***  IMPORTANT NOTICES:  BUGGY IDE CHIPSETS CAN CORRUPT DATA!!
@@ -92,9 +37,9 @@
 ***
 ***  Use of the "serialize" option is no longer necessary.
 
-This is the multiple IDE interface driver, as evolved from hd.c.
-It supports up to six IDE interfaces, on one or more IRQs (usually 14 & 15).
-There can be up to two drives per interface, as per the ATA-2 spec.
+This is the multiple IDE interface driver, as evolved from hd.c.  It supports
+up to 9 IDE interfaces per default, on one or more IRQs (usually 14 & 15).
+There can be up to two drives per interface, as per the ATA-6 spec.
 
 Primary:    ide0, port 0x1f0; major=3;  hda is minor=0; hdb is minor=64
 Secondary:  ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64
@@ -103,16 +48,14 @@
 fifth..     ide4, usually PCI, probed
 sixth..     ide5, usually PCI, probed
 
-To access devices on interfaces > ide0, device entries must first be
-created in /dev for them.  To create such entries, simply run the included
-shell script:   /usr/src/linux/scripts/MAKEDEV.ide
-
-Apparently many older releases of Slackware had incorrect entries
-in /dev for hdc* and hdd* -- this can also be corrected by running MAKEDEV.ide
-
-ide.c automatically probes for most IDE interfaces (including all PCI ones),
-for the drives/geometries attached to those interfaces, and for the
-IRQ numbers being used by the interfaces (normally 14, 15 for ide0/ide1).
+To access devices on interfaces > ide0, device entries please make sure that
+device files for them are present in /dev.  If not, please create such
+entries, by simply running the included shell script:
+/usr/src/linux/scripts/MAKEDEV.ide
+
+This driver automatically probes for most IDE interfaces (including all PCI
+ones), for the drives/geometries attached to those interfaces, and for the IRQ
+lines being used by the interfaces (normally 14, 15 for ide0/ide1).
 
 For special cases, interfaces may be specified using kernel "command line"
 options.  For example,
@@ -170,11 +113,11 @@
 	hdc=768,16,32
 	hdc=noprobe
 
-Note that when only one IDE device is attached to an interface,
-it should be jumpered as "single" or "master", *not* "slave".
-Many folks have had "trouble" with cdroms because of this requirement,
-so ide.c now probes for both units, though success is more likely
-when the drive is jumpered correctly.
+Note that when only one IDE device is attached to an interface, it should be
+jumpered as "single" or "master", *not* "slave".  Many folks have had
+"trouble" with cdroms because of this requirement, so the driver now probes
+for both units, though success is more likely when the drive is jumpered
+correctly.
 
 Courtesy of Scott Snyder and others, the driver supports ATAPI cdrom drives
 such as the NEC-260 and the new MITSUMI triple/quad speed drives.
@@ -193,8 +136,8 @@
 (/dev/hdc).  To mount a CD in the cdrom drive, one would use something like:
 
 	ln -sf /dev/hdc /dev/cdrom
-	mkdir /cd
-	mount /dev/cdrom /cd -t iso9660 -o ro
+	mkdir /mnt/cdrom
+	mount /dev/cdrom /mnt/cdrom -t iso9660 -o ro
 
 If, after doing all of the above, mount doesn't work and you see
 errors from the driver (with dmesg) complaining about `status=0xff',
@@ -274,8 +217,6 @@
 				older/odd IDE drives.
  "hdx=slow"		: insert a huge pause after each access to the data
 				port. Should be used only as a last resort.
- "hdx=swapdata"		: when the drive is a disk, byte swap all data
-
  "hdxlun=xx"		: set the drive last logical unit
 
  "idebus=xx"		: inform IDE driver of VESA/PCI bus speed in MHz,
@@ -307,8 +248,9 @@
  "idex=reset"		: reset interface after probe
  "idex=dma"		: automatically configure/use DMA if possible.
 
- The following are valid ONLY on ide0,
- and the defaults for the base,ctl ports must not be altered.
+The following are valid ONLY on ide0, which usually corresponds to the first
+ATA interface found on the particular host, and the defaults for the base,ctl
+ports must not be altered.
 
  "ide0=dtc2278"		: probe/support DTC2278 interface
  "ide0=ht6560b"		: probe/support HT6560B interface
@@ -329,179 +271,21 @@
 IDE = Integrated Drive Electronics, meaning that each drive has a built-in
 controller, which is why an "IDE interface card" is not a "controller card".
 
-IDE drives are designed to attach almost directly to the ISA bus of an AT-style
-computer.  The typical IDE interface card merely provides I/O port address
-decoding and tri-state buffers, although several newer localbus cards go much
-beyond the basics.  When purchasing a localbus IDE interface, avoid cards with
-an onboard BIOS and those which require special drivers.  Instead, look for a
-card which uses hardware switches/jumpers to select the interface timing speed,
-to allow much faster data transfers than the original 8MHz ISA bus allows.
-
 ATA = AT (the old IBM 286 computer) Attachment Interface, a draft American
 National Standard for connecting hard drives to PCs.  This is the official
 name for "IDE".
 
-The latest standards define some enhancements, known as the ATA-2 spec,
+The latest standards define some enhancements, known as the ATA-6 spec,
 which grew out of vendor-specific "Enhanced IDE" (EIDE) implementations.
 
 ATAPI = ATA Packet Interface, a new protocol for controlling the drives,
 similar to SCSI protocols, created at the same time as the ATA2 standard.
-ATAPI is currently used for controlling CDROM and TAPE devices, and will
-likely also soon be used for Floppy drives, removable R/W cartridges,
-and for high capacity hard disk drives.
-
-How To Use *Big* ATA/IDE drives with Linux
-------------------------------------------
-The ATA Interface spec for IDE disk drives allows a total of 28 bits
-(8 bits for sector, 16 bits for cylinder, and 4 bits for head) for addressing
-individual disk sectors of 512 bytes each (in "Linear Block Address" (LBA)
-mode, there is still only a total of 28 bits available in the hardware).
-This "limits" the capacity of an IDE drive to no more than 128GB (Giga-bytes).
-All current day IDE drives are somewhat smaller than this upper limit, and
-within a few years, ATAPI disk drives will raise the limit considerably.
-
-All IDE disk drives "suffer" from a "16-heads" limitation:  the hardware has
-only a four bit field for head selection, restricting the number of "physical"
-heads to 16 or less.  Since the BIOS usually has a 63 sectors/track limit,
-this means that all IDE drivers larger than 504MB (528Meg) must use a "physical"
-geometry with more than 1024 cylinders.
-
-   (1024cyls * 16heads * 63sects * 512bytes/sector) / (1024 * 1024) == 504MB
-
-(Some BIOSs (and controllers with onboard BIOS) pretend to allow "32" or "64"
- heads per drive (discussed below), but can only do so by playing games with
- the real (hidden) geometry, which is always limited to 16 or fewer heads).
-
-This presents two problems to most systems:
-
-	1. The INT13 interface to the BIOS only allows 10-bits for cylinder
-	addresses, giving a limit of 1024cyls for programs which use it.
-
-	2. The physical geometry fields of the disk partition table only
-	allow 10-bits for cylinder addresses, giving a similar limit of 1024
-	cyls for operating systems that do not use the "sector count" fields
-	instead of the physical Cyl/Head/Sect (CHS) geometry fields.
-
-Neither of these limitations affects Linux itself, as it (1) does not use the
-BIOS for disk access, and it (2) is clever enough to use the "sector count"
-fields of the partition table instead of the physical CHS geometry fields.
-
-	a) Most folks use LILO to load linux.  LILO uses the INT13 interface
-	to the BIOS to load the kernel at boot time.  Therefore, LILO can only
-	load linux if the files it needs (usually just the kernel images) are
-	located below the magic 1024 cylinder "boundary" (more on this later).
-
-	b) Many folks also like to have bootable DOS partitions on their
-	drive(s).  DOS also uses the INT13 interface to the BIOS, not only
-	for booting, but also for operation after booting.  Therefore, DOS
-	can normally only access partitions which are contained entirely below
-	the magic 1024 cylinder "boundary".
-
-There are at least seven commonly used schemes for kludging DOS to work
-around this "limitation".  In the long term, the problem is being solved
-by introduction of an alternative BIOS interface that does not have the
-same limitations as the INT13 interface.  New versions of DOS are expected
-to detect and use this interface in systems whose BIOS provides it.
-
-But in the present day, alternative solutions are necessary.
-
-The most popular solution in newer systems is to have the BIOS shift bits
-between the cylinder and head number fields.  This is activated by entering
-a translated logical geometry into the BIOS/CMOS setup for the drive.
-Thus, if the drive has a geometry of 2100/16/63 (CHS), then the BIOS could
-present a "logical" geometry of 525/64/63 by "shifting" two bits from the
-cylinder number into the head number field for purposes of the partition table,
-CMOS setup, and INT13 interfaces.  Linux kernels 1.1.39 and higher detect and
-"handle" this translation automatically, making this a rather painless solution
-for the 1024 cyls problem.  If for some reason Linux gets confused (unlikely),
-then use the kernel command line parameters to pass the *logical* geometry,
-as in:  hda=525,64,63
-
-If the BIOS does not support this form of drive translation, then several
-options remain, listed below in order of popularity:
-
-	- use a partition below the 1024 cyl boundary to hold the linux
-	boot files (kernel images and /boot directory), and place the rest
-	of linux anywhere else on the drive.  These files can reside in a DOS
-	partition, or in a tailor-made linux boot partition.
-	- use DiskManager software from OnTrack, supplied free with
-	many new hard drive purchases.
-	- use EZ-Drive software (similar to DiskManager).  Note though,
-	that LILO must *not* use the MBR when EZ-Drive is present.
-	Instead, install LILO on the first sector of your linux partition,
-	and mark it as "active" or "bootable" with fdisk.
-	- boot from a floppy disk instead of the hard drive (takes 10 seconds).
-
-If you cannot use drive translation, *and* your BIOS also restricts you to
-entering no more than 1024 cylinders in the geometry field in the CMOS setup,
-then just set it to 1024.  As of v3.5 of this driver, Linux automatically
-determines the *real* number of cylinders for fdisk to use, allowing easy
-access to the full disk capacity without having to fiddle around.
-
-Regardless of what you do, all DOS partitions *must* be contained entirely
-within the first 1024 logical cylinders.  For a 1Gig WD disk drive, here's
-a good "half and half" partitioning scheme to start with:
-
-	geometry = 2100/16/63
-	/dev/hda1 from cyl    1 to  992		dos
-	/dev/hda2 from cyl  993 to 1023		swap
-	/dev/hda3 from cyl 1024 to 2100		linux
-
-To ensure that LILO can boot linux, the boot files (kernel and /boot/*)
-must reside within the first 1024 cylinders of the drive.  If your linux
-root partition is *not* completely within the first 1024 cyls (quite common),
-then you can use LILO to boot linux from files on your DOS partition
-by doing the following after installing Slackware (or whatever):
-
-	0. Boot from the "boot floppy" created during the installation
-        1. Mount your DOS partition as /dos (and stick it in /etc/fstab)
-        2. Move /boot to /dos/boot with:  cp -a /boot /dos ; rm -r /boot
-        3. Create a symlink for LILO to use with:  ln -s /dos/boot /boot
-        4. Move your kernel (/vmlinuz) to /boot/vmlinuz:  mv /vmlinuz /boot
-        5. Edit /etc/lilo.conf to change /vmlinuz to /boot/vmlinuz
-        6. Re-run LILO with:  lilo
-
-	A danger with this approach is that whenever an MS-DOS "defragmentation"
-	program is run (like Norton "speeddisk"), it may move the Linux boot
-	files around, confusing LILO and making the (Linux) system unbootable.
-	Be sure to keep a kernel "boot floppy" at hand for such circumstances.
-	A possible workaround is to mark the Linux files as S+H+R (System,
-	Hidden, Readonly), to prevent most defragmentation programs from
-	moving the files around.
-
-If you "don't do DOS", then partition as you please, but remember to create
-a small partition to hold the /boot directory (and vmlinuz) as described above
-such that they stay within the first 1024 cylinders.
-
-Note that when creating partitions that span beyond cylinder 1024,
-Linux fdisk will complain about "Partition X has different physical/logical
-endings" and emit messages such as "This is larger than 1024, and may cause
-problems with some software".   Ignore this for linux partitions.  The "some
-software" refers to DOS, the BIOS, and LILO, as described previously.
-
-Western Digital ships a "DiskManager 6.03" diskette with all of their big
-hard drives.  Use BIOS translation instead of this if possible, as it is a
-more generally compatible method of achieving the same results (DOS access
-to the entire disk).  However, if you must use DiskManager, it now works
-with Linux 1.3.x in most cases.  Let me know if you still have trouble.
-
-My recommendations to anyone who asks about NEW systems are:
-
-        - buy a motherboard that uses the Intel Triton chipset -- very common.
-        - use IDE for the first two drives, placing them on separate interfaces.
-		- very fast 7200rpm drives are now available
-		(though many problems have been reported with Seagate ones).
-	- place the IDE cdrom drive as slave on either interface.
-        - if additional disks are to be connected, consider your needs:
-                - fileserver?  Buy a SC200 SCSI adaptor for the next few drives.
-                - personal system?  Use IDE for the next two drives.
-                - still not enough?  Keep adding SC200 SCSI cards as needed.
-
-Most manufacturers make both IDE and SCSI versions of each of their drives.
-The IDE ones are usually as fast and cheaper, due to lower command overhead
-and the higher data transfer speed of UDMA2.  But fast/ultrawide/superlative
-SCSI is still king of the heap, especially for servers, if you've got the bucks.
+ATAPI is currently used for controlling CDROM, TAPE and FLOPPY (ZIP or
+LS120/240) devices, removable R/W cartridges, and for high capacity hard disk
+drives.
 
 [email protected]
 --
-For current maintainers of this stuff, see the linux/MAINTAINERS file.
+Wed Apr 17 22:52:44 CEST 2002 edited by Marcin Dalecki
+
+For current maintainers of this stuff, please see the linux/MAINTAINERS file.
arch/cris/drivers/ide.c +1 -27
diff -urN linux-2.5.8/arch/cris/drivers/ide.c linux/arch/cris/drivers/ide.c
@@ -280,7 +280,7 @@
 		hwif->tuneproc = &tune_e100_ide;
 		hwif->dmaproc = &e100_dmaproc;
 		hwif->ata_read = e100_ide_input_data;
-		hwif->ata_write = e100_ide_input_data;
+		hwif->ata_write = e100_ide_output_data;
 		hwif->atapi_read = e100_atapi_read;
 		hwif->atapi_write = e100_atapi_write;
 	}
@@ -560,32 +560,6 @@
 	e100_atapi_write(drive, buffer, wcount << 2);
 }
 
-/*
- * The multiplexor for ide_xxxput_data and atapi calls
- */
-static void 
-e100_ideproc (ide_ide_action_t func, ide_drive_t *drive,
-	      void *buffer, unsigned int length)
-{
-	switch (func) {
-		case ideproc_ide_input_data:
-			e100_ide_input_data(drive, buffer, length);
-			break;
-		case ideproc_ide_output_data:
-			e100_ide_input_data(drive, buffer, length);
-			break;
-		case ideproc_atapi_read:
-			e100_atapi_read(drive, buffer, length);
-			break;
-		case ideproc_atapi_write:
-			e100_atapi_write(drive, buffer, length);
-			break;
-		default:
-			printk("e100_ideproc: unsupported func %d!\n", func);
-			break;
-	}
-}
-
 /* we only have one DMA channel on the chip for ATA, so we can keep these statically */
 static etrax_dma_descr ata_descrs[MAX_DMA_DESCRS];
 static unsigned int ata_tot_size;
drivers/ide/amd74xx.c +3 -2
diff -urN linux-2.5.8/drivers/ide/amd74xx.c linux/drivers/ide/amd74xx.c
@@ -422,9 +422,10 @@
 	hwif->speedproc = &amd_set_drive;
 	hwif->autodma = 0;
 
+	hwif->io_32bit = 1;
+	hwif->unmask = 1;
+
 	for (i = 0; i < 2; i++) {
-		hwif->drives[i].io_32bit = 1;
-		hwif->drives[i].unmask = 1;
 		hwif->drives[i].autotune = 1;
 		hwif->drives[i].dn = hwif->unit * 2 + i;
 	}
drivers/ide/cmd640.c +16 -16
diff -urN linux-2.5.8/drivers/ide/cmd640.c linux/drivers/ide/cmd640.c
@@ -21,7 +21,7 @@
  *
  *  [email protected], [email protected], [email protected],
  *  [email protected], [email protected], [email protected],
- *  [email protected], [email protected],
+ *  [email protected], [email protected],
  *  [email protected], [email protected],
  *  [email protected], [email protected], [email protected],
  *  [email protected], [email protected], [email protected],
@@ -403,19 +403,19 @@
  */
 static void __init check_prefetch (unsigned int index)
 {
-	ide_drive_t *drive = cmd_drives[index];
+	struct ata_device *drive = cmd_drives[index];
 	byte b = get_cmd640_reg(prefetch_regs[index]);
 
 	if (b & prefetch_masks[index]) {	/* is prefetch off? */
-		drive->no_unmask = 0;
-		drive->no_io_32bit = 1;
-		drive->io_32bit = 0;
+		drive->channel->no_unmask = 0;
+		drive->channel->no_io_32bit = 1;
+		drive->channel->io_32bit = 0;
 	} else {
 #if CMD640_PREFETCH_MASKS
-		drive->no_unmask = 1;
-		drive->unmask = 0;
+		drive->channel->no_unmask = 1;
+		drive->channel->unmask = 0;
 #endif
-		drive->no_io_32bit = 0;
+		drive->channel->no_io_32bit = 0;
 	}
 }
 
@@ -460,15 +460,15 @@
 	b = get_cmd640_reg(reg);
 	if (mode) {	/* want prefetch on? */
 #if CMD640_PREFETCH_MASKS
-		drive->no_unmask = 1;
-		drive->unmask = 0;
+		drive->channel->no_unmask = 1;
+		drive->channel->unmask = 0;
 #endif
-		drive->no_io_32bit = 0;
+		drive->channel->no_io_32bit = 0;
 		b &= ~prefetch_masks[index];	/* enable prefetch */
 	} else {
-		drive->no_unmask = 0;
-		drive->no_io_32bit = 1;
-		drive->io_32bit = 0;
+		drive->channel->no_unmask = 0;
+		drive->channel->no_io_32bit = 1;
+		drive->channel->io_32bit = 0;
 		b |= prefetch_masks[index];	/* disable prefetch */
 	}
 	put_cmd640_reg(reg, b);
@@ -827,7 +827,7 @@
 			retrieve_drive_counts (index);
 			check_prefetch (index);
 			printk("cmd640: drive%d timings/prefetch(%s) preserved",
-				index, drive->no_io_32bit ? "off" : "on");
+				index, drive->channel->no_io_32bit ? "off" : "on");
 			display_clocks(index);
 		}
 #else
@@ -836,7 +836,7 @@
 		 */
 		check_prefetch (index);
 		printk("cmd640: drive%d timings/prefetch(%s) preserved\n",
-			index, drive->no_io_32bit ? "off" : "on");
+			index, drive->channel->no_io_32bit ? "off" : "on");
 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
 	}
 
drivers/ide/dtc2278.c +6 -6
diff -urN linux-2.5.8/drivers/ide/dtc2278.c linux/drivers/ide/dtc2278.c
@@ -88,8 +88,7 @@
 	/*
 	 * 32bit I/O has to be enabled for *both* drives at the same time.
 	 */
-	drive->io_32bit = 1;
-	drive->channel->drives[!drive->select.b.unit].io_32bit = 1;
+	drive->channel->io_32bit = 1;
 }
 
 void __init init_dtc2278 (void)
@@ -120,10 +119,11 @@
 	ide_hwifs[0].chipset = ide_dtc2278;
 	ide_hwifs[1].chipset = ide_dtc2278;
 	ide_hwifs[0].tuneproc = &tune_dtc2278;
-	ide_hwifs[0].drives[0].no_unmask = 1;
-	ide_hwifs[0].drives[1].no_unmask = 1;
-	ide_hwifs[1].drives[0].no_unmask = 1;
-	ide_hwifs[1].drives[1].no_unmask = 1;
+	/* FIXME: What about the following?!
+	ide_hwifs[1].tuneproc = &tune_dtc2278;
+	 */
+	ide_hwifs[0].no_unmask = 1;
+	ide_hwifs[1].no_unmask = 1;
 	ide_hwifs[0].unit = ATA_PRIMARY;
 	ide_hwifs[1].unit = ATA_SECONDARY;
 }
drivers/ide/ht6560b.c +3 -3
diff -urN linux-2.5.8/drivers/ide/ht6560b.c linux/drivers/ide/ht6560b.c
@@ -261,11 +261,11 @@
 	 */
 	if (state) {
 		drive->drive_data |= t;   /* enable prefetch mode */
-		drive->no_unmask = 1;
-		drive->unmask = 0;
+		drive->channel->no_unmask = 1;
+		drive->channel->unmask = 0;
 	} else {
 		drive->drive_data &= ~t;  /* disable prefetch mode */
-		drive->no_unmask = 0;
+		drive->channel->no_unmask = 0;
 	}
 	
 	restore_flags (flags);	/* all CPUs */
drivers/ide/ide-cd.c +6 -0
diff -urN linux-2.5.8/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -669,6 +669,12 @@
 			   request or data protect error.*/
 			ide_dump_status (drive, "command error", stat);
 			cdrom_end_request(drive, 0);
+		} else if (sense_key == MEDIUM_ERROR) {
+			/* No point in re-trying a zillion times on a bad
+			 * sector.  The error is not correctable at all.
+			 */
+			ide_dump_status (drive, "media error (bad sector)", stat);
+			cdrom_end_request(drive, 0);
 		} else if ((err & ~ABRT_ERR) != 0) {
 			/* Go to the default handler
 			   for other errors. */
drivers/ide/ide-disk.c +8 -3
diff -urN linux-2.5.8/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
@@ -755,8 +755,6 @@
 	drive->special.b.recalibrate  = legacy;
 	if (OK_TO_RESET_CONTROLLER)
 		drive->mult_count = 0;
-	if (!drive->keep_settings && !drive->using_dma)
-		drive->mult_req = 0;
 	if (drive->mult_req != drive->mult_count)
 		drive->special.b.set_multmode = 1;
 }
@@ -1231,7 +1229,14 @@
 			drive->special.b.set_multmode = 1;
 #endif
 	}
-	drive->no_io_32bit = id->dword_io ? 1 : 0;
+
+	/* FIXME: Nowadays there are many chipsets out there which *require* 32
+	 * bit IO. Those will most propably not work properly with drives not
+	 * supporting this. But right now we don't do anything about this. We
+	 * dont' even *warn* the user!
+	 */
+
+	drive->channel->no_io_32bit = id->dword_io ? 1 : 0;
 
 	if (drive->id->cfs_enable_2 & 0x3000)
 		write_cache(drive, (id->cfs_enable_2 & 0x3000));
drivers/ide/ide-taskfile.c +5 -10
diff -urN linux-2.5.8/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
@@ -156,7 +156,7 @@
 		return;
 	}
 
-	io_32bit = drive->io_32bit;
+	io_32bit = drive->channel->io_32bit;
 
 	if (io_32bit) {
 #if SUPPORT_VLB_SYNC
@@ -167,7 +167,7 @@
 			ata_read_32(drive, buffer, wcount);
 	} else {
 #if SUPPORT_SLOW_DATA_PORTS
-		if (drive->slow)
+		if (drive->channel->slow)
 			ata_read_slow(drive, buffer, wcount);
 		else
 #endif
@@ -187,7 +187,7 @@
 		return;
 	}
 
-	io_32bit = drive->io_32bit;
+	io_32bit = drive->channel->io_32bit;
 
 	if (io_32bit) {
 #if SUPPORT_VLB_SYNC
@@ -198,7 +198,7 @@
 			ata_write_32(drive, buffer, wcount);
 	} else {
 #if SUPPORT_SLOW_DATA_PORTS
-		if (drive->slow)
+		if (drive->channel->slow)
 			ata_write_slow(drive, buffer, wcount);
 		else
 #endif
@@ -976,6 +976,7 @@
 		if (argbuf == NULL)
 			return -ENOMEM;
 		memcpy(argbuf, vals, 4);
+		memset(argbuf + 4, 0, argsize - 4);
 	}
 
 	if (set_transfer(drive, &args)) {
@@ -986,14 +987,8 @@
 
 	/* Issue ATA command and wait for completion.
 	 */
-
-	/* FIXME: Do we really have to zero out the buffer?
-	 */
-	memset(argbuf, 4, SECTOR_WORDS * 4 * vals[3]);
 	ide_init_drive_cmd(&rq);
 	rq.buffer = argbuf;
-	memcpy(argbuf, vals, 4);
-
 	err = ide_do_drive_cmd(drive, &rq, ide_wait);
 
 	if (!err && xfer_rate) {
drivers/ide/ide.c +22 -37

118 lines not on this page · raw message

drivers/ide/pdc202xx.c +2 -5
diff -urN linux-2.5.8/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
@@ -1268,11 +1268,8 @@
 
 #undef CONFIG_PDC202XX_32_UNMASK
 #ifdef CONFIG_PDC202XX_32_UNMASK
-	hwif->drives[0].io_32bit = 1;
-	hwif->drives[1].io_32bit = 1;
-
-	hwif->drives[0].unmask = 1;
-	hwif->drives[1].unmask = 1;
+	hwif->io_32bit = 1;
+	hwif->unmask = 1;
 #endif
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
drivers/ide/pdc4030.c +3 -5
diff -urN linux-2.5.8/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
@@ -250,11 +250,9 @@
 	memcpy(hwif2->io_ports, hwif->hw.io_ports, sizeof(hwif2->io_ports));
 	hwif2->irq = hwif->irq;
 	hwif2->hw.irq = hwif->hw.irq = hwif->irq;
+	hwif->io_32bit = 3;
+	hwif2->io_32bit = 3;
 	for (i=0; i<2 ; i++) {
-		hwif->drives[i].io_32bit = 3;
-		hwif2->drives[i].io_32bit = 3;
-		hwif->drives[i].keep_settings = 1;
-		hwif2->drives[i].keep_settings = 1;
 		if (!ident.current_tm[i].cyl)
 			hwif->drives[i].noprobe = 1;
 		if (!ident.current_tm[i+2].cyl)
@@ -634,7 +632,7 @@
 			       "PROMISE_WRITE\n", drive->name);
 			return startstop;
 		}
-		if (!drive->unmask)
+		if (!drive->channel->unmask)
 			__cli();	/* local CPU only */
 		HWGROUP(drive)->wrq = *rq; /* scratchpad */
 		return promise_write(drive);
drivers/ide/piix.c +2 -3
diff -urN linux-2.5.8/drivers/ide/piix.c linux/drivers/ide/piix.c
@@ -545,10 +545,9 @@
 	hwif->tuneproc = &piix_tune_drive;
 	hwif->speedproc = &piix_set_drive;
 	hwif->autodma = 0;
-
+	hwif->io_32bit = 1;
+	hwif->unmask = 1;
 	for (i = 0; i < 2; i++) {
-		hwif->drives[i].io_32bit = 1;
-		hwif->drives[i].unmask = 1;
 		hwif->drives[i].autotune = 1;
 		hwif->drives[i].dn = hwif->unit * 2 + i;
 	}
drivers/ide/qd65xx.c +3 -5
diff -urN linux-2.5.8/drivers/ide/qd65xx.c linux/drivers/ide/qd65xx.c
@@ -370,8 +370,7 @@
 		hwif->config_data = config;
 		hwif->drives[0].drive_data =
 		hwif->drives[1].drive_data = QD6500_DEF_DATA;
-		hwif->drives[0].io_32bit =
-		hwif->drives[1].io_32bit = 1;
+		hwif->io_32bit = 1;
 		hwif->tuneproc = &qd6500_tune_drive;
 		return 1;
 	}
@@ -403,8 +402,7 @@
 			hwif->config_data = config | (control <<8);
 			hwif->drives[0].drive_data =
 			hwif->drives[1].drive_data = QD6580_DEF_DATA;
-			hwif->drives[0].io_32bit =
-			hwif->drives[1].io_32bit = 1;
+			hwif->io_32bit = 1;
 			hwif->tuneproc = &qd6580_tune_drive;
 
 			qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
@@ -426,11 +424,11 @@
 				ide_hwifs[i].select_data = base;
 				ide_hwifs[i].config_data = config | (control <<8);
 				ide_hwifs[i].tuneproc = &qd6580_tune_drive;
+				ide_hwifs[i].io_32bit = 1;
 
 				for (j = 0; j < 2; j++) {
 					ide_hwifs[i].drives[j].drive_data =
 					       i?QD6580_DEF_DATA2:QD6580_DEF_DATA;
-					ide_hwifs[i].drives[j].io_32bit = 1;
 				}
 			}
 
drivers/ide/rz1000.c +1 -2
diff -urN linux-2.5.8/drivers/ide/rz1000.c linux/drivers/ide/rz1000.c
@@ -40,8 +40,7 @@
 		printk("%s: disabled chipset read-ahead (buggy RZ1000/RZ1001)\n", hwif->name);
 	} else {
 		hwif->serialized = 1;
-		hwif->drives[0].no_unmask = 1;
-		hwif->drives[1].no_unmask = 1;
+		hwif->no_unmask = 1;
 		printk("%s: serialized, disabled unmasking (buggy RZ1000/RZ1001)\n", hwif->name);
 	}
 }
drivers/ide/via82cxxx.c +2 -2
diff -urN linux-2.5.8/drivers/ide/via82cxxx.c linux/drivers/ide/via82cxxx.c
@@ -535,10 +535,10 @@
 	hwif->tuneproc = &via82cxxx_tune_drive;
 	hwif->speedproc = &via_set_drive;
 	hwif->autodma = 0;
+	hwif->io_32bit = 1;
 
+	hwif->unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1;
 	for (i = 0; i < 2; i++) {
-		hwif->drives[i].io_32bit = 1;
-		hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1;
 		hwif->drives[i].autotune = 1;
 		hwif->drives[i].dn = hwif->unit * 2 + i;
 	}
include/linux/hdreg.h +0 -2
diff -urN linux-2.5.8/include/linux/hdreg.h linux/include/linux/hdreg.h
@@ -296,7 +296,6 @@
 #define HDIO_GET_MULTCOUNT	0x0304	/* get current IDE blockmode setting */
 #define HDIO_GET_QDMA		0x0305	/* get use-qdma flag */
 #define HDIO_OBSOLETE_IDENTITY	0x0307	/* OBSOLETE, DO NOT USE: returns 142 bytes */
-#define HDIO_GET_KEEPSETTINGS	0x0308	/* get keep-settings-on-reset flag */
 #define HDIO_GET_32BIT		0x0309	/* get current io_32bit setting */
 #define HDIO_GET_NOWERR		0x030a	/* get ignore-write-error flag */
 #define HDIO_GET_DMA		0x030b	/* get use-dma flag */
@@ -316,7 +315,6 @@
 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
 #define HDIO_SET_MULTCOUNT	0x0321	/* change IDE blockmode */
 #define HDIO_SET_UNMASKINTR	0x0322	/* permit other irqs during I/O */
-#define HDIO_SET_KEEPSETTINGS	0x0323	/* keep ioctl settings on reset */
 #define HDIO_SET_32BIT		0x0324	/* change io_32bit flags */
 #define HDIO_SET_NOWERR		0x0325	/* change ignore-write-error flag */
 #define HDIO_SET_DMA		0x0326	/* change use-dma flag */
include/linux/ide.h +6 -10
diff -urN linux-2.5.8/include/linux/ide.h linux/include/linux/ide.h
@@ -342,12 +342,10 @@
 	unsigned long PADAM_timeout;		/* max time to wait for irq */
 
 	special_t	special;	/* special action flags */
-	byte     keep_settings;		/* restore settings after drive reset */
 	byte     using_dma;		/* disk is using dma for read/write */
 	byte	 using_tcq;		/* disk is using queued dma operations*/
 	byte	 retry_pio;		/* retrying dma capable host in pio */
 	byte	 state;			/* retry state */
-	byte     unmask;		/* flag: okay to unmask other irqs */
 	byte     dsc_overlap;		/* flag: DSC overlap */
 
 	unsigned waiting_for_dma: 1;	/* dma currently in progress */
@@ -358,7 +356,6 @@
 	unsigned noprobe	: 1;	/* from:  hdx=noprobe */
 	unsigned removable	: 1;	/* 1 if need to do check_media_change */
 	unsigned forced_geom	: 1;	/* 1 if hdx=c,h,s was given at boot */
-	unsigned no_unmask	: 1;	/* disallow setting unmask bit */
 	unsigned nobios		: 1;	/* flag: do not probe bios for drive */
 	unsigned revalidate	: 1;	/* request revalidation */
 	unsigned atapi_overlap	: 1;	/* flag: ATAPI overlap (not supported) */
@@ -388,13 +385,6 @@
 	unsigned long long capacity48;	/* total number of sectors */
 	unsigned int	drive_data;	/* for use by tuneproc/selectproc as needed */
 
-	/* FIXME: Those are properties of a channel and not a drive!  Move them
-	 * later there.
-	 */
-	byte		slow;		/* flag: slow data port */
-	unsigned no_io_32bit	: 1;	/* disallow enabling 32bit I/O */
-	byte		io_32bit;	/* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
-
 	wait_queue_head_t wqueue;	/* used to wait for drive in open() */
 
 	struct hd_driveid *id;		/* drive model identification info */
@@ -523,6 +513,12 @@
 	unsigned	autodma    : 1;	/* automatically try to enable DMA at boot */
 	unsigned	udma_four  : 1;	/* 1=ATA-66 capable, 0=default */
 	unsigned	highmem	   : 1; /* can do full 32-bit dma */
+	byte		slow;		/* flag: slow data port */
+	unsigned no_io_32bit	   : 1;	/* disallow enabling 32bit I/O */
+	byte		io_32bit;	/* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
+	unsigned no_unmask	   : 1;	/* disallow setting unmask bit */
+	byte		unmask;		/* flag: okay to unmask other irqs */
+
 #if (DISK_RECOVERY_TIME > 0)
 	unsigned long	last_time;	/* time when previous rq was done */
 #endif
#70 lore raw

Re: [PATCH] 2.5.8 IDE 37

In reply to Linus Torvalds

Tough I have made some progress in the adaptation of the IDE-CD code to the new request handling introduced alognside with the TCQ stuff it's still isn't read for public consumption. Therefore:

Wed Apr 17 23:24:52 CEST 2002 ide-clean-39

Synchronize with Jens Axobe:

- Congruent ATA_AR_POOL fix to the ATA_AR_STATIC memmory corruption fix.

- Multi sector write handling fix.

- Fix drive capability deduction.

- Various other minor fixes.

drivers/ide/ide-dma.c +8 -2
diff -urN linux-2.5.8/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
@@ -599,13 +599,19 @@
 			printk("%s: DMA disabled\n", drive->name);
 		case ide_dma_off_quietly:
 			set_high = 0;
-			drive->using_tcq = 0;
 			outb(inb(dma_base+2) & ~(1<<(5+unit)), dma_base+2);
+#ifdef CONFIG_BLK_DEV_IDE_TCQ
+			hwif->dmaproc(ide_dma_queued_off, drive);
+#endif
 		case ide_dma_on:
 			ide_toggle_bounce(drive, set_high);
 			drive->using_dma = (func == ide_dma_on);
-			if (drive->using_dma)
+			if (drive->using_dma) {
 				outb(inb(dma_base+2)|(1<<(5+unit)), dma_base+2);
+#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
+				hwif->dmaproc(ide_dma_queued_on, drive);
+#endif
+			}
 			return 0;
 		case ide_dma_check:
 			return config_drive_for_dma (drive);
drivers/ide/ide-taskfile.c +27 -15

69 lines not on this page · raw message

drivers/ide/ide-tcq.c +31 -23

153 lines not on this page · raw message

drivers/ide/ide.c +1 -2
diff -urN linux-2.5.8/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -803,8 +803,7 @@
 				args->hobfile.high_cylinder = IN_BYTE(IDE_HCYL_REG);
 			}
 		}
-		if (ar->ar_flags & ATA_AR_RETURN)
-			ata_ar_put(drive, ar);
+		ata_ar_put(drive, ar);
 	}
 
 	blkdev_dequeue_request(rq);
include/linux/ide.h +7 -6
diff -urN linux-2.5.8/include/linux/ide.h linux/include/linux/ide.h
@@ -968,10 +968,9 @@
 /*
  * ata_request flag bits
  */
-#define ATA_AR_QUEUED	1
-#define ATA_AR_SETUP	2
-#define ATA_AR_RETURN	4
-#define ATA_AR_STATIC	8
+#define ATA_AR_QUEUED	1	/* was queued */
+#define ATA_AR_SETUP	2	/* dma table mapped */
+#define ATA_AR_POOL	4	/* originated from drive pool */
 
 /*
  * if turn-around time is longer than this, halve queue depth
@@ -1003,8 +1002,10 @@
 
 	if (!list_empty(&drive->free_req)) {
 		ar = list_ata_entry(drive->free_req.next);
+
 		list_del(&ar->ar_queue);
 		ata_ar_init(drive, ar);
+		ar->ar_flags |= ATA_AR_POOL;
 	}
 
 	return ar;
@@ -1012,8 +1013,8 @@
 
 static inline void ata_ar_put(ide_drive_t *drive, struct ata_request *ar)
 {
-	if (!(ar->ar_flags & ATA_AR_STATIC))
-	    list_add(&ar->ar_queue, &drive->free_req);
+	if (ar->ar_flags & ATA_AR_POOL)
+		list_add(&ar->ar_queue, &drive->free_req);
 
 	if (ar->ar_flags & ATA_AR_QUEUED) {
 		/* clear the tag */
#71 lore raw

PATCH 1/1 2.5.8 IDE 39

In reply to Linus Torvalds

Hugh... wrong subject line...

Tough I have made some progress in the adaptation of the IDE-CD code to the new request handling introduced alognside with the TCQ stuff it's still isn't read for public consumption. Therefore:

Wed Apr 17 23:24:52 CEST 2002 ide-clean-39

Synchronize with Jens Axobe:

- Congruent ATA_AR_POOL fix to the ATA_AR_STATIC memmory corruption fix.

- Multi sector write handling fix.

- Fix drive capability deduction.

- Various other minor fixes.

drivers/ide/ide-dma.c +8 -2
diff -urN linux-2.5.8/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
@@ -599,13 +599,19 @@
 			printk("%s: DMA disabled\n", drive->name);
 		case ide_dma_off_quietly:
 			set_high = 0;
-			drive->using_tcq = 0;
 			outb(inb(dma_base+2) & ~(1<<(5+unit)), dma_base+2);
+#ifdef CONFIG_BLK_DEV_IDE_TCQ
+			hwif->dmaproc(ide_dma_queued_off, drive);
+#endif
 		case ide_dma_on:
 			ide_toggle_bounce(drive, set_high);
 			drive->using_dma = (func == ide_dma_on);
-			if (drive->using_dma)
+			if (drive->using_dma) {
 				outb(inb(dma_base+2)|(1<<(5+unit)), dma_base+2);
+#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
+				hwif->dmaproc(ide_dma_queued_on, drive);
+#endif
+			}
 			return 0;
 		case ide_dma_check:
 			return config_drive_for_dma (drive);
drivers/ide/ide-taskfile.c +27 -15

69 lines not on this page · raw message

drivers/ide/ide-tcq.c +31 -23

153 lines not on this page · raw message

drivers/ide/ide.c +1 -2
diff -urN linux-2.5.8/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -803,8 +803,7 @@
 				args->hobfile.high_cylinder = IN_BYTE(IDE_HCYL_REG);
 			}
 		}
-		if (ar->ar_flags & ATA_AR_RETURN)
-			ata_ar_put(drive, ar);
+		ata_ar_put(drive, ar);
 	}
 
 	blkdev_dequeue_request(rq);
include/linux/ide.h +7 -6
diff -urN linux-2.5.8/include/linux/ide.h linux/include/linux/ide.h
@@ -968,10 +968,9 @@
 /*
  * ata_request flag bits
  */
-#define ATA_AR_QUEUED	1
-#define ATA_AR_SETUP	2
-#define ATA_AR_RETURN	4
-#define ATA_AR_STATIC	8
+#define ATA_AR_QUEUED	1	/* was queued */
+#define ATA_AR_SETUP	2	/* dma table mapped */
+#define ATA_AR_POOL	4	/* originated from drive pool */
 
 /*
  * if turn-around time is longer than this, halve queue depth
@@ -1003,8 +1002,10 @@
 
 	if (!list_empty(&drive->free_req)) {
 		ar = list_ata_entry(drive->free_req.next);
+
 		list_del(&ar->ar_queue);
 		ata_ar_init(drive, ar);
+		ar->ar_flags |= ATA_AR_POOL;
 	}
 
 	return ar;
@@ -1012,8 +1013,8 @@
 
 static inline void ata_ar_put(ide_drive_t *drive, struct ata_request *ar)
 {
-	if (!(ar->ar_flags & ATA_AR_STATIC))
-	    list_add(&ar->ar_queue, &drive->free_req);
+	if (ar->ar_flags & ATA_AR_POOL)
+		list_add(&ar->ar_queue, &drive->free_req);
 
 	if (ar->ar_flags & ATA_AR_QUEUED) {
 		/* clear the tag */
#72 lore raw

Re: [PATCH] 2.5.8 IDE 38

In reply to Linus Torvalds

Review line 521

Quoted 10 lines · Martin Dalecki
(quoted diff) +6 -0
@@ -523,6 +513,12 @@
 	unsigned	autodma    : 1;	/* automatically try to enable DMA at boot */
 	unsigned	udma_four  : 1;	/* 1=ATA-66 capable, 0=default */
 	unsigned	highmem	   : 1; /* can do full 32-bit dma */
+	byte		slow;		/* flag: slow data port */
+	unsigned no_io_32bit	   : 1;	/* disallow enabling 32bit I/O */
+	byte		io_32bit;	/* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
+	unsigned no_unmask	   : 1;	/* disallow setting unmask bit */
+	byte		unmask;		/* flag: okay to unmask other irqs */
+

Just cosmetic... This causes the layout to be:

1 bit
1 bit
1 bit
align to word
1 byte
align to word
1 bit
align to word
1 byte
align to word
1 bit
align to word
1 byte
align to word

which is rather wasteful. Any chance you can group the bits together and the bytes together?

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#73 lore raw

Re: [PATCH] 2.5.8 IDE 38

In reply to Linus Torvalds
Quoted 31 lines · Russell King

Review line 521

Quoted 10 lines · Martin Dalecki
(quoted diff) +6 -0
@@ -523,6 +513,12 @@
 	unsigned	autodma    : 1;	/* automatically try to enable DMA at boot */
 	unsigned	udma_four  : 1;	/* 1=ATA-66 capable, 0=default */
 	unsigned	highmem	   : 1; /* can do full 32-bit dma */
+	byte		slow;		/* flag: slow data port */
+	unsigned no_io_32bit	   : 1;	/* disallow enabling 32bit I/O */
+	byte		io_32bit;	/* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
+	unsigned no_unmask	   : 1;	/* disallow setting unmask bit */
+	byte		unmask;		/* flag: okay to unmask other irqs */
+

Just cosmetic... This causes the layout to be:

1 bit
1 bit
1 bit
align to word
1 byte
align to word
1 bit
align to word
1 byte
align to word
1 bit
align to word
1 byte
align to word

Quoted 2 lines

which is rather wasteful. Any chance you can group the bits together and the bytes together?

Of course you are right. I will group them later.