From eebca89bf99b4cd835df42d8ce36b42220f9c643 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 2 Jun 2024 21:55:35 -0400 Subject: kernel: ahci: Acquire global "io_lock" during cmd Signed-off-by: Ian Moffett --- sys/dev/ic/ahci.c | 5 +++-- sys/include/dev/ic/ahcivar.h | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index e7b2b7e..e140636 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -48,6 +48,7 @@ __KERNEL_META("$Hyra$: ahci.c, Ian Marco Moffett, " static struct pci_device *dev; static struct timer driver_tmr; +static struct mutex io_lock; /* * Poll register to have `bits' set/unset. @@ -271,7 +272,7 @@ ahci_submit_cmd(struct ahci_hba *hba, struct hba_port *port, uint8_t cmdslot) } /* Activate the command slot */ - mutex_acquire(&hba->lock); + mutex_acquire(&io_lock); mmio_write32(&port->ci, __BIT(cmdslot)); /* @@ -291,7 +292,7 @@ ahci_submit_cmd(struct ahci_hba *hba, struct hba_port *port, uint8_t cmdslot) pr_error("IDENTIFY timeout: slot %d still set!\n", cmdslot); } - mutex_release(&hba->lock); + mutex_release(&io_lock); return status; } diff --git a/sys/include/dev/ic/ahcivar.h b/sys/include/dev/ic/ahcivar.h index 72ca198..0b945ae 100644 --- a/sys/include/dev/ic/ahcivar.h +++ b/sys/include/dev/ic/ahcivar.h @@ -118,7 +118,6 @@ struct ahci_hba { struct ahci_cmd_hdr *cmdlist; uint32_t ncmdslots; uint32_t nports; - struct mutex lock; }; /* Commands */ -- cgit v1.2.3