Commit 0e242816 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Move IRQ processing to tasklet, use single flag for disk access

parent a8fbc767
This diff is collapsed.
...@@ -24,22 +24,20 @@ ...@@ -24,22 +24,20 @@
#ifndef _AHCI_ELPHEL_EXT #ifndef _AHCI_ELPHEL_EXT
#define _AHCI_ELPHEL_EXT #define _AHCI_ELPHEL_EXT
/** Flag indicating that IRQ should not be processed in ahci_handle_port_interrupt */ /** Flag indicating that IRQ corresponds to internal command and should not be
* processed in ahci_handle_port_interrupt */
#define IRQ_SIMPLE (1 << 0) #define IRQ_SIMPLE (1 << 0)
/** Flag indicating that driver's internal command is in progress. This flag is set when /** Flag indicating that disk is currently busy. Access to this flag should be protected by
* driver performs write on its own and is mutually exclusive with #NATIVE_CMD flag */ * spin locks to prevent race conditions */
#define INTERNAL_CMD (1 << 1) #define DISK_BUSY (1 << 1)
/** Flag indicating that libahci command is in progress. This flag is set when
* driver performs write from the system calls and is mutually exclusive with #INTERNAL_CMD flag */
#define NATIVE_CMD (1 << 2)
/** Processing driver's internal command is in progress */ /** Processing driver's internal command is in progress */
#define PROC_CMD (1 << 3) #define PROC_CMD (1 << 2)
/** Flag indicating that the remaining chunk of data will be recorder */ /** Flag indicating that the remaining chunk of data will be recorded */
#define LAST_BLOCK (1 << 4) #define LAST_BLOCK (1 << 3)
/** 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 << 5) #define DELAYED_FINISH (1 << 4)
#define LOCK_TAIL (1 << 6) #define LOCK_TAIL (1 << 5)
/** 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 */
...@@ -125,12 +123,12 @@ struct elphel_ahci_priv { ...@@ -125,12 +123,12 @@ struct elphel_ahci_priv {
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 head_ptr; ///< pointer to command slot which will be written next
size_t tail_ptr; ///< pointer to next free command slot size_t tail_ptr; ///< pointer to next free command slot
spinlock_t flags_lock; ///< controls access to two flags in @e flags variable: spinlock_t flags_lock; ///< controls access to #DISK_BUSY flag in @e flags variable.
///< #INTERNAL_CMD and #NATIVE_CMD. These flags control access to disk ///< This flag controls access to disk write operations either from
///< write operations either from the the driver itself or from the system and ///< the the driver itself or from the system. Mutex is not used
///< thus are mutually exclusive. Only flags set operation should be ///< because this flag is accessed from interrupt context
///> protected by this spin lock. Mutex is not used because these flags are accessed struct tasklet_struct bh; ///< command processing tasklet
///> from interrupt context struct device *dev; ///< pointer to parent device structure
}; };
#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