Skip to content

Commit 7ae23df

Browse files
committed
intr/powerpc: remove architecture copy of PIC device
Now that the value is on the event, there is no need for PowerPC to duplicate the value on the powerpc_intr structure.
1 parent 0647e0f commit 7ae23df

File tree

1 file changed

+31
-33
lines changed

1 file changed

+31
-33
lines changed

sys/powerpc/powerpc/intr_machdep.c

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ struct powerpc_intr {
9090
struct intr_event event;
9191
long *cntp;
9292
void *priv; /* PIC-private data */
93-
device_t pic;
9493
u_int irq;
9594
u_int intline;
9695
u_int vector;
@@ -241,8 +240,8 @@ smp_intr_init(void *dummy __unused)
241240
for (vector = 0; vector < nvectors; vector++) {
242241
i = powerpc_intrs[vector];
243242
if (i != NULL && !CK_SLIST_EMPTY(&i->event.ie_handlers) &&
244-
i->pic == root_pic)
245-
PIC_BIND(i->pic, i->intline, i->pi_cpuset, &i->priv);
243+
i->event.ie_pic == root_pic)
244+
PIC_BIND(i->event.ie_pic, i->intline, i->pi_cpuset, &i->priv);
246245
}
247246

248247
root = device_lookup_by_name("root0");
@@ -299,7 +298,6 @@ intr_lookup(u_int irq)
299298
i->trig = INTR_TRIGGER_CONFORM;
300299
i->pol = INTR_POLARITY_CONFORM;
301300
i->irq = irq;
302-
i->pic = NULL;
303301
i->vector = -1;
304302
i->fwcode = 0;
305303
i->ipi = 0;
@@ -321,7 +319,7 @@ intr_lookup(u_int irq)
321319
}
322320

323321
if (iscan == NULL && i->vector != -1) {
324-
error = intr_event_init(&i->event, i->pic, irq, 0,
322+
error = intr_event_init(&i->event, pic, irq, 0,
325323
"irq%u:", irq);
326324
if (error == 0) {
327325
powerpc_intrs[i->vector] = i;
@@ -360,11 +358,11 @@ powerpc_map_irq(struct powerpc_intr *i)
360358
return (EINVAL);
361359

362360
i->intline = i->irq - p->base;
363-
i->pic = p->dev;
361+
i->event.ie_pic = p->dev;
364362

365363
/* Try a best guess if that failed */
366-
if (i->pic == NULL)
367-
i->pic = root_pic;
364+
if (i->event.ie_pic == NULL)
365+
i->event.ie_pic = root_pic;
368366

369367
return (0);
370368
}
@@ -373,22 +371,22 @@ static void
373371
powerpc_intr_eoi(device_t pic, interrupt_t *i)
374372
{
375373

376-
PIC_EOI(i->pic, i->intline, i->priv);
374+
PIC_EOI(i->event.ie_pic, i->intline, i->priv);
377375
}
378376

379377
static void
380378
powerpc_intr_pre_ithread(device_t pic, interrupt_t *i)
381379
{
382380

383-
PIC_MASK(i->pic, i->intline, i->priv);
384-
PIC_EOI(i->pic, i->intline, i->priv);
381+
PIC_MASK(i->event.ie_pic, i->intline, i->priv);
382+
PIC_EOI(i->event.ie_pic, i->intline, i->priv);
385383
}
386384

387385
static void
388386
powerpc_intr_post_ithread(device_t pic, interrupt_t *i)
389387
{
390388

391-
PIC_UNMASK(i->pic, i->intline, i->priv);
389+
PIC_UNMASK(i->event.ie_pic, i->intline, i->priv);
392390
}
393391

394392
static int
@@ -401,8 +399,8 @@ powerpc_assign_intr_cpu(device_t pic, interrupt_t *i, u_int cpu)
401399
else
402400
CPU_SETOF(cpu, &i->pi_cpuset);
403401

404-
if (!cold && i->pic != NULL && i->pic == root_pic)
405-
PIC_BIND(i->pic, i->intline, i->pi_cpuset, &i->priv);
402+
if (!cold && i->event.ie_pic != NULL && i->event.ie_pic == root_pic)
403+
PIC_BIND(i->event.ie_pic, i->intline, i->pi_cpuset, &i->priv);
406404

407405
return (0);
408406
#else
@@ -561,14 +559,14 @@ powerpc_enable_intr(void)
561559
continue;
562560

563561
if (i->trig == INTR_TRIGGER_INVALID)
564-
PIC_TRANSLATE_CODE(i->pic, i->intline, i->fwcode,
562+
PIC_TRANSLATE_CODE(i->event.ie_pic, i->intline, i->fwcode,
565563
&i->trig, &i->pol);
566564
if (i->trig != INTR_TRIGGER_CONFORM ||
567565
i->pol != INTR_POLARITY_CONFORM)
568-
PIC_CONFIG(i->pic, i->intline, i->trig, i->pol);
566+
PIC_CONFIG(i->event.ie_pic, i->intline, i->trig, i->pol);
569567

570568
if (!CK_SLIST_EMPTY(&i->event.ie_handlers))
571-
PIC_ENABLE(i->pic, i->intline, vector, &i->priv);
569+
PIC_ENABLE(i->event.ie_pic, i->intline, vector, &i->priv);
572570
}
573571

574572
return (0);
@@ -607,18 +605,18 @@ powerpc_setup_intr(const char *name, u_int irq, driver_filter_t filter,
607605

608606
if (!error) {
609607
if (i->trig == INTR_TRIGGER_INVALID)
610-
PIC_TRANSLATE_CODE(i->pic, i->intline,
608+
PIC_TRANSLATE_CODE(i->event.ie_pic, i->intline,
611609
i->fwcode, &i->trig, &i->pol);
612610

613611
if (i->trig != INTR_TRIGGER_CONFORM ||
614612
i->pol != INTR_POLARITY_CONFORM)
615-
PIC_CONFIG(i->pic, i->intline, i->trig, i->pol);
613+
PIC_CONFIG(i->event.ie_pic, i->intline, i->trig, i->pol);
616614

617-
if (i->pic == root_pic)
618-
PIC_BIND(i->pic, i->intline, i->pi_cpuset, &i->priv);
615+
if (i->event.ie_pic == root_pic)
616+
PIC_BIND(i->event.ie_pic, i->intline, i->pi_cpuset, &i->priv);
619617

620618
if (enable)
621-
PIC_ENABLE(i->pic, i->intline, i->vector,
619+
PIC_ENABLE(i->event.ie_pic, i->intline, i->vector,
622620
&i->priv);
623621
}
624622
}
@@ -659,10 +657,10 @@ powerpc_fw_config_intr(int irq, int sense_code)
659657
i->pol = INTR_POLARITY_CONFORM;
660658
i->fwcode = sense_code;
661659

662-
if (!cold && i->pic != NULL) {
663-
PIC_TRANSLATE_CODE(i->pic, i->intline, i->fwcode, &i->trig,
660+
if (!cold && i->event.ie_pic != NULL) {
661+
PIC_TRANSLATE_CODE(i->event.ie_pic, i->intline, i->fwcode, &i->trig,
664662
&i->pol);
665-
PIC_CONFIG(i->pic, i->intline, i->trig, i->pol);
663+
PIC_CONFIG(i->event.ie_pic, i->intline, i->trig, i->pol);
666664
}
667665

668666
return (0);
@@ -680,8 +678,8 @@ powerpc_config_intr(int irq, enum intr_trigger trig, enum intr_polarity pol)
680678
i->trig = trig;
681679
i->pol = pol;
682680

683-
if (!cold && i->pic != NULL)
684-
PIC_CONFIG(i->pic, i->intline, trig, pol);
681+
if (!cold && i->event.ie_pic != NULL)
682+
PIC_CONFIG(i->event.ie_pic, i->intline, trig, pol);
685683

686684
return (0);
687685
}
@@ -705,7 +703,7 @@ powerpc_dispatch_intr(u_int vector, struct trapframe *tf)
705703
* This prevents races in IPI handling.
706704
*/
707705
if (i->ipi)
708-
PIC_EOI(i->pic, i->intline, i->priv);
706+
PIC_EOI(i->event.ie_pic, i->intline, i->priv);
709707

710708
if (intr_event_handle(ie, tf) != 0) {
711709
goto stray;
@@ -722,7 +720,7 @@ powerpc_dispatch_intr(u_int vector, struct trapframe *tf)
722720
}
723721
}
724722
if (i != NULL)
725-
PIC_MASK(i->pic, i->intline, i->priv);
723+
PIC_MASK(i->event.ie_pic, i->intline, i->priv);
726724
}
727725

728726
void
@@ -731,10 +729,10 @@ powerpc_intr_mask(u_int irq)
731729
struct powerpc_intr *i;
732730

733731
i = intr_lookup(irq);
734-
if (i == NULL || i->pic == NULL)
732+
if (i == NULL || i->event.ie_pic == NULL)
735733
return;
736734

737-
PIC_MASK(i->pic, i->intline, i->priv);
735+
PIC_MASK(i->event.ie_pic, i->intline, i->priv);
738736
}
739737

740738
void
@@ -743,8 +741,8 @@ powerpc_intr_unmask(u_int irq)
743741
struct powerpc_intr *i;
744742

745743
i = intr_lookup(irq);
746-
if (i == NULL || i->pic == NULL)
744+
if (i == NULL || i->event.ie_pic == NULL)
747745
return;
748746

749-
PIC_UNMASK(i->pic, i->intline, i->priv);
747+
PIC_UNMASK(i->event.ie_pic, i->intline, i->priv);
750748
}

0 commit comments

Comments
 (0)