drivers/ssb/pcmcia.c
Source file repositories/reference/linux-study-clean/drivers/ssb/pcmcia.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ssb/pcmcia.c- Extension
.c- Size
- 19535 bytes
- Lines
- 832
- Domain
- Driver Families
- Bucket
- drivers/ssb
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
ssb_private.hlinux/ssb/ssb.hlinux/delay.hlinux/io.hlinux/etherdevice.hpcmcia/cistpl.hpcmcia/ciscode.hpcmcia/ds.hpcmcia/cisreg.h
Detected Declarations
function ssb_pcmcia_cfg_writefunction ssb_pcmcia_cfg_readfunction ssb_pcmcia_switch_coreidxfunction ssb_pcmcia_switch_corefunction ssb_pcmcia_switch_segmentfunction select_core_and_segmentfunction ssb_pcmcia_read8function ssb_pcmcia_read16function ssb_pcmcia_read32function ssb_pcmcia_block_readfunction ssb_pcmcia_write8function ssb_pcmcia_write16function ssb_pcmcia_write32function ssb_pcmcia_block_writefunction ssb_pcmcia_sprom_commandfunction ssb_pcmcia_sprom_readfunction ssb_pcmcia_sprom_writefunction ssb_pcmcia_sprom_read_allfunction ssb_pcmcia_sprom_write_allfunction ssb_pcmcia_sprom_check_crcfunction ssb_pcmcia_get_macfunction ssb_pcmcia_do_get_invariantsfunction ssb_pcmcia_get_invariantsfunction ssb_sprom_showfunction ssb_sprom_storefunction ssb_pcmcia_cor_setupfunction ssb_pcmcia_hardware_setupfunction ssb_pcmcia_exitfunction ssb_pcmcia_init
Annotated Snippet
while (count) {
*buf = __raw_readb(addr);
buf++;
count--;
}
break;
}
case sizeof(u16): {
__le16 *buf = buffer;
WARN_ON(count & 1);
while (count) {
*buf = (__force __le16)__raw_readw(addr);
buf++;
count -= 2;
}
break;
}
case sizeof(u32): {
__le16 *buf = buffer;
WARN_ON(count & 3);
while (count) {
*buf = (__force __le16)__raw_readw(addr);
buf++;
*buf = (__force __le16)__raw_readw(addr + 2);
buf++;
count -= 4;
}
break;
}
default:
WARN_ON(1);
}
unlock:
spin_unlock_irqrestore(&bus->bar_lock, flags);
}
#endif /* CONFIG_SSB_BLOCKIO */
static void ssb_pcmcia_write8(struct ssb_device *dev, u16 offset, u8 value)
{
struct ssb_bus *bus = dev->bus;
unsigned long flags;
int err;
spin_lock_irqsave(&bus->bar_lock, flags);
err = select_core_and_segment(dev, &offset);
if (likely(!err))
writeb(value, bus->mmio + offset);
spin_unlock_irqrestore(&bus->bar_lock, flags);
}
static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value)
{
struct ssb_bus *bus = dev->bus;
unsigned long flags;
int err;
spin_lock_irqsave(&bus->bar_lock, flags);
err = select_core_and_segment(dev, &offset);
if (likely(!err))
writew(value, bus->mmio + offset);
spin_unlock_irqrestore(&bus->bar_lock, flags);
}
static void ssb_pcmcia_write32(struct ssb_device *dev, u16 offset, u32 value)
{
struct ssb_bus *bus = dev->bus;
unsigned long flags;
int err;
spin_lock_irqsave(&bus->bar_lock, flags);
err = select_core_and_segment(dev, &offset);
if (likely(!err)) {
writew((value & 0x0000FFFF), bus->mmio + offset);
writew(((value & 0xFFFF0000) >> 16), bus->mmio + offset + 2);
}
spin_unlock_irqrestore(&bus->bar_lock, flags);
}
#ifdef CONFIG_SSB_BLOCKIO
static void ssb_pcmcia_block_write(struct ssb_device *dev, const void *buffer,
size_t count, u16 offset, u8 reg_width)
{
struct ssb_bus *bus = dev->bus;
unsigned long flags;
void __iomem *addr = bus->mmio + offset;
int err;
spin_lock_irqsave(&bus->bar_lock, flags);
Annotation
- Immediate include surface: `ssb_private.h`, `linux/ssb/ssb.h`, `linux/delay.h`, `linux/io.h`, `linux/etherdevice.h`, `pcmcia/cistpl.h`, `pcmcia/ciscode.h`, `pcmcia/ds.h`.
- Detected declarations: `function ssb_pcmcia_cfg_write`, `function ssb_pcmcia_cfg_read`, `function ssb_pcmcia_switch_coreidx`, `function ssb_pcmcia_switch_core`, `function ssb_pcmcia_switch_segment`, `function select_core_and_segment`, `function ssb_pcmcia_read8`, `function ssb_pcmcia_read16`, `function ssb_pcmcia_read32`, `function ssb_pcmcia_block_read`.
- Atlas domain: Driver Families / drivers/ssb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.