Skip to content

ahci/pciidex: Fix four bugs in AHCI driver - #9

Draft
tkreuzer with Copilot wants to merge 4 commits into
SMP/smp-bringupfrom
copilot/debug-ahci-hang-issue
Draft

ahci/pciidex: Fix four bugs in AHCI driver#9
tkreuzer with Copilot wants to merge 4 commits into
SMP/smp-bringupfrom
copilot/debug-ahci-hang-issue

Conversation

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown

Four independent bugs in the new AHCI pciidex driver, one commit each.

Duplicate macro (ahci.h)

AHCI_PXCMD_ICC_DEVSLEEP was defined twice on consecutive lines. Removed the duplicate.

Missing format specifier (pdo.c)

// Before — Status silently dropped
ERR("CH %lu: Could not connect to interrupt\n", ChanData->Channel, Status);

// After
ERR("CH %lu: Could not connect to interrupt %lx\n", ChanData->Channel, Status);

Tautological ASSERT (ahci_generic.c)

ASSERT(Controller->MaxChannels == 0) inside if (Controller->MaxChannels == 0) is always true and never fires. Replaced with ASSERT(FALSE) to mark the path as unexpected.

Wrong bitwise operators in AtaAhciFbsControl (ahci_hw.c)

& and ^ were swapped in the condition that guards the PxFBS register write:

// Before — wrong: AND common bits, then XOR with enable mask
if ((FbsControl & NewFbsControl) ^ AHCI_FBS_ENABLE)

// After — correct: XOR to find differing bits, AND to test the ENABLE bit
if ((FbsControl ^ NewFbsControl) & AHCI_FBS_ENABLE)

The original expression evaluated non-zero (triggering a write) in cases where FbsControl had other status bits set even when the ENABLE bit was already in the desired state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants