aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-03 12:02:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-03 12:02:32 -0400
commitea02259fdf47ca81ff3ca0c22906d989094fb8ff (patch)
tree5d3672aa246e016f695bc62a861902a50de7b461
parent8fe74cf053de7ad2124a894996f84fa890a81093 (diff)
parenteae6c2b6414fc6673ac5415442fe463c01005366 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/linux-hdreg-h-cleanup
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/linux-hdreg-h-cleanup: remove <linux/ata.h> include from <linux/hdreg.h> include/linux/hdreg.h: remove unused defines isd200: use ATA_* defines instead of *_STAT and *_ERR ones include/linux/hdreg.h: cover WIN_* and friends with #ifndef/#endif __KERNEL__ aoe: WIN_* -> ATA_CMD_* isd200: WIN_* -> ATA_CMD_* include/linux/hdreg.h: cover struct hd_driveid with #ifndef/#endif __KERNEL__ xsysace: make it 'struct hd_driveid'-free ubd_kern: make it 'struct hd_driveid'-free isd200: make it 'struct hd_driveid'-free
-rw-r--r--arch/um/drivers/ubd_kern.c12
-rw-r--r--drivers/block/aoe/aoecmd.c23
-rw-r--r--drivers/block/hd.c2
-rw-r--r--drivers/block/xsysace.c30
-rw-r--r--drivers/usb/storage/isd200.c239
-rw-r--r--include/linux/hdreg.h66
6 files changed, 117 insertions, 255 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index d42f826a8ab9..f934225fd8ef 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -22,6 +22,7 @@
22#include "linux/kernel.h" 22#include "linux/kernel.h"
23#include "linux/module.h" 23#include "linux/module.h"
24#include "linux/blkdev.h" 24#include "linux/blkdev.h"
25#include "linux/ata.h"
25#include "linux/hdreg.h" 26#include "linux/hdreg.h"
26#include "linux/init.h" 27#include "linux/init.h"
27#include "linux/cdrom.h" 28#include "linux/cdrom.h"
@@ -1308,16 +1309,15 @@ static int ubd_ioctl(struct block_device *bdev, fmode_t mode,
1308 unsigned int cmd, unsigned long arg) 1309 unsigned int cmd, unsigned long arg)
1309{ 1310{
1310 struct ubd *ubd_dev = bdev->bd_disk->private_data; 1311 struct ubd *ubd_dev = bdev->bd_disk->private_data;
1311 struct hd_driveid ubd_id = { 1312 u16 ubd_id[ATA_ID_WORDS];
1312 .cyls = 0,
1313 .heads = 128,
1314 .sectors = 32,
1315 };
1316 1313
1317 switch (cmd) { 1314 switch (cmd) {
1318 struct cdrom_volctrl volume; 1315 struct cdrom_volctrl volume;
1319 case HDIO_GET_IDENTITY: 1316 case HDIO_GET_IDENTITY:
1320 ubd_id.cyls = ubd_dev->size / (128 * 32 * 512); 1317 memset(&ubd_id, 0, ATA_ID_WORDS * 2);
1318 ubd_id[ATA_ID_CYLS] = ubd_dev->size / (128 * 32 * 512);
1319 ubd_id[ATA_ID_HEADS] = 128;
1320 ubd_id[ATA_ID_SECTORS] = 32;
1321 if(copy_to_user((char __user *) arg, (char *) &ubd_id, 1321 if(copy_to_user((char __user *) arg, (char *) &ubd_id,
1322 sizeof(ubd_id))) 1322 sizeof(ubd_id)))
1323 return -EFAULT; 1323 return -EFAULT;
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 45c5a33daf49..31693bc24444 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -4,6 +4,7 @@
4 * Filesystem request handling methods 4 * Filesystem request handling methods
5 */ 5 */
6 6
7#include <linux/ata.h>
7#include <linux/hdreg.h> 8#include <linux/hdreg.h>
8#include <linux/blkdev.h> 9#include <linux/blkdev.h>
9#include <linux/skbuff.h> 10#include <linux/skbuff.h>
@@ -267,7 +268,7 @@ aoecmd_ata_rw(struct aoedev *d)
267 writebit = 0; 268 writebit = 0;
268 } 269 }
269 270
270 ah->cmdstat = WIN_READ | writebit | extbit; 271 ah->cmdstat = ATA_CMD_PIO_READ | writebit | extbit;
271 272
272 /* mark all tracking fields and load out */ 273 /* mark all tracking fields and load out */
273 buf->nframesout += 1; 274 buf->nframesout += 1;
@@ -362,10 +363,10 @@ resend(struct aoedev *d, struct aoetgt *t, struct frame *f)
362 switch (ah->cmdstat) { 363 switch (ah->cmdstat) {
363 default: 364 default:
364 break; 365 break;
365 case WIN_READ: 366 case ATA_CMD_PIO_READ:
366 case WIN_READ_EXT: 367 case ATA_CMD_PIO_READ_EXT:
367 case WIN_WRITE: 368 case ATA_CMD_PIO_WRITE:
368 case WIN_WRITE_EXT: 369 case ATA_CMD_PIO_WRITE_EXT:
369 put_lba(ah, f->lba); 370 put_lba(ah, f->lba);
370 371
371 n = f->bcnt; 372 n = f->bcnt;
@@ -812,8 +813,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
812 d->htgt = NULL; 813 d->htgt = NULL;
813 n = ahout->scnt << 9; 814 n = ahout->scnt << 9;
814 switch (ahout->cmdstat) { 815 switch (ahout->cmdstat) {
815 case WIN_READ: 816 case ATA_CMD_PIO_READ:
816 case WIN_READ_EXT: 817 case ATA_CMD_PIO_READ_EXT:
817 if (skb->len - sizeof *hin - sizeof *ahin < n) { 818 if (skb->len - sizeof *hin - sizeof *ahin < n) {
818 printk(KERN_ERR 819 printk(KERN_ERR
819 "aoe: %s. skb->len=%d need=%ld\n", 820 "aoe: %s. skb->len=%d need=%ld\n",
@@ -823,8 +824,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
823 return; 824 return;
824 } 825 }
825 memcpy(f->bufaddr, ahin+1, n); 826 memcpy(f->bufaddr, ahin+1, n);
826 case WIN_WRITE: 827 case ATA_CMD_PIO_WRITE:
827 case WIN_WRITE_EXT: 828 case ATA_CMD_PIO_WRITE_EXT:
828 ifp = getif(t, skb->dev); 829 ifp = getif(t, skb->dev);
829 if (ifp) { 830 if (ifp) {
830 ifp->lost = 0; 831 ifp->lost = 0;
@@ -838,7 +839,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
838 goto xmit; 839 goto xmit;
839 } 840 }
840 break; 841 break;
841 case WIN_IDENTIFY: 842 case ATA_CMD_ID_ATA:
842 if (skb->len - sizeof *hin - sizeof *ahin < 512) { 843 if (skb->len - sizeof *hin - sizeof *ahin < 512) {
843 printk(KERN_INFO 844 printk(KERN_INFO
844 "aoe: runt data size in ataid. skb->len=%d\n", 845 "aoe: runt data size in ataid. skb->len=%d\n",
@@ -914,7 +915,7 @@ aoecmd_ata_id(struct aoedev *d)
914 915
915 /* set up ata header */ 916 /* set up ata header */
916 ah->scnt = 1; 917 ah->scnt = 1;
917 ah->cmdstat = WIN_IDENTIFY; 918 ah->cmdstat = ATA_CMD_ID_ATA;
918 ah->lba3 = 0xa0; 919 ah->lba3 = 0xa0;
919 920
920 skb->dev = t->ifp->nd; 921 skb->dev = t->ifp->nd;
diff --git a/drivers/block/hd.c b/drivers/block/hd.c
index 482c0c4b964f..3c11f062a18c 100644
--- a/drivers/block/hd.c
+++ b/drivers/block/hd.c
@@ -42,6 +42,8 @@
42#include <linux/ata.h> 42#include <linux/ata.h>
43#include <linux/hdreg.h> 43#include <linux/hdreg.h>
44 44
45#define HD_IRQ 14
46
45#define REALLY_SLOW_IO 47#define REALLY_SLOW_IO
46#include <asm/system.h> 48#include <asm/system.h>
47#include <asm/io.h> 49#include <asm/io.h>
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 119be3442f28..6cccdc3f5220 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -89,6 +89,7 @@
89#include <linux/delay.h> 89#include <linux/delay.h>
90#include <linux/slab.h> 90#include <linux/slab.h>
91#include <linux/blkdev.h> 91#include <linux/blkdev.h>
92#include <linux/ata.h>
92#include <linux/hdreg.h> 93#include <linux/hdreg.h>
93#include <linux/platform_device.h> 94#include <linux/platform_device.h>
94#if defined(CONFIG_OF) 95#if defined(CONFIG_OF)
@@ -208,7 +209,7 @@ struct ace_device {
208 struct gendisk *gd; 209 struct gendisk *gd;
209 210
210 /* Inserted CF card parameters */ 211 /* Inserted CF card parameters */
211 struct hd_driveid cf_id; 212 u16 cf_id[ATA_ID_WORDS];
212}; 213};
213 214
214static int ace_major; 215static int ace_major;
@@ -402,21 +403,14 @@ static void ace_dump_regs(struct ace_device *ace)
402 ace_in32(ace, ACE_CFGLBA), ace_in(ace, ACE_FATSTAT)); 403 ace_in32(ace, ACE_CFGLBA), ace_in(ace, ACE_FATSTAT));
403} 404}
404 405
405void ace_fix_driveid(struct hd_driveid *id) 406void ace_fix_driveid(u16 *id)
406{ 407{
407#if defined(__BIG_ENDIAN) 408#if defined(__BIG_ENDIAN)
408 u16 *buf = (void *)id;
409 int i; 409 int i;
410 410
411 /* All half words have wrong byte order; swap the bytes */ 411 /* All half words have wrong byte order; swap the bytes */
412 for (i = 0; i < sizeof(struct hd_driveid); i += 2, buf++) 412 for (i = 0; i < ATA_ID_WORDS; i++, id++)
413 *buf = le16_to_cpu(*buf); 413 *id = le16_to_cpu(*id);
414
415 /* Some of the data values are 32bit; swap the half words */
416 id->lba_capacity = ((id->lba_capacity >> 16) & 0x0000FFFF) |
417 ((id->lba_capacity << 16) & 0xFFFF0000);
418 id->spg = ((id->spg >> 16) & 0x0000FFFF) |
419 ((id->spg << 16) & 0xFFFF0000);
420#endif 414#endif
421} 415}
422 416
@@ -614,7 +608,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
614 break; 608 break;
615 609
616 case ACE_FSM_STATE_IDENTIFY_COMPLETE: 610 case ACE_FSM_STATE_IDENTIFY_COMPLETE:
617 ace_fix_driveid(&ace->cf_id); 611 ace_fix_driveid(&ace->cf_id[0]);
618 ace_dump_mem(&ace->cf_id, 512); /* Debug: Dump out disk ID */ 612 ace_dump_mem(&ace->cf_id, 512); /* Debug: Dump out disk ID */
619 613
620 if (ace->data_result) { 614 if (ace->data_result) {
@@ -627,9 +621,10 @@ static void ace_fsm_dostate(struct ace_device *ace)
627 ace->media_change = 0; 621 ace->media_change = 0;
628 622
629 /* Record disk parameters */ 623 /* Record disk parameters */
630 set_capacity(ace->gd, ace->cf_id.lba_capacity); 624 set_capacity(ace->gd,
625 ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
631 dev_info(ace->dev, "capacity: %i sectors\n", 626 dev_info(ace->dev, "capacity: %i sectors\n",
632 ace->cf_id.lba_capacity); 627 ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
633 } 628 }
634 629
635 /* We're done, drop to IDLE state and notify waiters */ 630 /* We're done, drop to IDLE state and notify waiters */
@@ -928,12 +923,13 @@ static int ace_release(struct gendisk *disk, fmode_t mode)
928static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo) 923static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
929{ 924{
930 struct ace_device *ace = bdev->bd_disk->private_data; 925 struct ace_device *ace = bdev->bd_disk->private_data;
926 u16 *cf_id = &ace->cf_id[0];
931 927
932 dev_dbg(ace->dev, "ace_getgeo()\n"); 928 dev_dbg(ace->dev, "ace_getgeo()\n");
933 929
934 geo->heads = ace->cf_id.heads; 930 geo->heads = cf_id[ATA_ID_HEADS];
935 geo->sectors = ace->cf_id.sectors; 931 geo->sectors = cf_id[ATA_ID_SECTORS];
936 geo->cylinders = ace->cf_id.cyls; 932 geo->cylinders = cf_id[ATA_ID_CYLS];
937 933
938 return 0; 934 return 0;
939} 935}
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 882c57b399f7..fdba2f69d4c9 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -46,6 +46,7 @@
46#include <linux/errno.h> 46#include <linux/errno.h>
47#include <linux/module.h> 47#include <linux/module.h>
48#include <linux/slab.h> 48#include <linux/slab.h>
49#include <linux/ata.h>
49#include <linux/hdreg.h> 50#include <linux/hdreg.h>
50#include <linux/scatterlist.h> 51#include <linux/scatterlist.h>
51 52
@@ -328,7 +329,7 @@ struct isd200_config {
328 329
329struct isd200_info { 330struct isd200_info {
330 struct inquiry_data InquiryData; 331 struct inquiry_data InquiryData;
331 struct hd_driveid *id; 332 u16 *id;
332 struct isd200_config ConfigData; 333 struct isd200_config ConfigData;
333 unsigned char *RegsBuf; 334 unsigned char *RegsBuf;
334 unsigned char ATARegs[8]; 335 unsigned char ATARegs[8];
@@ -419,19 +420,19 @@ static void isd200_build_sense(struct us_data *us, struct scsi_cmnd *srb)
419 buf->Flags = UNIT_ATTENTION; 420 buf->Flags = UNIT_ATTENTION;
420 buf->AdditionalSenseCode = 0; 421 buf->AdditionalSenseCode = 0;
421 buf->AdditionalSenseCodeQualifier = 0; 422 buf->AdditionalSenseCodeQualifier = 0;
422 } else if(error & MCR_ERR) { 423 } else if (error & ATA_MCR) {
423 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; 424 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
424 buf->AdditionalSenseLength = 0xb; 425 buf->AdditionalSenseLength = 0xb;
425 buf->Flags = UNIT_ATTENTION; 426 buf->Flags = UNIT_ATTENTION;
426 buf->AdditionalSenseCode = 0; 427 buf->AdditionalSenseCode = 0;
427 buf->AdditionalSenseCodeQualifier = 0; 428 buf->AdditionalSenseCodeQualifier = 0;
428 } else if(error & TRK0_ERR) { 429 } else if (error & ATA_TRK0NF) {
429 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; 430 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
430 buf->AdditionalSenseLength = 0xb; 431 buf->AdditionalSenseLength = 0xb;
431 buf->Flags = NOT_READY; 432 buf->Flags = NOT_READY;
432 buf->AdditionalSenseCode = 0; 433 buf->AdditionalSenseCode = 0;
433 buf->AdditionalSenseCodeQualifier = 0; 434 buf->AdditionalSenseCodeQualifier = 0;
434 } else if(error & ECC_ERR) { 435 } else if (error & ATA_UNC) {
435 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; 436 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
436 buf->AdditionalSenseLength = 0xb; 437 buf->AdditionalSenseLength = 0xb;
437 buf->Flags = DATA_PROTECT; 438 buf->Flags = DATA_PROTECT;
@@ -547,16 +548,16 @@ static int isd200_action( struct us_data *us, int action,
547 ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_5; 548 ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_5;
548 ata.generic.RegisterSelect = REG_DEVICE_HEAD | REG_COMMAND; 549 ata.generic.RegisterSelect = REG_DEVICE_HEAD | REG_COMMAND;
549 ata.write.DeviceHeadByte = info->DeviceHead; 550 ata.write.DeviceHeadByte = info->DeviceHead;
550 ata.write.CommandByte = WIN_SRST; 551 ata.write.CommandByte = ATA_CMD_DEV_RESET;
551 isd200_set_srb(info, DMA_NONE, NULL, 0); 552 isd200_set_srb(info, DMA_NONE, NULL, 0);
552 break; 553 break;
553 554
554 case ACTION_IDENTIFY: 555 case ACTION_IDENTIFY:
555 US_DEBUGP(" isd200_action(IDENTIFY)\n"); 556 US_DEBUGP(" isd200_action(IDENTIFY)\n");
556 ata.generic.RegisterSelect = REG_COMMAND; 557 ata.generic.RegisterSelect = REG_COMMAND;
557 ata.write.CommandByte = WIN_IDENTIFY; 558 ata.write.CommandByte = ATA_CMD_ID_ATA;
558 isd200_set_srb(info, DMA_FROM_DEVICE, info->id, 559 isd200_set_srb(info, DMA_FROM_DEVICE, info->id,
559 sizeof(struct hd_driveid)); 560 ATA_ID_WORDS * 2);
560 break; 561 break;
561 562
562 default: 563 default:
@@ -944,22 +945,22 @@ static int isd200_try_enum(struct us_data *us, unsigned char master_slave,
944 break; 945 break;
945 946
946 if (!detect) { 947 if (!detect) {
947 if (regs[ATA_REG_STATUS_OFFSET] & BUSY_STAT) { 948 if (regs[ATA_REG_STATUS_OFFSET] & ATA_BUSY) {
948 US_DEBUGP(" %s status is still BSY, try again...\n",mstr); 949 US_DEBUGP(" %s status is still BSY, try again...\n",mstr);
949 } else { 950 } else {
950 US_DEBUGP(" %s status !BSY, continue with next operation\n",mstr); 951 US_DEBUGP(" %s status !BSY, continue with next operation\n",mstr);
951 break; 952 break;
952 } 953 }
953 } 954 }
954 /* check for BUSY_STAT and */ 955 /* check for ATA_BUSY and */
955 /* WRERR_STAT (workaround ATA Zip drive) and */ 956 /* ATA_DF (workaround ATA Zip drive) and */
956 /* ERR_STAT (workaround for Archos CD-ROM) */ 957 /* ATA_ERR (workaround for Archos CD-ROM) */
957 else if (regs[ATA_REG_STATUS_OFFSET] & 958 else if (regs[ATA_REG_STATUS_OFFSET] &
958 (BUSY_STAT | WRERR_STAT | ERR_STAT )) { 959 (ATA_BUSY | ATA_DF | ATA_ERR)) {
959 US_DEBUGP(" Status indicates it is not ready, try again...\n"); 960 US_DEBUGP(" Status indicates it is not ready, try again...\n");
960 } 961 }
961 /* check for DRDY, ATA devices set DRDY after SRST */ 962 /* check for DRDY, ATA devices set DRDY after SRST */
962 else if (regs[ATA_REG_STATUS_OFFSET] & READY_STAT) { 963 else if (regs[ATA_REG_STATUS_OFFSET] & ATA_DRDY) {
963 US_DEBUGP(" Identified ATA device\n"); 964 US_DEBUGP(" Identified ATA device\n");
964 info->DeviceFlags |= DF_ATA_DEVICE; 965 info->DeviceFlags |= DF_ATA_DEVICE;
965 info->DeviceHead = master_slave; 966 info->DeviceHead = master_slave;
@@ -1053,103 +1054,50 @@ static int isd200_manual_enum(struct us_data *us)
1053 return(retStatus); 1054 return(retStatus);
1054} 1055}
1055 1056
1056static void isd200_fix_driveid (struct hd_driveid *id) 1057static void isd200_fix_driveid(u16 *id)
1057{ 1058{
1058#ifndef __LITTLE_ENDIAN 1059#ifndef __LITTLE_ENDIAN
1059# ifdef __BIG_ENDIAN 1060# ifdef __BIG_ENDIAN
1060 int i; 1061 int i;
1061 u16 *stringcast; 1062
1062 1063 for (i = 0; i < ATA_ID_WORDS; i++)
1063 id->config = __le16_to_cpu(id->config); 1064 id[i] = __le16_to_cpu(id[i]);
1064 id->cyls = __le16_to_cpu(id->cyls);
1065 id->reserved2 = __le16_to_cpu(id->reserved2);
1066 id->heads = __le16_to_cpu(id->heads);
1067 id->track_bytes = __le16_to_cpu(id->track_bytes);
1068 id->sector_bytes = __le16_to_cpu(id->sector_bytes);
1069 id->sectors = __le16_to_cpu(id->sectors);
1070 id->vendor0 = __le16_to_cpu(id->vendor0);
1071 id->vendor1 = __le16_to_cpu(id->vendor1);
1072 id->vendor2 = __le16_to_cpu(id->vendor2);
1073 stringcast = (u16 *)&id->serial_no[0];
1074 for (i = 0; i < (20/2); i++)
1075 stringcast[i] = __le16_to_cpu(stringcast[i]);
1076 id->buf_type = __le16_to_cpu(id->buf_type);
1077 id->buf_size = __le16_to_cpu(id->buf_size);
1078 id->ecc_bytes = __le16_to_cpu(id->ecc_bytes);
1079 stringcast = (u16 *)&id->fw_rev[0];
1080 for (i = 0; i < (8/2); i++)
1081 stringcast[i] = __le16_to_cpu(stringcast[i]);
1082 stringcast = (u16 *)&id->model[0];
1083 for (i = 0; i < (40/2); i++)
1084 stringcast[i] = __le16_to_cpu(stringcast[i]);
1085 id->dword_io = __le16_to_cpu(id->dword_io);
1086 id->reserved50 = __le16_to_cpu(id->reserved50);
1087 id->field_valid = __le16_to_cpu(id->field_valid);
1088 id->cur_cyls = __le16_to_cpu(id->cur_cyls);
1089 id->cur_heads = __le16_to_cpu(id->cur_heads);
1090 id->cur_sectors = __le16_to_cpu(id->cur_sectors);
1091 id->cur_capacity0 = __le16_to_cpu(id->cur_capacity0);
1092 id->cur_capacity1 = __le16_to_cpu(id->cur_capacity1);
1093 id->lba_capacity = __le32_to_cpu(id->lba_capacity);
1094 id->dma_1word = __le16_to_cpu(id->dma_1word);
1095 id->dma_mword = __le16_to_cpu(id->dma_mword);
1096 id->eide_pio_modes = __le16_to_cpu(id->eide_pio_modes);
1097 id->eide_dma_min = __le16_to_cpu(id->eide_dma_min);
1098 id->eide_dma_time = __le16_to_cpu(id->eide_dma_time);
1099 id->eide_pio = __le16_to_cpu(id->eide_pio);
1100 id->eide_pio_iordy = __le16_to_cpu(id->eide_pio_iordy);
1101 for (i = 0; i < 2; ++i)
1102 id->words69_70[i] = __le16_to_cpu(id->words69_70[i]);
1103 for (i = 0; i < 4; ++i)
1104 id->words71_74[i] = __le16_to_cpu(id->words71_74[i]);
1105 id->queue_depth = __le16_to_cpu(id->queue_depth);
1106 for (i = 0; i < 4; ++i)
1107 id->words76_79[i] = __le16_to_cpu(id->words76_79[i]);
1108 id->major_rev_num = __le16_to_cpu(id->major_rev_num);
1109 id->minor_rev_num = __le16_to_cpu(id->minor_rev_num);
1110 id->command_set_1 = __le16_to_cpu(id->command_set_1);
1111 id->command_set_2 = __le16_to_cpu(id->command_set_2);
1112 id->cfsse = __le16_to_cpu(id->cfsse);
1113 id->cfs_enable_1 = __le16_to_cpu(id->cfs_enable_1);
1114 id->cfs_enable_2 = __le16_to_cpu(id->cfs_enable_2);
1115 id->csf_default = __le16_to_cpu(id->csf_default);
1116 id->dma_ultra = __le16_to_cpu(id->dma_ultra);
1117 id->trseuc = __le16_to_cpu(id->trseuc);
1118 id->trsEuc = __le16_to_cpu(id->trsEuc);
1119 id->CurAPMvalues = __le16_to_cpu(id->CurAPMvalues);
1120 id->mprc = __le16_to_cpu(id->mprc);
1121 id->hw_config = __le16_to_cpu(id->hw_config);
1122 id->acoustic = __le16_to_cpu(id->acoustic);
1123 id->msrqs = __le16_to_cpu(id->msrqs);
1124 id->sxfert = __le16_to_cpu(id->sxfert);
1125 id->sal = __le16_to_cpu(id->sal);
1126 id->spg = __le32_to_cpu(id->spg);
1127 id->lba_capacity_2 = __le64_to_cpu(id->lba_capacity_2);
1128 for (i = 0; i < 22; i++)
1129 id->words104_125[i] = __le16_to_cpu(id->words104_125[i]);
1130 id->last_lun = __le16_to_cpu(id->last_lun);
1131 id->word127 = __le16_to_cpu(id->word127);
1132 id->dlf = __le16_to_cpu(id->dlf);
1133 id->csfo = __le16_to_cpu(id->csfo);
1134 for (i = 0; i < 26; i++)
1135 id->words130_155[i] = __le16_to_cpu(id->words130_155[i]);
1136 id->word156 = __le16_to_cpu(id->word156);
1137 for (i = 0; i < 3; i++)
1138 id->words157_159[i] = __le16_to_cpu(id->words157_159[i]);
1139 id->cfa_power = __le16_to_cpu(id->cfa_power);
1140 for (i = 0; i < 14; i++)
1141 id->words161_175[i] = __le16_to_cpu(id->words161_175[i]);
1142 for (i = 0; i < 31; i++)
1143 id->words176_205[i] = __le16_to_cpu(id->words176_205[i]);
1144 for (i = 0; i < 48; i++)
1145 id->words206_254[i] = __le16_to_cpu(id->words206_254[i]);
1146 id->integrity_word = __le16_to_cpu(id->integrity_word);
1147# else 1065# else
1148# error "Please fix <asm/byteorder.h>" 1066# error "Please fix <asm/byteorder.h>"
1149# endif 1067# endif
1150#endif 1068#endif
1151} 1069}
1152 1070
1071static void isd200_dump_driveid(u16 *id)
1072{
1073 US_DEBUGP(" Identify Data Structure:\n");
1074 US_DEBUGP(" config = 0x%x\n", id[ATA_ID_CONFIG]);
1075 US_DEBUGP(" cyls = 0x%x\n", id[ATA_ID_CYLS]);
1076 US_DEBUGP(" heads = 0x%x\n", id[ATA_ID_HEADS]);
1077 US_DEBUGP(" track_bytes = 0x%x\n", id[4]);
1078 US_DEBUGP(" sector_bytes = 0x%x\n", id[5]);
1079 US_DEBUGP(" sectors = 0x%x\n", id[ATA_ID_SECTORS]);
1080 US_DEBUGP(" serial_no[0] = 0x%x\n", *(char *)&id[ATA_ID_SERNO]);
1081 US_DEBUGP(" buf_type = 0x%x\n", id[20]);
1082 US_DEBUGP(" buf_size = 0x%x\n", id[ATA_ID_BUF_SIZE]);
1083 US_DEBUGP(" ecc_bytes = 0x%x\n", id[22]);
1084 US_DEBUGP(" fw_rev[0] = 0x%x\n", *(char *)&id[ATA_ID_FW_REV]);
1085 US_DEBUGP(" model[0] = 0x%x\n", *(char *)&id[ATA_ID_PROD]);
1086 US_DEBUGP(" max_multsect = 0x%x\n", id[ATA_ID_MAX_MULTSECT] & 0xff);
1087 US_DEBUGP(" dword_io = 0x%x\n", id[ATA_ID_DWORD_IO]);
1088 US_DEBUGP(" capability = 0x%x\n", id[ATA_ID_CAPABILITY] >> 8);
1089 US_DEBUGP(" tPIO = 0x%x\n", id[ATA_ID_OLD_PIO_MODES] >> 8);
1090 US_DEBUGP(" tDMA = 0x%x\n", id[ATA_ID_OLD_DMA_MODES] >> 8);
1091 US_DEBUGP(" field_valid = 0x%x\n", id[ATA_ID_FIELD_VALID]);
1092 US_DEBUGP(" cur_cyls = 0x%x\n", id[ATA_ID_CUR_CYLS]);
1093 US_DEBUGP(" cur_heads = 0x%x\n", id[ATA_ID_CUR_HEADS]);
1094 US_DEBUGP(" cur_sectors = 0x%x\n", id[ATA_ID_CUR_SECTORS]);
1095 US_DEBUGP(" cur_capacity = 0x%x\n", ata_id_u32(id, 57));
1096 US_DEBUGP(" multsect = 0x%x\n", id[ATA_ID_MULTSECT] & 0xff);
1097 US_DEBUGP(" lba_capacity = 0x%x\n", ata_id_u32(id, ATA_ID_LBA_CAPACITY));
1098 US_DEBUGP(" command_set_1 = 0x%x\n", id[ATA_ID_COMMAND_SET_1]);
1099 US_DEBUGP(" command_set_2 = 0x%x\n", id[ATA_ID_COMMAND_SET_2]);
1100}
1153 1101
1154/************************************************************************** 1102/**************************************************************************
1155 * isd200_get_inquiry_data 1103 * isd200_get_inquiry_data
@@ -1163,7 +1111,7 @@ static int isd200_get_inquiry_data( struct us_data *us )
1163{ 1111{
1164 struct isd200_info *info = (struct isd200_info *)us->extra; 1112 struct isd200_info *info = (struct isd200_info *)us->extra;
1165 int retStatus = ISD200_GOOD; 1113 int retStatus = ISD200_GOOD;
1166 struct hd_driveid *id = info->id; 1114 u16 *id = info->id;
1167 1115
1168 US_DEBUGP("Entering isd200_get_inquiry_data\n"); 1116 US_DEBUGP("Entering isd200_get_inquiry_data\n");
1169 1117
@@ -1180,8 +1128,7 @@ static int isd200_get_inquiry_data( struct us_data *us )
1180 /* this must be an ATA device */ 1128 /* this must be an ATA device */
1181 /* perform an ATA Command Identify */ 1129 /* perform an ATA Command Identify */
1182 transferStatus = isd200_action( us, ACTION_IDENTIFY, 1130 transferStatus = isd200_action( us, ACTION_IDENTIFY,
1183 id, 1131 id, ATA_ID_WORDS * 2);
1184 sizeof(struct hd_driveid) );
1185 if (transferStatus != ISD200_TRANSPORT_GOOD) { 1132 if (transferStatus != ISD200_TRANSPORT_GOOD) {
1186 /* Error issuing ATA Command Identify */ 1133 /* Error issuing ATA Command Identify */
1187 US_DEBUGP(" Error issuing ATA Command Identify\n"); 1134 US_DEBUGP(" Error issuing ATA Command Identify\n");
@@ -1191,35 +1138,9 @@ static int isd200_get_inquiry_data( struct us_data *us )
1191 int i; 1138 int i;
1192 __be16 *src; 1139 __be16 *src;
1193 __u16 *dest; 1140 __u16 *dest;
1194 isd200_fix_driveid(id);
1195 1141
1196 US_DEBUGP(" Identify Data Structure:\n"); 1142 isd200_fix_driveid(id);
1197 US_DEBUGP(" config = 0x%x\n", id->config); 1143 isd200_dump_driveid(id);
1198 US_DEBUGP(" cyls = 0x%x\n", id->cyls);
1199 US_DEBUGP(" heads = 0x%x\n", id->heads);
1200 US_DEBUGP(" track_bytes = 0x%x\n", id->track_bytes);
1201 US_DEBUGP(" sector_bytes = 0x%x\n", id->sector_bytes);
1202 US_DEBUGP(" sectors = 0x%x\n", id->sectors);
1203 US_DEBUGP(" serial_no[0] = 0x%x\n", id->serial_no[0]);
1204 US_DEBUGP(" buf_type = 0x%x\n", id->buf_type);
1205 US_DEBUGP(" buf_size = 0x%x\n", id->buf_size);
1206 US_DEBUGP(" ecc_bytes = 0x%x\n", id->ecc_bytes);
1207 US_DEBUGP(" fw_rev[0] = 0x%x\n", id->fw_rev[0]);
1208 US_DEBUGP(" model[0] = 0x%x\n", id->model[0]);
1209 US_DEBUGP(" max_multsect = 0x%x\n", id->max_multsect);
1210 US_DEBUGP(" dword_io = 0x%x\n", id->dword_io);
1211 US_DEBUGP(" capability = 0x%x\n", id->capability);
1212 US_DEBUGP(" tPIO = 0x%x\n", id->tPIO);
1213 US_DEBUGP(" tDMA = 0x%x\n", id->tDMA);
1214 US_DEBUGP(" field_valid = 0x%x\n", id->field_valid);
1215 US_DEBUGP(" cur_cyls = 0x%x\n", id->cur_cyls);
1216 US_DEBUGP(" cur_heads = 0x%x\n", id->cur_heads);
1217 US_DEBUGP(" cur_sectors = 0x%x\n", id->cur_sectors);
1218 US_DEBUGP(" cur_capacity = 0x%x\n", (id->cur_capacity1 << 16) + id->cur_capacity0 );
1219 US_DEBUGP(" multsect = 0x%x\n", id->multsect);
1220 US_DEBUGP(" lba_capacity = 0x%x\n", id->lba_capacity);
1221 US_DEBUGP(" command_set_1 = 0x%x\n", id->command_set_1);
1222 US_DEBUGP(" command_set_2 = 0x%x\n", id->command_set_2);
1223 1144
1224 memset(&info->InquiryData, 0, sizeof(info->InquiryData)); 1145 memset(&info->InquiryData, 0, sizeof(info->InquiryData));
1225 1146
@@ -1229,30 +1150,30 @@ static int isd200_get_inquiry_data( struct us_data *us )
1229 /* The length must be at least 36 (5 + 31) */ 1150 /* The length must be at least 36 (5 + 31) */
1230 info->InquiryData.AdditionalLength = 0x1F; 1151 info->InquiryData.AdditionalLength = 0x1F;
1231 1152
1232 if (id->command_set_1 & COMMANDSET_MEDIA_STATUS) { 1153 if (id[ATA_ID_COMMAND_SET_1] & COMMANDSET_MEDIA_STATUS) {
1233 /* set the removable bit */ 1154 /* set the removable bit */
1234 info->InquiryData.DeviceTypeModifier = DEVICE_REMOVABLE; 1155 info->InquiryData.DeviceTypeModifier = DEVICE_REMOVABLE;
1235 info->DeviceFlags |= DF_REMOVABLE_MEDIA; 1156 info->DeviceFlags |= DF_REMOVABLE_MEDIA;
1236 } 1157 }
1237 1158
1238 /* Fill in vendor identification fields */ 1159 /* Fill in vendor identification fields */
1239 src = (__be16*)id->model; 1160 src = (__be16 *)&id[ATA_ID_PROD];
1240 dest = (__u16*)info->InquiryData.VendorId; 1161 dest = (__u16*)info->InquiryData.VendorId;
1241 for (i=0;i<4;i++) 1162 for (i=0;i<4;i++)
1242 dest[i] = be16_to_cpu(src[i]); 1163 dest[i] = be16_to_cpu(src[i]);
1243 1164
1244 src = (__be16*)(id->model+8); 1165 src = (__be16 *)&id[ATA_ID_PROD + 8/2];
1245 dest = (__u16*)info->InquiryData.ProductId; 1166 dest = (__u16*)info->InquiryData.ProductId;
1246 for (i=0;i<8;i++) 1167 for (i=0;i<8;i++)
1247 dest[i] = be16_to_cpu(src[i]); 1168 dest[i] = be16_to_cpu(src[i]);
1248 1169
1249 src = (__be16*)id->fw_rev; 1170 src = (__be16 *)&id[ATA_ID_FW_REV];
1250 dest = (__u16*)info->InquiryData.ProductRevisionLevel; 1171 dest = (__u16*)info->InquiryData.ProductRevisionLevel;
1251 for (i=0;i<2;i++) 1172 for (i=0;i<2;i++)
1252 dest[i] = be16_to_cpu(src[i]); 1173 dest[i] = be16_to_cpu(src[i]);
1253 1174
1254 /* determine if it supports Media Status Notification */ 1175 /* determine if it supports Media Status Notification */
1255 if (id->command_set_2 & COMMANDSET_MEDIA_STATUS) { 1176 if (id[ATA_ID_COMMAND_SET_2] & COMMANDSET_MEDIA_STATUS) {
1256 US_DEBUGP(" Device supports Media Status Notification\n"); 1177 US_DEBUGP(" Device supports Media Status Notification\n");
1257 1178
1258 /* Indicate that it is enabled, even though it is not 1179 /* Indicate that it is enabled, even though it is not
@@ -1301,7 +1222,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1301 union ata_cdb * ataCdb) 1222 union ata_cdb * ataCdb)
1302{ 1223{
1303 struct isd200_info *info = (struct isd200_info *)us->extra; 1224 struct isd200_info *info = (struct isd200_info *)us->extra;
1304 struct hd_driveid *id = info->id; 1225 u16 *id = info->id;
1305 int sendToTransport = 1; 1226 int sendToTransport = 1;
1306 unsigned char sectnum, head; 1227 unsigned char sectnum, head;
1307 unsigned short cylinder; 1228 unsigned short cylinder;
@@ -1369,13 +1290,12 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1369 1290
1370 US_DEBUGP(" ATA OUT - SCSIOP_READ_CAPACITY\n"); 1291 US_DEBUGP(" ATA OUT - SCSIOP_READ_CAPACITY\n");
1371 1292
1372 if (id->capability & CAPABILITY_LBA ) { 1293 if (ata_id_has_lba(id))
1373 capacity = id->lba_capacity - 1; 1294 capacity = ata_id_u32(id, ATA_ID_LBA_CAPACITY) - 1;
1374 } else { 1295 else
1375 capacity = (id->heads * 1296 capacity = (id[ATA_ID_HEADS] * id[ATA_ID_CYLS] *
1376 id->cyls * 1297 id[ATA_ID_SECTORS]) - 1;
1377 id->sectors) - 1; 1298
1378 }
1379 readCapacityData.LogicalBlockAddress = cpu_to_be32(capacity); 1299 readCapacityData.LogicalBlockAddress = cpu_to_be32(capacity);
1380 readCapacityData.BytesPerBlock = cpu_to_be32(0x200); 1300 readCapacityData.BytesPerBlock = cpu_to_be32(0x200);
1381 1301
@@ -1392,16 +1312,16 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1392 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]); 1312 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]);
1393 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8]; 1313 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8];
1394 1314
1395 if (id->capability & CAPABILITY_LBA) { 1315 if (ata_id_has_lba(id)) {
1396 sectnum = (unsigned char)(lba); 1316 sectnum = (unsigned char)(lba);
1397 cylinder = (unsigned short)(lba>>8); 1317 cylinder = (unsigned short)(lba>>8);
1398 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F); 1318 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F);
1399 } else { 1319 } else {
1400 sectnum = (unsigned char)((lba % id->sectors) + 1); 1320 sectnum = (u8)((lba % id[ATA_ID_SECTORS]) + 1);
1401 cylinder = (unsigned short)(lba / (id->sectors * 1321 cylinder = (u16)(lba / (id[ATA_ID_SECTORS] *
1402 id->heads)); 1322 id[ATA_ID_HEADS]));
1403 head = (unsigned char)((lba / id->sectors) % 1323 head = (u8)((lba / id[ATA_ID_SECTORS]) %
1404 id->heads); 1324 id[ATA_ID_HEADS]);
1405 } 1325 }
1406 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; 1326 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
1407 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; 1327 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
@@ -1415,7 +1335,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1415 ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8); 1335 ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8);
1416 ataCdb->write.CylinderLowByte = (unsigned char)cylinder; 1336 ataCdb->write.CylinderLowByte = (unsigned char)cylinder;
1417 ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD); 1337 ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD);
1418 ataCdb->write.CommandByte = WIN_READ; 1338 ataCdb->write.CommandByte = ATA_CMD_PIO_READ;
1419 break; 1339 break;
1420 1340
1421 case WRITE_10: 1341 case WRITE_10:
@@ -1424,14 +1344,16 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1424 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]); 1344 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]);
1425 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8]; 1345 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8];
1426 1346
1427 if (id->capability & CAPABILITY_LBA) { 1347 if (ata_id_has_lba(id)) {
1428 sectnum = (unsigned char)(lba); 1348 sectnum = (unsigned char)(lba);
1429 cylinder = (unsigned short)(lba>>8); 1349 cylinder = (unsigned short)(lba>>8);
1430 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F); 1350 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F);
1431 } else { 1351 } else {
1432 sectnum = (unsigned char)((lba % id->sectors) + 1); 1352 sectnum = (u8)((lba % id[ATA_ID_SECTORS]) + 1);
1433 cylinder = (unsigned short)(lba / (id->sectors * id->heads)); 1353 cylinder = (u16)(lba / (id[ATA_ID_SECTORS] *
1434 head = (unsigned char)((lba / id->sectors) % id->heads); 1354 id[ATA_ID_HEADS]));
1355 head = (u8)((lba / id[ATA_ID_SECTORS]) %
1356 id[ATA_ID_HEADS]);
1435 } 1357 }
1436 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; 1358 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
1437 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; 1359 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
@@ -1445,7 +1367,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1445 ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8); 1367 ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8);
1446 ataCdb->write.CylinderLowByte = (unsigned char)cylinder; 1368 ataCdb->write.CylinderLowByte = (unsigned char)cylinder;
1447 ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD); 1369 ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD);
1448 ataCdb->write.CommandByte = WIN_WRITE; 1370 ataCdb->write.CommandByte = ATA_CMD_PIO_WRITE;
1449 break; 1371 break;
1450 1372
1451 case ALLOW_MEDIUM_REMOVAL: 1373 case ALLOW_MEDIUM_REMOVAL:
@@ -1459,7 +1381,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1459 ataCdb->generic.TransferBlockSize = 1; 1381 ataCdb->generic.TransferBlockSize = 1;
1460 ataCdb->generic.RegisterSelect = REG_COMMAND; 1382 ataCdb->generic.RegisterSelect = REG_COMMAND;
1461 ataCdb->write.CommandByte = (srb->cmnd[4] & 0x1) ? 1383 ataCdb->write.CommandByte = (srb->cmnd[4] & 0x1) ?
1462 WIN_DOORLOCK : WIN_DOORUNLOCK; 1384 ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK;
1463 isd200_srb_set_bufflen(srb, 0); 1385 isd200_srb_set_bufflen(srb, 0);
1464 } else { 1386 } else {
1465 US_DEBUGP(" Not removeable media, just report okay\n"); 1387 US_DEBUGP(" Not removeable media, just report okay\n");
@@ -1539,8 +1461,7 @@ static int isd200_init_info(struct us_data *us)
1539 if (!info) 1461 if (!info)
1540 retStatus = ISD200_ERROR; 1462 retStatus = ISD200_ERROR;
1541 else { 1463 else {
1542 info->id = (struct hd_driveid *) 1464 info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL);
1543 kzalloc(sizeof(struct hd_driveid), GFP_KERNEL);
1544 info->RegsBuf = (unsigned char *) 1465 info->RegsBuf = (unsigned char *)
1545 kmalloc(sizeof(info->ATARegs), GFP_KERNEL); 1466 kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
1546 info->srb.sense_buffer = 1467 info->srb.sense_buffer =
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index ed21bd3dbd25..29ee2873f4a8 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -1,68 +1,6 @@
1#ifndef _LINUX_HDREG_H 1#ifndef _LINUX_HDREG_H
2#define _LINUX_HDREG_H 2#define _LINUX_HDREG_H
3 3
4#ifdef __KERNEL__
5#include <linux/ata.h>
6
7/*
8 * This file contains some defines for the AT-hd-controller.
9 * Various sources.
10 */
11
12/* ide.c has its own port definitions in "ide.h" */
13
14#define HD_IRQ 14
15
16/* Hd controller regs. Ref: IBM AT Bios-listing */
17#define HD_DATA 0x1f0 /* _CTL when writing */
18#define HD_ERROR 0x1f1 /* see err-bits */
19#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
20#define HD_SECTOR 0x1f3 /* starting sector */
21#define HD_LCYL 0x1f4 /* starting cylinder */
22#define HD_HCYL 0x1f5 /* high byte of starting cyl */
23#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
24#define HD_STATUS 0x1f7 /* see status-bits */
25#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
26#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
27#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
28
29#define HD_CMD 0x3f6 /* used for resets */
30#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
31
32/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
33
34/* Bits of HD_STATUS */
35#define ERR_STAT 0x01
36#define INDEX_STAT 0x02
37#define ECC_STAT 0x04 /* Corrected error */
38#define DRQ_STAT 0x08
39#define SEEK_STAT 0x10
40#define SRV_STAT 0x10
41#define WRERR_STAT 0x20
42#define READY_STAT 0x40
43#define BUSY_STAT 0x80
44
45/* Bits for HD_ERROR */
46#define MARK_ERR 0x01 /* Bad address mark */
47#define ILI_ERR 0x01 /* Illegal Length Indication (ATAPI) */
48#define TRK0_ERR 0x02 /* couldn't find track 0 */
49#define EOM_ERR 0x02 /* End Of Media (ATAPI) */
50#define ABRT_ERR 0x04 /* Command aborted */
51#define MCR_ERR 0x08 /* media change request */
52#define ID_ERR 0x10 /* ID field not found */
53#define MC_ERR 0x20 /* media changed */
54#define ECC_ERR 0x40 /* Uncorrectable ECC error */
55#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
56#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
57#define LFS_ERR 0xf0 /* Last Failed Sense (ATAPI) */
58
59/* Bits of HD_NSECTOR */
60#define CD 0x01
61#define IO 0x02
62#define REL 0x04
63#define TAG_MASK 0xf8
64#endif /* __KERNEL__ */
65
66#include <linux/types.h> 4#include <linux/types.h>
67 5
68/* 6/*
@@ -191,6 +129,7 @@ typedef struct hd_drive_hob_hdr {
191#define TASKFILE_INVALID 0x7fff 129#define TASKFILE_INVALID 0x7fff
192#endif 130#endif
193 131
132#ifndef __KERNEL__
194/* ATA/ATAPI Commands pre T13 Spec */ 133/* ATA/ATAPI Commands pre T13 Spec */
195#define WIN_NOP 0x00 134#define WIN_NOP 0x00
196/* 135/*
@@ -379,6 +318,7 @@ typedef struct hd_drive_hob_hdr {
379#define SECURITY_ERASE_UNIT 0xBD 318#define SECURITY_ERASE_UNIT 0xBD
380#define SECURITY_FREEZE_LOCK 0xBE 319#define SECURITY_FREEZE_LOCK 0xBE
381#define SECURITY_DISABLE_PASSWORD 0xBF 320#define SECURITY_DISABLE_PASSWORD 0xBF
321#endif /* __KERNEL__ */
382 322
383struct hd_geometry { 323struct hd_geometry {
384 unsigned char heads; 324 unsigned char heads;
@@ -448,6 +388,7 @@ enum {
448 388
449#define __NEW_HD_DRIVE_ID 389#define __NEW_HD_DRIVE_ID
450 390
391#ifndef __KERNEL__
451/* 392/*
452 * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. 393 * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec.
453 * 394 *
@@ -699,6 +640,7 @@ struct hd_driveid {
699 * 7:0 Signature 640 * 7:0 Signature
700 */ 641 */
701}; 642};
643#endif /* __KERNEL__ */
702 644
703/* 645/*
704 * IDE "nice" flags. These are used on a per drive basis to determine 646 * IDE "nice" flags. These are used on a per drive basis to determine