include/linux/dio.h
Source file repositories/reference/linux-study-clean/include/linux/dio.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/dio.h- Extension
.h- Size
- 10929 bytes
- Lines
- 275
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hasm/hp300hw.h
Detected Declarations
struct dio_devstruct dio_busstruct dio_device_idstruct dio_driverfunction request_mem_regionfunction dio_set_drvdata
Annotated Snippet
extern const struct bus_type dio_bus_type;
/*
* DIO device IDs
*/
struct dio_device_id {
dio_id id; /* Device ID or DIO_WILDCARD */
unsigned long driver_data; /* Data private to the driver */
};
/*
* DIO device drivers
*/
struct dio_driver {
struct list_head node;
char *name;
const struct dio_device_id *id_table; /* NULL if wants all devices */
int (*probe)(struct dio_dev *z, const struct dio_device_id *id);
/* New device inserted */
void (*remove)(struct dio_dev *z); /* Device removed (NULL if not a hot-plug capable driver) */
struct device_driver driver;
};
#define to_dio_driver(drv) container_of_const(drv, struct dio_driver, driver)
/* DIO/DIO-II boards all have the following 8bit registers.
* These are offsets from the base of the device.
*/
#define DIO_IDOFF 0x01 /* primary device ID */
#define DIO_IPLOFF 0x03 /* interrupt priority level */
#define DIO_SECIDOFF 0x15 /* secondary device ID */
#define DIOII_SIZEOFF 0x101 /* device size, DIO-II only */
#define DIO_VIRADDRBASE 0xf0000000UL /* vir addr where IOspace is mapped */
#define DIO_BASE 0x600000 /* start of DIO space */
#define DIO_END 0x1000000 /* end of DIO space */
#define DIO_DEVSIZE 0x10000 /* size of a DIO device */
#define DIOII_BASE 0x01000000 /* start of DIO-II space */
#define DIOII_END 0x20000000 /* end of DIO-II space */
#define DIOII_DEVSIZE 0x00400000 /* size of a DIO-II device */
/* highest valid select code */
#define DIO_SCMAX (hp300_model == HP_320 ? 32 : 256)
#define DIOII_SCBASE 132 /* lowest DIO-II select code */
#define DIO_SCINHOLE(scode) (((scode) >= 32) && ((scode) < DIOII_SCBASE))
#define DIO_ISDIOII(scode) ((scode) >= 132 && (scode) < 256)
/* macros to read device IDs, given base address */
#define DIO_ID(baseaddr) in_8((baseaddr) + DIO_IDOFF)
#define DIO_SECID(baseaddr) in_8((baseaddr) + DIO_SECIDOFF)
/* extract the interrupt level */
#define DIO_IPL(baseaddr) (((in_8((baseaddr) + DIO_IPLOFF) >> 4) & 0x03) + 3)
/* find the size of a DIO-II board's address space.
* DIO boards are all fixed length.
*/
#define DIOII_SIZE(baseaddr) ((in_8((baseaddr) + DIOII_SIZEOFF) + 1) * 0x100000)
/* general purpose macro for both DIO and DIO-II */
#define DIO_SIZE(scode, base) (DIO_ISDIOII((scode)) ? DIOII_SIZE((base)) : DIO_DEVSIZE)
/* The hardware has primary and secondary IDs; we encode these in a single
* int as PRIMARY ID & (SECONDARY ID << 8).
* In practice this is only important for framebuffers,
* and everybody else just sets ID fields equal to the DIO_ID_FOO value.
*/
#define DIO_ENCODE_ID(pr,sec) ((((int)sec & 0xff) << 8) | ((int)pr & 0xff))
/* macro to determine whether a given primary ID requires a secondary ID byte */
#define DIO_NEEDSSECID(id) ((id) == DIO_ID_FBUFFER)
#define DIO_WILDCARD 0xff
/* Now a whole slew of macros giving device IDs and descriptive strings: */
#define DIO_ID_DCA0 0x02 /* 98644A serial */
#define DIO_DESC_DCA0 "98644A DCA0 serial"
#define DIO_ID_DCA0REM 0x82 /* 98644A serial */
#define DIO_DESC_DCA0REM "98644A DCA0REM serial"
#define DIO_ID_DCA1 0x42 /* 98644A serial */
#define DIO_DESC_DCA1 "98644A DCA1 serial"
#define DIO_ID_DCA1REM 0xc2 /* 98644A serial */
#define DIO_DESC_DCA1REM "98644A DCA1REM serial"
#define DIO_ID_DCM 0x05 /* 98642A serial MUX */
#define DIO_DESC_DCM "98642A DCM serial MUX"
#define DIO_ID_DCMREM 0x85 /* 98642A serial MUX */
#define DIO_DESC_DCMREM "98642A DCMREM serial MUX"
#define DIO_ID_LAN 0x15 /* 98643A LAN */
#define DIO_DESC_LAN "98643A LANCE ethernet"
Annotation
- Immediate include surface: `linux/device.h`, `asm/hp300hw.h`.
- Detected declarations: `struct dio_dev`, `struct dio_bus`, `struct dio_device_id`, `struct dio_driver`, `function request_mem_region`, `function dio_set_drvdata`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern 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.