root/include/linux/hdreg.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _LINUX_HDREG_H
   2 #define _LINUX_HDREG_H
   3 
   4 #include <linux/config.h>
   5 
   6 /*
   7  * This file contains some defines for the AT-hd-controller.
   8  * Various sources.  
   9  */
  10 
  11 #define HD_IRQ 14               /* the standard disk interrupt */
  12 
  13 /* ide.c has it's own port definitions in "ide.h" */
  14 
  15 /* Hd controller regs. Ref: IBM AT Bios-listing */
  16 #define HD_DATA         0x1f0   /* _CTL when writing */
  17 #define HD_ERROR        0x1f1   /* see err-bits */
  18 #define HD_NSECTOR      0x1f2   /* nr of sectors to read/write */
  19 #define HD_SECTOR       0x1f3   /* starting sector */
  20 #define HD_LCYL         0x1f4   /* starting cylinder */
  21 #define HD_HCYL         0x1f5   /* high byte of starting cyl */
  22 #define HD_CURRENT      0x1f6   /* 101dhhhh , d=drive, hhhh=head */
  23 #define HD_STATUS       0x1f7   /* see status-bits */
  24 #define HD_FEATURE HD_ERROR     /* same io address, read=error, write=feature */
  25 #define HD_PRECOMP HD_FEATURE   /* obsolete use of this port - predates IDE */
  26 #define HD_COMMAND HD_STATUS    /* same io address, read=status, write=cmd */
  27 
  28 #define HD_CMD          0x3f6   /* used for resets */
  29 #define HD_ALTSTATUS    0x3f6   /* same as HD_STATUS but doesn't clear irq */
  30 
  31 /* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
  32 
  33 /* Bits of HD_STATUS */
  34 #define ERR_STAT        0x01
  35 #define INDEX_STAT      0x02
  36 #define ECC_STAT        0x04    /* Corrected error */
  37 #define DRQ_STAT        0x08
  38 #define SEEK_STAT       0x10
  39 #define WRERR_STAT      0x20
  40 #define READY_STAT      0x40
  41 #define BUSY_STAT       0x80
  42 
  43 /* Values for HD_COMMAND */
  44 #define WIN_RESTORE             0x10
  45 #define WIN_READ                0x20
  46 #define WIN_WRITE               0x30
  47 #define WIN_VERIFY              0x40
  48 #define WIN_FORMAT              0x50
  49 #define WIN_INIT                0x60
  50 #define WIN_SEEK                0x70
  51 #define WIN_DIAGNOSE            0x90
  52 #define WIN_SPECIFY             0x91    /* set drive geometry translation */
  53 #define WIN_SETIDLE1            0xE3
  54 #define WIN_SETIDLE2            0x97
  55 
  56 #define WIN_DOORLOCK            0xde    /* lock door on removeable drives */
  57 #define WIN_DOORUNLOCK          0xdf    /* unlock door on removeable drives */
  58 
  59 #define WIN_MULTREAD            0xC4    /* read sectors using multiple mode */
  60 #define WIN_MULTWRITE           0xC5    /* write sectors using multiple mode */
  61 #define WIN_SETMULT             0xC6    /* enable/disable multiple mode */
  62 #define WIN_IDENTIFY            0xEC    /* ask drive to identify itself */
  63 #define WIN_SETFEATURES         0xEF    /* set special drive features */
  64 #define WIN_READDMA             0xc8    /* read sectors using DMA transfers */
  65 #define WIN_WRITEDMA            0xca    /* write sectors using DMA transfers */
  66 
  67 /* Additional drive command codes used by ATAPI devices. */
  68 #define WIN_PIDENTIFY           0xA1    /* identify ATAPI device        */
  69 #define WIN_SRST                0x08    /* ATAPI soft reset command */
  70 #define WIN_PACKETCMD           0xa0    /* Send a packet command. */
  71 
  72 /* Bits for HD_ERROR */
  73 #define MARK_ERR        0x01    /* Bad address mark */
  74 #define TRK0_ERR        0x02    /* couldn't find track 0 */
  75 #define ABRT_ERR        0x04    /* Command aborted */
  76 #define ID_ERR          0x10    /* ID field not found */
  77 #define ECC_ERR         0x40    /* Uncorrectable ECC error */
  78 #define BBD_ERR         0x80    /* block marked bad */
  79 
  80 struct hd_geometry {
  81       unsigned char heads;
  82       unsigned char sectors;
  83       unsigned short cylinders;
  84       unsigned long start;
  85 };
  86 
  87 /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x30n/0x31n */
  88 #define HDIO_GETGEO             0x301   /* get device geometry */
  89 #define HDIO_GET_UNMASKINTR     0x302   /* get current unmask setting */
  90 #define HDIO_GET_MULTCOUNT      0x304   /* get current IDE blockmode setting */
  91 #define HDIO_GET_IDENTITY       0x307   /* get IDE identification info */
  92 #define HDIO_GET_KEEPSETTINGS   0x308   /* get keep-settings-on-reset flag */
  93 #define HDIO_GET_CHIPSET        0x309   /* get current interface type setting */
  94 #define HDIO_GET_NOWERR         0x30a   /* get ignore-write-error flag */
  95 #define HDIO_GET_DMA            0x30b   /* get use-dma flag */
  96 #define HDIO_DRIVE_CMD          0x31f   /* execute a special drive command */
  97 
  98 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x32n/0x33n */
  99 #define HDIO_SET_MULTCOUNT      0x321   /* set IDE blockmode */
 100 #define HDIO_SET_UNMASKINTR     0x322   /* permit other irqs during I/O */
 101 #define HDIO_SET_KEEPSETTINGS   0x323   /* keep ioctl settings on reset */
 102 #define HDIO_SET_CHIPSET        0x324   /* optimise driver for interface type */
 103 #define HDIO_SET_NOWERR         0x325   /* set ignore-write-error flag */
 104 #define HDIO_SET_DMA            0x326   /* set use-dma flag */
 105 
 106 /* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */
 107 struct hd_driveid {
 108         unsigned short  config;         /* lots of obsolete bit flags */
 109         unsigned short  cyls;           /* "physical" cyls */
 110         unsigned short  reserved2;      /* reserved (word 2) */
 111         unsigned short  heads;          /* "physical" heads */
 112         unsigned short  track_bytes;    /* unformatted bytes per track */
 113         unsigned short  sector_bytes;   /* unformatted bytes per sector */
 114         unsigned short  sectors;        /* "physical" sectors per track */
 115         unsigned short  vendor0;        /* vendor unique */
 116         unsigned short  vendor1;        /* vendor unique */
 117         unsigned short  vendor2;        /* vendor unique */
 118         unsigned char   serial_no[20];  /* 0 = not_specified */
 119         unsigned short  buf_type;
 120         unsigned short  buf_size;       /* 512 byte increments; 0 = not_specified */
 121         unsigned short  ecc_bytes;      /* for r/w long cmds; 0 = not_specified */
 122         unsigned char   fw_rev[8];      /* 0 = not_specified */
 123         unsigned char   model[40];      /* 0 = not_specified */
 124         unsigned char   max_multsect;   /* 0=not_implemented */
 125         unsigned char   vendor3;        /* vendor unique */
 126         unsigned short  dword_io;       /* 0=not_implemented; 1=implemented */
 127         unsigned char   vendor4;        /* vendor unique */
 128         unsigned char   capability;     /* bits 0:DMA 1:LBA 2:IORDYsw 3:IORDYsup*/
 129         unsigned short  reserved50;     /* reserved (word 50) */
 130         unsigned char   vendor5;        /* vendor unique */
 131         unsigned char   tPIO;           /* 0=slow, 1=medium, 2=fast */
 132         unsigned char   vendor6;        /* vendor unique */
 133         unsigned char   tDMA;           /* 0=slow, 1=medium, 2=fast */
 134         unsigned short  field_valid;    /* bits 0:cur_ok 1:eide_ok */
 135         unsigned short  cur_cyls;       /* logical cylinders */
 136         unsigned short  cur_heads;      /* logical heads */
 137         unsigned short  cur_sectors;    /* logical sectors per track */
 138         unsigned short  cur_capacity0;  /* logical total sectors on drive */
 139         unsigned short  cur_capacity1;  /*  (2 words, misaligned int)     */
 140         unsigned char   multsect;       /* current multiple sector count */
 141         unsigned char   multsect_valid; /* when (bit0==1) multsect is ok */
 142         unsigned int    lba_capacity;   /* total number of sectors */
 143         unsigned short  dma_1word;      /* single-word dma info */
 144         unsigned short  dma_mword;      /* multiple-word dma info */
 145         unsigned short  eide_pio_modes; /* bits 0:mode3 1:mode4 */
 146         unsigned short  eide_dma_min;   /* min mword dma cycle time (ns) */
 147         unsigned short  eide_dma_time;  /* recommended mword dma cycle time (ns) */
 148         unsigned short  eide_pio;       /* min cycle time (ns), no IORDY  */
 149         unsigned short  eide_pio_iordy; /* min cycle time (ns), with IORDY */
 150         unsigned short  reserved69;     /* reserved (word 69) */
 151         unsigned short  reserved70;     /* reserved (word 70) */
 152         /* unsigned short reservedxx[57];*/     /* reserved (words 71-127) */
 153         /* unsigned short vendor7  [32];*/      /* vendor unique (words 128-159) */
 154         /* unsigned short reservedyy[96];*/     /* reserved (words 160-255) */
 155 };
 156 
 157 /*
 158  * These routines are used for kernel command line parameters from main.c:
 159  */
 160 #ifdef CONFIG_BLK_DEV_HD
 161 void hd_setup(char *, int *);
 162 #endif  /* CONFIG_BLK_DEV_HD */
 163 #ifdef CONFIG_BLK_DEV_IDE
 164 void ide_setup(char *);
 165 #endif  /* CONFIG_BLK_DEV_IDE */
 166 
 167 #endif  /* _LINUX_HDREG_H */

/* [previous][next][first][last][top][bottom][index][help] */