Re: IDE Ultra DMA patch

mlord (mlord@pobox.com)
Thu, 18 Sep 1997 11:52:14 -0400


Kim has sent me this patch for inclusion in the Linux IDE driver.

But before I add it, I need to hear from TX-motherboard users
about their experiences with it.

So.. if you have a TX motherboard + "UltraDMA" (or Ultra33) drive,
then let me/us know what happens.

You may notice that the patch itself (below) doesn't actually do anything,
other than notice that the drive/chipset are configured for UltraDMA,
so it ought to be safe enough.. but does it actually have any effect for you?

-ml
the Linux IDE guy

Kim-Hoe Pang wrote:
>
> Hi,
>
> This patch will enable Ultra DMA data transfer protocol on the IDE
> interface in the Intel TX motherboard. This patch is against 2.1.55
> kernel. Use the BIOS setup to enable the IDE drive for UDMA.
> If all go well, look for status message in the "dmesg" output.
> If UDMA is not enabled in the BIOS, then the patch will select the
> normal dma transfer mode for the IDE interface.
> To disable the DMA mode, use "hdparm -d0 /dev/hdx".
>
> Note on UDMA: don't expect to see a 2x boost in the disk transfer
> rate. In fact the increase is only about 5 to 10 % for the current
> generation drive. The instantaneous transfer however, as seen on a logic
> analyser, does meet the spec. of 60ns/word.
>
> Kim-Hoe
>
> ---------------------------------------------------------------
> diff -ru linux/drivers/block/ide-disk.c linux-2.1.55.tx/drivers/block/ide-disk.c
> --- linux/drivers/block/ide-disk.c Tue May 13 22:41:04 1997
> +++ linux-2.1.55.tx/drivers/block/ide-disk.c Mon Sep 15 19:49:04 1997
> @@ -606,7 +606,7 @@
> drive->name, id->model, idedisk_capacity(drive)/2048L, id->buf_size/2,
> drive->select.b.lba ? "LBA, " : "",
> drive->bios_cyl, drive->bios_head, drive->bios_sect,
> - drive->using_dma ? ", DMA" : "");
> + drive->using_dma ? (drive->using_udma ? " UDMA" : " DMA") : "");
>
> drive->mult_count = 0;
> if (id->max_multsect) {
> diff -ru linux/drivers/block/ide.c linux-2.1.55.tx/drivers/block/ide.c
> --- linux/drivers/block/ide.c Tue Aug 12 18:21:15 1997
> +++ linux-2.1.55.tx/drivers/block/ide.c Mon Sep 15 19:46:46 1997
> @@ -867,7 +867,7 @@
> #if FANCY_STATUS_DUMPS
> if (drive->media == ide_disk) {
> printk(" { ");
> - if (err & BBD_ERR) printk("BadSector ");
> + if (err & BBD_ERR) printk("%s", drive->using_udma ? "ICRC error" : "BadSector ");
> if (err & ECC_ERR) printk("UncorrectableError ");
> if (err & ID_ERR) printk("SectorIdNotFound ");
> if (err & ABRT_ERR) printk("DriveStatusError ");
> diff -ru linux/drivers/block/ide.h linux-2.1.55.tx/drivers/block/ide.h
> --- linux/drivers/block/ide.h Tue Sep 9 11:16:37 1997
> +++ linux-2.1.55.tx/drivers/block/ide.h Mon Sep 15 19:47:10 1997
> @@ -209,6 +209,7 @@
> unsigned busy : 1; /* currently doing revalidate_disk() */
> unsigned removable : 1; /* 1 if need to do check_media_change */
> unsigned using_dma : 1; /* disk is using dma for read/write */
> + unsigned using_udma : 1; /* disk is using udma for read/write */
> unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
> unsigned unmask : 1; /* flag: okay to unmask other irqs */
> unsigned no_unmask : 1; /* disallow setting unmask bit */
> diff -ru linux/drivers/block/triton.c linux-2.1.55.tx/drivers/block/triton.c
> --- linux/drivers/block/triton.c Thu Jun 26 12:33:38 1997
> +++ linux-2.1.55.tx/drivers/block/triton.c Mon Sep 15 20:14:34 1997
> @@ -274,6 +274,7 @@
> printk("%s: DMA disabled\n", drive->name);
> case ide_dma_on:
> drive->using_dma = (func == ide_dma_on);
> + if (drive->using_udma) return 0;
> reg = (HWIF(drive)->io_ports[IDE_DATA_OFFSET] == 0x170) ? 0x42 : 0x40;
> if (pcibios_read_config_word(piix_pci_bus, piix_pci_fn, reg, (short *)&timing)) {
> printk("%s: pcibios read failed\n", HWIF(drive)->name);
> @@ -335,8 +336,30 @@
> static int config_drive_for_dma (ide_drive_t *drive)
> {
> const char **list;
> + unsigned short wtime;
>
> struct hd_driveid *id = drive->id;
> + /* first check that UDMA mode is supported and enabled (in BIOS setup) */
> + if (id->field_valid & 4) {
> + if ((id->dma_udma & 0x407) == 0x407) {
> + /* UDMA mode 2 is supported */
> + drive->using_udma = 1;
> + printk("%s: UDMA mode 2 is supported and is enabled\n", drive->name);
> + printk(" dma mword=0x%x, udma mode=0x%x \n", id->dma_mword, id->dma_udma);
> + pcibios_read_config_word(piix_pci_bus,piix_pci_fn, 0x48, &wtime);
> + printk(" UDMACTL register=0x%x, ", wtime);
> + pcibios_read_config_word(piix_pci_bus, piix_pci_fn, 0x4a, &wtime);
> + printk(" UDMATIM register=0x%x \n", wtime);
> + return piix_dmaproc(ide_dma_on, drive);
> + }
> + else {
> + if (id->dma_udma == (id->dma_udma & 0x7))
> + printk("%s: UDMA mode 2 is supported but not enabled (in BIOS setup)\n", drive->name);
> + else
> + printk("%s: UDMA mode 2 is not supported\n", drive->name);
> + }
> + }
> + /* UDMA mode not enabled, fall back to normal DMA mode processing */
> if (id && (id->capability & 1)) {
> /* Enable DMA on any drive that supports mode2 (multi/single word) DMA */
> if (id->field_valid & 2)
> diff -ru linux/include/linux/hdreg.h linux-2.1.55.tx/include/linux/hdreg.h
> --- linux/include/linux/hdreg.h Tue Sep 9 11:16:25 1997
> +++ linux-2.1.55.tx/include/linux/hdreg.h Mon Sep 15 17:43:36 1997
> @@ -154,6 +154,8 @@
> /* unsigned short reservedxx[57];*/ /* reserved (words 71-127) */
> /* unsigned short vendor7 [32];*/ /* vendor unique (words 128-159) */
> /* unsigned short reservedyy[96];*/ /* reserved (words 160-255) */
> + unsigned short reserved71_87[17];
> + unsigned short dma_udma;
> };
>
> /*