drivers/macintosh/adb-iop.c
Source file repositories/reference/linux-study-clean/drivers/macintosh/adb-iop.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/macintosh/adb-iop.c- Extension
.c- Size
- 6448 bytes
- Lines
- 298
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/kernel.hlinux/mm.hlinux/delay.hlinux/init.hasm/macintosh.hasm/macints.hasm/mac_iop.hasm/adb_iop.hlinux/unaligned.hlinux/adb.h
Detected Declarations
function adb_iop_donefunction adb_iop_completefunction adb_iop_listenfunction adb_iop_startfunction adb_iop_probefunction adb_iop_initfunction adb_iop_send_requestfunction adb_iop_writefunction adb_iop_set_ap_completefunction adb_iop_autopollfunction adb_iop_pollfunction adb_iop_reset_bus
Annotated Snippet
if (adb_iop_state == awaiting_reply) {
struct adb_request *req = current_req;
if (req->reply_expected) {
req->reply_len = amsg->count + 1;
memcpy(req->reply, &amsg->cmd, req->reply_len);
}
req_done = true;
}
break;
case ADB_IOP_AUTOPOLL:
if (((1 << addr) & autopoll_devs) &&
amsg->cmd == ADB_READREG(addr, 0))
adb_input(&amsg->cmd, amsg->count + 1, 1);
break;
}
msg->reply[0] = autopoll_addr ? ADB_IOP_AUTOPOLL : 0;
msg->reply[1] = 0;
msg->reply[2] = autopoll_addr ? ADB_READREG(autopoll_addr, 0) : 0;
iop_complete_message(msg);
if (req_done)
adb_iop_done();
local_irq_restore(flags);
}
/*
* Start sending an ADB packet, IOP style
*
* There isn't much to do other than hand the packet over to the IOP
* after encapsulating it in an adb_iopmsg.
*/
static void adb_iop_start(void)
{
struct adb_request *req;
struct adb_iopmsg amsg;
/* get the packet to send */
req = current_req;
if (!req)
return;
/* The IOP takes MacII-style packets, so strip the initial
* ADB_PACKET byte.
*/
amsg.flags = ADB_IOP_EXPLICIT;
amsg.count = req->nbytes - 2;
/* amsg.data immediately follows amsg.cmd, effectively making
* &amsg.cmd a pointer to the beginning of a full ADB packet.
*/
memcpy(&amsg.cmd, req->data + 1, req->nbytes - 1);
req->sent = 1;
adb_iop_state = sending;
/* Now send it. The IOP manager will call adb_iop_complete
* when the message has been sent.
*/
iop_send_message(ADB_IOP, ADB_CHAN, req, sizeof(amsg), (__u8 *)&amsg,
adb_iop_complete);
}
static int adb_iop_probe(void)
{
if (!iop_ism_present)
return -ENODEV;
return 0;
}
static int adb_iop_init(void)
{
pr_info("adb: IOP ISM driver v0.4 for Unified ADB\n");
iop_listen(ADB_IOP, ADB_CHAN, adb_iop_listen, "ADB");
return 0;
}
static int adb_iop_send_request(struct adb_request *req, int sync)
{
int err;
err = adb_iop_write(req);
if (err)
return err;
if (sync) {
while (!req->complete)
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/mm.h`, `linux/delay.h`, `linux/init.h`, `asm/macintosh.h`, `asm/macints.h`, `asm/mac_iop.h`.
- Detected declarations: `function adb_iop_done`, `function adb_iop_complete`, `function adb_iop_listen`, `function adb_iop_start`, `function adb_iop_probe`, `function adb_iop_init`, `function adb_iop_send_request`, `function adb_iop_write`, `function adb_iop_set_ap_complete`, `function adb_iop_autopoll`.
- Atlas domain: Driver Families / drivers/macintosh.
- Implementation status: source implementation candidate.
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.