Commit 927f8201 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

continue on sequencer code

parent 82906512
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -124,7 +124,9 @@ module ahci_ctrl_stat #(
    input                         ssts_det_ndnp,     // no device detected, phy communication not established
    input                         ssts_det_dnp,      // device detected, but phy communication not established
    input                         ssts_det_dp,       // device detected, phy communication established
    input                         ssts_det_offline,  // device detected, phy communication established
    input                         ssts_det_offline,  // device offline
    output                  [3:0] ssts_det,          // current value of PxSSTS.DET
    
 // SCR2:SControl (written by software only)
    output reg              [3:0] sctl_ipm,          // Interface power management transitions allowed
    output reg              [3:0] sctl_spd,          // Interface maximal speed
@@ -254,7 +256,7 @@ module ahci_ctrl_stat #(
    assign update_pending =  | regs_changed;
    assign pcmd_fre = |(HBA_PORT__PxCMD__FRE__MASK & PxCMD_r); 
    assign serr_diag_X = |(HBA_PORT__PxSERR__DIAG__X__MASK & PxSERR_r);
       
    assign ssts_det = PxSSTS_r[3:0];   
    
localparam PxIE_MASK =   HBA_PORT__PxIE__TFEE__MASK | // 'h40000000;
                         HBA_PORT__PxIE__IFE__MASK |  // 'h8000000;
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ module ahci_fsm
    output                        ssts_det_dnp,      // device detected, but phy communication not established
    output                        ssts_det_dp,       // device detected, phy communication established
    output                        ssts_det_offline,  // device detected, phy communication established
    input                   [3:0] ssts_det,          // current value of PxSSTS.DET

 // SCR2:SControl (written by software only)
    input                   [3:0] sctl_ipm,          // Interface power management transitions allowed
+4 −0
Original line number Diff line number Diff line
@@ -387,6 +387,8 @@ module ahci_top#(
    wire                          ssts_det_dnp;      // device detected, but phy communication not established
    wire                          ssts_det_dp;       // device detected, phy communication established
    wire                          ssts_det_offline;  // device detected, phy communication established
    wire                    [3:0] ssts_det;          // current value of PxSSTS.DET
    
 // SCR2:SControl (written by software only)
    wire                    [3:0] sctl_ipm;          // Interface power management transitions allowed
    wire                    [3:0] sctl_spd;          // Interface maximal speed
@@ -484,6 +486,7 @@ module ahci_top#(
        .ssts_det_dnp             (ssts_det_dnp),      // output
        .ssts_det_dp              (ssts_det_dp),       // output
        .ssts_det_offline         (ssts_det_offline),  // output
        .ssts_det                 (ssts_det),          // input[3:0]
        .sctl_ipm                 (sctl_ipm),          // input[3:0] 
        .sctl_spd                 (sctl_spd),          // input[3:0] 
        .sctl_det                 (sctl_det),          // input[3:0] 
@@ -699,6 +702,7 @@ module ahci_top#(
        .ssts_det_dnp            (ssts_det_dnp),            // input
        .ssts_det_dp             (ssts_det_dp),             // input
        .ssts_det_offline        (ssts_det_offline),        // input
        .ssts_det                (ssts_det),                // output[3:0]
        .sctl_ipm                (sctl_ipm),                // output[3:0] reg 
        .sctl_spd                (sctl_spd),                // output[3:0] reg 
        .sctl_det                (sctl_det),                // output[3:0] reg
+34 −2
Original line number Diff line number Diff line
@@ -97,12 +97,44 @@ sequence = [{LBL:'POR', ADR: 0x0, ACT: NOP},
            {                           ACT: 'XFER_CNTR_CLEAR'}, # clear_xfer_cntr
            
            {LBL:'P:Idle',              ACT: 'PCMD_CR_SET'},     # pcmd_cr_set

            
            {IF: 'PXSSTS_DET_NE_3',     GOTO:'P:NotRunning' },   # 1. ssts_det!=3, // device detected, phy communication not established
            {IF: 'PXCI0_NOT_CMDTOISSUE',GOTO:'P:FetchCmd' },     # 2. pxci0 && !pCmdToIssue was pIssueSlot==32, -> p:SelectCmd
            {IF: 'PCTI_CTBAR_XCZ',      GOTO:'CFIS:SyncEscape'}, # 3. pCmdToIssue && ch_r && xfer_cntr_zero
            {IF: 'FIS_DATA',            GOTO:'DR:Entry'},        # 4. fis_first_vld && (fis_type == 'h46)
            {IF: 'FIS',                 GOTO:'NDR:Entry'},       # 5. fis_first_vld # already assumed && ((fis_type != 'h46)
            {IF: 'PCTI_XCZ',            GOTO:'CFIS:Xmit'},       # 6. pCmdToIssue && xfer_cntr_zero
            {                           GOTO:'P:Idle'},          #10. (#7-#9 PM, not implemented)
#P:SelectCmd not implemented, using single slot            
            {LBL:'P:FetchCmd',          ACT:'FETCH_CMD'},        # fetch_cmd (other actions included in ahci_fis_transmit)
            {IF: 'CTBAA_CTBAP',         ACT:'CFIS:PrefetchACMD'},#1. ch_a && ch_p # Note ch_p may be ignored or transition may be ignored
            {IF: 'CTBAP',               ACT:'CFIS:PrefetchPRD'}, #2. ch_p         # Note ch_p may be ignored or transition may be ignored
                                                                 # PxTFD.STS.BSY must be set before issuing a command (or now if predicted)
            {LBL:'P:StartComm',         ACT: 'SET_STS_7F'},         # frcv_set_sts_7f
            {                           ACT: 'SET_UPDATE_SIG'},     #  #frcv_set_update_sig
            {                           ACT: 'XMIT_COMRESET'},      # Now does it on reset. See if it is possible to transmit COMRESET w/o reset
            {IF: 'PXSSTS_DET_EQ_1',     GOTO:'P:StartComm'},
            {                           GOTO:'P:NotRunning'},
#P:PowerOn, P;PwerOff,P:PhyListening - not implemented
#FB:* - Not implemented
#PM:* - Not implemented
            {LBL:'NDR:Entry',           ACT: 'NOP'},
            {IF: 'FIS_ERR',             GOTO:'ERR:Non-fatal'},   # 1. fis_ok
            {IF: 'FIS_FERR',            GOTO:'ERR:Fatal'},       # 2. fis_ferr
            {                           GOTO:'NDR:Accept'},      # 3.
            
            ]

"""
    input                         fis_ok,        // FIS done,  checksum OK reset by starting a new get FIS
    input                         fis_err,       // FIS done, checksum ERROR reset by starting a new get FIS
    input                         fis_ferr,      // FIS done, fatal error - FIS too long

    input                         fetch_cmd,   // Enter p:FetchCmd, fetch command header (from the register memory, prefetch command FIS)
                                               // wait for either fetch_cmd_busy == 0 or pCmdToIssue ==1 after fetch_cmd

    input                         fis_first_vld, // fis_first contains valid FIS header, reset by 'get_*'
    input                   [7:0] fis_type,      // FIS type (low byte in the first FIS DWORD), valid with  'fis_first_vld'

pcmd_cr_set,    // command list run set
clear_xfer_cntr
pcmd_cr_reset