Changeset ae3ff9f5 in mainline for uspace/drv/block/ahci/ahci_sata.h


Ignore:
Timestamp:
2012-07-18T17:35:08Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7030bc9
Parents:
730dce77
Message:

import AHCI updates (comments, fixes) from Petr Jerman (lp:~petr-jerman/+junk/hos-ahci)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/block/ahci/ahci_sata.h

    r730dce77 rae3ff9f5  
    3636#include <sys/types.h>
    3737
     38/*----------------------------------------------------------------------------*/
     39/*-- SATA Buffer Lengths -----------------------------------------------------*/
     40/*----------------------------------------------------------------------------*/
     41
     42/** Default sector size in bytes. */
     43#define SATA_DEFAULT_SECTOR_SIZE  512
     44
     45/** Size for set feature command buffer in bytes. */
     46#define SATA_SET_FEATURE_BUFFER_LENGTH  512
     47
     48/** Size for indentify (packet) device buffer in bytes. */
     49#define SATA_IDENTIFY_DEVICE_BUFFER_LENGTH  512
     50
     51/*----------------------------------------------------------------------------*/
     52/*-- SATA Fis Frames ---------------------------------------------------------*/
     53/*----------------------------------------------------------------------------*/
     54
     55/** Sata FIS Type number. */
     56#define SATA_CMD_FIS_TYPE  0x27
     57
     58/** Sata FIS Type command indicator. */
     59#define SATA_CMD_FIS_COMMAND_INDICATOR  0x80
     60
    3861/** Standard Command frame. */
    3962typedef struct {
    40         /** FIS type - always 0x27. */
     63        /** FIS type - always SATA_CMD_FIS_TYPE. */
    4164        unsigned int fis_type : 8;
    42         /** Indicate that FIS is a Command - always 0x80. */
     65        /** Indicate that FIS is a Command - always SATA_CMD_FIS_COMMAND_INDICATOR. */
    4366        unsigned int c : 8;
    4467        /** Command - Identity device - 0xec, Set fetures - 0xef. */
     
    6285        /** Reserved. */
    6386        unsigned int reserved2 : 32;
    64 } std_command_frame_t;
     87} sata_std_command_frame_t;
    6588
    6689/** Command frame for NCQ data operation. */
     
    6891        /** FIS type - always 0x27. */
    6992        uint8_t fis_type;
    70         /** Indicate that FIS is a Command - always 0x80. */
     93        /** Indicate that FIS is a Command - always SATA_CMD_FIS_COMMAND_INDICATOR. */
    7194        uint8_t c;
    7295        /** Command - FPDMA Read - 0x60, FPDMA Write - 0x61. */
     
    105128        /** Reserved. */
    106129        uint8_t reserved6;
    107 } ncq_command_frame_t;
     130} sata_ncq_command_frame_t;
     131
     132/*----------------------------------------------------------------------------*/
     133/*-- SATA Identify device ----------------------------------------------------*/
     134/*----------------------------------------------------------------------------*/
    108135
    109136/** Data returned from identify device and identify packet device command. */
     
    129156        uint16_t max_rw_multiple;
    130157        uint16_t reserved48;
    131         /** Different meaning for packet device. */
     158        /* Different meaning for packet device. */
    132159        uint16_t caps;
    133160        uint16_t reserved50;
     
    183210        uint16_t total_lba48_3;
    184211       
     212        uint16_t reserved104[1 + 105 - 104];
     213        uint16_t physical_logic_sector_size;
    185214        /* Note: more fields are defined in ATA/ATAPI-7. */
    186         uint16_t reserved104[1 + 127 - 104];
    187         uint16_t _vs128[1 + 159 - 128];
     215        uint16_t reserved107[1 + 127 - 107];
     216        uint16_t reserved128[1 + 159 - 128];
    188217        uint16_t reserved160[1 + 255 - 160];
    189 } identify_data_t;
     218} sata_identify_data_t;
    190219
    191220/** Capability bits for register device. */
    192 enum ata_regdev_caps {
    193         rd_cap_iordy = 0x0800,
    194         rd_cap_iordy_cbd = 0x0400,
    195         rd_cap_lba = 0x0200,
    196         rd_cap_dma = 0x0100
     221enum sata_rd_caps {
     222        sata_rd_cap_iordy = 0x0800,
     223        sata_rd_cap_iordy_cbd = 0x0400,
     224        sata_rd_cap_lba = 0x0200,
     225        sata_rd_cap_dma = 0x0100
    197226};
    198227
    199228/** Bits of @c identify_data_t.cmd_set1. */
    200 enum ata_cs1 {
     229enum sata_cs1 {
    201230        /** 48-bit address feature set. */
    202         cs1_addr48 = 0x0400
     231        sata_cs1_addr48 = 0x0400
    203232};
    204233
    205234/** SATA capatibilities for not packet device - Serial ATA revision 3_1. */
    206 enum sata_np_cap {
     235enum sata_np_caps {
    207236        /** Supports READ LOG DMA EXT. */
    208         np_cap_log_ext = 0x8000,
     237        sata_np_cap_log_ext = 0x8000,
    209238        /** Supports Device Automatic Partial to Slumber transitions. */
    210         np_cap_dev_slm = 0x4000,
     239        sata_np_cap_dev_slm = 0x4000,
    211240        /** Supports Host Automatic Partial to Slumber transitions. */
    212         np_cap_host_slm = 0x2000,
     241        sata_np_cap_host_slm = 0x2000,
    213242        /** Supports NCQ priority information. */
    214         np_cap_ncq_prio = 0x1000,
     243        sata_np_cap_ncq_prio = 0x1000,
    215244        /** Supports Unload while NCQ command outstanding. */
    216         np_cap_unload_ncq = 0x0800,
     245        sata_np_cap_unload_ncq = 0x0800,
    217246        /** Supports Phy event counters. */
    218         np_cap_phy_ctx = 0x0400,
     247        sata_np_cap_phy_ctx = 0x0400,
    219248        /** Supports recepits of host-initiated interface power management. */
    220         np_cap_host_pmngmnt = 0x0200,
     249        sata_np_cap_host_pmngmnt = 0x0200,
    221250       
    222251        /** Supports NCQ. */
    223         np_cap_ncq = 0x0100,
     252        sata_np_cap_ncq = 0x0100,
    224253       
    225254        /** Supports SATA 3. */
    226         np_cap_sata_3 = 0x0008,
     255        sata_np_cap_sata_3 = 0x0008,
    227256        /** Supports SATA 2. */
    228         np_cap_sata_2 = 0x0004,
     257        sata_np_cap_sata_2 = 0x0004,
    229258        /** Supports SATA 1. */
    230         np_cap_sata_1 = 0x0002
     259        sata_np_cap_sata_1 = 0x0002
    231260};
    232261
    233262/** SATA capatibilities for packet device - Serial ATA revision 3_1. */
    234 enum sata_pt_cap {
     263enum sata_pt_caps {
    235264        /** Supports READ LOG DMA EXT. */
    236         pt_cap_log_ext = 0x8000,
     265        sata_pt_cap_log_ext = 0x8000,
    237266        /** Supports Device Automatic Partial to Slumber transitions. */
    238         pt_cap_dev_slm = 0x4000,
     267        sata_pt_cap_dev_slm = 0x4000,
    239268        /** Supports Host Automatic Partial to Slumber transitions. */
    240         pt_cap_host_slm = 0x2000,
     269        sata_pt_cap_host_slm = 0x2000,
    241270        /** Supports Phy event counters. */
    242         pt_cap_phy_ctx = 0x0400,
     271        sata_pt_cap_phy_ctx = 0x0400,
    243272        /** Supports recepits of host-initiated interface power management. */
    244         pt_cap_host_pmngmnt = 0x0200,
     273        sata_pt_cap_host_pmngmnt = 0x0200,
    245274       
    246275        /** Supports SATA 3. */
    247         pt_cap_sat_3 = 0x0008,
     276        sata_pt_cap_sat_3 = 0x0008,
    248277        /** Supports SATA 2. */
    249         pt_cap_sat_2 = 0x0004,
     278        sata_pt_cap_sat_2 = 0x0004,
    250279        /** Supports SATA 1. */
    251         pt_cap_sat_1 = 0x0002
     280        sata_pt_cap_sat_1 = 0x0002
    252281};
    253282
Note: See TracChangeset for help on using the changeset viewer.