drivers/pnp/pnpbios/bioscalls.c
Source file repositories/reference/linux-study-clean/drivers/pnp/pnpbios/bioscalls.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pnp/pnpbios/bioscalls.c- Extension
.c- Size
- 13265 bytes
- Lines
- 491
- Domain
- Driver Families
- Bucket
- drivers/pnp
- 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
linux/types.hlinux/module.hlinux/init.hlinux/linkage.hlinux/kernel.hlinux/device.hlinux/pnp.hlinux/mm.hlinux/smp.hlinux/kmod.hlinux/completion.hlinux/spinlock.hasm/page.hasm/desc.hasm/byteorder.hpnpbios.h
Detected Declarations
function call_pnp_biosfunction pnpbios_print_statusfunction __pnp_bios_dev_node_infofunction pnp_bios_dev_node_infofunction BIOSesfunction pnp_bios_get_dev_nodefunction currentfunction pnp_bios_set_dev_nodefunction pnp_bios_dock_station_infofunction __pnp_bios_get_stat_resfunction pnp_bios_get_stat_resfunction __pnp_bios_isapnp_configfunction pnp_bios_isapnp_configfunction __pnp_bios_escd_infofunction pnp_bios_escd_infofunction __pnp_bios_read_escdfunction pnp_bios_read_escdfunction pnpbios_calls_initfunction for_each_possible_cpu
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* bioscalls.c - the lowlevel layer of the PnPBIOS driver
*/
#include <linux/types.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/linkage.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/pnp.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/kmod.h>
#include <linux/completion.h>
#include <linux/spinlock.h>
#include <asm/page.h>
#include <asm/desc.h>
#include <asm/byteorder.h>
#include "pnpbios.h"
__visible struct {
u16 offset;
u16 segment;
} pnp_bios_callpoint;
/*
* These are some opcodes for a "static asmlinkage"
* As this code is *not* executed inside the linux kernel segment, but in a
* alias at offset 0, we need a far return that can not be compiled by
* default (please, prove me wrong! this is *really* ugly!)
* This is the only way to get the bios to return into the kernel code,
* because the bios code runs in 16 bit protected mode and therefore can only
* return to the caller if the call is within the first 64kB, and the linux
* kernel begins at offset 3GB...
*/
asmlinkage __visible void pnp_bios_callfunc(void);
__asm__(".text \n"
__ALIGN_STR "\n"
".globl pnp_bios_callfunc\n"
"pnp_bios_callfunc:\n"
" pushl %edx \n"
" pushl %ecx \n"
" pushl %ebx \n"
" pushl %eax \n"
" lcallw *pnp_bios_callpoint\n"
" addl $16, %esp \n"
" lret \n"
".previous \n");
#define Q2_SET_SEL(cpu, selname, address, size) \
do { \
struct desc_struct *gdt = get_cpu_gdt_rw((cpu)); \
set_desc_base(&gdt[(selname) >> 3], (u32)(address)); \
set_desc_limit(&gdt[(selname) >> 3], (size) - 1); \
} while(0)
static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(DESC_DATA32_BIOS,
(unsigned long)__va(0x400UL), PAGE_SIZE - 0x400 - 1);
/*
* At some point we want to use this stack frame pointer to unwind
* after PnP BIOS oopses.
*/
__visible u32 pnp_bios_fault_esp;
__visible u32 pnp_bios_fault_eip;
__visible u32 pnp_bios_is_utter_crap = 0;
static DEFINE_SPINLOCK(pnp_bios_lock);
/*
* Support Functions
*/
static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3,
u16 arg4, u16 arg5, u16 arg6, u16 arg7,
void *ts1_base, u32 ts1_size,
void *ts2_base, u32 ts2_size)
{
unsigned long flags;
u16 status;
struct desc_struct save_desc_40;
int cpu;
Annotation
- Immediate include surface: `linux/types.h`, `linux/module.h`, `linux/init.h`, `linux/linkage.h`, `linux/kernel.h`, `linux/device.h`, `linux/pnp.h`, `linux/mm.h`.
- Detected declarations: `function call_pnp_bios`, `function pnpbios_print_status`, `function __pnp_bios_dev_node_info`, `function pnp_bios_dev_node_info`, `function BIOSes`, `function pnp_bios_get_dev_node`, `function current`, `function pnp_bios_set_dev_node`, `function pnp_bios_dock_station_info`, `function __pnp_bios_get_stat_res`.
- Atlas domain: Driver Families / drivers/pnp.
- 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.