summaryrefslogtreecommitdiff
path: root/linux/dev
diff options
context:
space:
mode:
Diffstat (limited to 'linux/dev')
-rw-r--r--linux/dev/drivers/block/ahci.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/linux/dev/drivers/block/ahci.c b/linux/dev/drivers/block/ahci.c
index 3b31e84..dbc8fdb 100644
--- a/linux/dev/drivers/block/ahci.c
+++ b/linux/dev/drivers/block/ahci.c
@@ -397,7 +397,7 @@ static void ahci_do_request() /* invoked with cli() */
}
if (blockend > port->capacity) {
printk("offset for %u was %lu\n", minor, port->part[minor & PARTN_MASK].start_sect);
- printk("bad access: block %lu, count= %u\n", blockend, port->capacity);
+ printk("bad access: block %lu, count= %lu\n", blockend, (unsigned long) port->capacity);
goto kill_rq;
}
@@ -514,6 +514,15 @@ static struct file_operations ahci_fops = {
.revalidate = NULL,
};
+/* Disk timed out while processing identify, interrupt ahci_probe_port */
+static void identify_timeout(unsigned long data)
+{
+ struct port *port = (void*) data;
+
+ wake_up(&port->q);
+}
+
+static struct timer_list identify_timer = { .function = identify_timeout };
/* Probe one AHCI port */
static void ahci_probe_port(const volatile struct ahci_host *ahci_host, const volatile struct ahci_port *ahci_port)
@@ -671,15 +680,20 @@ static void ahci_probe_port(const volatile struct ahci_host *ahci_host, const vo
writel(1 << slot, &ahci_port->ci);
timeout = jiffies + WAIT_MAX;
+ identify_timer.expires = timeout;
+ identify_timer.data = (unsigned long) port;
+ add_timer(&identify_timer);
while (!port->status) {
- if (jiffies > timeout) {
+ if (jiffies >= timeout) {
printk("sd%u: timeout waiting for ready\n", port-ports);
port->ahci_host = NULL;
port->ahci_port = NULL;
+ del_timer(&identify_timer);
return;
}
sleep_on(&port->q);
}
+ del_timer(&identify_timer);
restore_flags(flags);
if (readl(&ahci_port->is) & PORT_IRQ_TF_ERR)
@@ -712,9 +726,9 @@ static void ahci_probe_port(const volatile struct ahci_host *ahci_host, const vo
}
}
if (port->capacity/2048 >= 10240)
- printk("sd%u: %s, %uGB w/%dkB Cache\n", port - ports, id.model, port->capacity/(2048*1024), id.buf_size/2);
+ printk("sd%u: %s, %uGB w/%dkB Cache\n", port - ports, id.model, (unsigned) (port->capacity/(2048*1024)), id.buf_size/2);
else
- printk("sd%u: %s, %uMB w/%dkB Cache\n", port - ports, id.model, port->capacity/2048, id.buf_size/2);
+ printk("sd%u: %s, %uMB w/%dkB Cache\n", port - ports, id.model, (unsigned) (port->capacity/2048), id.buf_size/2);
}
port->identify = 0;
}
@@ -763,10 +777,6 @@ static void ahci_probe_dev(unsigned char bus, unsigned char device)
/* Map mmio */
ahci_host = vremap(bar, 0x2000);
- if (!(readl(&ahci_host->cap) & HOST_CAP_ONLY)) {
- printk("ahci: %02u:%02u.%u: available as IDE too, skipping it\n", bus, dev, fun);
- return;
- }
/* Request IRQ */
if (request_irq(irq, &ahci_interrupt, SA_SHIRQ, "ahci", (void*) ahci_host)) {