2.4.19-pre9, IDE on Sparc, Big Disks
Hello Andre and LKML!
I just pulled a copy of Marcello's tree from bk and compiled it on my sparc (that's a sun ultra 5). Everything went well but the IDE.
I have a large ide disk connected to this guy (around 120GB if memory serves) and it used to work properly in the 2.4.17 era.
Now when I boot, I got this:
========>8========>8========>8========>8========>8========>8========>8========>8
PROMLIB: Sun IEEE Boot Prom 3.31.0 2001/07/25 20:36
Linux version 2.4.19-pre9 (mchouque@rugby) (gcc version egcs-2.92.11 19980921 (gcc2 ss-980609 experimental)) #2 Wed May 29 16:45:15 EDT 2002
ARCH: SUN4U
[...]
Uniform Multi-Platform E-IDE driver Revision: 6.31
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
CMD646: IDE controller on PCI bus 01 dev 18
CMD646: chipset revision 3
CMD646: chipset revision 0x03, MultiWord DMA Force Limited
CMD646: 100% native mode on irq 4,7e0
ide0: BM-DMA at 0x1fe02c00020-0x1fe02c00027, BIOS settings: hda:pio, hdb:pio
ide1: BM-DMA at 0x1fe02c00028-0x1fe02c0002f, BIOS settings: hdc:pio, hdd:piohda: ST39111A, ATA DISK drive
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
hdc: Maxtor 4G120J6, ATA DISK drive
hdd: CRD-8322B, ATAPI CD/DVD-ROM drive
ide0 at 0x1fe02c00000-0x1fe02c00007,0x1fe02c0000a on irq 4,7e0
ide1 at 0x1fe02c00010-0x1fe02c00017,0x1fe02c0001a on irq 4,7e0 (shared with ide0)
hda: 17803297 sectors (9115 MB) w/2048KiB Cache, CHS=17662/16/63, (U)DMA
hdc: -612473816857182208 sectors (9131146371508413 MB) w/2048KiB Cache, CHS=-1102014018/255/63, (U)DMA
hdd: ATAPI 32X CD-ROM drive, 128kB Cache
Uniform CD-ROM driver Revision: 3.12
Partition check:
hda: hda1 hda2 hda3
hdc:<6>attempt to access beyond end of device
16:00: rw=0, want=1, limit=-2147483648
attempt to access beyond end of device
16:00: rw=0, want=2, limit=-2147483648
attempt to access beyond end of device
16:00: rw=0, want=3, limit=-2147483648
attempt to access beyond end of device
16:00: rw=0, want=4, limit=-2147483648
attempt to access beyond end of device
16:00: rw=0, want=5, limit=-2147483648
attempt to access beyond end of device
16:00: rw=0, want=6, limit=-2147483648
attempt to access beyond end of device
16:00: rw=0, want=7, limit=-2147483648
attempt to access beyond end of device
16:00: rw=0, want=8, limit=-2147483648
attempt to access beyond end of device
[... Repeat this block one more time ...]
unable to read partition table
========>8========>8========>8========>8========>8========>8========>8========>8
This what I have in my config file:
#
# ATA/IDE/MFM/RLL support
#CONFIG_IDE=y
#
# IDE, ATA and ATAPI Block devices
#CONFIG_BLK_DEV_IDE=y
# CONFIG_BLK_DEV_HD_IDE is not set
# CONFIG_BLK_DEV_HD is not setCONFIG_BLK_DEV_IDEDISK=yCONFIG_IDEDISK_MULTI_MODE=y
# CONFIG_IDEDISK_STROKE is not set
# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set
# CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set
# CONFIG_BLK_DEV_IDEDISK_IBM is not set
# CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set
# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set
# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set
# CONFIG_BLK_DEV_IDEDISK_WD is not set
# CONFIG_BLK_DEV_COMMERIAL is not set
# CONFIG_BLK_DEV_TIVO is not set
# CONFIG_BLK_DEV_IDECS is not setCONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set
# CONFIG_IDE_TASK_IOCTL is not set
# CONFIG_BLK_DEV_CMD640 is not set
# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
# CONFIG_BLK_DEV_ISAPNP is not set
# CONFIG_BLK_DEV_RZ1000 is not setCONFIG_BLK_DEV_IDEPCI=yCONFIG_IDEPCI_SHARE_IRQ=yCONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_BLK_DEV_IDEDMA_FORCED is not setCONFIG_IDEDMA_PCI_AUTO=y
# CONFIG_IDEDMA_ONLYDISK is not setCONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_BLK_DEV_IDEDMA_TIMEOUT is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not setCONFIG_BLK_DEV_ADMA=y
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_ALI15X3 is not set
# CONFIG_WDC_ALI15X3 is not set
# CONFIG_BLK_DEV_AMD74XX is not set
# CONFIG_AMD74XX_OVERRIDE is not setCONFIG_BLK_DEV_CMD64X=y
# CONFIG_BLK_DEV_CMD680 is not set
# CONFIG_BLK_DEV_CY82C693 is not set
# CONFIG_BLK_DEV_CS5530 is not set
# CONFIG_BLK_DEV_HPT34X is not set
# CONFIG_HPT34X_AUTODMA is not set
# CONFIG_BLK_DEV_HPT366 is not set
# CONFIG_BLK_DEV_NS87415 is not set
# CONFIG_BLK_DEV_OPTI621 is not set
# CONFIG_BLK_DEV_PDC202XX is not set
# CONFIG_PDC202XX_BURST is not set
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_CHIPSETS is not setCONFIG_IDEDMA_AUTO=y
# CONFIG_IDEDMA_IVB is not set
# CONFIG_DMA_NONPCI is not setCONFIG_BLK_DEV_IDE_MODES=y
# CONFIG_BLK_DEV_ATARAID is not set
# CONFIG_BLK_DEV_ATARAID_PDC is not set
# CONFIG_BLK_DEV_ATARAID_HPT is not set
Finally the output of lspci:
00:00.0 Host bridge: Sun Microsystems Computer Corp. Ultra IIi
00:01.0 PCI bridge: Sun Microsystems Computer Corp. Simba Advanced PCI Bridge (rev 13) 00:01.1 PCI bridge: Sun Microsystems Computer Corp. Simba Advanced PCI Bridge (rev 13) 01:01.0 Bridge: Sun Microsystems Computer Corp. EBUS (rev 01)
01:01.1 Ethernet controller: Sun Microsystems Computer Corp. Happy Meal (rev 01) 01:02.0 VGA compatible controller: ATI Technologies Inc 3D Rage Pro 215GP (rev 5c) 01:03.0 IDE interface: CMD Technology Inc PCI0646 (rev 03)
Right now I'm recompiling the kernel without DMA to see it changes anything.
If you need anything from me, be my guest.
Cheers, Mathieu.
Signature · 4 lines
Mathieu Chouquet-Stringer E-Mail : [email protected] It is exactly because a man cannot do a thing that he is a proper judge of it. -- Oscar Wilde
Hey Mathieu, give this patch a spin. It makes it through the compiler, but more interesting is if it fixes your problem or not :-)
It's just the PowerPC code (from arch/ppc/kernel/setup.c). There is nothing platform specific about any of this, it really just belongs in drivers/ide/, and it can even run on Intel because it is effectively a NOP on little-endian systems. This would be the best because then updates to this structure would likely be accompanied with the matching changes to ide_fix_driveid().
I mean, let's have a look at current implementations:
Alpha: little-endian, NOP
Arm: little-endian, NOP
Cris: little-endian, NOP
i386: little-endian, NOP
ia64: little-endian, NOP
M68k: big-endian, byte-swap, same bug as Sparc
mips: byte-swap when cpu is in big-endian mode
mips64: No endian checks, BUG
parisc: Big endian but no byte-swapping, bug?
Anyone using IDE successfully on parisc?
ppc: big-endian, byte swap
s390{,x}: little-endian, NOP
sh: BUG, does not check endianness
sparc/sparc64: big-endian, byte swaps but is buggy.
What a mess, let's just fix this right :-)
asm-sparc64/ide.h renamed from asm-sparc64/ide.h.~1~ +84 -70
@@ -232,79 +232,93 @@#endif } -#define T_CHAR (0x0000)/* char: don't touch */ -#define T_SHORT (0x4000)/* short: 12 -> 21 */ -#define T_INT (0x8000)/* int: 1234 -> 4321 */ -#define T_TEXT (0xc000)/* text: 12 -> 21 */ - -#define T_MASK_TYPE (0xc000) -#define T_MASK_COUNT (0x3fff) - -#define D_CHAR (cnt) (T_CHAR | (cnt)) -#define D_SHORT (cnt) (T_SHORT | (cnt)) -#define D_INT (cnt) (T_INT | (cnt)) -#define D_TEXT (cnt) (T_TEXT | (cnt)) - -static u_short driveid_types[] = { -D_SHORT (10 ),/* config - vendor2 */ -D_TEXT (20 ),/* serial_no */ -D_SHORT (3 ),/* buf_type - ecc_bytes */ -D_TEXT (48 ),/* fw_rev - model */ -D_CHAR (2 ),/* max_multsect - vendor3 */ -D_SHORT (1 ),/* dword_io */ -D_CHAR (2 ),/* vendor4 - capability */ -D_SHORT (1 ),/* reserved50 */ -D_CHAR (4 ),/* vendor5 - tDMA */ -D_SHORT (4 ),/* field_valid - cur_sectors */ -D_INT (1 ),/* cur_capacity */ -D_CHAR (2 ),/* multsect - multsect_valid */ -D_INT (1 ),/* lba_capacity */ -D_SHORT (194 )/* dma_1word - reservedyy */ -}; - -#define num_driveid_types (sizeof(driveid_types)/sizeof(*driveid_types)) -static __inline__void ide_fix_driveid (struct hd_driveid *id) { -u_char *p = (u_char *)id; -int i, j, cnt; -u_char t; +int i; +u16 *stringcast; -for (i =0 ; i < num_driveid_types; i++) { - cnt = driveid_types[i] &T_MASK_COUNT ; -switch (driveid_types[i] &T_MASK_TYPE ) { -case T_CHAR : - p += cnt; -break ; -case T_SHORT : -for (j =0 ; j < cnt; j++) { - t = p[0 ]; - p[0 ] = p[1 ]; - p[1 ] = t; - p +=2 ; - } -break ; -case T_INT : -for (j =0 ; j < cnt; j++) { - t = p[0 ]; - p[0 ] = p[3 ]; - p[3 ] = t; - t = p[1 ]; - p[1 ] = p[2 ]; - p[2 ] = t; - p +=4 ; - } -break ; -case T_TEXT : -for (j =0 ; j < cnt; j +=2 ) { - t = p[0 ]; - p[0 ] = p[1 ]; - p[1 ] = t; - p +=2 ; - } -break ; - }; - } + id->config =__le16_to_cpu (id->config); + id->cyls =__le16_to_cpu (id->cyls); + id->reserved2 =__le16_to_cpu (id->reserved2); + id->heads =__le16_to_cpu (id->heads); + id->track_bytes =__le16_to_cpu (id->track_bytes); + id->sector_bytes =__le16_to_cpu (id->sector_bytes); + id->sectors =__le16_to_cpu (id->sectors); + id->vendor0 =__le16_to_cpu (id->vendor0); + id->vendor1 =__le16_to_cpu (id->vendor1); + id->vendor2 =__le16_to_cpu (id->vendor2); + stringcast = (u16 *)&id->serial_no[0 ]; +for (i =0 ; i < (20 /2 ); i++) + stringcast[i] =__le16_to_cpu (stringcast[i]); + id->buf_type =__le16_to_cpu (id->buf_type); + id->buf_size =__le16_to_cpu (id->buf_size); + id->ecc_bytes =__le16_to_cpu (id->ecc_bytes); + stringcast = (u16 *)&id->fw_rev[0 ]; +for (i =0 ; i < (8 /2 ); i++) + stringcast[i] =__le16_to_cpu (stringcast[i]); + stringcast = (u16 *)&id->model[0 ]; +for (i =0 ; i < (40 /2 ); i++) + stringcast[i] =__le16_to_cpu (stringcast[i]); + id->dword_io =__le16_to_cpu (id->dword_io); + id->reserved50 =__le16_to_cpu (id->reserved50); + id->field_valid =__le16_to_cpu (id->field_valid); + id->cur_cyls =__le16_to_cpu (id->cur_cyls); + id->cur_heads =__le16_to_cpu (id->cur_heads); + id->cur_sectors =__le16_to_cpu (id->cur_sectors); + id->cur_capacity0 =__le16_to_cpu (id->cur_capacity0); + id->cur_capacity1 =__le16_to_cpu (id->cur_capacity1); + id->lba_capacity =__le32_to_cpu (id->lba_capacity); + id->dma_1word =__le16_to_cpu (id->dma_1word); + id->dma_mword =__le16_to_cpu (id->dma_mword); + id->eide_pio_modes =__le16_to_cpu (id->eide_pio_modes); + id->eide_dma_min =__le16_to_cpu (id->eide_dma_min); + id->eide_dma_time =__le16_to_cpu (id->eide_dma_time); + id->eide_pio =__le16_to_cpu (id->eide_pio); + id->eide_pio_iordy =__le16_to_cpu (id->eide_pio_iordy); +for (i =0 ; i <2 ; i++) + id->words69_70[i] =__le16_to_cpu (id->words69_70[i]); +for (i =0 ; i <4 ; i++) + id->words71_74[i] =__le16_to_cpu (id->words71_74[i]); + id->queue_depth =__le16_to_cpu (id->queue_depth); +for (i =0 ; i <4 ; i++) + id->words76_79[i] =__le16_to_cpu (id->words76_79[i]); + id->major_rev_num =__le16_to_cpu (id->major_rev_num); + id->minor_rev_num =__le16_to_cpu (id->minor_rev_num); + id->command_set_1 =__le16_to_cpu (id->command_set_1); + id->command_set_2 =__le16_to_cpu (id->command_set_2); + id->cfsse =__le16_to_cpu (id->cfsse); + id->cfs_enable_1 =__le16_to_cpu (id->cfs_enable_1); + id->cfs_enable_2 =__le16_to_cpu (id->cfs_enable_2); + id->csf_default =__le16_to_cpu (id->csf_default); + id->dma_ultra =__le16_to_cpu (id->dma_ultra); + id->word89 =__le16_to_cpu (id->word89); + id->word90 =__le16_to_cpu (id->word90); + id->CurAPMvalues =__le16_to_cpu (id->CurAPMvalues); + id->word92 =__le16_to_cpu (id->word92); + id->hw_config =__le16_to_cpu (id->hw_config); + id->acoustic =__le16_to_cpu (id->acoustic); +for (i =0 ; i <5 ; i++) + id->words95_99[i] =__le16_to_cpu (id->words95_99[i]); + id->lba_capacity_2 =__le64_to_cpu (id->lba_capacity_2); +for (i =0 ; i <22 ; i++) + id->words104_125[i] =__le16_to_cpu (id->words104_125[i]); + id->last_lun =__le16_to_cpu (id->last_lun); + id->word127 =__le16_to_cpu (id->word127); + id->dlf =__le16_to_cpu (id->dlf); + id->csfo =__le16_to_cpu (id->csfo); +for (i =0 ; i <26 ; i++) + id->words130_155[i] =__le16_to_cpu (id->words130_155[i]); + id->word156 =__le16_to_cpu (id->word156); +for (i =0 ; i <3 ; i++) + id->words157_159[i] =__le16_to_cpu (id->words157_159[i]); + id->cfa_power =__le16_to_cpu (id->cfa_power); +for (i =0 ; i <14 ; i++) + id->words161_175[i] =__le16_to_cpu (id->words161_175[i]); +for (i =0 ; i <31 ; i++) + id->words176_205[i] =__le16_to_cpu (id->words176_205[i]); +for (i =0 ; i <48 ; i++) + id->words206_254[i] =__le16_to_cpu (id->words206_254[i]); + id->integrity_word =__le16_to_cpu (id->integrity_word); }/*
It fixed it:
hdc: Maxtor 4G120J6, ATA DISK drive
hdd: CRD-8322B, ATAPI CD/DVD-ROM drive
ide0 at 0x1fe02c00000-0x1fe02c00007,0x1fe02c0000a on irq 4,7e0
ide1 at 0x1fe02c00010-0x1fe02c00017,0x1fe02c0001a on irq 4,7e0 (shared with ide0)
hda: 17803297 sectors (9115 MB) w/2048KiB Cache, CHS=17662/16/63, (U)DMA
hdc: 240121728 sectors (122942 MB) w/2048KiB Cache, CHS=238216/255/63, (U)DMA
Thanks David!
Quoted 4 lines · David S. Miller
Hey Mathieu, give this patch a spin. It makes it through the compiler, but more interesting is if it fixes your problem or not :-)
Signature · 4 lines
Mathieu Chouquet-Stringer E-Mail : [email protected] It is exactly because a man cannot do a thing that he is a proper judge of it. -- Oscar Wilde