sdiahci: Need to properly initialize spinlock.
authorDan Cross <crossd@gmail.com>
Wed, 5 Apr 2017 19:22:05 +0000 (15:22 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 6 Apr 2017 15:12:55 +0000 (11:12 -0400)
The AHCI driver was using `spinlock_init` on locks it was trying
to `spin_lock_irqsave`.  Use `spinlock_init_irqsave` instead.

Similarly, we have to initialize the controller lock.

Change-Id: Ieeb87601c9d73d77f524c948500d50db68247484
Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/dev/sdiahci.c

index 24d5473..5b82f99 100644 (file)
@@ -2165,7 +2165,7 @@ static int newctlr(struct ctlr *ctlr, struct sdev *sdev, int nunit)
        pi = ahci_hba_read32(ctlr->hba, HBA_PI);
        for (i = 0; i < NCtlrdrv; i++) {
                drive = ctlr->rawdrive + i;
-               spinlock_init(&drive->Lock);
+               spinlock_init_irqsave(&drive->Lock);
                drive->portno = i;
                drive->driveno = -1;
                drive->sectors = 0;
@@ -2232,6 +2232,7 @@ static struct sdev *iapnp(void)
                qlock_init(&s->unitlock);
                c->physio = p->bar[Abar].mmio_base32 & ~0xf;
                c->mmio = (void *)vmap_pmem_nocache(c->physio, p->bar[Abar].mmio_sz);
+               spinlock_init_irqsave(&c->Lock);
                if (c->mmio == 0) {
                        printk("ahci: %s: address %#lX in use did=%#x\n", Tname(c),
                               c->physio, p->dev_id);