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. Check out some definitions (see comments with
   9  * a ques).
  10  */
  11 
  12 /* Hd controller regs. Ref: IBM AT Bios-listing */
  13 /* For a second IDE interface, xor all addresses with 0x80 */
  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 /* Bits of HD_STATUS */
  30 #define ERR_STAT        0x01
  31 #define INDEX_STAT      0x02
  32 #define ECC_STAT        0x04    /* Corrected error */
  33 #define DRQ_STAT        0x08
  34 #define SEEK_STAT       0x10
  35 #define WRERR_STAT      0x20
  36 #define READY_STAT      0x40
  37 #define BUSY_STAT       0x80
  38 
  39 /* Values for HD_COMMAND */
  40 #define WIN_RESTORE             0x10
  41 #define WIN_READ                0x20
  42 #define WIN_WRITE               0x30
  43 #define WIN_VERIFY              0x40
  44 #define WIN_FORMAT              0x50
  45 #define WIN_INIT                0x60
  46 #define WIN_SEEK                0x70
  47 #define WIN_DIAGNOSE            0x90
  48 #define WIN_SPECIFY             0x91
  49 #define WIN_SETIDLE1            0xE3
  50 #define WIN_SETIDLE2            0x97
  51 
  52 #define WIN_PIDENTIFY           0xA1    /* identify ATA-PI device       */
  53 #define WIN_MULTREAD            0xC4    /* read multiple sectors        */
  54 #define WIN_MULTWRITE           0xC5    /* write multiple sectors       */
  55 #define WIN_SETMULT             0xC6    /* enable read multiple         */
  56 #define WIN_IDENTIFY            0xEC    /* ask drive to identify itself */
  57 #define WIN_SETFEATURES         0xEF    /* set special drive features   */
  58 
  59 /* Bits for HD_ERROR */
  60 #define MARK_ERR        0x01    /* Bad address mark */
  61 #define TRK0_ERR        0x02    /* couldn't find track 0 */
  62 #define ABRT_ERR        0x04    /* Command aborted */
  63 #define ID_ERR          0x10    /* ID field not found */
  64 #define ECC_ERR         0x40    /* Uncorrectable ECC error */
  65 #define BBD_ERR         0x80    /* block marked bad */
  66 
  67 struct hd_geometry {
  68       unsigned char heads;
  69       unsigned char sectors;
  70       unsigned short cylinders;
  71       unsigned long start;
  72 };
  73 
  74 /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x30n/0x31n */
  75 #define HDIO_GETGEO             0x301   /* get device geometry */
  76 #define HDIO_REQ                HDIO_GETGEO     /* obsolete, use HDIO_GETGEO */
  77 #define HDIO_GET_UNMASKINTR     0x302   /* get current unmask setting */
  78 #define HDIO_GET_MULTCOUNT      0x304   /* get current IDE blockmode setting */
  79 #define HDIO_GET_IDENTITY       0x307   /* get IDE identification info */
  80 #define HDIO_GET_KEEPSETTINGS   0x308   /* get keep-settings-on-reset flag */
  81 #define HDIO_DRIVE_CMD          0x31f   /* execute a special drive command */
  82 
  83 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x32n/0x33n */
  84 #define HDIO_SET_MULTCOUNT      0x321   /* set IDE blockmode */
  85 #define HDIO_SET_UNMASKINTR     0x322   /* permit other irqs during I/O */
  86 #define HDIO_SET_KEEPSETTINGS   0x323   /* keep ioctl settings on reset */
  87 
  88 /* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */
  89 struct hd_driveid {
  90         unsigned short  config;         /* lots of obsolete bit flags */
  91         unsigned short  cyls;           /* "physical" cyls */
  92         unsigned short  reserved2;      /* reserved (word 2) */
  93         unsigned short  heads;          /* "physical" heads */
  94         unsigned short  track_bytes;    /* unformatted bytes per track */
  95         unsigned short  sector_bytes;   /* unformatted bytes per sector */
  96         unsigned short  sectors;        /* "physical" sectors per track */
  97         unsigned short  vendor0;        /* vendor unique */
  98         unsigned short  vendor1;        /* vendor unique */
  99         unsigned short  vendor2;        /* vendor unique */
 100         unsigned char   serial_no[20];  /* 0 = not_specified */
 101         unsigned short  buf_type;
 102         unsigned short  buf_size;       /* 512 byte increments; 0 = not_specified */
 103         unsigned short  ecc_bytes;      /* for r/w long cmds; 0 = not_specified */
 104         unsigned char   fw_rev[8];      /* 0 = not_specified */
 105         unsigned char   model[40];      /* 0 = not_specified */
 106         unsigned char   max_multsect;   /* 0=not_implemented */
 107         unsigned char   vendor3;        /* vendor unique */
 108         unsigned short  dword_io;       /* 0=not_implemented; 1=implemented */
 109         unsigned char   vendor4;        /* vendor unique */
 110         unsigned char   capability;     /* bits 0:DMA 1:LBA 2:IORDYsw 3:IORDYsup*/
 111         unsigned short  reserved50;     /* reserved (word 50) */
 112         unsigned char   vendor5;        /* vendor unique */
 113         unsigned char   tPIO;           /* 0=slow, 1=medium, 2=fast */
 114         unsigned char   vendor6;        /* vendor unique */
 115         unsigned char   tDMA;           /* 0=slow, 1=medium, 2=fast */
 116         unsigned short  field_valid;    /* bits 0:cur_ok 1:eide_ok */
 117         unsigned short  cur_cyls;       /* logical cylinders */
 118         unsigned short  cur_heads;      /* logical heads */
 119         unsigned short  cur_sectors;    /* logical sectors per track */
 120         unsigned short  cur_capacity0;  /* logical total sectors on drive */
 121         unsigned short  cur_capacity1;  /*  (2 words, misaligned int)     */
 122         unsigned char   multsect;       /* current multiple sector count */
 123         unsigned char   multsect_valid; /* when (bit0==1) multsect is ok */
 124         unsigned int    lba_capacity;   /* total number of sectors */
 125         unsigned short  dma_1word;      /* single-word dma info */
 126         unsigned short  dma_mword;      /* multiple-word dma info */
 127         unsigned short  eide_pio_modes; /* bits 0:mode3 1:mode4 */
 128         unsigned short  eide_dma_min;   /* min mword dma cycle time (ns) */
 129         unsigned short  eide_dma_time;  /* recommended mword dma cycle time (ns) */
 130         unsigned short  eide_pio;       /* min cycle time (ns), no IORDY  */
 131         unsigned short  eide_pio_iordy; /* min cycle time (ns), with IORDY */
 132         unsigned short  reserved69;     /* reserved (word 69) */
 133         unsigned short  reserved70;     /* reserved (word 70) */
 134         /* unsigned short reservedxx[57];*/     /* reserved (words 71-127) */
 135         /* unsigned short vendor7  [32];*/      /* vendor unique (words 128-159) */
 136         /* unsigned short reservedyy[96];*/     /* reserved (words 160-255) */
 137 };
 138 
 139 /*
 140  * These routines are used for kernel command line parameters from main.c:
 141  */
 142 #ifdef CONFIG_BLK_DEV_HD
 143 void hd_setup(char *, int *);
 144 #endif  /* CONFIG_BLK_DEV_HD */
 145 #ifdef CONFIG_BLK_DEV_IDE
 146 void ide_setup(char *, int *);
 147 void hda_setup(char *, int *);
 148 void hdb_setup(char *, int *);
 149 void hdc_setup(char *, int *);
 150 void hdd_setup(char *, int *);
 151 #endif  /* CONFIG_BLK_DEV_IDE */
 152 
 153 #endif  /* _LINUX_HDREG_H */

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