drivers/scsi/arm/arm_scsi.h
Source file repositories/reference/linux-study-clean/drivers/scsi/arm/arm_scsi.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/arm/arm_scsi.h- Extension
.h- Size
- 3157 bytes
- Lines
- 137
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/scatterlist.h
Detected Declarations
struct arm_cmd_privfunction copy_SCp_to_sgfunction next_SCpfunction get_next_SCp_bytefunction put_next_SCp_bytefunction init_SCp
Annotated Snippet
struct arm_cmd_priv {
struct scsi_pointer scsi_pointer;
};
static inline struct scsi_pointer *arm_scsi_pointer(struct scsi_cmnd *cmd)
{
struct arm_cmd_priv *acmd = scsi_cmd_priv(cmd);
return &acmd->scsi_pointer;
}
/*
* The scatter-gather list handling. This contains all
* the yucky stuff that needs to be fixed properly.
*/
/*
* copy_SCp_to_sg() Assumes contiguous allocation at @sg of at-most @max
* entries of uninitialized memory. SCp is from scsi-ml and has a valid
* (possibly chained) sg-list
*/
static inline int copy_SCp_to_sg(struct scatterlist *sg, struct scsi_pointer *SCp, int max)
{
int bufs = SCp->buffers_residual;
/* FIXME: It should be easy for drivers to loop on copy_SCp_to_sg().
* and to remove this BUG_ON. Use min() in-its-place
*/
BUG_ON(bufs + 1 > max);
sg_set_buf(sg, SCp->ptr, SCp->this_residual);
if (bufs) {
struct scatterlist *src_sg;
unsigned i;
for_each_sg(sg_next(SCp->buffer), src_sg, bufs, i)
*(++sg) = *src_sg;
sg_mark_end(sg);
}
return bufs + 1;
}
static inline int next_SCp(struct scsi_pointer *SCp)
{
int ret = SCp->buffers_residual;
if (ret) {
SCp->buffer = sg_next(SCp->buffer);
SCp->buffers_residual--;
SCp->ptr = sg_virt(SCp->buffer);
SCp->this_residual = SCp->buffer->length;
} else {
SCp->ptr = NULL;
SCp->this_residual = 0;
}
return ret;
}
static inline unsigned char get_next_SCp_byte(struct scsi_pointer *SCp)
{
char c = *SCp->ptr;
SCp->ptr += 1;
SCp->this_residual -= 1;
return c;
}
static inline void put_next_SCp_byte(struct scsi_pointer *SCp, unsigned char c)
{
*SCp->ptr = c;
SCp->ptr += 1;
SCp->this_residual -= 1;
}
static inline void init_SCp(struct scsi_cmnd *SCpnt)
{
struct scsi_pointer *scsi_pointer = arm_scsi_pointer(SCpnt);
memset(scsi_pointer, 0, sizeof(struct scsi_pointer));
if (scsi_bufflen(SCpnt)) {
unsigned long len = 0;
scsi_pointer->buffer = scsi_sglist(SCpnt);
scsi_pointer->buffers_residual = scsi_sg_count(SCpnt) - 1;
scsi_pointer->ptr = sg_virt(scsi_pointer->buffer);
scsi_pointer->this_residual = scsi_pointer->buffer->length;
scsi_pointer->phase = scsi_bufflen(SCpnt);
Annotation
- Immediate include surface: `linux/scatterlist.h`.
- Detected declarations: `struct arm_cmd_priv`, `function copy_SCp_to_sg`, `function next_SCp`, `function get_next_SCp_byte`, `function put_next_SCp_byte`, `function init_SCp`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.