Skip to contentSkip to conversation

2.5.9 -- OOPS in IDE code (symbolic dump and boot log included)

PATCH In review Miles Lane 19 participants 48 messages Apr 23, 2002 – May 7, 2002

Subsystems (3)
lore
Share & tools
lore

Miles Lane

author
#0 lore raw

I should probably add the /proc/ksyms snapshotting stuff to get the module information for you as well. I hope this current batch of info helps, for starters.

ksymoops 2.4.4 on i686 2.4.7-10. Options used

     -v /usr/src/linux/vmlinux (specified)
     -K (specified)
     -L (specified)
     -o /lib/modules/2.5.9/ (specified)
     -m /boot/System.map-2.5.9 (specified)
Unable to handle kernel NULL pointer dereference at virtual address 00000004
*pde = 00000000
Oops: 0002
CPU:    0
EIP:    0010:[<c01fb579>]    Not tainted

Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010002
eax: 00000004 ebx: cf44be24 ecx: 00000000 edx: 00000000
esi: cf44bd90 edi: c03426bc ebp: 00000296 esp: c02ddeac
ds: 0018 es: 0018 ss: 0018

Stack: 00000001 cf44bd90 cf44be24 c03426bc 00000001 c01ff62f c03426bc 00000001 
       00000000 d98f164d c03426bc 00000001 cf44bd50 00000000 cf44bd90 cf44be24 
       cff26500 d98f227b c02ddf0c c03426bc 00000000 c02ddf10 00000000 c01fce26 
Call Trace: [<c01ff62f>] [<d98f164d>] [<d98f227b>] [<c01fce26>] [<c01fd433>] 
   [<d98f2250>] [<c0108709>] [<c01088eb>] [<c0105310>] [<c010730e>] [<c0105310>] 
   [<c0105310>] [<c0105337>] [<c01053b6>] [<c0105000>] 
Code: c7 04 90 00 00 00 00 8b 53 0c 8b 87 20 02 00 00 0f b3 10 8b 
Quoted 1 line
Quoted 1 line

EIP; c01fb579 <__ide_end_request+109/190> <=====

Trace; c01ff62f <ide_end_request+f/20>
Trace; d98f164d <END_OF_CODE+195a2039/????>
Trace; d98f227b <END_OF_CODE+195a2c67/????>
Trace; c01fce26 <ide_do_request+36/a0>
Trace; c01fd433 <ide_intr+103/1c0>
Trace; d98f2250 <END_OF_CODE+195a2c3c/????>
Trace; c0108709 <handle_IRQ_event+39/70>
Trace; c01088eb <do_IRQ+8b/110>
Trace; c0105310 <default_idle+0/30>
Trace; c010730e <common_interrupt+22/28>
Trace; c0105310 <default_idle+0/30>
Trace; c0105310 <default_idle+0/30>
Trace; c0105337 <default_idle+27/30>
Trace; c01053b6 <cpu_idle+36/40>
Trace; c0105000 <_stext+0/0>
Code; c01fb579 <__ide_end_request+109/190>
00000000 <_EIP>:
Code; c01fb579 <__ide_end_request+109/190> <=====
0: c7 04 90 00 00 00 00 movl $0x0,(%eax,%edx,4) <=====
Code; c01fb580 <__ide_end_request+110/190>
7: 8b 53 0c mov 0xc(%ebx),%edx
Code; c01fb583 <__ide_end_request+113/190>
a: 8b 87 20 02 00 00 mov 0x220(%edi),%eax
Code; c01fb589 <__ide_end_request+119/190>
10: 0f b3 10 btr %edx,(%eax)
Code; c01fb58c <__ide_end_request+11c/190>
13: 8b 00 mov (%eax),%eax

<0>Kernel panic: Aiee, killing interrupt handler!

1 warning and 1 error issued. Results may not be reliable.

Linux version 2.5.9 ([email protected]) (gcc version 3.0.4 (Red Hat Linux 7.2 3.0.4-1)) #4 2BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000000ffe0000 (usable)
BIOS-e820: 000000000ffe0000 - 000000000fff8000 (ACPI data)
BIOS-e820: 000000000fff8000 - 0000000010000000 (ACPI NVS)
BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)
255MB LOWMEM available.
On node 0 totalpages: 65504
zone(0): 4096 pages.
zone(1): 61408 pages.
zone(2): 0 pages.
ACPI: RSDP (v000 AMI ) @ 0x000fae70
ACPI: RSDT (v001 GATEWA 8DT-084 00529.06553) @ 0x0fff0000
ACPI: FADT (v001 GATEWA 8DT-084 00529.06553) @ 0x0fff1000
Kernel command line: ro root=/dev/hda6 hdd=ide-scsi console=ttyS0,38400 video=riva:1600x1200-16@76
ide_setup: hdd=ide-scsi
Local APIC disabled by BIOS -- reenabling.
Found and enabled local APIC!
Initializing CPU#0
Detected 848.364 MHz processor.
Console: colour VGA+ 80x25
Calibrating delay loop... 1690.82 BogoMIPS
Memory: 256916k/262016k available (1509k kernel code, 4712k reserved, 391k data, 232k init, 0k highmem) Dentry-cache hash table entries: 32768 (order: 6, 262144 bytes)
Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer-cache hash table entries: 16384 (order: 4, 65536 bytes)
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 512K (64 bytes/line)
CPU: AMD Athlon(tm) Processor stepping 01
Enabling fast FPU save and restore... done.
Checking 'hlt' instruction... OK.
POSIX conformance testing by UNIFIX
enabled ExtINT on CPU#0
ESR value before enabling vector: 00000000
ESR value after enabling vector: 00000000
Using local APIC timer interrupts.
calibrating APIC timer ...
..... CPU clock speed is 848.3696 MHz.
..... host bus clock speed is 199.6163 MHz.
cpu: 0, clocks: 1996163, slice: 998081
CPU0<T0:1996160,T1:998064,D:15,S:998081,C:1996163>
mtrr: v1.40 (20010327) Richard Gooch ([email protected])
mtrr: detected mtrr type: Intel
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
ACPI: Bus Driver revision 20020404
ACPI: Core Subsystem revision 20020403
PCI: PCI BIOS revision 2.10 entry at 0xfdad1, last bus=1
PCI: Using configuration type 1
tbxface-0101 [03] Acpi_load_tables : ACPI Tables successfully loaded
Parsing Methods:...................................................................................
83 Control Methods found and parsed (271 nodes total)
ACPI Namespace successfully loaded at root c03276f8
evxfevnt-0080 [04] Acpi_enable : Transition to ACPI mode successful
Executing all Device _STA and_INI methods:............... exfldio-0100 [21] Ex_setup_region : Field) exfldio-0110 [21] Ex_setup_region : Field [PS2E] Base+Offset+Width 0+0+4 is beyond end of region [) uteval-0421 [07] Ut_execute_STA : _STA on PS2M failed AE_AML_REGION_LIMIT
...........
26 Devices found containing: 25 _STA, 2 _INI methods
Completing Region/Field/Buffer/Package initialization:..........................................
Initialized 12/15 Regions 1/1 Fields 21/21 Buffers 8/9 Packages (271 nodes)
ACPI: Interpreter enabled
ACPI: Using PIC for interrupt routing
ACPI: System [ACPI] (supports S0 S1 S5)
ACPI: PCI Root Bridge [PCI0] (00:00:00.00)
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]

      00:00:11[A] -> \_SB_.LNKA[0]
      00:00:11[B] -> \_SB_.LNKB[0]
      00:00:11[C] -> \_SB_.LNKC[0]
      00:00:11[D] -> \_SB_.LNKD[0]
      00:00:12[A] -> \_SB_.LNKB[0]
      00:00:12[B] -> \_SB_.LNKC[0]
      00:00:12[C] -> \_SB_.LNKD[0]
      00:00:12[D] -> \_SB_.LNKA[0]
      00:00:13[A] -> \_SB_.LNKC[0]
      00:00:13[B] -> \_SB_.LNKD[0]
      00:00:13[C] -> \_SB_.LNKA[0]
      00:00:13[D] -> \_SB_.LNKB[0]
      00:00:14[A] -> \_SB_.LNKB[0]
      00:00:14[B] -> \_SB_.LNKC[0]
      00:00:14[C] -> \_SB_.LNKD[0]
      00:00:14[D] -> \_SB_.LNKA[0]
      00:00:0F[A] -> \_SB_.LNKA[0]
      00:00:0F[B] -> \_SB_.LNKB[0]
      00:00:0F[C] -> \_SB_.LNKC[0]
      00:00:0F[D] -> \_SB_.LNKD[0]
      00:00:07[D] -> \_SB_.LNKD[0]
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.AGPB._PRT]
      00:01:05[A] -> \_SB_.LNKA[0]

exfldio-0100 [21] Ex_setup_region : Field [PS2E] access width (4 bytes) too large for region [PSRG) exfldio-0110 [21] Ex_setup_region : Field [PS2E] Base+Offset+Width 0+0+4 is beyond end of region [)acpi_pci_link-0164 [09] acpi_pci_link_get_poss: Resource is not an IRQ entry
acpi_pci_link-0164 [09] acpi_pci_link_get_poss: Resource is not an IRQ entry acpi_pci_link-0164 [09] acpi_pci_link_get_poss: Resource is not an IRQ entry acpi_pci_link-0164 [09] acpi_pci_link_get_poss: Resource is not an IRQ entry
PCI: Probing PCI hardware
PCI: Using ACPI for IRQ routing
acpi_pci_link-0330 [02] acpi_pci_link_get_irq : Invalid link context
pci_root-0160 [01] acpi_prt_get_irq : Unable to reslove IRQ
PCI: No IRQ known for interrupt pin A of device 00:14.0
acpi_pci_link-0330 [02] acpi_pci_link_get_irq : Invalid link context
pci_root-0160 [01] acpi_prt_get_irq : Unable to reslove IRQ
PCI: No IRQ known for interrupt pin B of device 00:14.1
Starting kswapd
BIO: pool of 256 setup, 14Kb (56 bytes/bio)
biovec: init pool 0, 1 entries, 12 bytes
biovec: init pool 1, 4 entries, 48 bytes
biovec: init pool 2, 16 entries, 192 bytes
biovec: init pool 3, 64 entries, 768 bytes
biovec: init pool 4, 128 entries, 1536 bytes
biovec: init pool 5, 256 entries, 3072 bytes
Journalled Block Device driver loaded
rivafb: RIVA MTRR set to ON
Console: switching to colour frame buffer device 200x75
rivafb: PCI nVidia NV16 framebuffer ver 0.9.2a (GeForce-DDR, 32MB @ 0xE8000000)
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled ttyS00 at 0x03f8 (irq = 4) is a 16550A
ttyS02 at 0x03e8 (irq = 0) is a 16550A
block: 256 slots per queue, batch=32
loop: loaded (max 8 devices)
acpi_pci_link-0330 [02] acpi_pci_link_get_irq : Invalid link context
pci_root-0160 [01] acpi_prt_get_irq : Unable to reslove IRQ
PCI: No IRQ known for interrupt pin A of device 00:13.0
3c59x: Donald Becker and others. www.scyld.com/network/vortex.html
00:13.0: 3Com PCI 3c905C Tornado at 0xfc00. Vers LK1.1.17
phy=0, phyx=24, mii_status=0x782d
Linux agpgart interface v0.99 (c) Jeff Hartmann
agpgart: Maximum main memory to use for agp memory: 203M
agpgart: Detected AMD Irongate chipset
agpgart: AGP aperture is 64M @ 0xf8000000
ipddp.c:v0.01 8/28/97 Bradford W. Johnson <[email protected]>
ipddp0: Appletalk-IP Encap. mode by Bradford W. Johnson <[email protected]> Uniform Multi-Platform E-IDE driver ver.:7.0.0
ide: system bus speed 33MHz
Advanced Micro Devices [AMD] AMD-756 [Viper] IDE: IDE controller on PCI slot 00:07.1 Advanced Micro Devices [AMD] AMD-756 [Viper] IDE: chipset revision 3
Advanced Micro Devices [AMD] AMD-756 [Viper] IDE: not 100% native mode: will probe irqs later
AMD_IDE: Advanced Micro Devices [AMD] AMD-756 [Viper] IDE (rev 03) UDMA66 controller on pci00:07.1

    ide0: BM-DMA at 0xcb00-0xcb07, BIOS settings: hda:DMA, hdb:pio
    ide1: BM-DMA at 0xcb08-0xcb0f, BIOS settings: hdc:DMA, hdd:DMA

hda: QUANTUM FIREBALLP LM30, ATA DISK drive
hdc: Pioneer DVD-ROM ATAPIModel DVD-114 0117, ATAPI CD/DVD-ROM drive
hdd: R/RW 4x4x24, ATAPI CD/DVD-ROM drive
ide2: ports already in use, skipping probe
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
ide: unexpected interrupt 0 14
hda: 58633344 sectors (30020 MB) w/1900KiB Cache, CHS=58168/16/63, UDMA(66) Partition check:
hda: [PTBL] [3649/255/63] hda1 hda2 < hda5 hda6 hda7 hda8 hda9 hda10 hda11 hda12 hda13 >
mice: PS/2 mouse device common for all mice
md: linear personality registered as nr 1
md: raid0 personality registered as nr 2
md: md driver 0.90.0 MAX_MD_DEVS=256, MD_SB_DISKS=27
md: Autodetecting RAID arrays.
[events: 00000098]
[events: 00000098]

md: autorun ...
md: considering hda12 ...
md:  adding hda12 ...
md:  adding hda11 ...
md: created md0
md: bind<hda11,1>
md0: WARNING: hda12 appears to be on the same physical disk as hda11. True
     protection against single-disk failure might be compromised.
md: bind<hda12,2>
md: running: <hda12><hda11>
md: hda12's event counter: 00000098
md: hda11's event counter: 00000098
md0: max total readahead window set to 512k
md0: 2 data-disks, max readahead per data-disk: 256k
raid0: looking at hda11
raid0:   comparing hda11(1028032) with hda11(1028032)
raid0:   END
raid0:   ==> UNIQUE
raid0: 1 zones
raid0: looking at hda12
raid0:   comparing hda12(1028032) with hda11(1028032)
raid0:   EQUAL
raid0: FINAL 1 zones
raid0: zone 0
raid0: checking hda11 ... contained as device 0

(1028032) is smallest!.
raid0: checking hda12 ... contained as device 1
raid0: zone->nb_dev: 2, size: 2056064
raid0: current zone offset: 1028032
raid0: done.
raid0 : md_size is 2056064 blocks.
raid0 : conf->smallest->size is 2056064 blocks.
raid0 : nb_zone is 1.
raid0 : Allocating 8 bytes for hash.
md: updating md0 RAID superblock on device
md: hda12 [events: 00000099]<6>(write) hda12's sb offset: 1028032
md: hda11 [events: 00000099]<6>(write) hda11's sb offset: 1028032
md: ... autorun DONE.
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 2048 buckets, 16Kbytes
TCP: Hash tables configured (established 16384 bind 32768) IPv4 over IPv4 tunneling driver
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NET4: AppleTalk 0.18a for Linux NET4.0
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 232k freed
INIT: version 2.78 booting
Welcome to Red Hat Linux
Press 'I' to enter interactive startup.

Mounting proc filesystem:  [  OK  ]
Configuring kernel parameters:  [  OK  ]
Setting clock  (localtime): Mon Apr 22 22:15:59 PDT 2002 [  OK  ]
Activating swap partitions:  [  OK  ]
Setting hostname turbulence.megapathdsl.net:  [  OK  ]
Mounting USB filesystem:  [  OK  ]
Initializing USB controller (usb-ohci):  [  OK  ]
Initializing USB HID interface:  [  OK  ]
Initializing USB mouse:  modprobe: Can't locate module mousedev

[FAILED]
Checking root filesystem
/: clean, 313674/1921984 files, 2266435/3841535 blocks [/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/hda6
[ OK ]
Remounting root filesystem in read-write mode: [ OK ] Finding module dependencies: [ OK ]
Starting up RAID devices: md0
Checking filesystems
/boot: clean, 77/84336 files, 53660/337333 blocks /home: clean, 13228/257024 files, 173634/514016 blocks Logical sector size is zero.dosfsck 2.7, 14 Feb 2001, FAT32, LFN

Logical sector size is zero.dosfsck 2.7, 14 Feb 2001, FAT32, LFN

Logical sector size is zero.dosfsck 2.7, 14 Feb 2001, FAT32, LFN dosfsck 2.7, 14 Feb 2001, FAT32, LFN
Checking all file systems.
[/sbin/fsck.ext3 (1) -- /boot] fsck.ext3 -a /dev/hda5 [/sbin/fsck.ext3 (1) -- /home] fsck.ext3 -a /dev/md0 [/sbin/fsck.vfat (1) -- /mnt/test1] fsck.vfat -a /dev/hda7 [/sbin/fsck.vfat (1) -- /mnt/test2] fsck.vfat -a /dev/hda8 [/sbin/fsck.vfat (1) -- /mnt/test3] fsck.vfat -a /dev/hda9 [/sbin/fsck.vfat (1) -- /mnt/test4] fsck.vfat -a /dev/hda10

Logical sector size is zero.
[PASSED]
Mounting local filesystems: mount: wrong fs type, bad option, bad superblock on /dev/hda7,
or too many mounted file systems
mount: wrong fs type, bad option, bad superblock on /dev/hda8,
or too many mounted file systems
mount: wrong fs type, bad option, bad superblock on /dev/hda9,
or too many mounted file systems
mount: mount point /mnt/test4 does not exist
[FAILED]

Enabling local filesystem quotas:  [  OK  ]
Enabling swap space:  [  OK  ]
Unable to handle kernel NULL pointer dereference at virtual address 00000004
*pde = 00000000
Oops: 0002
CPU:    0
EIP:    0010:[<c01fb579>]    Not tainted
EFLAGS: 00010002
eax: 00000004   ebx: cf44be24   ecx: 00000000   edx: 00000000
esi: cf44bd90   edi: c03426bc   ebp: 00000296   esp: c02ddeac
ds: 0018   es: 0018   ss: 0018
Process swapper (pid: 0, threadinfo=c02dc000 task=c02bf3e0)
Stack: 00000001 cf44bd90 cf44be24 c03426bc 00000001 c01ff62f c03426bc 00000001 
       00000000 d98f164d c03426bc 00000001 cf44bd50 00000000 cf44bd90 cf44be24 
       cff26500 d98f227b c02ddf0c c03426bc 00000000 c02ddf10 00000000 c01fce26 
Call Trace: [<c01ff62f>] [<d98f164d>] [<d98f227b>] [<c01fce26>] [<c01fd433>] 
   [<d98f2250>] [<c0108709>] [<c01088eb>] [<c0105310>] [<c010730e>] [<c0105310>] 
   [<c0105310>] [<c0105337>] [<c01053b6>] [<c0105000>] 

Code: c7 04 90 00 00 00 00 8b 53 0c 8b 87 20 02 00 00 0f b3 10 8b 
 <0>Kernel panic: Aiee, killing interrupt handler!

In interrupt handler - not syncing

#1 lore raw
Quoted 8 lines · Miles Lane

I should probably add the /proc/ksyms snapshotting stuff to get the module information for you as well. I hope this current batch of info helps, for starters.

ksymoops 2.4.4 on i686 2.4.7-10. Options used

     -v /usr/src/linux/vmlinux (specified)
     -K (specified)
     -L (specified)
     -o /lib/modules/2.5.9/ (specified)
     -m /boot/System.map-2.5.9 (specified)

Looks like the oops came from module code.
Which modules did you use: ide-flappy and ide-scsi are still in need of the same medication ide-cd got.

author
#2 lore raw
Quoted 13 lines · Martin Dalecki
Quoted 10 lines · Miles Lane

I should probably add the /proc/ksyms snapshotting stuff to get the module information for you as well. I hope this current batch of info helps, for starters.

ksymoops 2.4.4 on i686 2.4.7-10. Options used

     -v /usr/src/linux/vmlinux (specified)
     -K (specified)
     -L (specified)
     -o /lib/modules/2.5.9/ (specified)
     -m /boot/System.map-2.5.9 (specified)
Quoted 3 lines

Looks like the oops came from module code.
Which modules did you use: ide-flappy and ide-scsi are still in need of the same medication ide-cd got.

CONFIG_BLK_DEV_IDESCSI=m
CONFIG_SCSI=m
CONFIG_BLK_DEV_SD=m
CONFIG_BLK_DEV_SR=m
CONFIG_CHR_DEV_SG=m

author
#3 lore raw
Quoted 18 lines · Miles Lane
Quoted 13 lines · Martin Dalecki
Quoted 10 lines · Miles Lane

I should probably add the /proc/ksyms snapshotting stuff to get the module information for you as well. I hope this current batch of info helps, for starters.

ksymoops 2.4.4 on i686 2.4.7-10. Options used

     -v /usr/src/linux/vmlinux (specified)
     -K (specified)
     -L (specified)
     -o /lib/modules/2.5.9/ (specified)
     -m /boot/System.map-2.5.9 (specified)
Quoted 3 lines

Looks like the oops came from module code.
Which modules did you use: ide-flappy and ide-scsi are still in need of the same medication ide-cd got.

Quoted 5 lines

CONFIG_BLK_DEV_IDESCSI=m
CONFIG_SCSI=m
CONFIG_BLK_DEV_SD=m
CONFIG_BLK_DEV_SR=m
CONFIG_CHR_DEV_SG=m

Hmm. You probably need this, too. Sorry for not sending this in the first reply.

CONFIG_IDE=y

#
# ATA and ATAPI Block devices
#
CONFIG_BLK_DEV_IDE=y
CONFIG_BLK_DEV_IDEDISK=y
CONFIG_IDEDISK_MULTI_MODE=y
CONFIG_BLK_DEV_IDECD=m
CONFIG_BLK_DEV_IDESCSI=m
CONFIG_BLK_DEV_CMD640=y
CONFIG_BLK_DEV_IDEPCI=y
CONFIG_IDEPCI_SHARE_IRQ=y
CONFIG_BLK_DEV_IDEDMA_PCI=y
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y
CONFIG_BLK_DEV_AMD74XX=y
CONFIG_IDEDMA_AUTO=y

#4 lore raw
In reply to Miles Lane
Quoted 13 lines · Martin Dalecki
Quoted 10 lines · Miles Lane

I should probably add the /proc/ksyms snapshotting stuff to get the module information for you as well. I hope this current batch of info helps, for starters.

ksymoops 2.4.4 on i686 2.4.7-10. Options used

    -v /usr/src/linux/vmlinux (specified)
    -K (specified)
    -L (specified)
    -o /lib/modules/2.5.9/ (specified)
    -m /boot/System.map-2.5.9 (specified)
Quoted 3 lines

Looks like the oops came from module code.
Which modules did you use: ide-flappy and ide-scsi are still in need of the same medication ide-cd got.

Martin,

There are several 'issues' with the ide-cd changes, in fact I think they are horrible. I'll take part of the blame for that, I'll explain.

The ata_ar_get() doesn't belong inside the do_request() strategies, the reason I did that for ide-disk was to get going on the tcq stuff and not spend too much time rewriting the ide request handling at that point. It was _never_ meant to propagate into the other ide drivers, and in fact the code in ide-disk has several tcq specific parts that really cannot work in ide-cd. Such as (ide-cd.c:ide_cdrom_do_request()):

	spin_lock...

	ar = ata_ar_get()
	if (!ar) {
		spin_unlock;
		return ide_started;
	}
	...

ide-disk guarentees that if ata_ar_get() fails, it's because we have some pending commands on the drive. The ide_started is bogus too, in this context it really should be ide_didnt_start_jack, but it works for ide-disk because of the above assumptions.

Don't tell me you can read ide_cdrom_do_request() right now without a barf bag :-)

I'd suggest moving the ata_ar_get() at the ide_queue_commands() level, and just pass { drive, ar } to the do_request() strategies. That's also why ide-disk.c:idedisk_do_request() has this comment:

	/*
	 * get a new command (push ar further down to avoid grabbing
	 * lock here
	 */
	spin_lock_irqsave(DRIVE_LOCK(drive), flags);

	ar = ata_ar_get(drive);
	...

I've been meaning to do this once tcq settled down, just didn't get around to it yet. But please don't start moving stuff like this into ide-cd too.

Signature · 1 line
Jens Axboe
#5 lore raw
In reply to Miles Lane
Quoted 4 lines

Martin,

There are several 'issues' with the ide-cd changes, in fact I think they are horrible. I'll take part of the blame for that, I'll explain.

Well... I refer you to my change long, where I indeed admitted directly that it's an ugly band aid ;-).

Quoted 3 lines

The ata_ar_get() doesn't belong inside the do_request() strategies, the reason I did that for ide-disk was to get going on the tcq stuff and not spend too much time rewriting the ide request handling at that point. It

Right. it belongs one level up. The request handling should possible learn whatever it it's handling ATA or ATAPI devices. In esp. the ide_start_dma() changes where no pretty...

Quoted 13 lines

was _never_ meant to propagate into the other ide drivers, and in fact the code in ide-disk has several tcq specific parts that really cannot work in ide-cd. Such as (ide-cd.c:ide_cdrom_do_request()):

	spin_lock...

	ar = ata_ar_get()
	if (!ar) {
		spin_unlock;
		return ide_started;
	}
	...
Quoted 4 lines

ide-disk guarentees that if ata_ar_get() fails, it's because we have some pending commands on the drive. The ide_started is bogus too, in this context it really should be ide_didnt_start_jack, but it works for ide-disk because of the above assumptions.

Fortunately it can't happen becouse the other devices don't support TCQ.

Quoted 2 lines

Don't tell me you can read ide_cdrom_do_request() right now without a barf bag :-)

Ohhh. there are a lot of other things I'm unhappy about there as well.

Quoted 3 lines

I'd suggest moving the ata_ar_get() at the ide_queue_commands() level, and just pass { drive, ar } to the do_request() strategies. That's also why ide-disk.c:idedisk_do_request() has this comment:

Yes this was my intention for the future. The only driver which will have problems with this is ide-scsi.c - it's not obvious (at least right now) to me how to change the do_request signature there.

Quoted 9 lines
	/*
	 * get a new command (push ar further down to avoid grabbing
	 * lock here
	 */
	spin_lock_irqsave(DRIVE_LOCK(drive), flags);

	ar = ata_ar_get(drive);
	...
Quoted 3 lines

I've been meaning to do this once tcq settled down, just didn't get around to it yet. But please don't start moving stuff like this into ide-cd too.

You notice that I didn't even care to change the write request code-path? BTW.> It became obvious to me as well that even all the drivers out there not supporting TCQ will have to get the TCQ parts of struct ata_device initialized - with a trivial queue depth. drive->tcq should therefore be really just a memmber of struct ata_device()..

#6 lore raw
In reply to Miles Lane
Quoted 7 lines · Martin Dalecki
Quoted 4 lines

Martin,

There are several 'issues' with the ide-cd changes, in fact I think they are horrible. I'll take part of the blame for that, I'll explain.

Well... I refer you to my change long, where I indeed admitted directly that it's an ugly band aid ;-).

Didn't read that :)

Quoted 7 lines
Quoted 3 lines

The ata_ar_get() doesn't belong inside the do_request() strategies, the reason I did that for ide-disk was to get going on the tcq stuff and not spend too much time rewriting the ide request handling at that point. It

Right. it belongs one level up. The request handling should possible learn whatever it it's handling ATA or ATAPI devices. In esp. the ide_start_dma() changes where no pretty...

Why would you care what type of transport they use??

Quoted 13 lines
Quoted 13 lines

was _never_ meant to propagate into the other ide drivers, and in fact the code in ide-disk has several tcq specific parts that really cannot work in ide-cd. Such as (ide-cd.c:ide_cdrom_do_request()):

	spin_lock...

	ar = ata_ar_get()
	if (!ar) {
		spin_unlock;
		return ide_started;
	}
	...
Quoted 7 lines
Quoted 4 lines

ide-disk guarentees that if ata_ar_get() fails, it's because we have some pending commands on the drive. The ide_started is bogus too, in this context it really should be ide_didnt_start_jack, but it works for ide-disk because of the above assumptions.

Fortunately it can't happen becouse the other devices don't support TCQ.

Right, it should rather be a bug trigger in ide-cd... Doesn't matter, it will be killed soon.

Quoted 7 lines
Quoted 3 lines

I'd suggest moving the ata_ar_get() at the ide_queue_commands() level, and just pass { drive, ar } to the do_request() strategies. That's also why ide-disk.c:idedisk_do_request() has this comment:

Yes this was my intention for the future. The only driver which will have problems with this is ide-scsi.c - it's not obvious (at least right now) to me how to change the do_request signature there.

How so? Even with pusing ar at the level discussed here, ide-xx.c does really not need to care. Change the do_request() strategy to just take the drive and ar, driver is free to just:

	/* something to this effect */
	struct request *rq = ar->ar_rq;
	sector_t block = ar->ar_block;

and the rest could remain unchanged. It's up to the driver how far it wants to take this. The only "problem" is that rq->special will always contain the pointer to the ar used, so none of them can touch it.

Quoted 13 lines
Quoted 9 lines
	/*
	 * get a new command (push ar further down to avoid grabbing
	 * lock here
	 */
	spin_lock_irqsave(DRIVE_LOCK(drive), flags);

	ar = ata_ar_get(drive);
	...
Quoted 3 lines

I've been meaning to do this once tcq settled down, just didn't get around to it yet. But please don't start moving stuff like this into ide-cd too.

Quoted 5 lines

You notice that I didn't even care to change the write request code-path? BTW.> It became obvious to me as well that even all the drivers out there not supporting TCQ will have to get the TCQ parts of struct ata_device initialized - with a trivial queue depth. drive->tcq should therefore be really just a memmber of struct ata_device()..

I disagree, there's no need to have a ->tcq if you don't support queueing. The "trivial queue depth" is already done, it's called drive->queue_depth and is 1 for non-tcq (or tcq with depth 1 :-).

Signature · 1 line
Jens Axboe
#7 lore raw
In reply to Miles Lane

* Martin Dalecki -- Tuesday 23 April 2002 10:00:

Quoted 3 lines

Looks like the oops came from module code.
Which modules did you use: ide-flappy and ide-scsi are still in need of the same medication ide-cd got.

I've got the same oops, but I have ide-cd compiled into the kernel, and use neither ide-scsi nor ide-floppy. It's obviously a ide-cd problem. (Oops report on request.)

m.

#8 lore raw
In reply to Miles Lane
Quoted 27 lines · Użytkownik Miles Lane
Quoted 18 lines · Miles Lane
Quoted 12 lines · Martin Dalecki
Quoted 8 lines · Miles Lane

I should probably add the /proc/ksyms snapshotting stuff to get the module information for you as well. I hope this current batch of info helps, for starters.

ksymoops 2.4.4 on i686 2.4.7-10. Options used

    -v /usr/src/linux/vmlinux (specified)
    -K (specified)
    -L (specified)
    -o /lib/modules/2.5.9/ (specified)
    -m /boot/System.map-2.5.9 (specified)
Quoted 3 lines

Looks like the oops came from module code.
Which modules did you use: ide-flappy and ide-scsi are still in need of the same medication ide-cd got.

Quoted 5 lines

CONFIG_BLK_DEV_IDESCSI=m
CONFIG_SCSI=m
CONFIG_BLK_DEV_SD=m
CONFIG_BLK_DEV_SR=m
CONFIG_CHR_DEV_SG=m

Quoted 2 lines

Hmm. You probably need this, too. Sorry for not sending this in the first reply.

OK I assume that the oops happens inside the ide-scsi module. This will be fixed in one of the forthcomming patch sets.

#9 lore raw

I had a similar oops loading ide-cd module, without ide-scsi or similar. EIP is the same, but since loading the module freezes the system, I do not have a complite oops.
The system il a PentiumIII 512 MB ram,with i810 chipset. Unfortunatelly all the other test systems I have right now are scsi based even for the cd reader, so I cannot test on other chipset.

Quoted 43 lines · Martin Dalecki

U¿ytkownik Miles Lane napisa³:

Quoted 29 lines · Miles Lane
Quoted 21 lines · Martin Dalecki
Quoted 15 lines
Quoted 10 lines · Miles Lane

I should probably add the /proc/ksyms snapshotting stuff to get the module information for you as well. I hope this current batch of info helps, for starters.

ksymoops 2.4.4 on i686 2.4.7-10. Options used

    -v /usr/src/linux/vmlinux (specified)
    -K (specified)
    -L (specified)
    -o /lib/modules/2.5.9/ (specified)
    -m /boot/System.map-2.5.9 (specified)
Quoted 3 lines

Looks like the oops came from module code.
Which modules did you use: ide-flappy and ide-scsi are still in need of the same medication ide-cd got.

Quoted 5 lines

CONFIG_BLK_DEV_IDESCSI=m
CONFIG_SCSI=m
CONFIG_BLK_DEV_SD=m
CONFIG_BLK_DEV_SR=m
CONFIG_CHR_DEV_SG=m

Quoted 2 lines

Hmm. You probably need this, too. Sorry for not sending this in the first reply.

OK I assume that the oops happens inside the ide-scsi module. This will be fixed in one of the forthcomming patch sets.

-
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/

#10 lore raw
In reply to Miles Lane
Quoted 30 lines · Martin Dalecki

U?ytkownik Miles Lane napisa?:

Quoted 29 lines · Miles Lane
Quoted 26 lines · Martin Dalecki
Quoted 15 lines
Quoted 10 lines · Miles Lane

I should probably add the /proc/ksyms snapshotting stuff to get the module information for you as well. I hope this current batch of info helps, for starters.

ksymoops 2.4.4 on i686 2.4.7-10. Options used
-v /usr/src/linux/vmlinux (specified)
-K (specified)
-L (specified)
-o /lib/modules/2.5.9/ (specified)
-m /boot/System.map-2.5.9 (specified)

Quoted 3 lines

Looks like the oops came from module code.
Which modules did you use: ide-flappy and ide-scsi are still in need of the same medication ide-cd got.

CONFIG_BLK_DEV_IDESCSI=m
CONFIG_SCSI=m
CONFIG_BLK_DEV_SD=m
CONFIG_BLK_DEV_SR=m
CONFIG_CHR_DEV_SG=m

Quoted 6 lines
Quoted 2 lines

Hmm. You probably need this, too. Sorry for not sending this in the first reply.

OK I assume that the oops happens inside the ide-scsi module. This will be fixed in one of the forthcomming patch sets.

Are you sure this isn't just due to ->special being set, and ide_end_request() assuming it's an ar? From ide-cd, that is.

Signature · 1 line
Jens Axboe
#11 lore raw
In reply to Miles Lane
Quoted 6 lines
Quoted 2 lines

OK I assume that the oops happens inside the ide-scsi module. This will be fixed in one of the forthcomming patch sets.

Are you sure this isn't just due to ->special being set, and ide_end_request() assuming it's an ar? From ide-cd, that is.

Yes right. Thank you for reminding me. I will have to redo the stuff from the "draft" patch I did send you once...

#12 lore raw
In reply to Miles Lane

Uz.ytkownik Jens Axboe napisa?:

Quoted 8 lines · Martin Dalecki
Quoted 3 lines

OK I assume that the oops happens inside the ide-scsi module. This will be fixed in one of the forthcomming patch sets.

Are you sure this isn't just due to ->special being set, and ide_end_request() assuming it's an ar? From ide-cd, that is.

Yes I know it's all the same. However unfortunately it's *not easy* to back out the ->special use from the drivers that do it. We have the following sutuation:

1. Generic BIO code checking for ->special and deciding whatever it should trying to merge request or not.

2. Gneric ATA code setting ->special for ata_request passing.

3. CD-ROM ATAPI code using ->special for passing packet commands and failed commands.

4. ide-scsi using it for the same purspose as CD-ROM

5. ide-floppy not using it at all buf abusing the ->buffer member for precisely the same purpose.

And unfortunately there is *no* easy solution for any of the above circumstances without breaking far too many things.

The conclusion simply is: unless the above issues are fixed the TCQ stuff has simply to be backed out again anbd live separately from the main code chain. :-(.

#13 lore raw
In reply to Miles Lane
Quoted 23 lines · Martin Dalecki

Uz.ytkownik Jens Axboe napisa?:

Quoted 8 lines · Martin Dalecki
Quoted 3 lines

OK I assume that the oops happens inside the ide-scsi module. This will be fixed in one of the forthcomming patch sets.

Are you sure this isn't just due to ->special being set, and ide_end_request() assuming it's an ar? From ide-cd, that is.

Yes I know it's all the same. However unfortunately it's *not easy* to back out the ->special use from the drivers that do it. We have the following sutuation:

1. Generic BIO code checking for ->special and deciding whatever it should trying to merge request or not.

2. Gneric ATA code setting ->special for ata_request passing.

3. CD-ROM ATAPI code using ->special for passing packet commands and failed commands.

Quoted 7 lines

4. ide-scsi using it for the same purspose as CD-ROM

5. ide-floppy not using it at all buf abusing the ->buffer member for precisely the same purpose.

And unfortunately there is *no* easy solution for any of the above circumstances without breaking far too many things.

You don't _have_ to back out the ->special usage. As I mentioned, it was always just a quick hack for ide-disk so I didn't have to change every single driver out there.

There are two options, as I see it:

- Keep ata_request as an ide-disk speciality. This is pretty trivial even though other drivers use ->special, because the ata_ar_put() path simply needs to do

	struct ata_request *ar = rq->special;

	if (ar && drive->media == ide_disk)
		ata_ar_put(ar);

and that is it.

- Make the ata_request the general means of passing down request in the IDE layer -- start by making hwgroup->rq into hwgroup->ar and _never_ store ar in ->special (you don't have to, you will always just go from ar -> rq, which is of course ar->ar_rq). This is what I wanted to do.

Quoted 3 lines

The conclusion simply is: unless the above issues are fixed the TCQ stuff has simply to be backed out again anbd live separately from the main code chain. :-(.

If you didn't persist on pushing half-done stuff to Linus all the time, I would have had the time to implement this properly... Now you keep doing hackish work-arounds to make things limp along. So please calm down for a moment, sick back, and think about it. It's a heck of a lot better than going full throttle with an axe.

Signature · 1 line
Jens Axboe
#14 lore raw
In reply to Miles Lane
Quoted 4 lines · Jens Axboe

- Make the ata_request the general means of passing down request in the IDE layer -- start by making hwgroup->rq into hwgroup->ar and _never_ store ar in ->special (you don't have to, you will always just go from ar -> rq, which is of course ar->ar_rq). This is what I wanted to do.

I'll do this on monday, I'm away friday and through the weekend. Lets get this fixed _properly_.

Signature · 1 line
Jens Axboe
#15 lore raw
In reply to Miles Lane
Quoted 8 lines · Jens Axboe
Quoted 4 lines · Jens Axboe

- Make the ata_request the general means of passing down request in the IDE layer -- start by making hwgroup->rq into hwgroup->ar and _never_ store ar in ->special (you don't have to, you will always just go from ar -> rq, which is of course ar->ar_rq). This is what I wanted to do.

I'll do this on monday, I'm away friday and through the weekend. Lets get this fixed _properly_.

The only _proper_ fix is to not abuse "special" at all. Mid-level layers simpyl should not use it.

Please don't use "special" for mid-level things that clash like this. There are real reasons why Linux tries hard to avoid stupidly overloaded "void *" things, and if IDE is to be cleaned up (which I sure hope), it should NOT use "special" at all.

And it should _definitely_ not use it for multiple different things, depending on what kind of disk it is. Checking whether the target is a disk or a CD is _absolutely_ the wrong thing to do, and will just make the code continue the current mistake of now being able to integrate the packet command stuff between them.

Jens, please don't make it worse. Add a new field if you have to, with a proper type, don't overload crap.

Linus

#16 lore raw

PATCH 1/1 2.5.10 UTS_VERSION

In reply to Miles Lane

Make sure UTS_VERSION is allways in "C" locale. Without it you will get (please note the day of week):

~# export LANG=en_US
~# uname -a
Linux rosomak.prv 2.5.10 #1 pią kwi 26 09:31:52 CEST 2002 i686 unknown ~#

Makefile +2 -2
diff -urN linux-2.5.10/Makefile linux/Makefile
@@ -312,8 +312,8 @@
 	@echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
 	@if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
 	@if [ -f .name ]; then  echo -n \-`cat .name` >> .ver; fi
-	@echo ' '`date`'"' >> .ver
-	@echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
+	@echo ' '`LANG=C date`'"' >> .ver
+	@echo \#define LINUX_COMPILE_TIME \"`LANG=C date +%T`\" >> .ver
 	@echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
 	@echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
 	@if [ -x /bin/dnsdomainname ]; then \
#17 lore raw

Re: [PATCH] 2.5.10 UTS_VERSION

Quoted 7 lines · Martin Dalecki

Make sure UTS_VERSION is allways in "C" locale. Without it you will get (please note the day of week):

~# export LANG=en_US
~# uname -a
Linux rosomak.prv 2.5.10 #1 pi± kwi 26 09:31:52 CEST 2002 i686 unknown ~#

Why is that a problem? If a user wants a kernel uname in their local language, kbuild has no objection. I need LC_COLLATE=C to get a consistent filename ordering for kbuild but everything else, including build messages, date and time can be local.

#18 lore raw

Re: [PATCH] 2.5.10 UTS_VERSION

Quoted 11 lines · Użytkownik Keith Owens
Quoted 7 lines · Martin Dalecki

Make sure UTS_VERSION is allways in "C" locale. Without it you will get (please note the day of week):

~# export LANG=en_US
~# uname -a
Linux rosomak.prv 2.5.10 #1 pi? kwi 26 09:31:52 CEST 2002 i686 unknown ~#

Quoted 4 lines

Why is that a problem? If a user wants a kernel uname in their local language, kbuild has no objection. I need LC_COLLATE=C to get a consistent filename ordering for kbuild but everything else, including build messages, date and time can be local.

Please note that this is not just a compile time problem! The UTS_STRING is hard compiled *in to* the kernel and should be normalized for the following reasons:

1. Consistency
2. Consistency
3. Consistency
4. Giving the uname command a chance to translate it to the peculiar locale of the user.
5. During boot this string will be printed to the console. This is the time where the system doesn't know *anything* about non ASCII character sets. This results in the above example for me for example in printing of utter garbage on the screen.
6. Kernel messages are supposed to be in LOCALE="C".

#19 lore raw

PATCH 1/1 2.5.10 IDE 42

In reply to Miles Lane

Thu Apr 25 21:54:03 CEST 2002 ide-clean-42

- Streamline the usage of sector_t over the strategy routines in question a bit. Streamline the do_request code in ide-disk.c.

- Improve the readability of start_request in ide.c.

- Remove obsolete/nowhere used stuff from hdreg.h.

- Splitup special_t into classical flag field.

- Use only a single field to determine the capacity of a drive. Make this field and the code paths it follows as far as possible use the sector_t instead of a hard coded integer types. This increases the chances that at some distant point in time we will indeed be able to use 64 bit wide sector_t entities. (Disks are getting huge those times now...)

arch/mips64/kernel/ioctl32.c +0 -3
diff -urN linux-2.5.10/arch/mips64/kernel/ioctl32.c linux/arch/mips64/kernel/ioctl32.c
@@ -732,15 +732,12 @@
 	IOCTL32_HANDLER(HDIO_GETGEO, hdio_getgeo),	/* hdreg.h ioctls  */
 	IOCTL32_HANDLER(HDIO_GET_UNMASKINTR, hdio_ioctl_trans),
 	IOCTL32_HANDLER(HDIO_GET_MULTCOUNT, hdio_ioctl_trans),
-	// HDIO_OBSOLETE_IDENTITY
 	IOCTL32_HANDLER(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans),
 	IOCTL32_HANDLER(HDIO_GET_32BIT, hdio_ioctl_trans),
 	IOCTL32_HANDLER(HDIO_GET_NOWERR, hdio_ioctl_trans),
 	IOCTL32_HANDLER(HDIO_GET_DMA, hdio_ioctl_trans),
 	IOCTL32_HANDLER(HDIO_GET_NICE, hdio_ioctl_trans),
 	IOCTL32_DEFAULT(HDIO_GET_IDENTITY),
-	// HDIO_TRISTATE_HWIF				/* not implemented */
-	// HDIO_DRIVE_TASK				/* To do, need specs */
 	IOCTL32_DEFAULT(HDIO_DRIVE_CMD),
 	IOCTL32_DEFAULT(HDIO_SET_MULTCOUNT),
 	IOCTL32_DEFAULT(HDIO_SET_UNMASKINTR),
drivers/block/ll_rw_blk.c +1 -1
diff -urN linux-2.5.10/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
@@ -334,7 +334,7 @@
 
 static char *rq_flags[] = { "REQ_RW", "REQ_RW_AHEAD", "REQ_BARRIER",
 			   "REQ_CMD", "REQ_NOMERGE", "REQ_STARTED",
-			   "REQ_DONTPREP", "REQ_DRIVE_CMD", "REQ_DRIVE_TASK",
+			   "REQ_DONTPREP", "REQ_DRIVE_CMD",
 			   "REQ_DRIVE_ACB", "REQ_PC", "REQ_BLOCK_PC",
 			   "REQ_SENSE", "REQ_SPECIAL" };
 
drivers/ide/ide.c +150 -168

529 lines not on this page · raw message

drivers/ide/ide-cd.c +14 -18
diff -urN linux-2.5.10/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -1162,11 +1162,12 @@
 	return ide_stopped;
 }
 
-static ide_startstop_t cdrom_start_seek_continuation (ide_drive_t *drive)
+static ide_startstop_t cdrom_start_seek_continuation(struct ata_device *drive)
 {
 	unsigned char cmd[CDROM_PACKET_SIZE];
 	struct request *rq = HWGROUP(drive)->rq;
-	int sector, frame, nskip;
+	sector_t sector;
+	int frame, nskip;
 
 	sector = rq->sector;
 	nskip = (sector % SECTORS_PER_FRAME);
@@ -1181,14 +1182,14 @@
 	return cdrom_transfer_packet_command(drive, cmd, WAIT_CMD, &cdrom_seek_intr);
 }
 
-static ide_startstop_t cdrom_start_seek (ide_drive_t *drive, unsigned int block)
+static ide_startstop_t cdrom_start_seek(struct ata_device *drive, sector_t block)
 {
 	struct cdrom_info *info = drive->driver_data;
 
 	info->dma = 0;
 	info->cmd = 0;
 	info->start_seek = jiffies;
-	return cdrom_start_packet_command (drive, 0, cdrom_start_seek_continuation);
+	return cdrom_start_packet_command(drive, 0, cdrom_start_seek_continuation);
 }
 
 /*
@@ -1199,7 +1200,7 @@
 static void restore_request (struct request *rq)
 {
 	if (rq->buffer != bio_data(rq->bio)) {
-		int n = (rq->buffer - (char *) bio_data(rq->bio)) / SECTOR_SIZE;
+		sector_t n = (rq->buffer - (char *) bio_data(rq->bio)) / SECTOR_SIZE;
 		rq->buffer = bio_data(rq->bio);
 		rq->nr_sectors += n;
 		rq->sector -= n;
@@ -1213,7 +1214,7 @@
 /*
  * Start a read request from the CD-ROM.
  */
-static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block)
+static ide_startstop_t cdrom_start_read(struct ata_device *drive, sector_t block)
 {
 	struct cdrom_info *info = drive->driver_data;
 	struct request *rq = HWGROUP(drive)->rq;
@@ -1634,8 +1635,6 @@
 	struct cdrom_info *info = drive->driver_data;
 
 	if (rq->flags & REQ_CMD) {
-	
-
 		if (CDROM_CONFIG_FLAGS(drive)->seeking) {
 			unsigned long elpased = jiffies - info->start_seek;
 			int stat = GET_STAT();
@@ -1650,7 +1649,7 @@
 			CDROM_CONFIG_FLAGS(drive)->seeking = 0;
 		}
 		if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap)
-			action = cdrom_start_seek (drive, block);
+			action = cdrom_start_seek(drive, block);
 		else {
 			if (rq_data_dir(rq) == READ)
 				action = cdrom_start_read(drive, block);
@@ -1837,7 +1836,7 @@
 	return cdrom_queue_packet_command(drive, cmd, sense, &pc);
 }
 
-static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
+static int cdrom_read_capacity(ide_drive_t *drive, u32 *capacity,
 			       struct request_sense *sense)
 {
 	struct {
@@ -2027,7 +2026,8 @@
 	/* Now try to get the total cdrom capacity. */
 	minor = (drive->select.b.unit) << PARTN_BITS;
 	dev = mk_kdev(drive->channel->major, minor);
-	stat = cdrom_get_last_written(dev, &toc->capacity);
+	/* FIXME: This is making worng assumptions about register layout. */
+	stat = cdrom_get_last_written(dev, (unsigned long *) &toc->capacity);
 	if (stat)
 		stat = cdrom_read_capacity(drive, &toc->capacity, sense);
 	if (stat)
@@ -2686,7 +2686,7 @@
 }
 
 static
-int ide_cdrom_setup (ide_drive_t *drive)
+int ide_cdrom_setup(ide_drive_t *drive)
 {
 	struct cdrom_info *info = drive->driver_data;
 	struct cdrom_device_info *cdi = &info->devinfo;
@@ -2702,7 +2702,6 @@
 
 	blk_queue_prep_rq(&drive->queue, ll_10byte_cmd_build);
 
-	drive->special.all	= 0;
 	drive->ready_stat	= 0;
 
 	CDROM_STATE_FLAGS (drive)->media_changed = 1;
@@ -2891,10 +2890,9 @@
 	set_blocksize(mk_kdev(drive->channel->major, minor), CD_FRAMESIZE);
 }
 
-static
-unsigned long ide_cdrom_capacity (ide_drive_t *drive)
+static sector_t ide_cdrom_capacity(struct ata_device *drive)
 {
-	unsigned long capacity;
+	u32 capacity;
 
 	if (cdrom_read_capacity(drive, &capacity, NULL))
 		return 0;
@@ -2934,9 +2932,7 @@
 	release:		ide_cdrom_release,
 	check_media_change:	ide_cdrom_check_media_change,
 	revalidate:		ide_cdrom_revalidate,
-	pre_reset:		NULL,
 	capacity:		ide_cdrom_capacity,
-	special:		NULL,
 	proc:			NULL
 };
 
drivers/ide/ide-cd.h +4 -5
diff -urN linux-2.5.10/drivers/ide/ide-cd.h linux/drivers/ide/ide-cd.h
@@ -151,12 +151,11 @@
 };
 
 struct atapi_toc {
-	int    last_session_lba;
-	int    xa_flag;
-	unsigned long capacity;
+	int last_session_lba;
+	int xa_flag;
+	u32 capacity;
 	struct atapi_toc_header hdr;
-	struct atapi_toc_entry  ent[MAX_TRACKS+1];
-	  /* One extra for the leadout. */
+	struct atapi_toc_entry ent[MAX_TRACKS+1];  /* one extra for the leadout. */
 };
 
 
drivers/ide/ide-disk.c +333 -345

880 lines not on this page · raw message

drivers/ide/ide-dma.c +3 -2
diff -urN linux-2.5.10/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
@@ -295,7 +295,7 @@
 	int i;
 	struct scatterlist *sg;
 
-	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) {
+	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) {
 		hwif->sg_nents = i = raw_build_sglist(hwif, HWGROUP(drive)->rq);
 	} else {
 		hwif->sg_nents = i = ide_build_sglist(hwif, HWGROUP(drive)->rq);
@@ -590,9 +590,10 @@
 
 			BUG_ON(HWGROUP(drive)->handler);
 			ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, dma_timer_expiry);	/* issue cmd to drive */
-			if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) &&
+			if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) &&
 			    (drive->addressing == 1)) {
 				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-floppy.c +6 -8
diff -urN linux-2.5.10/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
@@ -1255,12 +1255,12 @@
 	pc->c[0] = IDEFLOPPY_TEST_UNIT_READY_CMD;
 }
 
-static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct request *rq, unsigned long sector)
+static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct request *rq, sector_t sector)
 {
 	int block = sector / floppy->bs_factor;
 	int blocks = rq->nr_sectors / floppy->bs_factor;
 	int cmd = rq_data_dir(rq);
-	
+
 #if IDEFLOPPY_DEBUG_LOG
 	printk ("create_rw1%d_cmd: block == %d, blocks == %d\n",
 		2 * test_bit (IDEFLOPPY_USE_READ12, &floppy->flags), block, blocks);
@@ -1287,9 +1287,9 @@
 }
 
 /*
- *	idefloppy_do_request is our request handling function.	
+ * This is our request handling function.
  */
-static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, unsigned long block)
+static ide_startstop_t idefloppy_do_request(struct ata_device *drive, struct request *rq, sector_t block)
 {
 	idefloppy_floppy_t *floppy = drive->driver_data;
 	idefloppy_pc_t *pc;
@@ -1297,7 +1297,7 @@
 #if IDEFLOPPY_DEBUG_LOG
 	printk (KERN_INFO "rq_status: %d, rq_dev: %u, flags: %lx, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->flags,rq->errors);
 	printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %d\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors);
-#endif /* IDEFLOPPY_DEBUG_LOG */
+#endif
 
 	if (rq->errors >= ERROR_MAX) {
 		if (floppy->failed_pc != NULL)
@@ -1314,7 +1314,7 @@
 			idefloppy_end_request(drive, 0);
 			return ide_stopped;
 		}
-		pc = idefloppy_next_pc_storage (drive);
+		pc = idefloppy_next_pc_storage(drive);
 		idefloppy_create_rw_cmd (floppy, pc, rq, block);
 	} else if (rq->flags & IDEFLOPPY_RQ) {
 		pc = (idefloppy_pc_t *) rq->buffer;
@@ -2063,9 +2063,7 @@
 	release:		idefloppy_release,
 	check_media_change:	idefloppy_check_media_change,
 	revalidate:		NULL, /* use default method */
-	pre_reset:		NULL,
 	capacity:		idefloppy_capacity,
-	special:		NULL,
 	proc:			idefloppy_proc
 };
 
drivers/ide/ide-pmac.c +2 -2
diff -urN linux-2.5.10/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
@@ -1109,7 +1109,7 @@
 		udelay(1);
 
 	/* Build sglist */
-	if (rq->flags & REQ_DRIVE_TASKFILE) {
+	if (rq->flags & REQ_DRIVE_ACB) {
 		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);
@@ -1386,7 +1386,7 @@
 			return 0;
 		BUG_ON(HWGROUP(drive)->handler);
 		ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
-		if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) &&
+		if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) &&
 		    (drive->addressing == 1)) {
 			struct ata_taskfile *args = HWGROUP(drive)->rq->special;
 			OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
drivers/ide/ide-proc.c +2 -2
diff -urN linux-2.5.10/drivers/ide/ide-proc.c linux/drivers/ide/ide-proc.c
@@ -160,8 +160,8 @@
 	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)
+static int proc_ide_read_channel(char *page, char **start,
+		off_t off, int count, int *eof, void *data)
 {
 	struct ata_channel *hwif = data;
 	int		len;
drivers/ide/ide-tape.c +2 -2
diff -urN linux-2.5.10/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
@@ -2614,9 +2614,9 @@
 }
 
 /*
- *	idetape_do_request is our request handling function.	
+ * This is our request handling function.
  */
-static ide_startstop_t idetape_do_request (ide_drive_t *drive, struct request *rq, unsigned long block)
+static ide_startstop_t idetape_do_request(struct ata_device *drive, struct request *rq, sector_t block)
 {
 	idetape_tape_t *tape = drive->driver_data;
 	idetape_pc_t *pc;
drivers/ide/ide-taskfile.c +17 -56

150 lines not on this page · raw message

drivers/scsi/ide-scsi.c +5 -7
diff -urN linux-2.5.10/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
@@ -458,9 +458,9 @@
 }
 
 /*
- *	idescsi_do_request is our request handling function.
+ * This is our request handling function.
  */
-static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, unsigned long block)
+static ide_startstop_t idescsi_do_request(struct ata_device *drive, struct request *rq, sector_t block)
 {
 #if IDESCSI_DEBUG_LOG
 	printk (KERN_INFO "rq_status: %d, rq_dev: %u, cmd: %d, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->cmd,rq->errors);
@@ -468,20 +468,20 @@
 #endif /* IDESCSI_DEBUG_LOG */
 
 	if (rq->flags & REQ_SPECIAL) {
-		return idescsi_issue_pc (drive, (idescsi_pc_t *) rq->special);
+		return idescsi_issue_pc(drive, (idescsi_pc_t *) rq->special);
 	}
 	blk_dump_rq_flags(rq, "ide-scsi: unsup command");
 	idescsi_end_request(drive, 0);
 	return ide_stopped;
 }
 
-static int idescsi_open (struct inode *inode, struct file *filp, ide_drive_t *drive)
+static int idescsi_open(struct inode *inode, struct file *filp, struct ata_device *drive)
 {
 	MOD_INC_USE_COUNT;
 	return 0;
 }
 
-static void idescsi_ide_release (struct inode *inode, struct file *filp, ide_drive_t *drive)
+static void idescsi_ide_release(struct inode *inode, struct file *filp, struct ata_device *drive)
 {
 	MOD_DEC_USE_COUNT;
 }
@@ -556,9 +556,7 @@
 	release:		idescsi_ide_release,
 	check_media_change:	NULL,
 	revalidate:		idescsi_revalidate,
-	pre_reset:		NULL,
 	capacity:		NULL,
-	special:		NULL,
 	proc:			NULL
 };
 
include/linux/blkdev.h +4 -8
diff -urN linux-2.5.10/include/linux/blkdev.h linux/include/linux/blkdev.h
@@ -76,17 +76,16 @@
 	__REQ_STARTED,	/* drive already may have started this one */
 	__REQ_DONTPREP,	/* don't call prep for this one */
 	/*
-	 * for IDE
- 	*/
+	 * for ATA/ATAPI devices
+	 */
 	__REQ_DRIVE_CMD,
-	__REQ_DRIVE_TASK,
 	__REQ_DRIVE_ACB,
 
 	__REQ_PC,	/* packet command (special) */
 	__REQ_BLOCK_PC,	/* queued down pc from block layer */
 	__REQ_SENSE,	/* sense retrival */
 
-	__REQ_SPECIAL,	/* driver special command */
+	__REQ_SPECIAL,	/* driver special command (currently reset) */
 
 	__REQ_NR_BITS,	/* stops here */
 };
@@ -99,15 +98,12 @@
 #define REQ_STARTED	(1 << __REQ_STARTED)
 #define REQ_DONTPREP	(1 << __REQ_DONTPREP)
 #define REQ_DRIVE_CMD	(1 << __REQ_DRIVE_CMD)
-#define REQ_DRIVE_TASK	(1 << __REQ_DRIVE_TASK)
 #define REQ_DRIVE_ACB	(1 << __REQ_DRIVE_ACB)
 #define REQ_PC		(1 << __REQ_PC)
-#define REQ_SENSE	(1 << __REQ_SENSE)
 #define REQ_BLOCK_PC	(1 << __REQ_BLOCK_PC)
+#define REQ_SENSE	(1 << __REQ_SENSE)
 #define REQ_SPECIAL	(1 << __REQ_SPECIAL)
 
-#define REQ_DRIVE_TASKFILE	REQ_DRIVE_ACB
-
 #include <linux/elevator.h>
 
 typedef int (merge_request_fn) (request_queue_t *, struct request *,
include/linux/hdreg.h +2 -13
diff -urN linux-2.5.10/include/linux/hdreg.h linux/include/linux/hdreg.h
@@ -3,7 +3,7 @@
 
 /*
  * This file contains some defines for the AT-hd-controller.
- * Various sources.  
+ * Various sources.
  */
 
 #define HD_IRQ 14			/* the standard disk interrupt */
@@ -51,11 +51,9 @@
 
 /*
  * Command Header sizes for IOCTL commands
- *	HDIO_DRIVE_CMD and HDIO_DRIVE_TASK
  */
 
 #define HDIO_DRIVE_CMD_HDR_SIZE		(4 * sizeof(u8))
-#define HDIO_DRIVE_TASK_HDR_SIZE	(8 * sizeof(u8))
 #define HDIO_DRIVE_HOB_HDR_SIZE		(8 * sizeof(u8))
 
 #define IDE_DRIVE_TASK_INVALID		-1
@@ -287,7 +285,6 @@
 #define HDIO_GET_UNMASKINTR	0x0302	/* get current unmask setting */
 #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_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 */
@@ -298,12 +295,8 @@
 #define	HDIO_GET_ADDRESS	0x0310	/* */
 
 #define HDIO_GET_BUSSTATE	0x031a	/* get the bus state of the hwif */
-#define HDIO_TRISTATE_HWIF	0x031b	/* execute a channel tristate */
-#define HDIO_DRIVE_TASK		0x031e	/* execute task and special drive command */
 #define HDIO_DRIVE_CMD		0x031f	/* execute a special drive command */
 
-#define HDIO_DRIVE_CMD_AEB	HDIO_DRIVE_TASK
-
 /* 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 */
@@ -521,11 +514,7 @@
 					 *  7:0	current value
 					 */
 	unsigned short	words95_99[5];	/* reserved words 95-99 */
-#if 0
-	unsigned short	words100_103[4]	;/* reserved words 100-103 */
-#else
 	unsigned long long lba_capacity_2;/* 48-bit total number of sectors */
-#endif
 	unsigned short	words104_125[22];/* reserved words 104-125 */
 	unsigned short	last_lun;	/* (word 126) */
 	unsigned short	word127;	/* (word 127) Feature Set
@@ -573,7 +562,7 @@
 					 * 15:8 Checksum
 					 *  7:0 Signature
 					 */
-};
+} __attribute__((packed));
 
 /*
  * IDE "nice" flags. These are used on a per drive basis to determine
include/linux/ide.h +58 -62

201 lines not on this page · raw message

#20 lore raw

Re: [PATCH] 2.5.10 IDE 42

On Fri, 26 Apr 2002 09:41:30 +0200
Martin Dalecki <[email protected]> wrote:

Hi,

@@ -584,27 +585,25 @@
drive->failures = 0;
} else {
drive->failures++;
+ char *msg = "";

My compiler won't compile that ;)
Declare msg after the function's beginning and it compiles fine

Bye

#21 lore raw

Re: [PATCH] 2.5.10 IDE 42

In reply to Miles Lane

Hi!

Quoted 22 lines
(quoted diff) +11 -7
@@ -783,16 +771,23 @@
 	if (stat & BUSY_STAT)
 		printk("Busy ");
 	else {
-		if (stat & READY_STAT)	printk("DriveReady ");
-		if (stat & WRERR_STAT)	printk("DeviceFault ");
-		if (stat & SEEK_STAT)	printk("SeekComplete ");
-		if (stat & DRQ_STAT)	printk("DataRequest ");
-		if (stat & ECC_STAT)	printk("CorrectedError ");
-		if (stat & INDEX_STAT)	printk("Index ");
-		if (stat & ERR_STAT)	printk("Error ");
+		if (stat & READY_STAT)
+			printk("DriveReady ");
+		if (stat & WRERR_STAT)
+			printk("DeviceFault ");
+		if (stat & SEEK_STAT)
+			printk("SeekComplete ");
+		if (stat & DRQ_STAT)
+			printk("DataRequest ");
+		if (stat & ECC_STAT)
+			printk("CorrectedError ");
+		if (stat & INDEX_STAT)

Review line 793

Quoted 10 lines
(quoted diff) +4 -1
+			printk("Index ");
+		if (stat & ERR_STAT)
+			printk("Error ");
 	}
 	printk("}");
-#endif	/* FANCY_STATUS_DUMPS */
+#endif
 	printk("\n");
 	if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
 		err = GET_ERR();

I believe this is actually making it *less* readable.

Review line 840

Quoted 9 lines
(quoted diff) +1 -1
@@ -839,7 +834,7 @@
 					printk(", sector=%ld", HWGROUP(drive)->rq->sector);
 			}
 		}
-#endif	/* FANCY_STATUS_DUMPS */
+#endif
 		printk("\n");
 	}
 	__restore_flags (flags);	/* local CPU only */

Here to. Comment after endif is good thing; you don't have to add it but you should certainly not kill it.
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
#22 lore raw

Re: [PATCH] 2.5.10 IDE 42

Quoted 8 lines · Pavel Machek
Quoted 8 lines
(quoted diff) +8 -0
+		if (stat & READY_STAT)
+			printk("DriveReady ");
+		if (stat & WRERR_STAT)
+			printk("DeviceFault ");
+		if (stat & SEEK_STAT)
+			printk("SeekComplete ");
+		if (stat & DRQ_STAT)
+			printk("DataRequest ");
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+		if (stat & ECC_STAT)
+			printk("CorrectedError ");
+		if (stat & INDEX_STAT)
+			printk("Index ");
+		if (stat & ERR_STAT)
+			printk("Error ");

I believe this is actually making it *less* readable.

Somewhat agreed. Also, the above is just not the right way to do printouts.

I'd suggest rewriting the whole big mess as something like

	#define STAT_STR(x,s) \
		((stat & x ##_STAT) ? s " " : "")

	...

	printf("IDE: %s%s%s%s%s%s..\n"
		STAT_STR(READY, "DriveReady"),
		STAT_STR(WERR, "DeviceFault"),
		...

which is pretty certain to generate much smaller code (not to mention smaller sources).

Linus

#23 lore raw

Re: [PATCH] 2.5.10 IDE 42

Quoted 25 lines · Linus Torvalds
Quoted 8 lines · Pavel Machek
Quoted 8 lines
(quoted diff) +8 -0
+		if (stat & READY_STAT)
+			printk("DriveReady ");
+		if (stat & WRERR_STAT)
+			printk("DeviceFault ");
+		if (stat & SEEK_STAT)
+			printk("SeekComplete ");
+		if (stat & DRQ_STAT)
+			printk("DataRequest ");
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+		if (stat & ECC_STAT)
+			printk("CorrectedError ");
+		if (stat & INDEX_STAT)
+			printk("Index ");
+		if (stat & ERR_STAT)
+			printk("Error ");

I believe this is actually making it *less* readable.

Somewhat agreed. Also, the above is just not the right way to do printouts.

I'd suggest rewriting the whole big mess as something like

Quoted 9 lines
	#define STAT_STR(x,s) \
		((stat & x ##_STAT) ? s " " : "")

	...

	printf("IDE: %s%s%s%s%s%s..\n"
		STAT_STR(READY, "DriveReady"),
		STAT_STR(WERR, "DeviceFault"),
		...

I'd go even further and suggest that pulling the mapping from a mask or key to string out into a table and looping through it is preferable for this sort of thing. You win later if you decide you need the same mapping elsewhere or if you want to format your messages differently, add bits to it, etc. Tables are generally easier to inspect for errors than code, although Linus' version is very nearly a table.

Maintaining tables as code is a pain and is generally only a win for small or sparse state machines.

Signature · 1 line
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.."
#24 lore raw

Re: [PATCH] 2.5.10 IDE 42

Uz.ytkownik Oliver Xymoron napisa?:

Quoted 46 lines · Linus Torvalds
Quoted 27 lines · Pavel Machek
Quoted 17 lines
Quoted 5 lines
(quoted diff) +4 -0
+		if (stat & READY_STAT)
+			printk("DriveReady ");
+		if (stat & WRERR_STAT)
+			printk("DeviceFault ");

Review

Quoted 10 lines
(quoted diff) +10 -0
+		if (stat & SEEK_STAT)
+			printk("SeekComplete ");
+		if (stat & DRQ_STAT)
+			printk("DataRequest ");
+		if (stat & ECC_STAT)
+			printk("CorrectedError ");
+		if (stat & INDEX_STAT)
+			printk("Index ");
+		if (stat & ERR_STAT)
+			printk("Error ");

I believe this is actually making it *less* readable.

Somewhat agreed. Also, the above is just not the right way to do printouts.

I'd suggest rewriting the whole big mess as something like

Quoted 9 lines
	#define STAT_STR(x,s) \
		((stat & x ##_STAT) ? s " " : "")

	...

	printf("IDE: %s%s%s%s%s%s..\n"
		STAT_STR(READY, "DriveReady"),
		STAT_STR(WERR, "DeviceFault"),
		...

I'd go even further and suggest that pulling the mapping from a mask or key to string out into a table and looping through it is preferable for this sort of thing. You win later if you decide you need the same mapping elsewhere or if you want to format your messages differently, add bits to it, etc. Tables are generally easier to inspect for errors than code, although Linus' version is very nearly a table.

Quoted 2 lines

Maintaining tables as code is a pain and is generally only a win for small or sparse state machines.

Yes I will use an ffz() based loop to lookup a table.

#25 lore raw

Re: [PATCH] 2.5.10 IDE 42

In reply to Oliver Xymoron
Quoted 23 lines
Quoted 5 lines

Somewhat agreed. Also, the above is just not the right way to do printouts.

I'd suggest rewriting the whole big mess as something like

Quoted 9 lines
	#define STAT_STR(x,s) \
		((stat & x ##_STAT) ? s " " : "")

	...

	printf("IDE: %s%s%s%s%s%s..\n"
		STAT_STR(READY, "DriveReady"),
		STAT_STR(WERR, "DeviceFault"),
		...

I'd go even further and suggest that pulling the mapping from a mask or key to string out into a table and looping through it is preferable for this sort of thing. You win later if you decide you need the same mapping elsewhere or if you want to format your messages differently, add bits to it, etc. Tables are generally easier to inspect for errors than code, although Linus' version is very nearly a table.

Quoted 2 lines

Maintaining tables as code is a pain and is generally only a win for small or sparse state machines.

Once could have a look at the ll_rw_blk.c file. There is a function there, which is dissecting the differnt request attributes, which are stored as bitfields there.

#26 lore raw

Re: [PATCH] 2.5.10 IDE 42

In reply to Linus Torvalds

Uz.ytkownik Linus Torvalds napisa?:

Quoted 36 lines · Pavel Machek
Quoted 17 lines
Quoted 5 lines
(quoted diff) +4 -0
+		if (stat & READY_STAT)
+			printk("DriveReady ");
+		if (stat & WRERR_STAT)
+			printk("DeviceFault ");

Review

Quoted 10 lines
(quoted diff) +10 -0
+		if (stat & SEEK_STAT)
+			printk("SeekComplete ");
+		if (stat & DRQ_STAT)
+			printk("DataRequest ");
+		if (stat & ECC_STAT)
+			printk("CorrectedError ");
+		if (stat & INDEX_STAT)
+			printk("Index ");
+		if (stat & ERR_STAT)
+			printk("Error ");

I believe this is actually making it *less* readable.

Somewhat agreed. Also, the above is just not the right way to do printouts.

I'd suggest rewriting the whole big mess as something like

	#define STAT_STR(x,s) \
		((stat & x ##_STAT) ? s " " : "")

	...

	printf("IDE: %s%s%s%s%s%s..\n"
		STAT_STR(READY, "DriveReady"),
		STAT_STR(WERR, "DeviceFault"),
		...
Quoted 2 lines

which is pretty certain to generate much smaller code (not to mention smaller sources).

Agreed. Making the code more compact was the only reason I was touching those debugging sections in first place.

BTW> I'm still puzzled that gcc-3.1 eats C++ like randomly placed variable declarations. Is there someting I did miss in C9X papers maybe?

#27 lore raw

Re: [PATCH] 2.5.10 IDE 42

Hi.

On: Fri, 26 Apr 2002 23:32:44 +0200,

Quoted 3 lines · Martin Dalecki

BTW> I'm still puzzled that gcc-3.1 eats C++ like randomly placed variable declarations. Is there someting I did miss in C9X papers maybe?

Yes this is a C99 feature.

k33p h4ck1n6
René

Signature · 10 lines
René Rebe (Registered Linux user: #248718 <http://counter.li.org>)

eMail:    [email protected]
          [email protected]

Homepage: http://drocklinux.dyndns.org/rene/

Anyone sending unwanted advertising e-mail to this address will be
charged $25 for network traffic and computing time. By extracting my
address from this message or its header, you agree to these terms.
Quoted 1 line
#28 lore raw

Re: [PATCH] 2.5.10 IDE 42

In reply to Miles Lane
Quoted 13 lines · Pavel Machek

Review line 840

Quoted 10 lines
(quoted diff) +1 -1
@@ -839,7 +834,7 @@
 					printk(", sector=%ld", HWGROUP(drive)->rq->sector);
 			}
 		}
-#endif	/* FANCY_STATUS_DUMPS */
+#endif
 		printk("\n");
 	}
 	__restore_flags (flags);	/* local CPU only */

Here to. Comment after endif is good thing; you don't have to add it but you should certainly not kill it.

In cases where the #if is several pages before, or there multiple nested #if's, I agree. But when the #if is just a few lines up with no other #if's around, it's ugly.

We have functions elsewhere in the kernel like this..

void foo (void)
{

#if MY_MEMORY_SUCKS_BUT_LIKE_SILLY_COMMENTS
    one_line_of_code();

#endif /* MY_MEMORY_SUCKS_BUT_I_LIKE_SILLY_COMMENTS */ }

What information is this comment adding ?

Signature · 2 lines
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs
#29 lore raw

Re: [PATCH] 2.5.10 IDE 42

In reply to Miles Lane

Uz.ytkownik Sebastian Droege napisa?:

Quoted 12 lines

On Fri, 26 Apr 2002 09:41:30 +0200
Martin Dalecki <[email protected]> wrote:

Hi,

(quoted diff) +1 -0
@@ -584,27 +585,25 @@
 			drive->failures = 0;
 		} else {
 			drive->failures++;
+			char *msg = "";
 
 My compiler won't compile that ;)
Quoted 1 line

Declare msg after the function's beginning and it compiles fine

Well it doesn't has to be the function it sufficient to be the beginng of a block. However this is puzzling me, becouse the gcc-3.1 snap eats the above just like if it where a C++ complier!!!

Thank you for pointing out.

#30 lore raw

Re: [PATCH] 2.5.10 IDE 42

In reply to Miles Lane

Uz.ytkownik Pavel Machek napisa?:

Quoted 16 lines
Quoted 16 lines
(quoted diff) +14 -0
+		if (stat & READY_STAT)
+			printk("DriveReady ");
+		if (stat & WRERR_STAT)
+			printk("DeviceFault ");
+		if (stat & SEEK_STAT)
+			printk("SeekComplete ");
+		if (stat & DRQ_STAT)
+			printk("DataRequest ");
+		if (stat & ECC_STAT)
+			printk("CorrectedError ");
+		if (stat & INDEX_STAT)
+			printk("Index ");
+		if (stat & ERR_STAT)
+			printk("Error ");
	}
	printk("}");
Quoted 8 lines
Quoted 5 lines
(quoted diff) +1 -1
-#endif	/* FANCY_STATUS_DUMPS */
+#endif
	printk("\n");
	if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
		err = GET_ERR();

I believe this is actually making it *less* readable.

It makes the waste of stack setup code and call instructions more obvious then the former, so the chances are better that I will come back and compactize the actually generated code a bit ;-)

BTW> Redundant comments can only be false. Like the following:

#ifdef DEFINE

#endif /* DEFINE */

/*
* some_function() is used for this and that
*/
some_function()

{
	for (;;)
	{
	} /* for */
} /* some_function() */
#31 lore raw

Re: [PATCH] 2.5.10 IDE 42

In reply to Miles Lane
Quoted 22 lines · Martin Dalecki

Uz.ytkownik Sebastian Droege napisa?:

Quoted 12 lines

On Fri, 26 Apr 2002 09:41:30 +0200
Martin Dalecki <[email protected]> wrote:

Hi,

(quoted diff) +1 -0
@@ -584,27 +585,25 @@
             drive->failures = 0;
         } else {
             drive->failures++;
+            char *msg = "";
 
 My compiler won't compile that ;)
Quoted 1 line

Declare msg after the function's beginning and it compiles fine

Well it doesn't has to be the function it sufficient to be the beginng of a block. However this is puzzling me, becouse the gcc-3.1 snap eats the above just like if it where a C++ complier!!!

Quoted 1 line

Thank you for pointing out.

Note the "mixed declarations and code" @
http://www.gnu.org/software/gcc/gcc-3.0/c99status.html

Padraig.

#32 lore raw

Re: [PATCH] 2.5.10 IDE 42

[email protected] (Padraig Brady) wrote on 26.04.02 in <[email protected]>:

Quoted 23 lines
Quoted 13 lines · Martin Dalecki

Uz.ytkownik Sebastian Droege napisa?:

Quoted 11 lines

On Fri, 26 Apr 2002 09:41:30 +0200
Martin Dalecki <[email protected]> wrote:

Hi,

(quoted diff) +1 -0
@@ -584,27 +585,25 @@
             drive->failures = 0;
         } else {
             drive->failures++;
+            char *msg = "";
 
Quoted 8 lines
Quoted 2 lines
(quoted diff) +0 -0
 My compiler won't compile that ;)

Declare msg after the function's beginning and it compiles fine

Well it doesn't has to be the function it sufficient to be the beginng of a block. However this is puzzling me, becouse the gcc-3.1 snap eats the above just like if it where a C++ complier!!!

Quoted 2 lines

Note the "mixed declarations and code" @
http://www.gnu.org/software/gcc/gcc-3.0/c99status.html

And see the -std= option for selecting what ou want it to conform to.

MfG Kai

#33 lore raw

PATCH 1/1 2.5.13 IDE 52

In reply to Miles Lane

Fri May 3 17:50:22 CEST 2002 ide-clean-52

Adapted from patch Barłomiej Żołnierkiewicz:

- make straight8 a flag in ata_channel instead of byte

- don't store tables as code in drive_is_flashcard() and ide_xfer_verbose()

- fix init_gendisk() (due to 2.5.13 blksize_size[] change)

- compress region requesting/releasing
in channel_probe() and ide_unregister()

- clean a bit ide_setup_ports()

Start of DMA handling tratment.

- Fix the parameters to ide_build_dmatable() to be channel and request. Rename it to udma_new_table(). udma will mark arch specific functions later.

- Let ide_start_dma() take the request directly as an arguemnt. Rename it to ata_start_dma(). After realizing that the usage of the func argument of it was bogous and that nobody is using rwproc we where able to remove both of them.

- Fix ide_destroy_dmatable() to take the channel as argument and rename it to udma_destroy_table(). This function should have possible architecture specific implementation as well at some point in time.

- Split up the TCQ UDMA handling stuff in to proper functions. Jens must has been dreaming as he introduced them ;-).

arch/cris/drivers/ide.c +21 -27
diff -urN linux-2.5.13/arch/cris/drivers/ide.c linux/arch/cris/drivers/ide.c
@@ -191,7 +191,7 @@
 #define ATA_PIO0_STROBE 19
 #define ATA_PIO0_HOLD    4
 
-static int e100_dmaproc (ide_dma_action_t func, ide_drive_t *drive);
+static int e100_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq);
 static void e100_ideproc (ide_ide_action_t func, ide_drive_t *drive,
 			  void *buffer, unsigned int length);
 
@@ -278,7 +278,7 @@
 
 		hwif->chipset = ide_etrax100;
 		hwif->tuneproc = &tune_e100_ide;
-		hwif->dmaproc = &e100_dmaproc;
+		hwif->udma = &e100_dmaproc;
 		hwif->ata_read = e100_ide_input_data;
 		hwif->ata_write = e100_ide_output_data;
 		hwif->atapi_read = e100_atapi_read;
@@ -564,13 +564,14 @@
 static etrax_dma_descr ata_descrs[MAX_DMA_DESCRS];
 static unsigned int ata_tot_size;
 
+
 /*
- * e100_ide_build_dmatable() prepares a dma request.
- * Returns 0 if all went okay, returns 1 otherwise.
+ * This prepares a dma request.  Returns 0 if all went okay, returns 1
+ * otherwise.
  */
-static int e100_ide_build_dmatable (ide_drive_t *drive)
+
+static int e100_udma_new_table(struct ata_channel *ch, struct request *rq)
 {
-	struct request *rq = HWGROUP(drive)->rq;
 	struct buffer_head *bh = rq->bh;
 	unsigned long size, addr;
 	unsigned int count = 0;
@@ -602,7 +603,7 @@
 		/* did we run out of descriptors? */
 
 		if(count >= MAX_DMA_DESCRS) {
-			printk("%s: too few DMA descriptors\n", drive->name);
+			printk("%s: too few DMA descriptors\n", ch->name);
 			return 1;
 		}
 
@@ -623,7 +624,7 @@
                    size > 131072 only one split is necessary */
 
 		if(size > 65536) {
- 		        /* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
+		        /* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
                         ata_descrs[count].sw_len = 0;  /* 0 means 65536, this is a 16-bit field */
                         ata_descrs[count].ctrl = 0;
                         ata_descrs[count].buf = addr;
@@ -656,7 +657,7 @@
 		return 0;
 	}
 
-	printk("%s: empty DMA table?\n", drive->name);
+	printk("%s: empty DMA table?\n", ch->name);
 	return 1;	/* let the PIO routines handle this weirdness */
 }
 
@@ -695,7 +696,7 @@
 	LED_DISK_READ(0);
 	LED_DISK_WRITE(0);
 
-	dma_stat = drive->channel->dmaproc(ide_dma_end, drive);
+	dma_stat = drive->channel->udma(ide_dma_end, drive, rq);
 	stat = GET_STAT();			/* get drive status */
 	if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
 		if (!dma_stat) {
@@ -726,7 +727,7 @@
  * the caller should revert to PIO for the current request.
  */
 
-static int e100_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
+static int e100_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
 {
         static unsigned int reading; /* static to support ide_dma_begin semantics */
 	int atapi = 0;
@@ -786,24 +787,21 @@
 
 		/* set up the Etrax DMA descriptors */
 
-		if(e100_ide_build_dmatable (drive))
+		if(e100_udma_new_table(drive->channel, rq))
 			return 1;
 
 		if(!atapi) {
 			/* set the irq handler which will finish the request when DMA is done */
-		
 			ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
-			
+
 			/* issue cmd to drive */
-			
 			OUT_BYTE(WIN_READDMA, IDE_COMMAND_REG);
 		}
 
 		/* begin DMA */
-	      
 		*R_DMA_CH3_FIRST = virt_to_phys(ata_descrs);
 		*R_DMA_CH3_CMD   = IO_STATE(R_DMA_CH3_CMD, cmd, start);
-		
+
 		/* initiate a multi word dma read using DMA handshaking */
 		
 		*R_ATA_TRANSFER_CNT =
@@ -820,7 +818,7 @@
 		LED_DISK_READ(1);
 
 		D(printk("dma read of %d bytes.\n", ata_tot_size));
- 
+
 	} else {
 		/* writing */
 
@@ -829,29 +827,25 @@
 
 		/* set up the Etrax DMA descriptors */
 
-		if(e100_ide_build_dmatable (drive))
+		if(e100_udma_new_table(drive->channel, rq))
 			return 1;
 
 		if(!atapi) {
 			/* set the irq handler which will finish the request when DMA is done */
-				
 			ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
-			
+
 			/* issue cmd to drive */
-			
 			OUT_BYTE(WIN_WRITEDMA, IDE_COMMAND_REG);
 		}
 
 		/* begin DMA */
-		
 		*R_DMA_CH2_FIRST = virt_to_phys(ata_descrs);
 		*R_DMA_CH2_CMD   = IO_STATE(R_DMA_CH2_CMD, cmd, start);
-		
+
 		/* initiate a multi word dma write using DMA handshaking */
-		
 		*R_ATA_TRANSFER_CNT =
 			IO_FIELD(R_ATA_TRANSFER_CNT, count, ata_tot_size >> 1);
-		
+
 		*R_ATA_CTRL_DATA =
 			IO_FIELD(R_ATA_CTRL_DATA, data,     IDE_DATA_REG) |
 			IO_STATE(R_ATA_CTRL_DATA, rw,       write) |
@@ -878,7 +872,7 @@
  * --- Marcin Dalecki
  */
 
-void ide_release_dma(struct ata_channel *hwif)
+void ide_release_dma(struct ata_channel *ch)
 {
 	/* empty */
 }
drivers/ide/ata-timing.h +2 -2
diff -urN linux-2.5.13/drivers/ide/ata-timing.h linux/drivers/ide/ata-timing.h
@@ -74,12 +74,12 @@
  * It's a bit elaborate due to the legacy we have to bear.
  */
 
-extern short ata_timing_mode(ide_drive_t *drive, int map);
+extern short ata_timing_mode(struct ata_device *drive, int map);
 extern void ata_timing_quantize(struct ata_timing *t, struct ata_timing *q,
 		int T, int UT);
 extern void ata_timing_merge(struct ata_timing *a, struct ata_timing *b,
 		struct ata_timing *m, unsigned int what);
 extern struct ata_timing* ata_timing_data(short speed);
-extern int ata_timing_compute(ide_drive_t *drive,
+extern int ata_timing_compute(struct ata_device *drive,
 		short speed, struct ata_timing *t, int T, int UT);
 #endif
drivers/ide/cmd64x.c +44 -43

221 lines not on this page · raw message

drivers/ide/hpt34x.c +6 -6
diff -urN linux-2.5.13/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
@@ -312,10 +312,10 @@
  * by HighPoint|Triones Technologies, Inc.
  */
 
-int hpt34x_dmaproc (ide_dma_action_t func, struct ata_device *drive, struct request *rq)
+int hpt34x_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
 {
-	struct ata_channel *hwif = drive->channel;
-	unsigned long dma_base = hwif->dma_base;
+	struct ata_channel *ch = drive->channel;
+	unsigned long dma_base = ch->dma_base;
 	unsigned int count, reading = 0;
 	byte dma_stat;
 
@@ -325,9 +325,9 @@
 		case ide_dma_read:
 			reading = 1 << 3;
 		case ide_dma_write:
-			if (!(count = ide_build_dmatable(drive, func)))
+			if (!(count = udma_new_table(ch, rq)))
 				return 1;	/* try PIO instead of DMA */
-			outl(hwif->dmatable_dma, dma_base + 4); /* PRD table */
+			outl(ch->dmatable_dma, dma_base + 4); /* PRD table */
 			reading |= 0x01;
 			outb(reading, dma_base);		/* specify r/w */
 			outb(inb(dma_base+2)|6, dma_base+2);	/* clear INTR & ERROR flags */
@@ -342,7 +342,7 @@
 			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 */
+			udma_destroy_table(ch);			/* purge DMA mappings */
 			return (dma_stat & 7) != 4;		/* verify good DMA status */
 		default:
 			break;
drivers/ide/icside.c +7 -17
diff -urN linux-2.5.13/drivers/ide/icside.c linux/drivers/ide/icside.c
@@ -242,9 +242,9 @@
 }
 
 static int
-icside_build_dmatable(ide_drive_t *drive, int reading)
+icside_udma_new_table(struct ata_channel *ch, struct request *rq)
 {
-	return drive->channel->sg_nents = ide_build_sglist(drive->channel, HWGROUP(drive)->rq);
+	return ch->sg_nents = ide_build_sglist(ch, rq);
 }
 
 /* Teardown mappings after DMA has completed.  */
@@ -332,7 +332,7 @@
 	int i;
 	byte stat, dma_stat;
 
-	dma_stat = drive->channel->dmaproc(ide_dma_end, drive);
+	dma_stat = drive->channel->udma(ide_dma_end, drive, rq);
 	stat = GET_STAT();			/* get drive status */
 	if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
 		if (!dma_stat) {
@@ -350,7 +350,7 @@
 
 
 static int
-icside_dma_check(ide_drive_t *drive)
+icside_dma_check(struct ata_device *drive, struct request *rq)
 {
 	struct hd_driveid *id = drive->id;
 	struct ata_channel *hwif = drive->channel;
@@ -381,14 +381,7 @@
 out:
 	func = icside_config_if(drive, xfer_mode);
 
-	return hwif->dmaproc(func, drive);
-}
-
-static int
-icside_dma_verbose(ide_drive_t *drive)
-{
-	printk(", DMA");
-	return 1;
+	return hwif->udma(func, drive, rq);
 }
 
 static int
@@ -413,12 +406,12 @@
 		return 0;
 
 	case ide_dma_check:
-		return icside_dma_check(drive);
+		return icside_dma_check(drive, rq);
 
 	case ide_dma_read:
 		reading = 1;
 	case ide_dma_write:
-		count = icside_build_dmatable(drive, reading);
+		count = icside_udma_new_table(hwif, rq);
 		if (!count)
 			return 1;
 		disable_dma(hwif->hw.dma);
@@ -458,9 +451,6 @@
 	case ide_dma_test_irq:
 		return inb((unsigned long)hwif->hw.priv) & 1;
 
-	case ide_dma_verbose:
-		return icside_dma_verbose(drive);
-
 	case ide_dma_timeout:
 	default:
 		printk("icside_dmaproc: unsupported function: %d\n", func);
drivers/ide/ide.c +62 -76

351 lines not on this page · raw message

drivers/ide/ide-cd.c +1 -1
diff -urN linux-2.5.13/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -2652,7 +2652,7 @@
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (drive->using_dma)
-		(void) drive->channel->udma(ide_dma_verbose, drive, NULL);
+		udma_print(drive);
 #endif
 	printk("\n");
 
drivers/ide/ide-disk.c +34 -34

257 lines not on this page · raw message

drivers/ide/ide-dma.c +205 -214

589 lines not on this page · raw message

drivers/ide/ide-features.c +32 -23

61 lines not on this page · raw message

drivers/ide/ide-pmac.c +3 -9
diff -urN linux-2.5.13/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
@@ -1164,9 +1164,9 @@
 
 /* Teardown mappings after DMA has completed.  */
 static void
-pmac_ide_destroy_dmatable (ide_drive_t *drive, int ix)
+pmac_ide_destroy_dmatable(struct ata_channel *ch, int ix)
 {
-	struct pci_dev *dev = drive->channel->pci_dev;
+	struct pci_dev *dev = ch->pci_dev;
 	struct scatterlist *sg = pmac_ide[ix].sg_table;
 	int nents = pmac_ide[ix].sg_nents;
 
@@ -1367,10 +1367,6 @@
 		break;
 	case ide_dma_read:
 	case ide_dma_write:
-		/* this almost certainly isn't needed since we don't
-		   appear to have a rwproc */
-		if (drive->channel->rwproc)
-			drive->channel->rwproc(drive, func);
 		reading = (func == ide_dma_read);
 		if (!pmac_ide_build_dmatable(drive, rq, ix, !reading))
 			return 1;
@@ -1404,7 +1400,7 @@
 		drive->waiting_for_dma = 0;
 		dstat = in_le32(&dma->status);
 		out_le32(&dma->control, ((RUN|WAKE|DEAD) << 16));
-		pmac_ide_destroy_dmatable(drive, ix);
+		pmac_ide_destroy_dmatable(drive->channel, ix);
 		/* verify good dma status */
 		return (dstat & (RUN|DEAD|ACTIVE)) != RUN;
 	case ide_dma_test_irq: /* returns 1 if dma irq issued, 0 otherwise */
@@ -1453,8 +1449,6 @@
 	case ide_dma_bad_drive:
 	case ide_dma_good_drive:
 		return check_drive_lists(drive, (func == ide_dma_good_drive));
-	case ide_dma_verbose:
-		return report_drive_dmaing(drive);
 	case ide_dma_retune:
 	case ide_dma_lostirq:
 	case ide_dma_timeout:
drivers/ide/ide-probe.c +17 -22
diff -urN linux-2.5.13/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -448,7 +448,7 @@
  */
 static void channel_probe(struct ata_channel *ch)
 {
-	unsigned int unit;
+	unsigned int i;
 	unsigned long flags;
 	int error;
 
@@ -463,8 +463,8 @@
 	/*
 	 * Check for the presence of a channel by probing for drives on it.
 	 */
-	for (unit = 0; unit < MAX_DRIVES; ++unit) {
-		struct ata_device *drive = &ch->drives[unit];
+	for (i = 0; i < MAX_DRIVES; ++i) {
+		struct ata_device *drive = &ch->drives[i];
 
 		probe_for_drive(drive);
 
@@ -483,23 +483,8 @@
 		error += !request_region(ch->io_ports[IDE_DATA_OFFSET], 8, ch->name);
 		ch->straight8 = 1;
 	} else {
-		if (ch->io_ports[IDE_DATA_OFFSET])
-			error += !request_region(ch->io_ports[IDE_DATA_OFFSET], 1, ch->name);
-		if (ch->io_ports[IDE_ERROR_OFFSET])
-			error += !request_region(ch->io_ports[IDE_ERROR_OFFSET], 1, ch->name);
-		if (ch->io_ports[IDE_NSECTOR_OFFSET])
-			error += !request_region(ch->io_ports[IDE_NSECTOR_OFFSET], 1, ch->name);
-		if (ch->io_ports[IDE_SECTOR_OFFSET])
-			error += !request_region(ch->io_ports[IDE_SECTOR_OFFSET], 1, ch->name);
-		if (ch->io_ports[IDE_LCYL_OFFSET])
-			error += !request_region(ch->io_ports[IDE_LCYL_OFFSET], 1, ch->name);
-		if (ch->io_ports[IDE_HCYL_OFFSET])
-			error += !request_region(ch->io_ports[IDE_HCYL_OFFSET], 1, ch->name);
-		if (ch->io_ports[IDE_SELECT_OFFSET])
-			error += !request_region(ch->io_ports[IDE_SELECT_OFFSET], 1, ch->name);
-		if (ch->io_ports[IDE_STATUS_OFFSET])
-			error += !request_region(ch->io_ports[IDE_STATUS_OFFSET], 1, ch->name);
-
+		for (i = 0; i < 8; i++)
+			error += !request_region(ch->io_ports[i], 1, ch->name);
 	}
 	if (ch->io_ports[IDE_CONTROL_OFFSET])
 		error += !request_region(ch->io_ports[IDE_CONTROL_OFFSET], 1, ch->name);
@@ -561,8 +546,8 @@
 	/*
 	 * Now setup the PIO transfer modes of the drives on this channel.
 	 */
-	for (unit = 0; unit < MAX_DRIVES; ++unit) {
-		struct ata_device *drive = &ch->drives[unit];
+	for (i = 0; i < MAX_DRIVES; ++i) {
+		struct ata_device *drive = &ch->drives[i];
 
 		if (drive->present && (drive->autotune == 1)) {
 			if (drive->channel->tuneproc)
@@ -819,6 +804,16 @@
 		goto err_kmalloc_gd_part;
 	memset(gd->part, 0, ATA_MINORS * sizeof(struct hd_struct));
 
+	gd->de_arr = kmalloc (sizeof(*gd->de_arr) * MAX_DRIVES, GFP_KERNEL);
+	if (!gd->de_arr)
+		goto err_kmalloc_gd_de_arr;
+	memset(gd->de_arr, 0, sizeof(*gd->de_arr) * MAX_DRIVES);
+
+	gd->flags = kmalloc (sizeof(*gd->flags) * MAX_DRIVES, GFP_KERNEL);
+	if (!gd->flags)
+		goto err_kmalloc_gd_flags;
+	memset(gd->flags, 0, sizeof(*gd->flags) * MAX_DRIVES);
+
 	for (unit = 0; unit < MAX_DRIVES; ++unit)
 		ch->drives[unit].part = &gd->part[unit << PARTN_BITS];
 
drivers/ide/ide-taskfile.c +31 -32

145 lines not on this page · raw message

drivers/ide/Makefile +1 -1
diff -urN linux-2.5.13/drivers/ide/Makefile linux/drivers/ide/Makefile
@@ -10,7 +10,7 @@
 
 O_TARGET := idedriver.o
 
-export-objs		:= ide-taskfile.o ide.o ide-features.o ide-probe.o ataraid.o
+export-objs	:= ide-taskfile.o ide.o ide-features.o ide-probe.o ide-dma.o ataraid.o
 
 obj-y		:=
 obj-m		:=
drivers/ide/ns87415.c +1 -1
diff -urN linux-2.5.13/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
@@ -93,7 +93,7 @@
 			dma_stat = inb(hwif->dma_base+2);
 			outb(inb(hwif->dma_base)&~1, hwif->dma_base);	/* stop DMA */
 			outb(inb(hwif->dma_base)|6, hwif->dma_base);	/* from ERRATA: clear the INTR & ERROR bits */
-			ide_destroy_dmatable(drive);			/* and free any DMA resources */
+			udma_destroy_table(hwif);			/* and free any DMA resources */
 			return (dma_stat & 7) != 4;		/* verify good DMA status */
 		case ide_dma_write:
 		case ide_dma_read:
drivers/ide/tcq.c +114 -121

258 lines not on this page · raw message

drivers/ide/trm290.c +7 -7
diff -urN linux-2.5.13/drivers/ide/trm290.c linux/drivers/ide/trm290.c
@@ -175,7 +175,7 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 static int trm290_dmaproc (ide_dma_action_t func, struct ata_device *drive, struct request *rq)
 {
-	struct ata_channel *hwif = drive->channel;
+	struct ata_channel *ch = drive->channel;
 	unsigned int count, reading = 2, writing = 0;
 
 	switch (func) {
@@ -186,12 +186,12 @@
 			break;	/* always use PIO for writes */
 #endif
 		case ide_dma_read:
-			if (!(count = ide_build_dmatable(drive, func)))
+			if (!(count = udma_new_table(ch, rq)))
 				break;		/* try PIO instead of DMA */
 			trm290_prepare_drive(drive, 1);	/* select DMA xfer */
-			outl(hwif->dmatable_dma|reading|writing, hwif->dma_base);
+			outl(ch->dmatable_dma|reading|writing, ch->dma_base);
 			drive->waiting_for_dma = 1;
-			outw((count * 2) - 1, hwif->dma_base+2); /* start DMA */
+			outw((count * 2) - 1, ch->dma_base+2); /* start DMA */
 			if (drive->type != ATA_DISK)
 				return 0;
 			ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
@@ -201,10 +201,10 @@
 			return 0;
 		case ide_dma_end:
 			drive->waiting_for_dma = 0;
-			ide_destroy_dmatable(drive);		/* purge DMA mappings */
-			return (inw(hwif->dma_base+2) != 0x00ff);
+			udma_destroy_table(ch);	/* purge DMA mappings */
+			return (inw(ch->dma_base + 2) != 0x00ff);
 		case ide_dma_test_irq:
-			return (inw(hwif->dma_base+2) == 0x00ff);
+			return (inw(ch->dma_base + 2) == 0x00ff);
 		default:
 			return ide_dmaproc(func, drive, rq);
 	}
include/linux/ide.h +50 -65

233 lines not on this page · raw message

#34 lore raw

PATCH 1/1 2.5.13 IDE 53

In reply to Miles Lane

Sun May 5 16:26:37 CEST 2002 ide-clean-53

- Start splitting the functions for host chip handling in to separate entities. This change is quite sensitive and may cause some trouble but it's for certain worth it anyway, because it should for example provide a much better infrastructure for th handling of different architectures.

drivers/ide/aec62xx.c +2 -2
diff -urN linux-2.5.13/drivers/ide/aec62xx.c linux/drivers/ide/aec62xx.c
@@ -437,7 +437,7 @@
 
 	if (id && (id->capability & 1) && drive->channel->autodma) {
 		/* Consult the list of known "bad" drives */
-		if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
+		if (udma_black_list(drive)) {
 			dma_func = ide_dma_off;
 			goto fast_ata_pio;
 		}
@@ -459,7 +459,7 @@
 				if (dma_func != ide_dma_on)
 					goto no_dma_set;
 			}
-		} else if (ide_dmaproc(ide_dma_good_drive, drive, NULL)) {
+		} else if (udma_white_list(drive)) {
 			if (id->eide_dma_time > 150) {
 				goto no_dma_set;
 			}
drivers/ide/alim15x3.c +12 -7
diff -urN linux-2.5.13/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
@@ -441,7 +441,7 @@
 
 	if ((id != NULL) && ((id->capability & 1) != 0) && hwif->autodma) {
 		/* Consult the list of known "bad" drives */
-		if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
+		if (udma_black_list(drive)) {
 			dma_func = ide_dma_off;
 			goto fast_ata_pio;
 		}
@@ -463,7 +463,7 @@
 				if (dma_func != ide_dma_on)
 					goto no_dma_set;
 			}
-		} else if (ide_dmaproc(ide_dma_good_drive, drive, NULL)) {
+		} else if (udma_white_list(drive)) {
 			if (id->eide_dma_time > 150) {
 				goto no_dma_set;
 			}
@@ -483,21 +483,25 @@
 	return hwif->udma(dma_func, drive, NULL);
 }
 
+static int ali15x3_udma_write(struct ata_device *drive, struct request *rq)
+{
+	if ((m5229_revision < 0xC2) && (drive->type != ATA_DISK))
+		return 1;	/* try PIO instead of DMA */
+
+	return ata_do_udma(0, drive, rq);
+}
+
 static int ali15x3_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
 {
 	switch(func) {
 		case ide_dma_check:
 			return ali15x3_config_drive_for_dma(drive);
-		case ide_dma_write:
-			if ((m5229_revision < 0xC2) && (drive->type != ATA_DISK))
-				return 1;	/* try PIO instead of DMA */
-			break;
 		default:
 			break;
 	}
 	return ide_dmaproc(func, drive, rq);	/* use standard DMA stuff */
 }
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 
 unsigned int __init pci_init_ali15x3(struct pci_dev *dev)
 {
@@ -679,6 +683,7 @@
 		/*
 		 * M1543C or newer for DMAing
 		 */
+		hwif->udma_write = ali15x3_udma_write;
 		hwif->udma = ali15x3_dmaproc;
 		hwif->autodma = 1;
 	}
drivers/ide/cmd64x.c +53 -39

148 lines not on this page · raw message

drivers/ide/Config.in +5 -7
diff -urN linux-2.5.13/drivers/ide/Config.in linux/drivers/ide/Config.in
@@ -33,16 +33,16 @@
    dep_tristate '  Include IDE/ATAPI FLOPPY support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_BLK_DEV_IDE
    dep_tristate '  SCSI emulation support' CONFIG_BLK_DEV_IDESCSI $CONFIG_BLK_DEV_IDE $CONFIG_SCSI
 
-   comment 'IDE chipset support'
+   comment 'ATA host chipset support'
    dep_bool '  CMD640 chipset bugfix/support' CONFIG_BLK_DEV_CMD640 $CONFIG_X86
    dep_bool '    CMD640 enhanced support' CONFIG_BLK_DEV_CMD640_ENHANCED $CONFIG_BLK_DEV_CMD640
-   dep_bool '  ISA-PNP EIDE support' CONFIG_BLK_DEV_ISAPNP $CONFIG_ISAPNP
+   dep_bool '  ISA-PNP support' CONFIG_BLK_DEV_ISAPNP $CONFIG_ISAPNP
    if [ "$CONFIG_PCI" = "y" ]; then
       dep_bool '  RZ1000 chipset bugfix/support' CONFIG_BLK_DEV_RZ1000 $CONFIG_X86
-      bool '  Generic PCI IDE chipset support' CONFIG_BLK_DEV_IDEPCI
+      bool '  PCI host chipset support' CONFIG_BLK_DEV_IDEPCI
       if [ "$CONFIG_BLK_DEV_IDEPCI" = "y" ]; then
 	 bool '    Boot off-board chipsets first support' CONFIG_BLK_DEV_OFFBOARD
-	 bool '    Sharing PCI IDE interrupts support' CONFIG_IDEPCI_SHARE_IRQ
+	 bool '    Sharing PCI ATA interrupts support' CONFIG_IDEPCI_SHARE_IRQ
 	 bool '    Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA_PCI
 	 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
@@ -82,11 +82,9 @@
 	 dep_bool '    SiS5513 chipset support' CONFIG_BLK_DEV_SIS5513 $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_X86
 	 dep_bool '    Tekram TRM290 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_TRM290 $CONFIG_BLK_DEV_IDEDMA_PCI
 	 dep_bool '    VIA chipset support' CONFIG_BLK_DEV_VIA82CXXX $CONFIG_BLK_DEV_IDEDMA_PCI
+	 dep_bool '    Winbond SL82c105 support' CONFIG_BLK_DEV_SL82C105 $CONFIG_BLK_DEV_IDEDMA_PCI
       fi
 
-      if [ "$CONFIG_PPC" = "y" -o "$CONFIG_ARM" = "y" ]; then
-	 bool '    Winbond SL82c105 support' CONFIG_BLK_DEV_SL82C105
-      fi
    fi
    if [ "$CONFIG_ALL_PPC" = "y" ]; then
       bool '    Builtin PowerMac IDE support' CONFIG_BLK_DEV_IDE_PMAC
drivers/ide/cs5530.c +2 -2
diff -urN linux-2.5.13/drivers/ide/cs5530.c linux/drivers/ide/cs5530.c
@@ -158,7 +158,7 @@
 	 */
 	if (mate->present) {
 		struct hd_driveid *mateid = mate->id;
-		if (mateid && (mateid->capability & 1) && !hwif->udma(ide_dma_bad_drive, mate, NULL)) {
+		if (mateid && (mateid->capability & 1) && !udma_black_list(mate)) {
 			if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7))
 				udma_ok = 1;
 			else if ((mateid->field_valid & 2) && (mateid->dma_mword & 7))
@@ -172,7 +172,7 @@
 	 * Now see what the current drive is capable of,
 	 * selecting UDMA only if the mate said it was ok.
 	 */
-	if (id && (id->capability & 1) && hwif->autodma && !hwif->udma(ide_dma_bad_drive, drive, NULL)) {
+	if (id && (id->capability & 1) && hwif->autodma && !udma_black_list(drive)) {
 		if (udma_ok && (id->field_valid & 4) && (id->dma_ultra & 7)) {
 			if      (id->dma_ultra & 4)
 				mode = XFER_UDMA_2;
drivers/ide/hpt34x.c +56 -32

128 lines not on this page · raw message

drivers/ide/hpt366.c +86 -20

148 lines not on this page · raw message

drivers/ide/ide.c +8 -1
diff -urN linux-2.5.13/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -1407,7 +1407,7 @@
 	/*
 	 * end current dma transaction
 	 */
-	ch->udma(ide_dma_end, drive, rq);
+	ch->udma_stop(drive);
 
 	/*
 	 * complain a little, later we might remove some of this verbosity
@@ -2127,6 +2127,13 @@
 	ch->atapi_read = old.atapi_read;
 	ch->atapi_write = old.atapi_write;
 	ch->udma = old.udma;
+	ch->udma_start = old.udma_start;
+	ch->udma_stop = old.udma_stop;
+	ch->udma_read = old.udma_read;
+	ch->udma_write = old.udma_write;
+	ch->udma_irq_status = old.udma_irq_status;
+	ch->udma_timeout = old.udma_timeout;
+	ch->udma_lost_irq = old.udma_lost_irq;
 	ch->busproc = old.busproc;
 	ch->bus_state = old.bus_state;
 	ch->dma_base = old.dma_base;
drivers/ide/ide-cd.c +5 -5
diff -urN linux-2.5.13/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -737,9 +737,9 @@
 
 	if (info->dma) {
 		if (info->cmd == READ)
-			info->dma = !drive->channel->udma(ide_dma_read, drive, rq);
+			info->dma = !udma_read(drive, rq);
 		else if (info->cmd == WRITE)
-			info->dma = !drive->channel->udma(ide_dma_write, drive, rq);
+			info->dma = !udma_write(drive, rq);
 		else
 			printk("ide-cd: DMA set, but not allowed\n");
 	}
@@ -755,7 +755,7 @@
 		OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
 
 	if (info->dma)
-		drive->channel->udma(ide_dma_begin, drive, NULL);
+		udma_start(drive, rq);
 
 	if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
 		ide_set_handler(drive, handler, WAIT_CMD, cdrom_timer_expiry);
@@ -905,7 +905,7 @@
 	/* Check for errors. */
 	if (dma) {
 		info->dma = 0;
-		if ((dma_error = drive->channel->udma(ide_dma_end, drive, NULL)))
+		if ((dma_error = udma_stop(drive)))
 			drive->channel->udma(ide_dma_off, drive, NULL);
 	}
 
@@ -1480,7 +1480,7 @@
 	/* Check for errors. */
 	if (dma) {
 		info->dma = 0;
-		if ((dma_error = drive->channel->udma(ide_dma_end, drive, NULL))) {
+		if ((dma_error = udma_stop(drive))) {
 			printk("ide-cd: write dma error\n");
 			drive->channel->udma(ide_dma_off, drive, NULL);
 		}
drivers/ide/ide-dma.c +217 -46

331 lines not on this page · raw message

drivers/ide/ide-floppy.c +8 -4
diff -urN linux-2.5.13/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
@@ -901,7 +901,7 @@
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (test_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
-		if (drive->channel->udma(ide_dma_end, drive, NULL)) {
+		if (udma_stop(drive)) {
 			set_bit (PC_DMA_ERROR, &pc->flags);
 		} else {
 			pc->actually_transferred=pc->request_transfer;
@@ -1122,8 +1122,12 @@
 	if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) {
 		(void) drive->channel->udma(ide_dma_off, drive, NULL);
 	}
-	if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
-		dma_ok=!drive->channel->udma(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive, rq);
+	if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
+		if (test_bit (PC_WRITING, &pc->flags))
+			dma_ok = !udma_write(drive, rq);
+		else
+			dma_ok = !udma_read(drive, rq);
+	}
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
 	if (IDE_CONTROL_REG)
@@ -1136,7 +1140,7 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (dma_ok) {							/* Begin DMA, if necessary */
 		set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
-		(void) drive->channel->udma(ide_dma_begin, drive, NULL);
+		udma_start(drive, rq);
 	}
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
drivers/ide/ide-pci.c +12 -12
diff -urN linux-2.5.13/drivers/ide/ide-pci.c linux/drivers/ide/ide-pci.c
@@ -709,7 +709,7 @@
 		d->bootable = (pcicmd & PCI_COMMAND_MEMORY) ? OFF_BOARD : NEVER_BOARD;
 	}
 
-	printk("%s: chipset revision %d\n", dev->name, class_rev);
+	printk(KERN_INFO "ATA: chipset rev.: %d\n", class_rev);
 
 	/*
 	 * Can we trust the reported IRQ?
@@ -722,11 +722,11 @@
 		   to act otherwise on those. The Supertrak however we need
 		   to skip */
 		if (d->vendor == PCI_VENDOR_ID_PROMISE && d->device == PCI_DEVICE_ID_PROMISE_20265) {
-			printk(KERN_INFO "ide: Found promise 20265 in RAID mode.\n");
+			printk(KERN_INFO "ATA: Found promise 20265 in RAID mode.\n");
 			if(dev->bus->self && dev->bus->self->vendor == PCI_VENDOR_ID_INTEL &&
 				dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960)
 			{
-				printk(KERN_INFO "ide: Skipping Promise PDC20265 attached to I2O RAID controller.\n");
+				printk(KERN_INFO "ATA: Skipping Promise PDC20265 attached to I2O RAID controller.\n");
 				return;
 			}
 		}
@@ -734,9 +734,10 @@
 		   Suspect a fastrak and fall through */
 	}
 	if ((dev->class & ~(0xfa)) != ((PCI_CLASS_STORAGE_IDE << 8) | 5)) {
-		printk("%s: not 100%% native mode: will probe irqs later\n", dev->name);
+		printk(KERN_INFO "ATA: non-legacy mode: IRQ probe delayed\n");
+
 		/*
-		 * This allows off board ide-pci cards the enable a BIOS,
+		 * This allows off board ide-pci cards to enable a BIOS,
 		 * verify interrupt settings of split-mirror pci-config
 		 * space, place chipset into init-mode, and/or preserve
 		 * an interrupt if the card is not native ide support.
@@ -746,19 +747,18 @@
 		else
 			pciirq = trust_pci_irq(d, dev);
 	} else if (tried_config) {
-		printk("%s: will probe IRQs later\n", dev->name);
+		printk(KERN_INFO "ATA: will probe IRQs later\n");
 		pciirq = 0;
 	} else if (!pciirq) {
-		printk("%s: bad IRQ (%d): will probe later\n", dev->name, pciirq);
+		printk(KERN_INFO "ATA: invalid IRQ (%d): will probe later\n", pciirq);
 		pciirq = 0;
 	} else {
 		if (d->init_chipset)
 			d->init_chipset(dev);
 #ifdef __sparc__
-		printk("%s: 100%% native mode on irq %s\n",
-		       dev->name, __irq_itoa(pciirq));
+		printk(KERN_INFO "ATA: 100%% native mode on irq\n", __irq_itoa(pciirq));
 #else
-		printk("%s: 100%% native mode on irq %d\n", dev->name, pciirq);
+		printk(KERN_INFO "ATA: 100%% native mode on irq %d\n", pciirq);
 #endif
 	}
 
@@ -889,10 +889,10 @@
 		pdc20270_device_order_fixup(dev, d);
 	else if (!(d->vendor == 0 && d->device == 0) || (dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
 		if (d->vendor == 0 && d->device == 0)
-			printk(KERN_INFO "ATA: unknown ATA interface %s (%04x:%04x) on PCI slot %s\n",
+			printk(KERN_INFO "ATA: unknown interface: %s (%04x:%04x) on PCI slot %s\n",
 			       dev->name, vendor, device, dev->slot_name);
 		else
-			printk(KERN_INFO "ATA: interface %s on PCI slot %s\n", dev->name, dev->slot_name);
+			printk(KERN_INFO "ATA: interface: %s, on PCI slot %s\n", dev->name, dev->slot_name);
 		setup_pci_device(dev, d);
 	}
 }
drivers/ide/ide-pmac.c +0 -1
diff -urN linux-2.5.13/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
@@ -1449,7 +1449,6 @@
 	case ide_dma_bad_drive:
 	case ide_dma_good_drive:
 		return check_drive_lists(drive, (func == ide_dma_good_drive));
-	case ide_dma_retune:
 	case ide_dma_lostirq:
 	case ide_dma_timeout:
 		printk(KERN_WARNING "ide_pmac_dmaproc: chipset supported func only: %d\n", func);
drivers/ide/ide-tape.c +9 -5
diff -urN linux-2.5.13/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
@@ -2058,7 +2058,7 @@
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (test_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
-		if (drive->channel->udma(ide_dma_end, drive, NULL)) {
+		if (udma_stop(drive)) {
 			/*
 			 * A DMA error is sometimes expected. For example,
 			 * if the tape is crossing a filemark during a
@@ -2311,9 +2311,13 @@
 		printk (KERN_WARNING "ide-tape: DMA disabled, reverting to PIO\n");
 		(void) drive->channel->udma(ide_dma_off, drive, NULL);
 	}
-	if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
-		dma_ok = !drive->channel->udma(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive, rq);
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+	if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
+		if (test_bit (PC_WRITING, &pc->flags))
+			dma_ok = !udma_write(drive, rq);
+		else
+			dma_ok = !udma_read(drive, rq);
+	}
+#endif
 
 	if (IDE_CONTROL_REG)
 		OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
@@ -2324,7 +2328,7 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (dma_ok) {						/* Begin DMA, if necessary */
 		set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
-		(void) drive->channel->udma(ide_dma_begin, drive, NULL);
+		udma_start(drive, rq);
 	}
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 	if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) {
drivers/ide/ide-taskfile.c +2 -7
diff -urN linux-2.5.13/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
@@ -461,7 +461,6 @@
 		 * regular dma proc -- basically split stuff that needs to act
 		 * on a request from things like ide_dma_check etc.
 		 */
-		ide_dma_action_t dma_act;
 
 		if (!drive->using_dma)
 			return ide_started;
@@ -469,10 +468,10 @@
 		/* for dma commands we don't set the handler */
 		if (args->taskfile.command == WIN_WRITEDMA
 		 || args->taskfile.command == WIN_WRITEDMA_EXT)
-			dma_act = ide_dma_write;
+			udma_write(drive, rq);
 		else if (args->taskfile.command == WIN_READDMA
 		      || args->taskfile.command == WIN_READDMA_EXT)
-			dma_act = ide_dma_read;
+			udma_read(drive, rq);
 #ifdef CONFIG_BLK_DEV_IDE_TCQ
 		else if (args->taskfile.command == WIN_WRITEDMA_QUEUED
 		      || args->taskfile.command == WIN_WRITEDMA_QUEUED_EXT
@@ -484,10 +483,6 @@
 			printk("ata_taskfile: unknown command %x\n", args->taskfile.command);
 			return ide_stopped;
 		}
-
-
-		if (drive->channel->udma(dma_act, drive, rq))
-			return ide_stopped;
 	}
 
 	return ide_started;
drivers/ide/ns87415.c +46 -18

80 lines not on this page · raw message

drivers/ide/pdc202xx.c +98 -32

174 lines not on this page · raw message

drivers/ide/serverworks.c +45 -35

117 lines not on this page · raw message

drivers/ide/sis5513.c +2 -2
diff -urN linux-2.5.13/drivers/ide/sis5513.c linux/drivers/ide/sis5513.c
@@ -685,7 +685,7 @@
 
 	if (id && (id->capability & 1) && drive->channel->autodma) {
 		/* Consult the list of known "bad" drives */
-		if (ide_dmaproc(ide_dma_bad_drive, drive, NULL)) {
+		if (udma_black_list(drive)) {
 			dma_func = ide_dma_off;
 			goto fast_ata_pio;
 		}
@@ -707,7 +707,7 @@
 				if (dma_func != ide_dma_on)
 					goto no_dma_set;
 			}
-		} else if ((ide_dmaproc(ide_dma_good_drive, drive, NULL)) &&
+		} else if ((udma_white_list(drive)) &&
 			   (id->eide_dma_time > 150)) {
 			/* Consult the list of known "good" drives */
 			dma_func = config_chipset_for_dma(drive, 0);
drivers/ide/sl82c105.c +12 -12
diff -urN linux-2.5.13/drivers/ide/sl82c105.c linux/drivers/ide/sl82c105.c
@@ -114,7 +114,7 @@
  * Check to see if the drive and
  * chipset is capable of DMA mode
  */
-static int sl82c105_check_drive(ide_drive_t *drive)
+static int sl82c105_check_drive(ide_drive_t *drive, struct request *rq)
 {
 	ide_dma_action_t dma_func = ide_dma_off_quietly;
 
@@ -129,7 +129,7 @@
 			break;
 
 		/* Consult the list of known "bad" drives */
-		if (ide_dmaproc(ide_dma_bad_drive, drive)) {
+		if (udma_black_list(drive)) {
 			dma_func = ide_dma_off;
 			break;
 		}
@@ -140,23 +140,23 @@
 			break;
 		}
 
-		if (ide_dmaproc(ide_dma_good_drive, drive)) {
+		if (udma_white_list(drive)) {
 			dma_func = ide_dma_on;
 			break;
 		}
 	} while (0);
 
-	return drive->channel->dmaproc(dma_func, drive);
+	return drive->channel->udma(dma_func, drive, rq);
 }
 
 /*
  * Our own dmaproc, only to intercept ide_dma_check
  */
-static int sl82c105_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
+static int sl82c105_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
 {
 	switch (func) {
 	case ide_dma_check:
-		return sl82c105_check_drive(drive);
+		return sl82c105_check_drive(drive, rq);
 	case ide_dma_on:
 		if (config_for_dma(drive))
 			func = ide_dma_off;
@@ -168,7 +168,7 @@
 	default:
 		break;
 	}
-	return ide_dmaproc(func, drive);
+	return ide_dmaproc(func, drive, rq);
 }
 
 /*
@@ -183,8 +183,8 @@
 	 * We support 32-bit I/O on this interface, and it
 	 * doesn't have problems with interrupts.
 	 */
-	drive->io_32bit = 1;
-	drive->unmask = 1;
+	drive->channel->io_32bit = 1;
+	drive->channel->unmask = 1;
 }
 
 /*
@@ -252,10 +252,10 @@
 	}
 	outb(dma_state, dma_base + 2);
 
-	hwif->dmaproc = NULL;
+	hwif->udma = NULL;
 	ide_setup_dma(hwif, dma_base, 8);
-	if (hwif->dmaproc)
-		hwif->dmaproc = sl82c105_dmaproc;
+	if (hwif->udma)
+		hwif->udma = sl82c105_dmaproc;
 }
 
 /*
drivers/ide/tcq.c +3 -3
diff -urN linux-2.5.13/drivers/ide/tcq.c linux/drivers/ide/tcq.c
@@ -95,7 +95,7 @@
 	del_timer(&hwgroup->timer);
 
 	if (test_bit(IDE_DMA, &hwgroup->flags))
-		drive->channel->udma(ide_dma_end, drive, hwgroup->rq);
+		udma_stop(drive);
 
 	blk_queue_invalidate_tags(q);
 
@@ -328,7 +328,7 @@
 	/*
 	 * transfer was in progress, stop DMA engine
 	 */
-	dma_stat = drive->channel->udma(ide_dma_end, drive, rq);
+	dma_stat = udma_stop(drive);
 
 	/*
 	 * must be end of I/O, check status and complete as necessary
@@ -531,7 +531,7 @@
 		return ide_stopped;
 
 	set_irq(drive, ide_dmaq_intr);
-	if (!ch->udma(ide_dma_begin, drive, rq))
+	if (!udma_start(drive, rq))
 		return ide_started;
 
 	return ide_stopped;
drivers/ide/trm290.c +66 -25

108 lines not on this page · raw message

drivers/scsi/ide-scsi.c +8 -4
diff -urN linux-2.5.13/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
@@ -328,7 +328,7 @@
 		printk ("ide-scsi: %s: DMA complete\n", drive->name);
 #endif /* IDESCSI_DEBUG_LOG */
 		pc->actually_transferred=pc->request_transfer;
-		(void) drive->channel->udma(ide_dma_end, drive, NULL);
+		udma_stop(drive);
 	}
 
 	status = GET_STAT();						/* Clear the interrupt */
@@ -429,8 +429,12 @@
 	pc->current_position=pc->buffer;
 	bcount = min(pc->request_transfer, 63 * 1024);		/* Request to transfer the entire buffer at once */
 
-	if (drive->using_dma && rq->bio)
-		dma_ok = !drive->channel->udma(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive, rq);
+	if (drive->using_dma && rq->bio) {
+		if (test_bit (PC_WRITING, &pc->flags))
+			dma_ok = !udma_write(drive, rq);
+		else
+			dma_ok = !udma_read(drive, rq);
+	}
 
 	SELECT_DRIVE(drive->channel, drive);
 	if (IDE_CONTROL_REG)
@@ -441,7 +445,7 @@
 
 	if (dma_ok) {
 		set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
-		(void) drive->channel->udma(ide_dma_begin, drive, NULL);
+		udma_start(drive, rq);
 	}
 	if (test_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
 		ide_set_handler(drive, idescsi_transfer_pc, get_timeout(pc), NULL);
include/linux/ide.h +26 -7
diff -urN linux-2.5.13/include/linux/ide.h linux/include/linux/ide.h
@@ -375,15 +375,10 @@
 } ide_drive_t;
 
 typedef enum {
-	ide_dma_read,	ide_dma_write,
-	ide_dma_begin,	ide_dma_end,
 	ide_dma_check,
 	ide_dma_on, ide_dma_off,
 	ide_dma_off_quietly,
 	ide_dma_test_irq,
-	ide_dma_bad_drive,
-	ide_dma_good_drive,
-	ide_dma_retune,
 	ide_dma_lostirq,
 	ide_dma_timeout
 } ide_dma_action_t;
@@ -437,7 +432,19 @@
 	void (*atapi_read)(struct ata_device *, void *, unsigned int);
 	void (*atapi_write)(struct ata_device *, void *, unsigned int);
 
-	int (*udma)(ide_dma_action_t, struct ata_device *, struct request *); /* dma read/write/abort routine */
+	int (*udma)(ide_dma_action_t, struct ata_device *, struct request *);
+
+	int (*udma_start) (struct ata_device *, struct request *rq);
+	int (*udma_stop) (struct ata_device *);
+
+	int (*udma_read) (struct ata_device *, struct request *rq);
+	int (*udma_write) (struct ata_device *, struct request *rq);
+
+	int (*udma_irq_status) (struct ata_device *);
+
+	void (*udma_timeout) (struct ata_device *);
+	void (*udma_lost_irq) (struct ata_device *);
+
 	unsigned int	*dmatable_cpu;	/* dma physical region descriptor table (cpu view) */
 	dma_addr_t	dmatable_dma;	/* dma physical region descriptor table (dma view) */
 	struct scatterlist *sg_table;	/* Scatter-gather list used to build the above */
@@ -874,13 +881,25 @@
 extern void udma_destroy_table(struct ata_channel *);
 extern void udma_print(struct ata_device *);
 
+extern void udma_enable(struct ata_device *, int, int);
+extern int udma_black_list(struct ata_device *);
+extern int udma_white_list(struct ata_device *);
+extern void udma_timeout(struct ata_device *);
+extern void udma_lost_irq(struct ata_device *);
+extern int udma_start(struct ata_device *, struct request *rq);
+extern int udma_stop(struct ata_device *);
+extern int udma_read(struct ata_device *, struct request *rq);
+extern int udma_write(struct ata_device *, struct request *rq);
+extern int udma_irq_status(struct ata_device *);
+
+extern int ata_do_udma(unsigned int reading, struct ata_device *drive, struct request *rq);
+
 extern ide_startstop_t udma_tcq_taskfile(struct ata_device *, struct request *);
 extern int udma_tcq_enable(struct ata_device *, int);
 
 extern ide_startstop_t ide_dma_intr(struct ata_device *, struct request *);
 extern int check_drive_lists(struct ata_device *, int good_bad);
 extern int ide_dmaproc(ide_dma_action_t func, struct ata_device *, struct request *);
-extern ide_startstop_t ide_tcq_dmaproc(ide_dma_action_t, struct ata_device *, struct request *);
 extern void ide_release_dma(struct ata_channel *);
 extern void ide_setup_dma(struct ata_channel *,	unsigned long, unsigned int) __init;
 extern int ata_start_dma(struct ata_device *, struct request *rq);
#35 lore raw

[PATCH 2.5.13 IDE 54

In reply to Miles Lane

Sun May 5 16:32:22 CEST 2002 ide-clean-54

- Finish the changes from patch 53. ide_dma_actaion_t is gone now as well as whole hidden code paths associated with it. I hope I didn't mess too many things up with this, since the sheer size of the changes make them sensitive. (Tested on tree different host chip sets so it shouldn't be too bad...)

Just still some minor cleanup remaining to be done in this area. The tags lefts there are intentional.

In esp. the ide_dma_on method in cy82c693 looks suspicious.

Using udma_enable in ide-cd.c, ide-floppy.c and ide-tape.c is suspicious as well. We have just uncovered it.

In the next round we will concentrate on the fixes people did send me last time.

drivers/ide/aec62xx.c +36 -58
diff -urN linux-2.5.13/drivers/ide/aec62xx.c linux/drivers/ide/aec62xx.c
@@ -310,7 +310,7 @@
 	byte speed		= -1;
 
 	if (drive->type != ATA_DISK)
-		return ide_dma_off_quietly;
+		return 0;
 
 	if (((id->dma_ultra & 0x0010) ||
 	     (id->dma_ultra & 0x0008) ||
@@ -333,17 +333,17 @@
 	} else if (id->dma_1word & 0x0001) {
 		speed = XFER_SW_DMA_0;
 	} else {
- 		return ((int) ide_dma_off_quietly);
- 	}
+		return 0;
+	}
 
 	outb(inb(dma_base+2) & ~(1<<(5+unit)), dma_base+2);
 	(void) aec6210_tune_chipset(drive, speed);
 
-	return ((int)	((id->dma_ultra >> 11) & 3) ? ide_dma_off :
-			((id->dma_ultra >> 8) & 7) ? ide_dma_on :
-			((id->dma_mword >> 8) & 7) ? ide_dma_on :
-			((id->dma_1word >> 8) & 7) ? ide_dma_on :
-						     ide_dma_off_quietly);
+	return ((int)	((id->dma_ultra >> 11) & 3) ? 0 :
+			((id->dma_ultra >> 8) & 7) ? 1 :
+			((id->dma_mword >> 8) & 7) ? 1 :
+			((id->dma_1word >> 8) & 7) ? 1 :
+						     0);
 }
 
 static int config_aec6260_chipset_for_dma (ide_drive_t *drive, byte ultra)
@@ -356,7 +356,7 @@
 	byte ultra66		= eighty_ninty_three(drive);
 
 	if (drive->type != ATA_DISK)
-		return ((int) ide_dma_off_quietly);
+		return 0;
 
 	if ((id->dma_ultra & 0x0010) && (ultra) && (ultra66)) {
 		speed = XFER_UDMA_4;
@@ -381,17 +381,17 @@
 	} else if (id->dma_1word & 0x0001) {
 		speed = XFER_SW_DMA_0;
 	} else {
-		return ((int) ide_dma_off_quietly);
+		return 0;
 	}
 
 	outb(inb(dma_base+2) & ~(1<<(5+unit)), dma_base+2);
 	(void) aec6260_tune_chipset(drive, speed);
 
-	return ((int)	((id->dma_ultra >> 11) & 3) ? ide_dma_on :
-			((id->dma_ultra >> 8) & 7) ? ide_dma_on :
-			((id->dma_mword >> 8) & 7) ? ide_dma_on :
-			((id->dma_1word >> 8) & 7) ? ide_dma_on :
-						     ide_dma_off_quietly);
+	return ((int)	((id->dma_ultra >> 11) & 3) ? 1 :
+			((id->dma_ultra >> 8) & 7) ? 1 :
+			((id->dma_mword >> 8) & 7) ? 1 :
+			((id->dma_1word >> 8) & 7) ? 1 :
+						     0);
 }
 
 static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
@@ -403,7 +403,7 @@
 		case PCI_DEVICE_ID_ARTOP_ATP860R:
 			return config_aec6260_chipset_for_dma(drive, ultra);
 		default:
-			return ((int) ide_dma_off_quietly);
+			return 0;
 	}
 }
 
@@ -433,21 +433,23 @@
 static int config_drive_xfer_rate (ide_drive_t *drive)
 {
 	struct hd_driveid *id = drive->id;
-	ide_dma_action_t dma_func = ide_dma_on;
+	int on = 1;
+	int verbose = 1;
 
 	if (id && (id->capability & 1) && drive->channel->autodma) {
 		/* Consult the list of known "bad" drives */
 		if (udma_black_list(drive)) {
-			dma_func = ide_dma_off;
+			on = 0;
 			goto fast_ata_pio;
 		}
-		dma_func = ide_dma_off_quietly;
+		on = 0;
+		verbose = 0;
 		if (id->field_valid & 4) {
 			if (id->dma_ultra & 0x001F) {
 				/* Force if Capable UltraDMA */
-				dma_func = config_chipset_for_dma(drive, 1);
+				on = config_chipset_for_dma(drive, 1);
 				if ((id->field_valid & 2) &&
-				    (dma_func != ide_dma_on))
+				    (!on))
 					goto try_dma_modes;
 			}
 		} else if (id->field_valid & 2) {
@@ -455,8 +457,8 @@
 			if ((id->dma_mword & 0x0007) ||
 			    (id->dma_1word & 0x0007)) {
 				/* Force if Capable regular DMA modes */
-				dma_func = config_chipset_for_dma(drive, 0);
-				if (dma_func != ide_dma_on)
+				on = config_chipset_for_dma(drive, 0);
+				if (!on)
 					goto no_dma_set;
 			}
 		} else if (udma_white_list(drive)) {
@@ -464,53 +466,29 @@
 				goto no_dma_set;
 			}
 			/* Consult the list of known "good" drives */
-			dma_func = config_chipset_for_dma(drive, 0);
-			if (dma_func != ide_dma_on)
+			on = config_chipset_for_dma(drive, 0);
+			if (!on)
 				goto no_dma_set;
 		} else {
 			goto fast_ata_pio;
 		}
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 fast_ata_pio:
-		dma_func = ide_dma_off_quietly;
+		on = 0;
+		verbose = 0;
 no_dma_set:
 		aec62xx_tune_drive(drive, 5);
 	}
-	return drive->channel->udma(dma_func, drive, NULL);
+	udma_enable(drive, on, verbose);
+	return 0;
 }
 
-/*
- * aec62xx_dmaproc() initiates/aborts (U)DMA read/write operations on a drive.
- */
-int aec62xx_dmaproc (ide_dma_action_t func, struct ata_device *drive, struct request *rq)
+int aec62xx_dmaproc(struct ata_device *drive)
 {
-	switch (func) {
-		case ide_dma_check:
-			return config_drive_xfer_rate(drive);
-		case ide_dma_lostirq:
-		case ide_dma_timeout:
-			switch(drive->channel->pci_dev->device) {
-				case PCI_DEVICE_ID_ARTOP_ATP860:
-				case PCI_DEVICE_ID_ARTOP_ATP860R:
-//					{
-//						int i = 0;
-//						byte reg49h = 0;
-//						pci_read_config_byte(drive->channel->pci_dev, 0x49, &reg49h);
-//						for (i=0;i<256;i++)
-//							pci_write_config_byte(drive->channel->pci_dev, 0x49, reg49h|0x10);
-//						pci_write_config_byte(drive->channel->pci_dev, 0x49, reg49h & ~0x10);
-//					}
-//					return 0;
-				default:
-					break;
-			}
-		default:
-			break;
-	}
-	return ide_dmaproc(func, drive, rq);	/* use standard DMA stuff */
+	return config_drive_xfer_rate(drive);
 }
-#endif /* CONFIG_BLK_DEV_IDEDMA */
-#endif /* CONFIG_AEC62XX_TUNING */
+#endif
+#endif
 
 unsigned int __init pci_init_aec62xx (struct pci_dev *dev)
 {
@@ -546,7 +524,7 @@
 	hwif->speedproc = aec62xx_tune_chipset;
 # ifdef CONFIG_BLK_DEV_IDEDMA
 	if (hwif->dma_base)
-		hwif->udma = aec62xx_dmaproc;
+		hwif->XXX_udma = aec62xx_dmaproc;
 	hwif->highmem = 1;
 # else
 	hwif->drives[0].autotune = 1;
drivers/ide/alim15x3.c +31 -29

130 lines not on this page · raw message

drivers/ide/amd74xx.c +8 -21
diff -urN linux-2.5.13/drivers/ide/amd74xx.c linux/drivers/ide/amd74xx.c
@@ -275,36 +275,23 @@
 }
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-
-/*
- * amd74xx_dmaproc() is a callback from upper layers that can do
- * a lot, but we use it for DMA/PIO tuning only, delegating everything
- * else to the default ide_dmaproc().
- */
-
-int amd74xx_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
+int amd74xx_dmaproc(struct ata_device *drive)
 {
+	short w80 = drive->channel->udma_four;
 
-	if (func == ide_dma_check) {
-
-		short w80 = drive->channel->udma_four;
-
-		short speed = ata_timing_mode(drive,
+	short speed = ata_timing_mode(drive,
 			XFER_PIO | XFER_EPIO | XFER_MWDMA | XFER_UDMA |
 			((amd_config->flags & AMD_BAD_SWDMA) ? 0 : XFER_SWDMA) |
 			(w80 && (amd_config->flags & AMD_UDMA) >= AMD_UDMA_66 ? XFER_UDMA_66 : 0) |
 			(w80 && (amd_config->flags & AMD_UDMA) >= AMD_UDMA_100 ? XFER_UDMA_100 : 0));
 
-		amd_set_drive(drive, speed);
+	amd_set_drive(drive, speed);
 
-		func = (drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO)
-			? ide_dma_on : ide_dma_off_quietly;
-	}
+	udma_enable(drive, drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO, 0);
 
-	return ide_dmaproc(func, drive, rq);
+	return 0;
 }
-
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 
 /*
  * The initialization callback. Here we determine the IDE chip type
@@ -433,7 +420,7 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (hwif->dma_base) {
 		hwif->highmem = 1;
-		hwif->udma = amd74xx_dmaproc;
+		hwif->XXX_udma = amd74xx_dmaproc;
 # ifdef CONFIG_IDEDMA_AUTO
 		if (!noautodma)
 			hwif->autodma = 1;
drivers/ide/cmd64x.c +65 -74

254 lines not on this page · raw message

drivers/ide/cs5530.c +9 -19
diff -urN linux-2.5.13/drivers/ide/cs5530.c linux/drivers/ide/cs5530.c
@@ -144,7 +144,7 @@
 	/*
 	 * Default to DMA-off in case we run into trouble here.
 	 */
-	hwif->udma(ide_dma_off_quietly, drive, NULL);
+	udma_enable(drive, 0, 0);
 	outb(inb(hwif->dma_base+2)&~(unit?0x40:0x20), hwif->dma_base+2); /* clear DMA_capable bit */
 
 	/*
@@ -229,26 +229,16 @@
 	/*
 	 * Finally, turn DMA on in software, and exit.
 	 */
-	return hwif->udma(ide_dma_on, drive, NULL);	/* success */
+	udma_enable(drive, 1, 1);	/* success */
+
+	return 0;
 }
 
-/*
- * This is a CS5530-specific wrapper for the standard ide_dmaproc().
- * We need it for our custom "ide_dma_check" function.
- * All other requests are forwarded to the standard ide_dmaproc().
- */
-int cs5530_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
+int cs5530_dmaproc(struct ata_device *drive)
 {
-	switch (func) {
-		case ide_dma_check:
-			return cs5530_config_dma(drive);
-		default:
-			break;
-	}
-	/* Other cases are done by generic IDE-DMA code. */
-	return ide_dmaproc(func, drive, rq);
+	return cs5530_config_dma(drive);
 }
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 
 /*
  * Initialize the cs5530 bridge for reliable IDE DMA operation.
@@ -353,11 +343,11 @@
 		unsigned int basereg, d0_timings;
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-	hwif->udma = cs5530_dmaproc;
+	hwif->XXX_udma = cs5530_dmaproc;
 	hwif->highmem = 1;
 #else
 	hwif->autodma = 0;
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 
 		hwif->tuneproc = &cs5530_tuneproc;
 		basereg = CS5530_BASEREG(hwif);
drivers/ide/cy82c693.c +54 -55

241 lines not on this page · raw message

drivers/ide/hpt34x.c +29 -33

133 lines not on this page · raw message

drivers/ide/hpt366.c +46 -88

215 lines not on this page · raw message

drivers/ide/ide.c +17 -23
diff -urN linux-2.5.13/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -311,7 +311,7 @@
 
 	if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) {
 		drive->state = 0;
-		drive->channel->udma(ide_dma_on, drive, rq);
+		udma_enable(drive, 1, 1);
 	}
 
 	if (!end_that_request_first(rq, uptodate, nr_secs)) {
@@ -364,13 +364,13 @@
 
 	/* check the DMA crc count */
 	if (drive->crc_count) {
-		drive->channel->udma(ide_dma_off_quietly, drive, NULL);
+		udma_enable(drive, 0, 0);
 		if ((drive->channel->speedproc) != NULL)
 		        drive->channel->speedproc(drive, ide_auto_reduce_xfer(drive));
 		if (drive->current_speed >= XFER_SW_DMA_0)
-			drive->channel->udma(ide_dma_on, drive, NULL);
+			udma_enable(drive, 1, 1);
 	} else
-		drive->channel->udma(ide_dma_off, drive, NULL);
+		udma_enable(drive, 0, 1);
 }
 
 /*
@@ -1402,18 +1402,11 @@
  */
 static void dma_timeout_retry(struct ata_device *drive, struct request *rq)
 {
-	struct ata_channel *ch = drive->channel;
-
 	/*
 	 * end current dma transaction
 	 */
-	ch->udma_stop(drive);
-
-	/*
-	 * complain a little, later we might remove some of this verbosity
-	 */
-	printk("%s: timeout waiting for DMA\n", drive->name);
-	ch->udma(ide_dma_timeout, drive, rq);
+	udma_stop(drive);
+	udma_timeout(drive);
 
 	/*
 	 * Disable dma for now, but remember that we did so because of
@@ -1422,7 +1415,7 @@
 	 */
 	drive->retry_pio++;
 	drive->state = DMA_PIO_RETRY;
-	ch->udma(ide_dma_off_quietly, drive, rq);
+	udma_enable(drive, 0, 0);
 
 	/*
 	 * un-busy drive etc (hwgroup->busy is cleared on return) and
@@ -1510,7 +1503,7 @@
 				startstop = handler(drive, ch->hwgroup->rq);
 			} else if (drive_is_ready(drive)) {
 				if (drive->waiting_for_dma)
-					ch->udma(ide_dma_lostirq, drive, ch->hwgroup->rq);
+					udma_irq_lost(drive);
 				(void) ide_ack_intr(ch);
 				printk("%s: lost interrupt\n", drive->name);
 				startstop = handler(drive, ch->hwgroup->rq);
@@ -2126,14 +2119,14 @@
 	ch->ata_write = old.ata_write;
 	ch->atapi_read = old.atapi_read;
 	ch->atapi_write = old.atapi_write;
-	ch->udma = old.udma;
+	ch->XXX_udma = old.XXX_udma;
 	ch->udma_start = old.udma_start;
 	ch->udma_stop = old.udma_stop;
 	ch->udma_read = old.udma_read;
 	ch->udma_write = old.udma_write;
 	ch->udma_irq_status = old.udma_irq_status;
 	ch->udma_timeout = old.udma_timeout;
-	ch->udma_lost_irq = old.udma_lost_irq;
+	ch->udma_irq_lost = old.udma_irq_lost;
 	ch->busproc = old.busproc;
 	ch->bus_state = old.bus_state;
 	ch->dma_base = old.dma_base;
@@ -2409,10 +2402,11 @@
 {
 	if (!drive->driver)
 		return -EPERM;
-	if (!drive->id || !(drive->id->capability & 1) || !drive->channel->udma)
+
+	if (!drive->id || !(drive->id->capability & 1) || !drive->channel->XXX_udma)
 		return -EPERM;
-	if (drive->channel->udma(arg ? ide_dma_on : ide_dma_off, drive, NULL))
-		return -EIO;
+
+	udma_enable(drive, arg, 1);
 	return 0;
 }
 
@@ -3184,7 +3178,7 @@
 	restore_flags(flags);		/* all CPUs */
 	/* FIXME: Check what this magic number is supposed to be about? */
 	if (drive->autotune != 2) {
-		if (drive->channel->udma) {
+		if (drive->channel->XXX_udma) {
 
 			/*
 			 * Force DMAing for the beginning of the check.  Some
@@ -3194,8 +3188,8 @@
 			 *   PARANOIA!!!
 			 */
 
-			drive->channel->udma(ide_dma_off_quietly, drive, NULL);
-			drive->channel->udma(ide_dma_check, drive, NULL);
+			udma_enable(drive, 0, 0);
+			drive->channel->XXX_udma(drive);
 #ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
 			udma_tcq_enable(drive, 1);
 #endif
drivers/ide/ide-cd.c +2 -2
diff -urN linux-2.5.13/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -906,7 +906,7 @@
 	if (dma) {
 		info->dma = 0;
 		if ((dma_error = udma_stop(drive)))
-			drive->channel->udma(ide_dma_off, drive, NULL);
+			udma_enable(drive, 0, 1);
 	}
 
 	if (cdrom_decode_status(&startstop, drive, rq, 0, &stat))
@@ -1482,7 +1482,7 @@
 		info->dma = 0;
 		if ((dma_error = udma_stop(drive))) {
 			printk("ide-cd: write dma error\n");
-			drive->channel->udma(ide_dma_off, drive, NULL);
+			udma_enable(drive, 0, 1);
 		}
 	}
 
drivers/ide/ide-disk.c +1 -1
diff -urN linux-2.5.13/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
@@ -736,7 +736,7 @@
 {
 	if (!drive->driver)
 		return -EPERM;
-	if (!drive->channel->udma)
+	if (!drive->channel->XXX_udma)
 		return -EPERM;
 	if (arg == drive->queue_depth && drive->using_tcq)
 		return 0;
drivers/ide/ide-dma.c +39 -78

160 lines not on this page · raw message

drivers/ide/ide-floppy.c +6 -5
diff -urN linux-2.5.13/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
@@ -944,10 +944,11 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
 		printk (KERN_ERR "ide-floppy: The floppy wants to issue more interrupts in DMA mode\n");
-		drive->channel->udma(ide_dma_off, drive, NULL);
+		udma_enable(drive, 0, 1);
+
 		return ide_stopped;
 	}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 	bcount.b.high=IN_BYTE (IDE_BCOUNTH_REG);			/* Get the number of bytes to transfer */
 	bcount.b.low=IN_BYTE (IDE_BCOUNTL_REG);			/* on this interrupt */
 	ireason.all=IN_BYTE (IDE_IREASON_REG);
@@ -1119,9 +1120,9 @@
 	bcount.all = min(pc->request_transfer, 63 * 1024);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-	if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) {
-		(void) drive->channel->udma(ide_dma_off, drive, NULL);
-	}
+	if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags))
+		udma_enable(drive, 0, 1);
+
 	if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
 		if (test_bit (PC_WRITING, &pc->flags))
 			dma_ok = !udma_write(drive, rq);
drivers/ide/ide-tape.c +3 -2
diff -urN linux-2.5.13/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
@@ -2132,7 +2132,8 @@
 	if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
 		printk (KERN_ERR "ide-tape: The tape wants to issue more interrupts in DMA mode\n");
 		printk (KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n");
-		drive->channel->udma(ide_dma_off, drive, NULL);
+		udma_enable(drive, 0, 1);
+
 		return ide_stopped;
 	}
 #endif /* CONFIG_BLK_DEV_IDEDMA */
@@ -2309,7 +2310,7 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) {
 		printk (KERN_WARNING "ide-tape: DMA disabled, reverting to PIO\n");
-		(void) drive->channel->udma(ide_dma_off, drive, NULL);
+		udma_enable(drive, 0, 1);
 	}
 	if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
 		if (test_bit (PC_WRITING, &pc->flags))
drivers/ide/ide-taskfile.c +1 -1
diff -urN linux-2.5.13/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
@@ -260,7 +260,7 @@
 {
 	byte stat = 0;
 	if (drive->waiting_for_dma)
-		return drive->channel->udma(ide_dma_test_irq, drive, NULL);
+		return udma_irq_status(drive);
 #if 0
 	/* need to guarantee 400ns since last command was issued */
 	udelay(1);
drivers/ide/ns87415.c +8 -10
diff -urN linux-2.5.13/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
@@ -123,18 +123,16 @@
 	return 1;
 }
 
-static int ns87415_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
+static int ns87415_dmaproc(struct ata_device *drive)
 {
-	switch (func) {
-		case ide_dma_check:
-			if (drive->type != ATA_DISK)
-				return ide_dmaproc(ide_dma_off_quietly, drive, rq);
-			/* Fallthrough... */
-		default:
-			return ide_dmaproc(func, drive, rq);	/* use standard DMA stuff */
+	if (drive->type != ATA_DISK) {
+		udma_enable(drive, 0, 0);
+
+		return 0;
 	}
+	return XXX_ide_dmaproc(drive);
 }
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 
 void __init ide_init_ns87415(struct ata_channel *hwif)
 {
@@ -233,7 +231,7 @@
 		hwif->udma_stop = ns87415_udma_stop;
 		hwif->udma_read = ns87415_udma_read;
 		hwif->udma_write = ns87415_udma_write;
-		hwif->udma = ns87415_dmaproc;
+		hwif->XXX_udma = ns87415_dmaproc;
 	}
 #endif
 
drivers/ide/pdc202xx.c +76 -62

226 lines not on this page · raw message

drivers/ide/pdcadma.c +5 -9
diff -urN linux-2.5.13/drivers/ide/pdcadma.c linux/drivers/ide/pdcadma.c
@@ -58,15 +58,11 @@
 /*
  * This initiates/aborts (U)DMA read/write operations on a drive.
  */
-int pdcadma_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
+static int pdcadma_dmaproc(struct ata_device *drive)
 {
-	switch (func) {
-		case ide_dma_check:
-			func = ide_dma_off_quietly;
-		default:
-			break;
-	}
-	return ide_dmaproc(func, drive, rq);	/* use standard DMA stuff */
+	udma_enable(drive, 0, 0);
+
+	return 0;
 }
 #endif
 
@@ -96,7 +92,7 @@
 //	hwif->speedproc = &pdcadma_tune_chipset;
 
 //	if (hwif->dma_base) {
-//		hwif->dmaproc = &pdcadma_dmaproc;
+//		hwif->XXX_dmaproc = &pdcadma_dmaproc;
 //		hwif->autodma = 1;
 //	}
 }
drivers/ide/piix.c +12 -24
diff -urN linux-2.5.13/drivers/ide/piix.c linux/drivers/ide/piix.c
@@ -376,38 +376,26 @@
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 
-/*
- * piix_dmaproc() is a callback from upper layers that can do
- * a lot, but we use it for DMA/PIO tuning only, delegating everything
- * else to the default ide_dmaproc().
- */
-
-int piix_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
+int piix_dmaproc(struct ata_device *drive)
 {
+	short w80 = drive->channel->udma_four;
 
-	if (func == ide_dma_check) {
-
-		short w80 = drive->channel->udma_four;
-
-		short speed = ata_timing_mode(drive,
-			XFER_PIO | XFER_EPIO | 
+	short speed = ata_timing_mode(drive,
+			XFER_PIO | XFER_EPIO |
 			(piix_config->flags & PIIX_NODMA ? 0 : (XFER_SWDMA | XFER_MWDMA |
 			(piix_config->flags & PIIX_UDMA ? XFER_UDMA : 0) |
 			(w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_66 ? XFER_UDMA_66 : 0) |
 			(w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_100 ? XFER_UDMA_100 : 0) |
 			(w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_133 ? XFER_UDMA_133 : 0))));
 
-		piix_set_drive(drive, speed);
+	piix_set_drive(drive, speed);
 
-		func = (drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO)
-			? ide_dma_on : ide_dma_off_quietly;
+	udma_enable(drive, drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO, 0);
 
-	}
-
-	return ide_dmaproc(func, drive, rq);
+	return 0;
 }
 
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 
 /*
  * The initialization callback. Here we determine the IDE chip type
@@ -566,13 +554,13 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (hwif->dma_base) {
 		hwif->highmem = 1;
-		hwif->udma = piix_dmaproc;
-#ifdef CONFIG_IDEDMA_AUTO
+		hwif->XXX_udma = piix_dmaproc;
+# ifdef CONFIG_IDEDMA_AUTO
 		if (!noautodma)
 			hwif->autodma = 1;
-#endif
+# endif
 	}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 }
 
 /*
drivers/ide/serverworks.c +26 -27

109 lines not on this page · raw message

drivers/ide/sis5513.c +31 -32

127 lines not on this page · raw message

drivers/ide/sl82c105.c +18 -25

82 lines not on this page · raw message

drivers/ide/trm290.c +8 -11
diff -urN linux-2.5.13/drivers/ide/trm290.c linux/drivers/ide/trm290.c
@@ -235,18 +235,14 @@
 	return do_udma(0, drive, rq);
 }
 
-static int trm290_dmaproc (ide_dma_action_t func, struct ata_device *drive, struct request *rq)
+static int trm290_udma_irq_status(struct ata_device *drive)
 {
-	struct ata_channel *ch = drive->channel;
+	return (inw(drive->channel->dma_base + 2) == 0x00ff);
+}
 
-	switch (func) {
-		case ide_dma_test_irq:
-			return (inw(ch->dma_base + 2) == 0x00ff);
-		default:
-			return ide_dmaproc(func, drive, rq);
-	}
-	trm290_prepare_drive(drive, 0);	/* select PIO xfer */
-	return 1;
+static int trm290_dmaproc(struct ata_device *drive)
+{
+	return XXX_ide_dmaproc(drive);
 }
 #endif
 
@@ -304,7 +300,8 @@
 	hwif->udma_stop = trm290_udma_stop;
 	hwif->udma_read = trm290_udma_read;
 	hwif->udma_write = trm290_udma_write;
-	hwif->udma = trm290_dmaproc;
+	hwif->udma_irq_status = trm290_udma_irq_status;
+	hwif->XXX_udma = trm290_dmaproc;
 #endif
 
 	hwif->selectproc = &trm290_selectproc;
drivers/ide/via82cxxx.c +11 -24
diff -urN linux-2.5.13/drivers/ide/via82cxxx.c linux/drivers/ide/via82cxxx.c
@@ -356,37 +356,24 @@
 }
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-
-/*
- * via82cxxx_dmaproc() is a callback from upper layers that can do
- * a lot, but we use it for DMA/PIO tuning only, delegating everything
- * else to the default ide_dmaproc().
- */
-
-int via82cxxx_dmaproc(ide_dma_action_t func, struct ata_device *drive, struct request *rq)
+static int via82cxxx_dmaproc(struct ata_device *drive)
 {
+	short w80 = drive->channel->udma_four;
 
-	if (func == ide_dma_check) {
-
-		short w80 = drive->channel->udma_four;
-
-		short speed = ata_timing_mode(drive,
+	short speed = ata_timing_mode(drive,
 			XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA |
 			(via_config->flags & VIA_UDMA ? XFER_UDMA : 0) |
 			(w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) |
 			(w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) |
 			(w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0));
 
-		via_set_drive(drive, speed);
+	via_set_drive(drive, speed);
 
-		func = (drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO)
-			? ide_dma_on : ide_dma_off_quietly;
-	}
+	udma_enable(drive, drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO, 0);
 
-	return ide_dmaproc(func, drive, rq);
+	return 0;
 }
-
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 
 /*
  * The initialization callback. Here we determine the IDE chip type
@@ -546,13 +533,13 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (hwif->dma_base) {
 		hwif->highmem = 1;
-		hwif->udma = &via82cxxx_dmaproc;
-#ifdef CONFIG_IDEDMA_AUTO
+		hwif->XXX_udma = &via82cxxx_dmaproc;
+# ifdef CONFIG_IDEDMA_AUTO
 		if (!noautodma)
 			hwif->autodma = 1;
-#endif
+# endif
 	}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
 }
 
 /*
include/linux/ide.h +4 -13
diff -urN linux-2.5.13/include/linux/ide.h linux/include/linux/ide.h
@@ -374,15 +374,6 @@
 	int		max_depth;
 } ide_drive_t;
 
-typedef enum {
-	ide_dma_check,
-	ide_dma_on, ide_dma_off,
-	ide_dma_off_quietly,
-	ide_dma_test_irq,
-	ide_dma_lostirq,
-	ide_dma_timeout
-} ide_dma_action_t;
-
 enum {
 	ATA_PRIMARY	= 0,
 	ATA_SECONDARY	= 1
@@ -432,7 +423,7 @@
 	void (*atapi_read)(struct ata_device *, void *, unsigned int);
 	void (*atapi_write)(struct ata_device *, void *, unsigned int);
 
-	int (*udma)(ide_dma_action_t, struct ata_device *, struct request *);
+	int (*XXX_udma)(struct ata_device *);
 
 	int (*udma_start) (struct ata_device *, struct request *rq);
 	int (*udma_stop) (struct ata_device *);
@@ -443,7 +434,7 @@
 	int (*udma_irq_status) (struct ata_device *);
 
 	void (*udma_timeout) (struct ata_device *);
-	void (*udma_lost_irq) (struct ata_device *);
+	void (*udma_irq_lost) (struct ata_device *);
 
 	unsigned int	*dmatable_cpu;	/* dma physical region descriptor table (cpu view) */
 	dma_addr_t	dmatable_dma;	/* dma physical region descriptor table (dma view) */
@@ -885,7 +876,7 @@
 extern int udma_black_list(struct ata_device *);
 extern int udma_white_list(struct ata_device *);
 extern void udma_timeout(struct ata_device *);
-extern void udma_lost_irq(struct ata_device *);
+extern void udma_irq_lost(struct ata_device *);
 extern int udma_start(struct ata_device *, struct request *rq);
 extern int udma_stop(struct ata_device *);
 extern int udma_read(struct ata_device *, struct request *rq);
@@ -899,7 +890,7 @@
 
 extern ide_startstop_t ide_dma_intr(struct ata_device *, struct request *);
 extern int check_drive_lists(struct ata_device *, int good_bad);
-extern int ide_dmaproc(ide_dma_action_t func, struct ata_device *, struct request *);
+extern int XXX_ide_dmaproc(struct ata_device *);
 extern void ide_release_dma(struct ata_channel *);
 extern void ide_setup_dma(struct ata_channel *,	unsigned long, unsigned int) __init;
 extern int ata_start_dma(struct ata_device *, struct request *rq);
#36 lore raw

Re: [PATCH 2.5.13 IDE 54

Quoted 5 lines · Martin Dalecki

Sun May 5 16:32:22 CEST 2002 ide-clean-54

- Finish the changes from patch 53. ide_dma_actaion_t is gone now as well as whole hidden code paths associated with it. I hope I didn't mess too many things up with this, since the sheer size of the changes make them sensitive.

I'm wondering how you would suggest that I change ide-pmac.c now so that it compiles and works again.

With this patch we have calls to udma_enable scattered throughout ide.c, and udma_enable assumes that it is to do its stuff by poking particular I/O ports. You seem to have taken away the ability to have a chipset provide its own methods for setting up, enabling and disabling DMA.

The comment above udma_enable seems to indicate that you think it should be ifdef'd per-architecture. That won't work for us (besides being ugly), because we can have two ATA host adaptors in the one machine that need to be programmed quite differently. Consider for instance a powermac with the built-in IDE interface (which would use the ide-pmac.c code) and a plug-in PCI IDE card, for which the udma_enable code is presumably correct.

So we definitely need to have the DMA setup/enable/disable methods able to be specified per host adaptor.

If I have missed something, please let me know. But it looks to me very much as though this patch makes it impossible for me to use my powermac IDE interfaces.

Paul.

#37 lore raw

Re: [PATCH 2.5.13 IDE 54

Quoted 7 lines

The comment above udma_enable seems to indicate that you think it should be ifdef'd per-architecture. That won't work for us (besides being ugly), because we can have two ATA host adaptors in the one machine that need to be programmed quite differently. Consider for instance a powermac with the built-in IDE interface (which would use the ide-pmac.c code) and a plug-in PCI IDE card, for which the udma_enable code is presumably correct.

The same will be true for the PC very soon. In fact in a few cases it already is

#38 lore raw

Re: [PATCH 2.5.13 IDE 54

Uz.ytkownik Alan Cox napisa?:

Quoted 11 lines
Quoted 7 lines

The comment above udma_enable seems to indicate that you think it should be ifdef'd per-architecture. That won't work for us (besides being ugly), because we can have two ATA host adaptors in the one machine that need to be programmed quite differently. Consider for instance a powermac with the built-in IDE interface (which would use the ide-pmac.c code) and a plug-in PCI IDE card, for which the udma_enable code is presumably correct.

The same will be true for the PC very soon. In fact in a few cases it already is

I have already virtualized this method in my tree :-).

#39 lore raw

Re: [PATCH] 2.5.13 IDE 52

In reply to Miles Lane
Quoted 2 lines · Martin Dalecki

- Split up the TCQ UDMA handling stuff in to proper functions. Jens must has been dreaming as he introduced them ;-).

This was pending stuff, and why I wrote that the start command tcq = 1 stuff was a gross hack.

Quoted 37 lines
(quoted diff) +12 -14
-		int tcq = 0;
 
 		if (!drive->using_dma)
 			return ide_started;
 
 		/* for dma commands we don't set the handler */
-		if (args->taskfile.command == WIN_WRITEDMA || args->taskfile.command == WIN_WRITEDMA_EXT)
+		if (args->taskfile.command == WIN_WRITEDMA
+		 || args->taskfile.command == WIN_WRITEDMA_EXT)
 			dma_act = ide_dma_write;
-		else if (args->taskfile.command == WIN_READDMA || args->taskfile.command == WIN_READDMA_EXT)
+		else if (args->taskfile.command == WIN_READDMA
+		      || args->taskfile.command == WIN_READDMA_EXT)
 			dma_act = ide_dma_read;
-		else if (args->taskfile.command == WIN_WRITEDMA_QUEUED || args->taskfile.command == WIN_WRITEDMA_QUEUED_EXT) {
-			tcq = 1;
-			dma_act = ide_dma_write_queued;
-		} else if (args->taskfile.command == WIN_READDMA_QUEUED || args->taskfile.command == WIN_READDMA_QUEUED_EXT) {
-			tcq = 1;
-			dma_act = ide_dma_read_queued;
-		} else {
+#ifdef CONFIG_BLK_DEV_IDE_TCQ
+		else if (args->taskfile.command == WIN_WRITEDMA_QUEUED
+		      || args->taskfile.command == WIN_WRITEDMA_QUEUED_EXT
+		      || args->taskfile.command == WIN_READDMA_QUEUED
+		      || args->taskfile.command == WIN_READDMA_QUEUED_EXT)
+			return udma_tcq_taskfile(drive, rq);
+#endif
+		else {
 			printk("ata_taskfile: unknown command %x\n", args->taskfile.command);
 			return ide_stopped;
 		}
 
-		/*
-		 * FIXME: this is a gross hack, need to unify tcq dma proc and
-		 * regular dma proc -- basically split stuff that needs to act
-		 * on a request from things like ide_dma_check etc.

Review

Quoted 10 lines
(quoted diff) +3 -7
-		 */
-		if (tcq)
-			return drive->channel->udma(dma_act, drive, rq);
-		else {
-			if (drive->channel->udma(dma_act, drive, rq))
-				return ide_stopped;
-		}
+
+		if (drive->channel->udma(dma_act, drive, rq))
+			return ide_stopped;

This is still ugly, IMHO. What I wanted was to split the udma-> function into two parts, one that acts on a request (ide_dma_read, ide_dma_being, etc -- and then also ide_dma_read_queued) ad one that does the silly stuff like ide_dma_check etc. Then unify the tcq and non-tcq stuff so that udma_rw->(dma_act, drive, rq) always returns ide_started or ide_stopped (or ide_released) and kill the #ifdef above.

I don't think udma_tcq_taskfile() should be public like this, and btw I think the name really SUCKS! :-). ata_tcq_dma() is much better for instance, even though it should be a private stratey. BTW, this goes for all your tcq.c renaming.

Signature · 1 line
Jens Axboe
#40 lore raw

Re: [PATCH] 2.5.13 IDE 52

In reply to Miles Lane

Uz.ytkownik Jens Axboe napisa?:

Quoted 8 lines · Martin Dalecki
Quoted 3 lines

- Split up the TCQ UDMA handling stuff in to proper functions. Jens must has been dreaming as he introduced them ;-).

This was pending stuff, and why I wrote that the start command tcq = 1 stuff was a gross hack.

Sure I just did it in one go with the rest of DMA handling changes. I just wan'ted to get over with this.

Quoted 56 lines
Quoted 37 lines
(quoted diff) +0 -1
-		int tcq = 0;
		if (!drive->using_dma)
			return ide_started;

		/* for dma commands we don't set the handler */
(quoted diff) +2 -1
-		if (args->taskfile.command == WIN_WRITEDMA || args->taskfile.command == WIN_WRITEDMA_EXT)
+		if (args->taskfile.command == WIN_WRITEDMA
+		 || args->taskfile.command == WIN_WRITEDMA_EXT)
			dma_act = ide_dma_write;
(quoted diff) +2 -1
-		else if (args->taskfile.command == WIN_READDMA || args->taskfile.command == WIN_READDMA_EXT)
+		else if (args->taskfile.command == WIN_READDMA
+		      || args->taskfile.command == WIN_READDMA_EXT)
			dma_act = ide_dma_read;
(quoted diff) +8 -7
-		else if (args->taskfile.command == WIN_WRITEDMA_QUEUED || args->taskfile.command == WIN_WRITEDMA_QUEUED_EXT) {
-			tcq = 1;
-			dma_act = ide_dma_write_queued;
-		} else if (args->taskfile.command == WIN_READDMA_QUEUED || args->taskfile.command == WIN_READDMA_QUEUED_EXT) {
-			tcq = 1;
-			dma_act = ide_dma_read_queued;
-		} else {
+#ifdef CONFIG_BLK_DEV_IDE_TCQ
+		else if (args->taskfile.command == WIN_WRITEDMA_QUEUED
+		      || args->taskfile.command == WIN_WRITEDMA_QUEUED_EXT
+		      || args->taskfile.command == WIN_READDMA_QUEUED
+		      || args->taskfile.command == WIN_READDMA_QUEUED_EXT)
+			return udma_tcq_taskfile(drive, rq);
+#endif
+		else {
			printk("ata_taskfile: unknown command %x\n", args->taskfile.command);
			return ide_stopped;
		}
(quoted diff) +0 -4
-		/*
-		 * FIXME: this is a gross hack, need to unify tcq dma proc and
-		 * regular dma proc -- basically split stuff that needs to act
-		 * on a request from things like ide_dma_check etc.

Review

Quoted 10 lines
(quoted diff) +3 -7
-		 */
-		if (tcq)
-			return drive->channel->udma(dma_act, drive, rq);
-		else {
-			if (drive->channel->udma(dma_act, drive, rq))
-				return ide_stopped;
-		}
+
+		if (drive->channel->udma(dma_act, drive, rq))
+			return ide_stopped;

This is still ugly, IMHO. What I wanted was to split the udma-> function into two parts, one that acts on a request (ide_dma_read, ide_dma_being, etc -- and then also ide_dma_read_queued) ad one that does the silly stuff like ide_dma_check etc. Then unify the tcq and non-tcq stuff so that udma_rw->(dma_act, drive, rq) always returns ide_started or ide_stopped (or ide_released) and kill the #ifdef above.

Quoted 4 lines

I don't think udma_tcq_taskfile() should be public like this, and btw I think the name really SUCKS! :-). ata_tcq_dma() is much better for instance, even though it should be a private stratey. BTW, this goes for all your tcq.c renaming.

Sure it sucks. The most sucks the fact that the trasnfer functions should be folded in the generic context functions. I know.
I have choosen the udma prefix becouse ata_udma wouldn't contain much more information and just stayed consistant with it for the tcq stuff as well. Now one can at least understand the work flow of the DMA stuff I think so cleaning it firther should be easier now.

Please consided it all as a step in between and after reading 54 you should see where it's going...

#41 lore raw

Re: [PATCH] 2.5.13 IDE 53

In reply to Miles Lane
Quoted 4 lines · Martin Dalecki

- Start splitting the functions for host chip handling in to separate entities. This change is quite sensitive and may cause some trouble but it's for certain worth it anyway, because it should for example provide a much better infrastructure for th handling of different architectures.

Are you at some point going to add the black/white lists back into icside.c that you removed shortly after you took over the IDE maintainence? I've been patiently waiting to see what was going to happen to them.

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

Re: [PATCH] 2.5.13 IDE 53

In reply to Miles Lane

Uz.ytkownik Russell King napisa?:

Quoted 8 lines · Martin Dalecki
Quoted 5 lines

- Start splitting the functions for host chip handling in to separate entities. This change is quite sensitive and may cause some trouble but it's for certain worth it anyway, because it should for example provide a much better infrastructure for th handling of different architectures.

Quoted 4 lines

Are you at some point going to add the black/white lists back into icside.c that you removed shortly after you took over the IDE maintainence? I've been patiently waiting to see what was going to happen to them.

What about using the generic udma_black_list() and udma_white_list()? Just tell so and I could prvide the code for testing.

#43 lore raw

Re: [PATCH] 2.5.13 IDE 53

In reply to Miles Lane
Quoted 10 lines · Martin Dalecki

Uz.ytkownik Russell King napisa?:

Quoted 5 lines

Are you at some point going to add the black/white lists back into icside.c that you removed shortly after you took over the IDE maintainence? I've been patiently waiting to see what was going to happen to them.

What about using the generic udma_black_list() and udma_white_list()? Just tell so and I could prvide the code for testing.

Just a thought so i'll throw it out there. I'm just a spectator so far on this issue as i haven't yet been burned by it.

There seem to be several black|white lists floating around. This would appear to be an ongoing task keeping up with the new and obscure hardware to cope with capabilities and compatibilities and often requires kernel or module rebuilds and means ever-growing lists.

For some time i have been thinking that a common black|white list API might be worthwhile. Along with this would be the ability to examine and modify, or at least add to, the lists at runtime. For hot-plug some of the black|white checks might even be better handled by a daemon that can read an external file. That would facilitate testing and allow people to add support for their hot-plug devices without reboot.

Signature · 5 lines
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		[email protected]

		Remember Cernan and Schmitt
#44 lore raw

Re: [PATCH 2.5.13 IDE 54

In reply to Miles Lane

Uz.ytkownik Paul Mackerras napisa?:

Quoted 27 lines
Quoted 5 lines · Martin Dalecki

Sun May 5 16:32:22 CEST 2002 ide-clean-54

- Finish the changes from patch 53. ide_dma_actaion_t is gone now as well as whole hidden code paths associated with it. I hope I didn't mess too many things up with this, since the sheer size of the changes make them sensitive.

I'm wondering how you would suggest that I change ide-pmac.c now so that it compiles and works again.

With this patch we have calls to udma_enable scattered throughout ide.c, and udma_enable assumes that it is to do its stuff by poking particular I/O ports. You seem to have taken away the ability to have a chipset provide its own methods for setting up, enabling and disabling DMA.

The comment above udma_enable seems to indicate that you think it should be ifdef'd per-architecture. That won't work for us (besides being ugly), because we can have two ATA host adaptors in the one machine that need to be programmed quite differently. Consider for instance a powermac with the built-in IDE interface (which would use the ide-pmac.c code) and a plug-in PCI IDE card, for which the udma_enable code is presumably correct.

Quoted 2 lines

So we definitely need to have the DMA setup/enable/disable methods able to be specified per host adaptor.

OK I see I have "forced" you to take care of this.
My problem previously was the simple fact that in esp. the pmac code was sidestepping the generic code and providing his own mechanisms for handling chipset specific dma transfer methods.

As you can see now it's possible to have overloaded most of the "virtuaized" udma_xxx channel methods.

Now you request me to virtualize the udma_enable stuff. Nothing easier then this.

Now we have:

udma_enable()
{
...

    /* default method implementation */

...
}

I will do the following with it:

static do_dma_enable() // was udma_enable() before {
/* default method implementation */
}

udma_enable()
{
if (ch->udma_enable)

		return ch->udma_enable();

/* fallback to default implementation */
do_dma_enable();
}

I think this should suite your needs and you will be able to just overload the implementation of udma_enable() in ide-pmac.c

by setting the udma_enable method in the
host chip initialization routine there. (Directly alonside the the compiler will chock on ->udma so such memmber.)

Quoted 3 lines

If I have missed something, please let me know. But it looks to me very much as though this patch makes it impossible for me to use my powermac IDE interfaces.

Would the above infrastructue adjustment suit your needs?

If Yes (I think so), please just drop me an OK please.

#45 lore raw

Re: [PATCH 2.5.13 IDE 54

Quoted 10 lines

OK I see I have "forced" you to take care of this.
My problem previously was the simple fact that in esp. the pmac code was sidestepping the generic code and providing his own mechanisms for handling chipset specific dma transfer methods.

As you can see now it's possible to have overloaded most of the "virtuaized" udma_xxx channel methods.

Now you request me to virtualize the udma_enable stuff. Nothing easier then this.

I haven't looked closely at your new stuff yet, but here's what we need for ide-pmac (and similarily, on a whole bunch of embedded IDE controllers that do not behave like a legacy controller).

- hook on enabling/disabling DMA & setting up timing stuffs. Due to some weird HW, we must be in control of the actual sending of the feature setting command to the drive
- hook on creating/disposing the DMA related data structures (lists etc...)
- hook on setting up the DMA SG list as PRDs are really only specific to the legacy PCI controllers, we deal with all sort of different DMA controllers here in the outside world ;)
- hook on starting the DMA transfer
- hook on stopping the DMA transfer
- hook on knowing if the DMA is done and/or letting it drain completely upon reception of the last interrupt.

Ideally, in order to properly deal with some HW details, the hook on starting the DMA transfer should also be the one ultimately issuing the command to the taskfile register, as depending on the HW, it may have to be done either prior or after starting the DMA channel.

So instead of having a ton of hook, I'd rather see all of this be properly abstracted by default, the legacy IDE beeing only one of the possible set of callbacks, instead of having the default code in ide.c with hooks for different chipsets.

Regards,
Ben.

#46 lore raw

Re: [PATCH 2.5.13 IDE 54

In reply to Martin Dalecki

Uz.ytkownik [email protected] napisa?:

Quoted 16 lines
Quoted 10 lines

OK I see I have "forced" you to take care of this.
My problem previously was the simple fact that in esp. the pmac code was sidestepping the generic code and providing his own mechanisms for handling chipset specific dma transfer methods.

As you can see now it's possible to have overloaded most of the "virtuaized" udma_xxx channel methods.

Now you request me to virtualize the udma_enable stuff. Nothing easier then this.

I haven't looked closely at your new stuff yet, but here's what we need for ide-pmac (and similarily, on a whole bunch of embedded IDE controllers that do not behave like a legacy controller).

Quoted 12 lines

- hook on enabling/disabling DMA & setting up timing stuffs. Due to some weird HW, we must be in control of the actual sending of the feature setting command to the drive
- hook on creating/disposing the DMA related data structures (lists etc...)
- hook on setting up the DMA SG list as PRDs are really only specific to the legacy PCI controllers, we deal with all sort of different DMA controllers here in the outside world ;)
- hook on starting the DMA transfer
- hook on stopping the DMA transfer
- hook on knowing if the DMA is done and/or letting it drain completely upon reception of the last interrupt.

Alomst all of them done ;-). Please take a look at the end of ide-dma.c

Quoted 10 lines

Ideally, in order to properly deal with some HW details, the hook on starting the DMA transfer should also be the one ultimately issuing the command to the taskfile register, as depending on the HW, it may have to be done either prior or after starting the DMA channel.

So instead of having a ton of hook, I'd rather see all of this be properly abstracted by default, the legacy IDE beeing only one of the possible set of callbacks, instead of having the default code in ide.c with hooks for different chipsets.

This is presisely where the "default" code from the "virtualizations" found in ide-dma.c is going to go, after some restabilizing of the interface.

So I think we are at least "mentally" in sync.

#47 lore raw

Re: [PATCH 2.5.13 IDE 54

Quoted 7 lines

This is presisely where the "default" code from the "virtualizations" found in ide-dma.c is going to go, after some restabilizing of the interface.

So I think we are at least "mentally" in sync.

Ok, good. I just wanted to make sure you knew all we needed ;)

I'm looking forward to your new version.

Ben.