drivers/char/ipmi/kcs_bmc_aspeed.c
Source file repositories/reference/linux-study-clean/drivers/char/ipmi/kcs_bmc_aspeed.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/char/ipmi/kcs_bmc_aspeed.c- Extension
.c- Size
- 18550 bytes
- Lines
- 683
- Domain
- Driver Families
- Bucket
- drivers/char
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/atomic.hlinux/errno.hlinux/interrupt.hlinux/io.hlinux/irq.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_address.hlinux/platform_device.hlinux/poll.hlinux/regmap.hlinux/sched.hlinux/slab.hlinux/timer.hkcs_bmc_device.h
Detected Declarations
struct aspeed_kcs_bmcenum aspeed_kcs_irq_modefunction aspeed_kcs_inbfunction aspeed_kcs_outbfunction aspeed_kcs_updatebfunction aspeed_kcs_set_addressfunction aspeed_kcs_map_serirq_typefunction aspeed_kcs_config_upstream_irqfunction aspeed_kcs_enable_channelfunction aspeed_kcs_check_obefunction aspeed_kcs_irq_mask_updatefunction aspeed_kcs_irqfunction aspeed_kcs_config_downstream_irqfunction aspeed_kcs_of_get_channelfunction aspeed_kcs_of_get_io_addressfunction aspeed_kcs_probefunction aspeed_kcs_remove
Annotated Snippet
struct aspeed_kcs_bmc {
struct kcs_bmc_device kcs_bmc;
struct regmap *map;
struct {
enum aspeed_kcs_irq_mode mode;
int id;
} upstream_irq;
struct {
spinlock_t lock;
bool remove;
struct timer_list timer;
} obe;
};
static inline struct aspeed_kcs_bmc *to_aspeed_kcs_bmc(struct kcs_bmc_device *kcs_bmc)
{
return container_of(kcs_bmc, struct aspeed_kcs_bmc, kcs_bmc);
}
static u8 aspeed_kcs_inb(struct kcs_bmc_device *kcs_bmc, u32 reg)
{
struct aspeed_kcs_bmc *priv = to_aspeed_kcs_bmc(kcs_bmc);
u32 val = 0;
int rc;
rc = regmap_read(priv->map, reg, &val);
WARN(rc != 0, "regmap_read() failed: %d\n", rc);
return rc == 0 ? (u8) val : 0;
}
static void aspeed_kcs_outb(struct kcs_bmc_device *kcs_bmc, u32 reg, u8 data)
{
struct aspeed_kcs_bmc *priv = to_aspeed_kcs_bmc(kcs_bmc);
int rc;
rc = regmap_write(priv->map, reg, data);
WARN(rc != 0, "regmap_write() failed: %d\n", rc);
/* Trigger the upstream IRQ on ODR writes, if enabled */
switch (reg) {
case LPC_ODR1:
case LPC_ODR2:
case LPC_ODR3:
case LPC_ODR4:
break;
default:
return;
}
if (priv->upstream_irq.mode != aspeed_kcs_irq_serirq)
return;
switch (kcs_bmc->channel) {
case 1:
switch (priv->upstream_irq.id) {
case 12:
regmap_update_bits(priv->map, LPC_SIRQCR0, LPC_SIRQCR0_IRQ12E1,
LPC_SIRQCR0_IRQ12E1);
break;
case 1:
regmap_update_bits(priv->map, LPC_SIRQCR0, LPC_SIRQCR0_IRQ1E1,
LPC_SIRQCR0_IRQ1E1);
break;
default:
break;
}
break;
case 2:
regmap_update_bits(priv->map, LPC_HICR5, LPC_HICR5_IRQXE2, LPC_HICR5_IRQXE2);
break;
case 3:
regmap_update_bits(priv->map, LPC_HICR5, LPC_HICR5_IRQXE3, LPC_HICR5_IRQXE3);
break;
case 4:
regmap_update_bits(priv->map, LPC_HICRC, LPC_HICRC_IRQXE4, LPC_HICRC_IRQXE4);
break;
default:
break;
}
}
static void aspeed_kcs_updateb(struct kcs_bmc_device *kcs_bmc, u32 reg, u8 mask, u8 val)
{
struct aspeed_kcs_bmc *priv = to_aspeed_kcs_bmc(kcs_bmc);
int rc;
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/errno.h`, `linux/interrupt.h`, `linux/io.h`, `linux/irq.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct aspeed_kcs_bmc`, `enum aspeed_kcs_irq_mode`, `function aspeed_kcs_inb`, `function aspeed_kcs_outb`, `function aspeed_kcs_updateb`, `function aspeed_kcs_set_address`, `function aspeed_kcs_map_serirq_type`, `function aspeed_kcs_config_upstream_irq`, `function aspeed_kcs_enable_channel`, `function aspeed_kcs_check_obe`.
- Atlas domain: Driver Families / drivers/char.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.