����14-21 linux/include/linux/hdreg.h


  1 /*

  2  * This file contains some defines for the AT-hd-controller.

  3  * Various sources. Check out some definitions (see comments with

  4  * a ques).

  5  */

    /*

     * ���ļ�����һЩATӲ�̿������Ķ��塣���Ը������ϡ����֤ijЩ

     * ���壨�����ʺŵ�ע�ͣ���

     */

  6 #ifndef _HDREG_H

  7 #define _HDREG_H

  8

  9 /* Hd controller regs. Ref: IBM AT Bios-listing */

    /* Ӳ�̿������Ĵ����˿ڡ��μ���IBM AT Bios���� */

 10 #define HD_DATA         0x1f0   /* _CTL when writing */

 11 #define HD_ERROR        0x1f1   /* see err-bits */

 12 #define HD_NSECTOR      0x1f2   /* nr of sectors to read/write */

 13 #define HD_SECTOR       0x1f3   /* starting sector */

 14 #define HD_LCYL         0x1f4   /* starting cylinder */

 15 #define HD_HCYL         0x1f5   /* high byte of starting cyl */

 16 #define HD_CURRENT      0x1f6   /* 101dhhhh , d=drive, hhhh=head */

 17 #define HD_STATUS       0x1f7   /* see status-bits */

 18 #define HD_PRECOMP HD_ERROR     /* same io address, read=error, write=precomp */

 19 #define HD_COMMAND HD_STATUS    /* same io address, read=status, write=cmd */

 20

 21 #define HD_CMD          0x3f6   // ���ƼĴ����˿ڡ�

 22

 23 /* Bits of HD_STATUS */

    /* Ӳ��״̬�Ĵ�����λ�Ķ���(HD_STATUS) */

 24 #define ERR_STAT        0x01    // ����ִ�д���

 25 #define INDEX_STAT      0x02    // �յ�������

 26 #define ECC_STAT        0x04    /* Corrected error */  // ECCУ�����

 27 #define DRQ_STAT        0x08    // �������

 28 #define SEEK_STAT       0x10    // Ѱ��������

 29 #define WRERR_STAT      0x20    // ���������ϡ�

 30 #define READY_STAT      0x40    // ������׼���ã���������

 31 #define BUSY_STAT       0x80    // ������æµ��

 32

 33 /* Values for HD_COMMAND */

    /* Ӳ������ֵ��HD_CMD�� */

 34 #define WIN_RESTORE             0x10   // ����������У������������λ����

 35 #define WIN_READ                0x20   // ��������

 36 #define WIN_WRITE               0x30   // д������

 37 #define WIN_VERIFY              0x40   // �������顣

 38 #define WIN_FORMAT              0x50   // ��ʽ���ŵ���

 39 #define WIN_INIT                0x60   // ��������ʼ����

 40 #define WIN_SEEK                0x70   // Ѱ����

 41 #define WIN_DIAGNOSE            0x90   // ��������ϡ�

 42 #define WIN_SPECIFY             0x91   // ����������������

 43

 44 /* Bits for HD_ERROR */

    /* ����Ĵ���������λ�ĺ��壨HD_ERROR�� */

    // ִ�п������������ʱ��������������ʱ�IJ�ͬ������ֱ��г���

    // ==================================================

    //           �������ʱ            ��������ʱ

    // --------------------------------------------------

    // 0x01      �޴���               ���ݱ�־��ʧ

    // 0x02      ����������           �ŵ�0��

    // 0x03      ������������        

    // 0x04      ECC������            �������

    // 0x05      ���ƴ�������         

    // 0x10                            IDδ�ҵ�

    // 0x40                            ECC����

    // 0x80                            ������

    //---------------------------------------------------

 45 #define MARK_ERR        0x01    /* Bad address mark ? */

 46 #define TRK0_ERR        0x02    /* couldn't find track 0 */

 47 #define ABRT_ERR        0x04    /* ? */

 48 #define ID_ERR          0x10    /* ? */

 49 #define ECC_ERR         0x40    /* ? */

 50 #define BBD_ERR         0x80    /* ? */

 51

    // Ӳ�̷������ṹ���μ������б�����Ϣ��

 52 struct partition {

 53         unsigned char boot_ind;         /* 0x80 - active (unused) */

 54         unsigned char head;             /* ? */

 55         unsigned char sector;           /* ? */

 56         unsigned char cyl;              /* ? */

 57         unsigned char sys_ind;          /* ? */

 58         unsigned char end_head;         /* ? */

 59         unsigned char end_sector;       /* ? */

 60         unsigned char end_cyl;          /* ? */

 61         unsigned int start_sect;        /* starting sector counting from 0 */

 62         unsigned int nr_sects;          /* nr of sectors in partition */

 63 };

 64

 65 #endif

 66