Commit 49fd6ef1 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Organize incoming commands in queue

parent 967b475a
This diff is collapsed.
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
/** Flag indicating that recording should be stopped right after the last chunk of data /** Flag indicating that recording should be stopped right after the last chunk of data
* is written */ * is written */
#define DELAYED_FINISH (1 << 3) #define DELAYED_FINISH (1 << 3)
#define LOCK_TAIL (1 << 4)
/** The length of a command FIS in double words */ /** The length of a command FIS in double words */
#define CMD_FIS_LEN 5 #define CMD_FIS_LEN 5
/** This is used to get 28-bit address from 64-bit value */ /** This is used to get 28-bit address from 64-bit value */
...@@ -54,6 +55,8 @@ ...@@ -54,6 +55,8 @@
/** Maximum number of entries in PRDT table. HW max is 64k. /** Maximum number of entries in PRDT table. HW max is 64k.
* Set this value the same as AHCI_MAX_SG in ahci.h */ * Set this value the same as AHCI_MAX_SG in ahci.h */
#define MAX_SGL_LEN 168 #define MAX_SGL_LEN 168
/** Maximum number of frames which will be processed at the same time */
#define MAX_CMD_SLOTS 4
/** This structure holds raw device buffer pointers */ /** This structure holds raw device buffer pointers */
struct drv_pointers { struct drv_pointers {
...@@ -108,12 +111,14 @@ struct elphel_ahci_priv { ...@@ -108,12 +111,14 @@ struct elphel_ahci_priv {
int curr_cmd; int curr_cmd;
size_t max_data_sz; size_t max_data_sz;
struct drv_pointers lba_ptr; struct drv_pointers lba_ptr;
struct frame_buffers fbuffs; struct frame_buffers fbuffs[MAX_CMD_SLOTS];
struct fvec data_chunks[MAX_DATA_CHUNKS]; struct fvec data_chunks[MAX_CMD_SLOTS][MAX_DATA_CHUNKS];
struct fvec sgl[MAX_SGL_LEN]; struct fvec sgl[MAX_SGL_LEN];
int sg_elems; int sg_elems;
int curr_data_chunk; ///< index of a data chunk used during last transaction int curr_data_chunk; ///< index of a data chunk used during last transaction
size_t curr_data_offset; ///< offset of the last byte in a data chunk pointed to by @e curr_data_chunk size_t curr_data_offset; ///< offset of the last byte in a data chunk pointed to by @e curr_data_chunk
size_t head_ptr; ///< pointer to command slot which will be written next
size_t tail_ptr; ///< pointer to next free command slot
}; };
#endif /* _AHCI_ELPHEL_EXT */ #endif /* _AHCI_ELPHEL_EXT */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment