drivers/macintosh/via-macii.c
Source file repositories/reference/linux-study-clean/drivers/macintosh/via-macii.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/macintosh/via-macii.c- Extension
.c- Size
- 14316 bytes
- Lines
- 560
- Domain
- Driver Families
- Bucket
- drivers/macintosh
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/errno.hlinux/kernel.hlinux/delay.hlinux/adb.hlinux/interrupt.hlinux/init.hasm/macintosh.hasm/macints.hasm/mac_via.h
Detected Declarations
function macii_probefunction macii_initfunction macii_init_viafunction macii_queue_pollfunction macii_send_requestfunction macii_writefunction macii_autopollfunction macii_pollfunction macii_reset_busfunction macii_startfunction interrupts
Annotated Snippet
if (!(status & CTLR_IRQ)) {
/* /CTLR_IRQ asserted in idle state means we must
* read an autopoll reply from the transceiver buffer.
*/
macii_state = reading;
*reply_ptr = x;
reply_len = 1;
} else {
/* bus timeout */
reply_len = 0;
break;
}
/* set ADB state = even for first data byte */
via[B] = (via[B] & ~ST_MASK) | ST_EVEN;
break;
case sending:
req = current_req;
if (status == (ST_CMD | CTLR_IRQ)) {
/* /CTLR_IRQ de-asserted after the command byte means
* the host can continue with the transaction.
*/
/* Store command byte */
last_cmd = req->data[1];
if ((last_cmd & OP_MASK) == TALK) {
last_talk_cmd = last_cmd;
if ((last_cmd & CMD_MASK) == ADB_READREG(0, 0))
last_poll_cmd = last_cmd;
}
}
if (status == ST_CMD) {
/* /CTLR_IRQ asserted after the command byte means we
* must read an autopoll reply. The first byte was
* lost because the shift register was an output.
*/
macii_state = reading;
reading_reply = false;
reply_ptr = reply_buf;
*reply_ptr = last_talk_cmd;
reply_len = 1;
/* reset to shift in */
via[ACR] &= ~SR_OUT;
x = via[SR];
} else if (data_index >= req->nbytes) {
req->sent = 1;
if (req->reply_expected) {
macii_state = reading;
reading_reply = true;
reply_ptr = req->reply;
*reply_ptr = req->data[1];
reply_len = 1;
via[ACR] &= ~SR_OUT;
x = via[SR];
} else if ((req->data[1] & OP_MASK) == TALK) {
macii_state = reading;
reading_reply = false;
reply_ptr = reply_buf;
*reply_ptr = req->data[1];
reply_len = 1;
via[ACR] &= ~SR_OUT;
x = via[SR];
req->complete = 1;
current_req = req->next;
if (req->done)
(*req->done)(req);
} else {
macii_state = idle;
req->complete = 1;
current_req = req->next;
if (req->done)
(*req->done)(req);
break;
}
} else {
via[SR] = req->data[data_index++];
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/errno.h`, `linux/kernel.h`, `linux/delay.h`, `linux/adb.h`, `linux/interrupt.h`, `linux/init.h`, `asm/macintosh.h`.
- Detected declarations: `function macii_probe`, `function macii_init`, `function macii_init_via`, `function macii_queue_poll`, `function macii_send_request`, `function macii_write`, `function macii_autopoll`, `function macii_poll`, `function macii_reset_bus`, `function macii_start`.
- Atlas domain: Driver Families / drivers/macintosh.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.