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

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