summaryrefslogtreecommitdiff
path: root/sys/src/9/pc64
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-11-29 17:43:22 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2020-11-29 17:43:22 +0100
commit1d93a5628adc0f08463fe4272dc88fb0f61e631d (patch)
treeb96cb74f50ab891af2fc72ebaf0d8ac6309ae385 /sys/src/9/pc64
parent32a5ff9658cfa2d0d15cecf3b2a27be6b0742227 (diff)
pc, pc64, xen: rewrite interrupt handling code
This implements proper intrdisable() support for all interrupt controllers. For enable, (*arch->intrassign)(Vctl*) fills in the Vctl.enable and Vctl.disable pointers with the appropriate routines and returns the assigned vector number. Once the Vctl struct has been linked to its vector chain, Vctl.enable(Vctl*, shared) gets called with a flag if the vector has been already enabled (shared). This order is important here as enabling the interrupt on the controller before we have linked the chain can cause spurious interrupts, expecially on mp system where the interrupt can target a different cpu than the caller of intrenable(). The intrdisable() case is the other way around. We first disable the interrupt on the controller and after that unlink the Vctl from the chain. On a multiprocessor, the xfree() of the Vctl struct is delayed to avoid freeing it while it is still in use by another cpu. The xen port now also uses pc/irq.c which has been made generic enougth to handle xen's irq scheme. Also, archgeneric is now a separate file to avoid pulling in dependencies from the 8259 interrupt controller code.
Diffstat (limited to 'sys/src/9/pc64')
-rw-r--r--sys/src/9/pc64/dat.h7
-rw-r--r--sys/src/9/pc64/fns.h8
-rw-r--r--sys/src/9/pc64/pc641
-rw-r--r--sys/src/9/pc64/trap.c2
4 files changed, 7 insertions, 11 deletions
diff --git a/sys/src/9/pc64/dat.h b/sys/src/9/pc64/dat.h
index 6cb1cc9ed..84efe9a2c 100644
--- a/sys/src/9/pc64/dat.h
+++ b/sys/src/9/pc64/dat.h
@@ -254,13 +254,12 @@ struct PCArch
char* id;
int (*ident)(void); /* this should be in the model */
void (*reset)(void); /* this should be in the model */
- int (*serialpower)(int); /* 1 == on, 0 == off */
- int (*modempower)(int); /* 1 == on, 0 == off */
void (*intrinit)(void);
- int (*intrenable)(Vctl*);
+ int (*intrassign)(Vctl*);
+ int (*intrirqno)(int, int);
int (*intrvecno)(int);
- int (*intrdisable)(int);
+ int (*intrspurious)(int);
void (*introff)(void);
void (*intron)(void);
diff --git a/sys/src/9/pc64/fns.h b/sys/src/9/pc64/fns.h
index b3408badb..5afd1c0b1 100644
--- a/sys/src/9/pc64/fns.h
+++ b/sys/src/9/pc64/fns.h
@@ -63,13 +63,6 @@ void i8253init(void);
void i8253reset(void);
uvlong i8253read(uvlong*);
void i8253timerset(uvlong);
-int i8259disable(int);
-int i8259enable(Vctl*);
-void i8259init(void);
-int i8259isr(int);
-void i8259on(void);
-void i8259off(void);
-int i8259vecno(int);
void idle(void);
void idlehands(void);
int inb(int);
@@ -109,6 +102,7 @@ char* mtrr(uvlong, uvlong, char *);
void mtrrclock(void);
int mtrrprint(char *, long);
void mtrrsync(void);
+void nmienable(void);
void noteret(void);
uchar nvramread(int);
void nvramwrite(int, uchar);
diff --git a/sys/src/9/pc64/pc64 b/sys/src/9/pc64/pc64
index c5ef1fbbe..b4891a04b 100644
--- a/sys/src/9/pc64/pc64
+++ b/sys/src/9/pc64/pc64
@@ -93,6 +93,7 @@ link
misc
pci pcipc
+ archgeneric devkbd i8259 i8253
archacpi mp apic squidboy ec
archmp mp apic squidboy
mtrr
diff --git a/sys/src/9/pc64/trap.c b/sys/src/9/pc64/trap.c
index c79bc4ec5..252462096 100644
--- a/sys/src/9/pc64/trap.c
+++ b/sys/src/9/pc64/trap.c
@@ -67,6 +67,8 @@ trapinit(void)
{
irqinit();
+ nmienable();
+
/*
* Special traps.
* Syscall() is called directly without going through trap().