Commit 89da44db authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k mac local_irq*() updates

Convert m68k Mac drivers to new local_irq*() framework:
  - Mac IIfx and Quadra 9x0 ADB
  - Mac II and IIsi ADB
  - Powerbook ADB
parent 9417569f
...@@ -83,15 +83,14 @@ static void adb_iop_complete(struct iop_msg *msg, struct pt_regs *regs) ...@@ -83,15 +83,14 @@ static void adb_iop_complete(struct iop_msg *msg, struct pt_regs *regs)
struct adb_request *req; struct adb_request *req;
uint flags; uint flags;
save_flags(flags); local_irq_save(flags);
cli();
req = current_req; req = current_req;
if ((adb_iop_state == sending) && req && req->reply_expected) { if ((adb_iop_state == sending) && req && req->reply_expected) {
adb_iop_state = awaiting_reply; adb_iop_state = awaiting_reply;
} }
restore_flags(flags); local_irq_restore(flags);
} }
/* /*
...@@ -107,8 +106,7 @@ static void adb_iop_listen(struct iop_msg *msg, struct pt_regs *regs) ...@@ -107,8 +106,7 @@ static void adb_iop_listen(struct iop_msg *msg, struct pt_regs *regs)
struct adb_request *req; struct adb_request *req;
uint flags; uint flags;
save_flags(flags); local_irq_save(flags);
cli();
req = current_req; req = current_req;
...@@ -150,7 +148,7 @@ static void adb_iop_listen(struct iop_msg *msg, struct pt_regs *regs) ...@@ -150,7 +148,7 @@ static void adb_iop_listen(struct iop_msg *msg, struct pt_regs *regs)
memcpy(msg->reply, msg->message, IOP_MSG_LEN); memcpy(msg->reply, msg->message, IOP_MSG_LEN);
} }
iop_complete_message(msg); iop_complete_message(msg);
restore_flags(flags); local_irq_restore(flags);
} }
/* /*
...@@ -170,8 +168,7 @@ static void adb_iop_start(void) ...@@ -170,8 +168,7 @@ static void adb_iop_start(void)
req = current_req; req = current_req;
if (!req) return; if (!req) return;
save_flags(flags); local_irq_save(flags);
cli();
#ifdef DEBUG_ADB_IOP #ifdef DEBUG_ADB_IOP
printk("adb_iop_start: sending packet, %d bytes:", req->nbytes); printk("adb_iop_start: sending packet, %d bytes:", req->nbytes);
...@@ -192,7 +189,7 @@ static void adb_iop_start(void) ...@@ -192,7 +189,7 @@ static void adb_iop_start(void)
req->sent = 1; req->sent = 1;
adb_iop_state = sending; adb_iop_state = sending;
restore_flags(flags); local_irq_restore(flags);
/* Now send it. The IOP manager will call adb_iop_complete */ /* Now send it. The IOP manager will call adb_iop_complete */
/* when the packet has been sent. */ /* when the packet has been sent. */
...@@ -236,8 +233,7 @@ static int adb_iop_write(struct adb_request *req) ...@@ -236,8 +233,7 @@ static int adb_iop_write(struct adb_request *req)
return -EINVAL; return -EINVAL;
} }
save_flags(flags); local_irq_save(flags);
cli();
req->next = 0; req->next = 0;
req->sent = 0; req->sent = 0;
...@@ -252,7 +248,7 @@ static int adb_iop_write(struct adb_request *req) ...@@ -252,7 +248,7 @@ static int adb_iop_write(struct adb_request *req)
last_req = req; last_req = req;
} }
restore_flags(flags); local_irq_restore(flags);
if (adb_iop_state == idle) adb_iop_start(); if (adb_iop_state == idle) adb_iop_start();
return 0; return 0;
} }
......
...@@ -144,8 +144,7 @@ int macii_init(void) ...@@ -144,8 +144,7 @@ int macii_init(void)
unsigned long flags; unsigned long flags;
int err; int err;
save_flags(flags); local_irq_save(flags);
cli();
err = macii_init_via(); err = macii_init_via();
if (err) return err; if (err) return err;
...@@ -155,7 +154,7 @@ int macii_init(void) ...@@ -155,7 +154,7 @@ int macii_init(void)
if (err) return err; if (err) return err;
macii_state = idle; macii_state = idle;
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -196,13 +195,12 @@ static void macii_queue_poll(void) ...@@ -196,13 +195,12 @@ static void macii_queue_poll(void)
adb_request(&req, NULL, ADBREQ_REPLY|ADBREQ_NOSEND, 1, adb_request(&req, NULL, ADBREQ_REPLY|ADBREQ_NOSEND, 1,
ADB_READREG(device, 0)); ADB_READREG(device, 0));
save_flags(flags); local_irq_save(flags);
cli();
req.next = current_req; req.next = current_req;
current_req = &req; current_req = &req;
restore_flags(flags); local_irq_restore(flags);
macii_start(); macii_start();
in_poll--; in_poll--;
} }
...@@ -221,8 +219,7 @@ static void macii_retransmit(int device) ...@@ -221,8 +219,7 @@ static void macii_retransmit(int device)
adb_request(&rt, NULL, ADBREQ_REPLY|ADBREQ_NOSEND, 1, adb_request(&rt, NULL, ADBREQ_REPLY|ADBREQ_NOSEND, 1,
ADB_READREG(device, 0)); ADB_READREG(device, 0));
save_flags(flags); local_irq_save(flags);
cli();
if (current_req != NULL) { if (current_req != NULL) {
last_req->next = &rt; last_req->next = &rt;
...@@ -234,7 +231,7 @@ static void macii_retransmit(int device) ...@@ -234,7 +231,7 @@ static void macii_retransmit(int device)
if (macii_state == idle) macii_start(); if (macii_state == idle) macii_start();
restore_flags(flags); local_irq_restore(flags);
in_retransmit--; in_retransmit--;
} }
...@@ -267,7 +264,7 @@ static int macii_write(struct adb_request *req) ...@@ -267,7 +264,7 @@ static int macii_write(struct adb_request *req)
req->complete = 0; req->complete = 0;
req->reply_len = 0; req->reply_len = 0;
save_flags(flags); cli(); local_irq_save(flags);
if (current_req != NULL) { if (current_req != NULL) {
last_req->next = req; last_req->next = req;
...@@ -278,7 +275,7 @@ static int macii_write(struct adb_request *req) ...@@ -278,7 +275,7 @@ static int macii_write(struct adb_request *req)
if (macii_state == idle) macii_start(); if (macii_state == idle) macii_start();
} }
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -296,9 +293,9 @@ static void macii_poll(void) ...@@ -296,9 +293,9 @@ static void macii_poll(void)
{ {
unsigned long flags; unsigned long flags;
save_flags(flags); cli(); local_irq_save(flags);
if (via[IFR] & SR_INT) macii_interrupt(0, 0, 0); if (via[IFR] & SR_INT) macii_interrupt(0, 0, 0);
restore_flags(flags); local_irq_restore(flags);
} }
/* Reset the bus */ /* Reset the bus */
...@@ -328,7 +325,7 @@ static void macii_start(void) ...@@ -328,7 +325,7 @@ static void macii_start(void)
return; return;
} }
save_flags(flags); cli(); local_irq_save(flags);
/* /*
* IRQ signaled ?? (means ADB controller wants to send, or might * IRQ signaled ?? (means ADB controller wants to send, or might
...@@ -356,7 +353,7 @@ static void macii_start(void) ...@@ -356,7 +353,7 @@ static void macii_start(void)
(uint) via[B] & (ST_MASK|TREQ)); (uint) via[B] & (ST_MASK|TREQ));
retry_req = req; retry_req = req;
/* set ADB status here ? */ /* set ADB status here ? */
restore_flags(flags); local_irq_restore(flags);
return; return;
} else { } else {
need_poll = 0; need_poll = 0;
...@@ -385,7 +382,7 @@ static void macii_start(void) ...@@ -385,7 +382,7 @@ static void macii_start(void)
macii_state = sending; macii_state = sending;
data_index = 2; data_index = 2;
restore_flags(flags); local_irq_restore(flags);
} }
/* /*
...@@ -421,10 +418,10 @@ void macii_interrupt(int irq, void *arg, struct pt_regs *regs) ...@@ -421,10 +418,10 @@ void macii_interrupt(int irq, void *arg, struct pt_regs *regs)
last_status = status; last_status = status;
/* prevent races due to SCSI enabling ints */ /* prevent races due to SCSI enabling ints */
save_flags(flags); cli(); local_irq_save(flags);
if (driver_running) { if (driver_running) {
restore_flags(flags); local_irq_restore(flags);
return; return;
} }
...@@ -650,5 +647,5 @@ void macii_interrupt(int irq, void *arg, struct pt_regs *regs) ...@@ -650,5 +647,5 @@ void macii_interrupt(int irq, void *arg, struct pt_regs *regs)
} }
/* reset mutex and interrupts */ /* reset mutex and interrupts */
driver_running = 0; driver_running = 0;
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -312,8 +312,7 @@ maciisi_write(struct adb_request* req) ...@@ -312,8 +312,7 @@ maciisi_write(struct adb_request* req)
req->complete = 0; req->complete = 0;
req->reply_len = 0; req->reply_len = 0;
save_flags(flags); local_irq_save(flags);
cli();
if (current_req) { if (current_req) {
last_req->next = req; last_req->next = req;
...@@ -327,7 +326,7 @@ maciisi_write(struct adb_request* req) ...@@ -327,7 +326,7 @@ maciisi_write(struct adb_request* req)
i = maciisi_start(); i = maciisi_start();
if(i != 0) if(i != 0)
{ {
restore_flags(flags); local_irq_restore(flags);
return i; return i;
} }
} }
...@@ -336,11 +335,11 @@ maciisi_write(struct adb_request* req) ...@@ -336,11 +335,11 @@ maciisi_write(struct adb_request* req)
#ifdef DEBUG_MACIISI_ADB #ifdef DEBUG_MACIISI_ADB
printk(KERN_DEBUG "maciisi_write: would start, but state is %d\n", maciisi_state); printk(KERN_DEBUG "maciisi_write: would start, but state is %d\n", maciisi_state);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
return -EBUSY; return -EBUSY;
} }
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -401,15 +400,14 @@ maciisi_poll(void) ...@@ -401,15 +400,14 @@ maciisi_poll(void)
{ {
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
if (via[IFR] & SR_INT) { if (via[IFR] & SR_INT) {
maciisi_interrupt(0, 0, 0); maciisi_interrupt(0, 0, 0);
} }
else /* avoid calling this function too quickly in a loop */ else /* avoid calling this function too quickly in a loop */
udelay(ADB_DELAY); udelay(ADB_DELAY);
restore_flags(flags); local_irq_restore(flags);
} }
/* Shift register interrupt - this is *supposed* to mean that the /* Shift register interrupt - this is *supposed* to mean that the
...@@ -426,8 +424,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs) ...@@ -426,8 +424,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs)
int i; int i;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
status = via[B] & (TIP|TREQ); status = via[B] & (TIP|TREQ);
#ifdef DEBUG_MACIISI_ADB #ifdef DEBUG_MACIISI_ADB
...@@ -437,7 +434,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs) ...@@ -437,7 +434,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs)
if (!(via[IFR] & SR_INT)) { if (!(via[IFR] & SR_INT)) {
/* Shouldn't happen, we hope */ /* Shouldn't happen, we hope */
printk(KERN_ERR "maciisi_interrupt: called without interrupt flag set\n"); printk(KERN_ERR "maciisi_interrupt: called without interrupt flag set\n");
restore_flags(flags); local_irq_restore(flags);
return; return;
} }
...@@ -636,7 +633,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs) ...@@ -636,7 +633,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs)
default: default:
printk("maciisi_interrupt: unknown maciisi_state %d?\n", maciisi_state); printk("maciisi_interrupt: unknown maciisi_state %d?\n", maciisi_state);
} }
restore_flags(flags); local_irq_restore(flags);
} }
static void static void
......
...@@ -495,7 +495,7 @@ pmu_queue_request(struct adb_request *req) ...@@ -495,7 +495,7 @@ pmu_queue_request(struct adb_request *req)
req->next = 0; req->next = 0;
req->sent = 0; req->sent = 0;
req->complete = 0; req->complete = 0;
save_flags(flags); cli(); local_irq_save(flags);
if (current_req != 0) { if (current_req != 0) {
last_req->next = req; last_req->next = req;
...@@ -507,7 +507,7 @@ pmu_queue_request(struct adb_request *req) ...@@ -507,7 +507,7 @@ pmu_queue_request(struct adb_request *req)
pmu_start(); pmu_start();
} }
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -537,7 +537,7 @@ pmu_start() ...@@ -537,7 +537,7 @@ pmu_start()
/* assert pmu_state == idle */ /* assert pmu_state == idle */
/* get the packet to send */ /* get the packet to send */
save_flags(flags); cli(); local_irq_save(flags);
req = current_req; req = current_req;
if (req == 0 || pmu_state != idle if (req == 0 || pmu_state != idle
|| (req->reply_expected && req_awaiting_reply)) || (req->reply_expected && req_awaiting_reply))
...@@ -551,16 +551,15 @@ pmu_start() ...@@ -551,16 +551,15 @@ pmu_start()
send_byte(req->data[0]); send_byte(req->data[0]);
out: out:
restore_flags(flags); local_irq_restore(flags);
} }
void void
pmu_poll() pmu_poll()
{ {
unsigned long cpu_flags; unsigned long flags;
save_flags(cpu_flags); local_irq_save(flags);
cli();
if (via1[IFR] & SR_INT) { if (via1[IFR] & SR_INT) {
via1[IFR] = SR_INT; via1[IFR] = SR_INT;
pmu_interrupt(IRQ_MAC_ADB_SR, NULL, NULL); pmu_interrupt(IRQ_MAC_ADB_SR, NULL, NULL);
...@@ -569,7 +568,7 @@ pmu_poll() ...@@ -569,7 +568,7 @@ pmu_poll()
via1[IFR] = CB1_INT; via1[IFR] = CB1_INT;
pmu_interrupt(IRQ_MAC_ADB_CL, NULL, NULL); pmu_interrupt(IRQ_MAC_ADB_CL, NULL, NULL);
} }
restore_flags(cpu_flags); local_irq_restore(flags);
} }
static void static void
...@@ -963,9 +962,9 @@ int __openfirmware powerbook_sleep(void) ...@@ -963,9 +962,9 @@ int __openfirmware powerbook_sleep(void)
asm volatile("mfspr %0,1008" : "=r" (hid0) :); asm volatile("mfspr %0,1008" : "=r" (hid0) :);
hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP; hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP;
asm volatile("mtspr 1008,%0" : : "r" (hid0)); asm volatile("mtspr 1008,%0" : : "r" (hid0));
save_flags(msr); local_save_flags(msr);
msr |= MSR_POW | MSR_EE; msr |= MSR_POW | MSR_EE;
restore_flags(msr); local_irq_restore(msr);
udelay(10); udelay(10);
/* OK, we're awake again, start restoring things */ /* OK, we're awake again, start restoring things */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment