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. Check out some definitions (see comments with
   7  * a ques).
   8  */
   9 
  10 /* Hd controller regs. Ref: IBM AT Bios-listing */
  11 #define HD_DATA         0x1f0   /* _CTL when writing */
  12 #define HD_ERROR        0x1f1   /* see err-bits */
  13 #define HD_NSECTOR      0x1f2   /* nr of sectors to read/write */
  14 #define HD_SECTOR       0x1f3   /* starting sector */
  15 #define HD_LCYL         0x1f4   /* starting cylinder */
  16 #define HD_HCYL         0x1f5   /* high byte of starting cyl */
  17 #define HD_CURRENT      0x1f6   /* 101dhhhh , d=drive, hhhh=head */
  18 #define HD_STATUS       0x1f7   /* see status-bits */
  19 #define HD_PRECOMP HD_ERROR     /* same io address, read=error, write=precomp */
  20 #define HD_COMMAND HD_STATUS    /* same io address, read=status, write=cmd */
  21 
  22 #define HD_CMD          0x3f6
  23 
  24 /* Bits of HD_STATUS */
  25 #define ERR_STAT        0x01
  26 #define INDEX_STAT      0x02
  27 #define ECC_STAT        0x04    /* Corrected error */
  28 #define DRQ_STAT        0x08
  29 #define SEEK_STAT       0x10
  30 #define WRERR_STAT      0x20
  31 #define READY_STAT      0x40
  32 #define BUSY_STAT       0x80
  33 
  34 /* Values for HD_COMMAND */
  35 #define WIN_RESTORE             0x10
  36 #define WIN_READ                0x20
  37 #define WIN_WRITE               0x30
  38 #define WIN_VERIFY              0x40
  39 #define WIN_FORMAT              0x50
  40 #define WIN_INIT                0x60
  41 #define WIN_SEEK                0x70
  42 #define WIN_DIAGNOSE            0x90
  43 #define WIN_SPECIFY             0x91
  44 
  45 #define WIN_MULTREAD            0xC4    /* read multiple sectors        */
  46 #define WIN_MULTWRITE           0xC5    /* write multiple sectors       */
  47 #define WIN_SETMULT             0xC6    /* enable read multiple         */
  48 #define WIN_IDENTIFY            0xEC    /* ask drive to identify itself */
  49 #define WIN_SETFEATURES         0xEF    /* set special drive features   */
  50 
  51 /* Bits for HD_ERROR */
  52 #define MARK_ERR        0x01    /* Bad address mark */
  53 #define TRK0_ERR        0x02    /* couldn't find track 0 */
  54 #define ABRT_ERR        0x04    /* Command aborted */
  55 #define ID_ERR          0x10    /* ID field not found */
  56 #define ECC_ERR         0x40    /* Uncorrectable ECC error */
  57 #define BBD_ERR         0x80    /* block marked bad */
  58 
  59 
  60 /* HDIO_GETGEO is the preferred choice - HDIO_REQ will be removed at some
  61    later date */
  62 #define HDIO_REQ 0x301
  63 #define HDIO_GETGEO 0x301
  64 struct hd_geometry {
  65       unsigned char heads;
  66       unsigned char sectors;
  67       unsigned short cylinders;
  68       unsigned long start;
  69 };
  70 #define HDIO_GETUNMASKINTR      0x302
  71 #define HDIO_SETUNMASKINTR      0x303
  72 #define HDIO_GETMULTCOUNT       0x304
  73 #define HDIO_SETMULTCOUNT       0x305
  74 #define HDIO_SETFEATURE         0x306
  75 #define HDIO_GETIDENTITY        0x307
  76 #endif
  77 
  78 /* structure returned by HDIO_GETIDENTITY, as per ASC X3T9.2 rev 4a */
  79 struct hd_driveid {
  80         unsigned short  config;         /* lots of obsolete bit flags */
  81         unsigned short  cyls;           /* "physical" cyls */
  82         unsigned short  reserved0;      /* reserved */
  83         unsigned short  heads;          /* "physical" heads */
  84         unsigned short  track_bytes;    /* unformatted bytes per track */
  85         unsigned short  sector_bytes;   /* unformatted bytes per sector */
  86         unsigned short  sectors;        /* "physical" sectors per track */
  87         unsigned short  vendor0;        /* vendor unique */
  88         unsigned short  vendor1;        /* vendor unique */
  89         unsigned short  vendor2;        /* vendor unique */
  90         unsigned char   serial_no[20];  /* big_endian; 0 = not_specified */
  91         unsigned short  buf_type;
  92         unsigned short  buf_size;       /* 512 byte increments; 0 = not_specified */
  93         unsigned short  ecc_bytes;      /* for r/w long cmds; 0 = not_specified */
  94         unsigned char   fw_rev[8];      /* big_endian; 0 = not_specified */
  95         unsigned char   model[40];      /* big_endian; 0 = not_specified */
  96         unsigned char   max_multsect;   /* 0=not_implemented */
  97         unsigned char   vendor3;        /* vendor unique */
  98         unsigned short  dword_io;       /* 0=not_implemented; 1=implemented */
  99         unsigned char   vendor4;        /* vendor unique */
 100         unsigned char   capability;     /* bit0:DMA, bit1:LBA */
 101         unsigned short  reserved1;      /* reserved */
 102         unsigned char   vendor5;        /* vendor unique */
 103         unsigned char   tPIO;           /* 0=slow, 1=medium, 2=fast */
 104         unsigned char   vendor6;        /* vendor unique */
 105         unsigned char   tDMA;           /* 0=slow, 1=medium, 2=fast */
 106         unsigned short  cur_valid;      /* when (bit0==1) use logical geom */
 107         unsigned short  cur_cyls;       /* logical cylinders */
 108         unsigned short  cur_heads;      /* logical heads */
 109         unsigned short  cur_sectors;    /* logical sectors per track */
 110         unsigned short  cur_capacity0;  /* logical total sectors on drive */
 111         unsigned short  cur_capacity1;  /*  (2 words, misaligned int)     */
 112         unsigned char   multsect;       /* current multiple sector count */
 113         unsigned char   multsect_valid; /* when (bit0==1) multsect is ok */
 114         unsigned int    lba_capacity;   /* total number of sectors */
 115         unsigned short  dma_1word;      /* single-word dma info */
 116         unsigned short  dma_mword;      /* multiple-word dma info */
 117         /* unsigned short reserved2[64];*/      /* reserved */
 118         /* unsigned short vendor7  [32];*/      /* vendor unique */
 119         /* unsigned short reserved3[96];*/      /* reserved */
 120 };

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