1*7481efa2Scsapuntz /* $OpenBSD: atareg.h,v 1.1 1999/07/18 21:25:17 csapuntz Exp $ */ 2*7481efa2Scsapuntz /* $NetBSD: atareg.h,v 1.5 1999/01/18 20:06:24 bouyer Exp $ */ 3*7481efa2Scsapuntz 4*7481efa2Scsapuntz /* 5*7481efa2Scsapuntz * Drive parameter structure for ATA/ATAPI. 6*7481efa2Scsapuntz * Bit fields: WDC_* : common to ATA/ATAPI 7*7481efa2Scsapuntz * ATA_* : ATA only 8*7481efa2Scsapuntz * ATAPI_* : ATAPI only. 9*7481efa2Scsapuntz */ 10*7481efa2Scsapuntz struct ataparams { 11*7481efa2Scsapuntz /* drive info */ 12*7481efa2Scsapuntz u_int16_t atap_config; /* 0: general configuration */ 13*7481efa2Scsapuntz #define WDC_CFG_ATAPI_MASK 0xc000 14*7481efa2Scsapuntz #define WDC_CFG_ATAPI 0x8000 15*7481efa2Scsapuntz #define ATA_CFG_REMOVABLE 0x0080 16*7481efa2Scsapuntz #define ATA_CFG_FIXED 0x0040 17*7481efa2Scsapuntz #define ATAPI_CFG_TYPE_MASK 0x1f00 18*7481efa2Scsapuntz #define ATAPI_CFG_TYPE(x) (((x) & ATAPI_CFG_TYPE_MASK) >> 8) 19*7481efa2Scsapuntz #define ATAPI_CFG_REMOV 0x0080 20*7481efa2Scsapuntz #define ATAPI_CFG_DRQ_MASK 0x0060 21*7481efa2Scsapuntz #define ATAPI_CFG_STD_DRQ 0x0000 22*7481efa2Scsapuntz #define ATAPI_CFG_IRQ_DRQ 0x0020 23*7481efa2Scsapuntz #define ATAPI_CFG_ACCEL_DRQ 0x0040 24*7481efa2Scsapuntz #define ATAPI_CFG_CMD_MASK 0x0003 25*7481efa2Scsapuntz #define ATAPI_CFG_CMD_12 0x0000 26*7481efa2Scsapuntz #define ATAPI_CFG_CMD_16 0x0001 27*7481efa2Scsapuntz /* words 1-9 are ATA only */ 28*7481efa2Scsapuntz u_int16_t atap_cylinders; /* 1: # of non-removable cylinders */ 29*7481efa2Scsapuntz u_int16_t __reserved1; 30*7481efa2Scsapuntz u_int16_t atap_heads; /* 3: # of heads */ 31*7481efa2Scsapuntz u_int16_t __retired1[2]; /* 4-5: # of unform. bytes/track */ 32*7481efa2Scsapuntz u_int16_t atap_sectors; /* 6: # of sectors */ 33*7481efa2Scsapuntz u_int16_t __retired2[3]; 34*7481efa2Scsapuntz 35*7481efa2Scsapuntz u_int8_t atap_serial[20]; /* 10-19: serial number */ 36*7481efa2Scsapuntz u_int16_t __retired3[2]; 37*7481efa2Scsapuntz u_int16_t __obsolete1; 38*7481efa2Scsapuntz u_int8_t atap_revision[8]; /* 23-26: firmware revision */ 39*7481efa2Scsapuntz u_int8_t atap_model[40]; /* 27-46: model number */ 40*7481efa2Scsapuntz u_int16_t atap_multi; /* 47: maximum sectors per irq (ATA) */ 41*7481efa2Scsapuntz u_int16_t __reserved2; 42*7481efa2Scsapuntz u_int16_t atap_capabilities1; /* 49: capability flags */ 43*7481efa2Scsapuntz #define WDC_CAP_IORDY 0x0800 44*7481efa2Scsapuntz #define WDC_CAP_IORDY_DSBL 0x0400 45*7481efa2Scsapuntz #define WDC_CAP_LBA 0x0200 46*7481efa2Scsapuntz #define WDC_CAP_DMA 0x0100 47*7481efa2Scsapuntz #define ATA_CAP_STBY 0x2000 48*7481efa2Scsapuntz #define ATAPI_CAP_INTERL_DMA 0x8000 49*7481efa2Scsapuntz #define ATAPI_CAP_CMD_QUEUE 0x4000 50*7481efa2Scsapuntz #define ATAPI_CAP_OVERLP 0X2000 51*7481efa2Scsapuntz #define ATAPI_CAP_ATA_RST 0x1000 52*7481efa2Scsapuntz u_int16_t atap_capabilities2; /* 50: capability flags (ATA) */ 53*7481efa2Scsapuntz #if BYTE_ORDER == LITTLE_ENDIAN 54*7481efa2Scsapuntz u_int8_t __junk2; 55*7481efa2Scsapuntz u_int8_t atap_oldpiotiming; /* 51: old PIO timing mode */ 56*7481efa2Scsapuntz u_int8_t __junk3; 57*7481efa2Scsapuntz u_int8_t atap_olddmatiming; /* 52: old DMA timing mode (ATA) */ 58*7481efa2Scsapuntz #else 59*7481efa2Scsapuntz u_int8_t atap_oldpiotiming; /* 51: old PIO timing mode */ 60*7481efa2Scsapuntz u_int8_t __junk2; 61*7481efa2Scsapuntz u_int8_t atap_olddmatiming; /* 52: old DMA timing mode (ATA) */ 62*7481efa2Scsapuntz u_int8_t __junk3; 63*7481efa2Scsapuntz #endif 64*7481efa2Scsapuntz u_int16_t atap_extensions; /* 53: extentions supported */ 65*7481efa2Scsapuntz #define WDC_EXT_UDMA_MODES 0x0004 66*7481efa2Scsapuntz #define WDC_EXT_MODES 0x0002 67*7481efa2Scsapuntz #define WDC_EXT_GEOM 0x0001 68*7481efa2Scsapuntz /* words 54-62 are ATA only */ 69*7481efa2Scsapuntz u_int16_t atap_curcylinders; /* 54: current logical cyliners */ 70*7481efa2Scsapuntz u_int16_t atap_curheads; /* 55: current logical heads */ 71*7481efa2Scsapuntz u_int16_t atap_cursectors; /* 56: current logical sectors/tracks */ 72*7481efa2Scsapuntz u_int16_t atap_curcapacity[2]; /* 57-58: current capacity */ 73*7481efa2Scsapuntz u_int16_t atap_curmulti; /* 59: current multi-sector setting */ 74*7481efa2Scsapuntz #define WDC_MULTI_VALID 0x0100 75*7481efa2Scsapuntz #define WDC_MULTI_MASK 0x00ff 76*7481efa2Scsapuntz u_int16_t atap_capacity[2]; /* 60-61: total capacity (LBA only) */ 77*7481efa2Scsapuntz u_int16_t __retired4; 78*7481efa2Scsapuntz #if BYTE_ORDER == LITTLE_ENDIAN 79*7481efa2Scsapuntz u_int8_t atap_dmamode_supp; /* 63: multiword DMA mode supported */ 80*7481efa2Scsapuntz u_int8_t atap_dmamode_act; /* multiword DMA mode active */ 81*7481efa2Scsapuntz u_int8_t atap_piomode_supp; /* 64: PIO mode supported */ 82*7481efa2Scsapuntz u_int8_t __junk4; 83*7481efa2Scsapuntz #else 84*7481efa2Scsapuntz u_int8_t atap_dmamode_act; /* multiword DMA mode active */ 85*7481efa2Scsapuntz u_int8_t atap_dmamode_supp; /* 63: multiword DMA mode supported */ 86*7481efa2Scsapuntz u_int8_t __junk4; 87*7481efa2Scsapuntz u_int8_t atap_piomode_supp; /* 64: PIO mode supported */ 88*7481efa2Scsapuntz #endif 89*7481efa2Scsapuntz u_int16_t atap_dmatiming_mimi; /* 65: minimum DMA cycle time */ 90*7481efa2Scsapuntz u_int16_t atap_dmatiming_recom; /* 66: recomended DMA cycle time */ 91*7481efa2Scsapuntz u_int16_t atap_piotiming; /* 67: mini PIO cycle time without FC */ 92*7481efa2Scsapuntz u_int16_t atap_piotiming_iordy; /* 68: mini PIO cycle time with IORDY FC */ 93*7481efa2Scsapuntz u_int16_t __reserved3[2]; 94*7481efa2Scsapuntz /* words 71-72 are ATAPI only */ 95*7481efa2Scsapuntz u_int16_t atap_pkt_br; /* 71: time (ns) to bus release */ 96*7481efa2Scsapuntz u_int16_t atap_pkt_bsyclr; /* 72: tme to clear BSY after service */ 97*7481efa2Scsapuntz u_int16_t __reserved4[2]; 98*7481efa2Scsapuntz u_int16_t atap_queuedepth; /* 75: */ 99*7481efa2Scsapuntz #define WDC_QUEUE_DEPTH_MASK 0x0F 100*7481efa2Scsapuntz u_int16_t __reserved5[4]; 101*7481efa2Scsapuntz u_int16_t atap_ata_major; /* 80: Major version number */ 102*7481efa2Scsapuntz #define WDC_VER_ATA1 0x0002 103*7481efa2Scsapuntz #define WDC_VER_ATA2 0x0004 104*7481efa2Scsapuntz #define WDC_VER_ATA3 0x0008 105*7481efa2Scsapuntz #define WDC_VER_ATA4 0x0010 106*7481efa2Scsapuntz #define WDC_VER_ATA5 0x0020 107*7481efa2Scsapuntz u_int16_t atap_ata_minor; /* 81: Minor version number */ 108*7481efa2Scsapuntz u_int16_t atap_cmd_set1; /* 82: command set suported */ 109*7481efa2Scsapuntz #define WDC_CMD1_NOP 0x4000 110*7481efa2Scsapuntz #define WDC_CMD1_RB 0x2000 111*7481efa2Scsapuntz #define WDC_CMD1_WB 0x1000 112*7481efa2Scsapuntz #define WDC_CMD1_HPA 0x0400 113*7481efa2Scsapuntz #define WDC_CMD1_DVRST 0x0200 114*7481efa2Scsapuntz #define WDC_CMD1_SRV 0x0100 115*7481efa2Scsapuntz #define WDC_CMD1_RLSE 0x0080 116*7481efa2Scsapuntz #define WDC_CMD1_AHEAD 0x0040 117*7481efa2Scsapuntz #define WDC_CMD1_CACHE 0x0020 118*7481efa2Scsapuntz #define WDC_CMD1_PKT 0x0010 119*7481efa2Scsapuntz #define WDC_CMD1_PM 0x0008 120*7481efa2Scsapuntz #define WDC_CMD1_REMOV 0x0004 121*7481efa2Scsapuntz #define WDC_CMD1_SEC 0x0002 122*7481efa2Scsapuntz #define WDC_CMD1_SMART 0x0001 123*7481efa2Scsapuntz u_int16_t atap_cmd_set2; /* 83: command set suported */ 124*7481efa2Scsapuntz #define WDC_CMD2_RMSN 0x0010 125*7481efa2Scsapuntz #define WDC_CMD2_DM 0x0001 126*7481efa2Scsapuntz #define ATA_CMD2_APM 0x0008 127*7481efa2Scsapuntz #define ATA_CMD2_CFA 0x0004 128*7481efa2Scsapuntz #define ATA_CMD2_RWQ 0x0002 129*7481efa2Scsapuntz u_int16_t atap_cmd_ext; /* 84: command/features supp. ext. */ 130*7481efa2Scsapuntz u_int16_t atap_cmd1_en; /* 85: cmd/features enabled */ 131*7481efa2Scsapuntz /* bits are the same as atap_cmd_set1 */ 132*7481efa2Scsapuntz u_int16_t atap_cmd2_en; /* 86: cmd/features enabled */ 133*7481efa2Scsapuntz /* bits are the same as atap_cmd_set2 */ 134*7481efa2Scsapuntz u_int16_t atap_cmd_def; /* 87: cmd/features default */ 135*7481efa2Scsapuntz #if BYTE_ORDER == LITTLE_ENDIAN 136*7481efa2Scsapuntz u_int8_t atap_udmamode_supp; /* 88: Ultra-DMA mode supported */ 137*7481efa2Scsapuntz u_int8_t atap_udmamode_act; /* Ultra-DMA mode active */ 138*7481efa2Scsapuntz #else 139*7481efa2Scsapuntz u_int8_t atap_udmamode_act; /* Ultra-DMA mode active */ 140*7481efa2Scsapuntz u_int8_t atap_udmamode_supp; /* 88: Ultra-DMA mode supported */ 141*7481efa2Scsapuntz #endif 142*7481efa2Scsapuntz /* 89-92 are ATA-only */ 143*7481efa2Scsapuntz u_int16_t atap_seu_time; /* 89: Sec. Erase Unit compl. time */ 144*7481efa2Scsapuntz u_int16_t atap_eseu_time; /* 90: Enhanced SEU compl. time */ 145*7481efa2Scsapuntz u_int16_t atap_apm_val; /* 91: current APM value */ 146*7481efa2Scsapuntz u_int16_t __reserved6[35]; /* 92-126: reserved */ 147*7481efa2Scsapuntz u_int16_t atap_rmsn_supp; /* 127: remov. media status notif. */ 148*7481efa2Scsapuntz #define WDC_RMSN_SUPP_MASK 0x0003 149*7481efa2Scsapuntz #define WDC_RMSN_SUPP 0x0001 150*7481efa2Scsapuntz u_int16_t atap_sec_st; /* 128: security status */ 151*7481efa2Scsapuntz #define WDC_SEC_LEV_MAX 0x0100 152*7481efa2Scsapuntz #define WDC_SEC_ESE_SUPP 0x0020 153*7481efa2Scsapuntz #define WDC_SEC_EXP 0x0010 154*7481efa2Scsapuntz #define WDC_SEC_FROZEN 0x0008 155*7481efa2Scsapuntz #define WDC_SEC_LOCKED 0x0004 156*7481efa2Scsapuntz #define WDC_SEC_EN 0x0002 157*7481efa2Scsapuntz #define WDC_SEC_SUPP 0x0001 158*7481efa2Scsapuntz }; 159