Documentation/driver-api/parport-lowlevel.rst
Source file repositories/reference/linux-study-clean/Documentation/driver-api/parport-lowlevel.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/driver-api/parport-lowlevel.rst- Extension
.rst- Size
- 38003 bytes
- Lines
- 1838
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- 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/parport.h
Detected Declarations
struct parport_driverstruct parportstruct parport_driverstruct pardevicestruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsstruct parport_operationsfunction reversefunction lp_detachfunction lp_initfunction cleanup_modulefunction detect_devicefunction preemptfunction wakeupfunction toaster_detectfunction write
Annotated Snippet
struct parport_driver {
const char *name;
void (*attach) (struct parport *);
void (*detach) (struct parport *);
struct parport_driver *next;
};
int parport_register_driver (struct parport_driver *driver);
DESCRIPTION
^^^^^^^^^^^
In order to be notified about parallel ports when they are detected,
parport_register_driver should be called. Your driver will
immediately be notified of all ports that have already been detected,
and of each new port as low-level drivers are loaded.
A ``struct parport_driver`` contains the textual name of your driver,
a pointer to a function to handle new ports, and a pointer to a
function to handle ports going away due to a low-level driver
unloading. Ports will only be detached if they are not being used
(i.e. there are no devices registered on them).
The visible parts of the ``struct parport *`` argument given to
attach/detach are::
struct parport
{
struct parport *next; /* next parport in list */
const char *name; /* port's name */
unsigned int modes; /* bitfield of hardware modes */
struct parport_device_info probe_info;
/* IEEE1284 info */
int number; /* parport index */
struct parport_operations *ops;
...
};
There are other members of the structure, but they should not be
touched.
The ``modes`` member summarises the capabilities of the underlying
hardware. It consists of flags which may be bitwise-ored together:
============================= ===============================================
PARPORT_MODE_PCSPP IBM PC registers are available,
i.e. functions that act on data,
control and status registers are
probably writing directly to the
hardware.
PARPORT_MODE_TRISTATE The data drivers may be turned off.
This allows the data lines to be used
for reverse (peripheral to host)
transfers.
PARPORT_MODE_COMPAT The hardware can assist with
compatibility-mode (printer)
transfers, i.e. compat_write_block.
PARPORT_MODE_EPP The hardware can assist with EPP
transfers.
PARPORT_MODE_ECP The hardware can assist with ECP
transfers.
PARPORT_MODE_DMA The hardware can use DMA, so you might
want to pass ISA DMA-able memory
(i.e. memory allocated using the
GFP_DMA flag with kmalloc) to the
low-level driver in order to take
advantage of it.
============================= ===============================================
There may be other flags in ``modes`` as well.
Annotation
- Immediate include surface: `linux/parport.h`.
- Detected declarations: `struct parport_driver`, `struct parport`, `struct parport_driver`, `struct pardevice`, `struct parport_operations`, `struct parport_operations`, `struct parport_operations`, `struct parport_operations`, `struct parport_operations`, `struct parport_operations`.
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
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.