drivers/gpu/drm/nouveau/nouveau_bios.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nouveau_bios.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nouveau_bios.c- Extension
.c- Size
- 61282 bytes
- Lines
- 2153
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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
nouveau_drv.hnouveau_bios.hnouveau_reg.hdispnv04/hw.hnouveau_encoder.hsubdev/gsp.hlinux/io-mapping.hlinux/firmware.h
Detected Declarations
struct lvdstableheaderstruct bit_tablefunction filesfunction clkcmptablefunction run_digital_op_scriptfunction call_lvds_manufacturer_scriptfunction run_lvds_tablefunction call_lvds_scriptfunction parse_lvds_manufacturer_table_headerfunction get_fp_strapfunction parse_fp_mode_tablefunction nouveau_bios_fp_modefunction nouveau_bios_parse_lvds_tablefunction run_tmds_tablefunction parse_script_table_pointersfunction parse_bit_A_tbl_entryfunction parse_bit_display_tbl_entryfunction parse_bit_init_tbl_entryfunction parse_bit_i_tbl_entryfunction parse_bit_lvds_tbl_entryfunction parse_bit_M_tbl_entryfunction parse_bit_tmds_tbl_entryfunction bit_tablefunction parse_bit_tablefunction parse_bit_structurefunction parse_bmp_structurefunction findstrfunction olddcb_tablefunction olddcb_outpfunction olddcb_outp_foreachfunction olddcb_conntabfunction olddcb_connfunction fabricate_dcb_outputfunction parse_dcb20_entryfunction parse_dcb15_entryfunction merge_like_dcb_entriesfunction apply_dcb_encoder_quirksfunction sortedfunction fabricate_dcb_encoder_tablefunction parse_dcb_entryfunction dcb_fake_connectorsfunction parse_dcb_tablefunction load_nv17_hwsq_ucode_entryfunction load_nv17_hw_sequencer_ucodefunction NVInitVBIOSfunction nouveau_run_vbios_initfunction nouveau_bios_postedfunction nouveau_bios_init
Annotated Snippet
struct lvdstableheader {
uint8_t lvds_ver, headerlen, recordlen;
};
static int parse_lvds_manufacturer_table_header(struct drm_device *dev, struct nvbios *bios, struct lvdstableheader *lth)
{
/*
* BMP version (0xa) LVDS table has a simple header of version and
* record length. The BIT LVDS table has the typical BIT table header:
* version byte, header length byte, record length byte, and a byte for
* the maximum number of records that can be held in the table.
*/
struct nouveau_drm *drm = nouveau_drm(dev);
uint8_t lvds_ver, headerlen, recordlen;
memset(lth, 0, sizeof(struct lvdstableheader));
if (bios->fp.lvdsmanufacturerpointer == 0x0) {
NV_ERROR(drm, "Pointer to LVDS manufacturer table invalid\n");
return -EINVAL;
}
lvds_ver = bios->data[bios->fp.lvdsmanufacturerpointer];
switch (lvds_ver) {
case 0x0a: /* pre NV40 */
headerlen = 2;
recordlen = bios->data[bios->fp.lvdsmanufacturerpointer + 1];
break;
case 0x30: /* NV4x */
headerlen = bios->data[bios->fp.lvdsmanufacturerpointer + 1];
if (headerlen < 0x1f) {
NV_ERROR(drm, "LVDS table header not understood\n");
return -EINVAL;
}
recordlen = bios->data[bios->fp.lvdsmanufacturerpointer + 2];
break;
case 0x40: /* G80/G90 */
headerlen = bios->data[bios->fp.lvdsmanufacturerpointer + 1];
if (headerlen < 0x7) {
NV_ERROR(drm, "LVDS table header not understood\n");
return -EINVAL;
}
recordlen = bios->data[bios->fp.lvdsmanufacturerpointer + 2];
break;
default:
NV_ERROR(drm,
"LVDS table revision %d.%d not currently supported\n",
lvds_ver >> 4, lvds_ver & 0xf);
return -ENOSYS;
}
lth->lvds_ver = lvds_ver;
lth->headerlen = headerlen;
lth->recordlen = recordlen;
return 0;
}
static int
get_fp_strap(struct drm_device *dev, struct nvbios *bios)
{
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvif_object *device = &drm->client.device.object;
/*
* The fp strap is normally dictated by the "User Strap" in
* PEXTDEV_BOOT_0[20:16], but on BMP cards when bit 2 of the
* Internal_Flags struct at 0x48 is set, the user strap gets overriden
* by the PCI subsystem ID during POST, but not before the previous user
* strap has been committed to CR58 for CR57=0xf on head A, which may be
* read and used instead
*/
if (bios->major_version < 5 && bios->data[0x48] & 0x4)
return NVReadVgaCrtc5758(dev, 0, 0xf) & 0xf;
if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_MAXWELL)
return nvif_rd32(device, 0x001800) & 0x0000000f;
else
if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)
return (nvif_rd32(device, NV_PEXTDEV_BOOT_0) >> 24) & 0xf;
else
return (nvif_rd32(device, NV_PEXTDEV_BOOT_0) >> 16) & 0xf;
}
static int parse_fp_mode_table(struct drm_device *dev, struct nvbios *bios)
{
struct nouveau_drm *drm = nouveau_drm(dev);
Annotation
- Immediate include surface: `nouveau_drv.h`, `nouveau_bios.h`, `nouveau_reg.h`, `dispnv04/hw.h`, `nouveau_encoder.h`, `subdev/gsp.h`, `linux/io-mapping.h`, `linux/firmware.h`.
- Detected declarations: `struct lvdstableheader`, `struct bit_table`, `function files`, `function clkcmptable`, `function run_digital_op_script`, `function call_lvds_manufacturer_script`, `function run_lvds_table`, `function call_lvds_script`, `function parse_lvds_manufacturer_table_header`, `function get_fp_strap`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.