drivers/platform/mips/rs780e-acpi.c
Source file repositories/reference/linux-study-clean/drivers/platform/mips/rs780e-acpi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/mips/rs780e-acpi.c- Extension
.c- Size
- 3940 bytes
- Lines
- 166
- Domain
- Driver Families
- Bucket
- drivers/platform
- 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/io.hlinux/init.hlinux/ioport.hlinux/export.hlinux/of.hlinux/platform_device.h
Detected Declarations
function pmio_write_indexfunction pmio_read_indexfunction pm_iowritefunction pm_ioreadfunction pm2_iowritefunction pm2_ioreadfunction acpi_hw_clear_statusfunction acpi_registers_setupfunction rs780e_acpi_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/io.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/export.h>
#include <linux/of.h>
#include <linux/platform_device.h>
static unsigned long acpi_iobase;
#define ACPI_PM_EVT_BLK (acpi_iobase + 0x00) /* 4 bytes */
#define ACPI_PM_CNT_BLK (acpi_iobase + 0x04) /* 2 bytes */
#define ACPI_PMA_CNT_BLK (acpi_iobase + 0x0F) /* 1 byte */
#define ACPI_PM_TMR_BLK (acpi_iobase + 0x18) /* 4 bytes */
#define ACPI_GPE0_BLK (acpi_iobase + 0x10) /* 8 bytes */
#define ACPI_END (acpi_iobase + 0x80)
#define PM_INDEX 0xCD6
#define PM_DATA 0xCD7
#define PM2_INDEX 0xCD0
#define PM2_DATA 0xCD1
static void pmio_write_index(u16 index, u8 reg, u8 value)
{
outb(reg, index);
outb(value, index + 1);
}
static u8 pmio_read_index(u16 index, u8 reg)
{
outb(reg, index);
return inb(index + 1);
}
static void pm_iowrite(u8 reg, u8 value)
{
pmio_write_index(PM_INDEX, reg, value);
}
static u8 pm_ioread(u8 reg)
{
return pmio_read_index(PM_INDEX, reg);
}
static void pm2_iowrite(u8 reg, u8 value)
{
pmio_write_index(PM2_INDEX, reg, value);
}
static u8 pm2_ioread(u8 reg)
{
return pmio_read_index(PM2_INDEX, reg);
}
static void acpi_hw_clear_status(void)
{
u16 value;
/* PMStatus: Clear WakeStatus/PwrBtnStatus */
value = inw(ACPI_PM_EVT_BLK);
value |= (1 << 8 | 1 << 15);
outw(value, ACPI_PM_EVT_BLK);
/* GPEStatus: Clear all generated events */
outl(inl(ACPI_GPE0_BLK), ACPI_GPE0_BLK);
}
static void acpi_registers_setup(void)
{
u32 value;
/* PM Status Base */
pm_iowrite(0x20, ACPI_PM_EVT_BLK & 0xff);
pm_iowrite(0x21, ACPI_PM_EVT_BLK >> 8);
/* PM Control Base */
pm_iowrite(0x22, ACPI_PM_CNT_BLK & 0xff);
pm_iowrite(0x23, ACPI_PM_CNT_BLK >> 8);
/* GPM Base */
pm_iowrite(0x28, ACPI_GPE0_BLK & 0xff);
pm_iowrite(0x29, ACPI_GPE0_BLK >> 8);
/* ACPI End */
pm_iowrite(0x2e, ACPI_END & 0xff);
pm_iowrite(0x2f, ACPI_END >> 8);
/* IO Decode: When AcpiDecodeEnable set, South-Bridge uses the contents
* of the PM registers at index 0x20~0x2B to decode ACPI I/O address. */
pm_iowrite(0x0e, 1 << 3);
Annotation
- Immediate include surface: `linux/io.h`, `linux/init.h`, `linux/ioport.h`, `linux/export.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `function pmio_write_index`, `function pmio_read_index`, `function pm_iowrite`, `function pm_ioread`, `function pm2_iowrite`, `function pm2_ioread`, `function acpi_hw_clear_status`, `function acpi_registers_setup`, `function rs780e_acpi_probe`.
- Atlas domain: Driver Families / drivers/platform.
- 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.