drivers/usb/storage/sddr09.c
Source file repositories/reference/linux-study-clean/drivers/usb/storage/sddr09.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/storage/sddr09.c- Extension
.c- Size
- 45218 bytes
- Lines
- 1791
- Domain
- Driver Families
- Bucket
- drivers/usb
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/module.hlinux/slab.hscsi/scsi.hscsi/scsi_cmnd.hscsi/scsi_device.husb.htransport.hprotocol.hdebug.hscsiglue.hunusual_sddr09.h
Detected Declarations
struct nand_flash_devstruct sddr09_card_infofunction nand_find_idfunction nand_init_eccfunction nand_compute_eccfunction nand_compare_eccfunction nand_store_eccfunction sddr09_send_commandfunction sddr09_send_scsi_commandfunction sddr09_test_unit_readyfunction sddr09_request_sensefunction bytesfunction sizefunction sizefunction sizefunction sizefunction sddr09_erasefunction sddr09_writeXfunction sddr09_write_inplacefunction sddr09_read_sg_test_onlyfunction sddr09_read_statusfunction sddr09_read_datafunction sddr09_find_unused_pbafunction sddr09_write_lbafunction sddr09_write_datafunction sddr09_read_controlfunction sddr09_read_deviceIDfunction sddr09_get_wpfunction sddr09_resetfunction sddr09_get_cardinfofunction sddr09_read_mapfunction blocksfunction sddr09_card_info_destructorfunction sddr09_common_initfunction usb_stor_sddr09_dpcm_initfunction dpcm_transportfunction sddr09_transportfunction usb_stor_sddr09_initfunction sddr09_probe
Annotated Snippet
struct nand_flash_dev {
int model_id;
int chipshift; /* 1<<cs bytes total capacity */
char pageshift; /* 1<<ps bytes in a page */
char blockshift; /* 1<<bs pages in an erase block */
char zoneshift; /* 1<<zs blocks in a zone */
/* # of logical blocks is 125/128 of this */
char pageadrlen; /* length of an address in bytes - 1 */
};
/*
* NAND Flash Manufacturer ID Codes
*/
#define NAND_MFR_AMD 0x01
#define NAND_MFR_NATSEMI 0x8f
#define NAND_MFR_TOSHIBA 0x98
#define NAND_MFR_SAMSUNG 0xec
static inline char *nand_flash_manufacturer(int manuf_id) {
switch(manuf_id) {
case NAND_MFR_AMD:
return "AMD";
case NAND_MFR_NATSEMI:
return "NATSEMI";
case NAND_MFR_TOSHIBA:
return "Toshiba";
case NAND_MFR_SAMSUNG:
return "Samsung";
default:
return "unknown";
}
}
/*
* It looks like it is unnecessary to attach manufacturer to the
* remaining data: SSFDC prescribes manufacturer-independent id codes.
*
* 256 MB NAND flash has a 5-byte ID with 2nd byte 0xaa, 0xba, 0xca or 0xda.
*/
static const struct nand_flash_dev nand_flash_ids[] = {
/* NAND flash */
{ 0x6e, 20, 8, 4, 8, 2}, /* 1 MB */
{ 0xe8, 20, 8, 4, 8, 2}, /* 1 MB */
{ 0xec, 20, 8, 4, 8, 2}, /* 1 MB */
{ 0x64, 21, 8, 4, 9, 2}, /* 2 MB */
{ 0xea, 21, 8, 4, 9, 2}, /* 2 MB */
{ 0x6b, 22, 9, 4, 9, 2}, /* 4 MB */
{ 0xe3, 22, 9, 4, 9, 2}, /* 4 MB */
{ 0xe5, 22, 9, 4, 9, 2}, /* 4 MB */
{ 0xe6, 23, 9, 4, 10, 2}, /* 8 MB */
{ 0x73, 24, 9, 5, 10, 2}, /* 16 MB */
{ 0x75, 25, 9, 5, 10, 2}, /* 32 MB */
{ 0x76, 26, 9, 5, 10, 3}, /* 64 MB */
{ 0x79, 27, 9, 5, 10, 3}, /* 128 MB */
/* MASK ROM */
{ 0x5d, 21, 9, 4, 8, 2}, /* 2 MB */
{ 0xd5, 22, 9, 4, 9, 2}, /* 4 MB */
{ 0xd6, 23, 9, 4, 10, 2}, /* 8 MB */
{ 0x57, 24, 9, 4, 11, 2}, /* 16 MB */
{ 0x58, 25, 9, 4, 12, 2}, /* 32 MB */
{ 0,}
};
static const struct nand_flash_dev *
nand_find_id(unsigned char id) {
int i;
for (i = 0; i < ARRAY_SIZE(nand_flash_ids); i++)
if (nand_flash_ids[i].model_id == id)
return &(nand_flash_ids[i]);
return NULL;
}
/*
* ECC computation.
*/
static unsigned char parity[256];
static unsigned char ecc2[256];
static void nand_init_ecc(void) {
int i, j, a;
parity[0] = 0;
for (i = 1; i < 256; i++)
parity[i] = (parity[i&(i-1)] ^ 1);
for (i = 0; i < 256; i++) {
a = 0;
Annotation
- Immediate include surface: `linux/errno.h`, `linux/module.h`, `linux/slab.h`, `scsi/scsi.h`, `scsi/scsi_cmnd.h`, `scsi/scsi_device.h`, `usb.h`, `transport.h`.
- Detected declarations: `struct nand_flash_dev`, `struct sddr09_card_info`, `function nand_find_id`, `function nand_init_ecc`, `function nand_compute_ecc`, `function nand_compare_ecc`, `function nand_store_ecc`, `function sddr09_send_command`, `function sddr09_send_scsi_command`, `function sddr09_test_unit_ready`.
- Atlas domain: Driver Families / drivers/usb.
- 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.