enum { VectorDE = 1, /* debug exception */ VectorNMI = 2, /* non-maskable interrupt */ VectorBPT = 3, /* breakpoint */ VectorUD = 6, /* invalid opcode exception */ VectorCNA = 7, /* coprocessor not available */ Vector2F = 8, /* double fault */ VectorCSO = 9, /* coprocessor segment overrun */ VectorSNP = 11, /* segment not present */ VectorGPF = 13, /* general protection fault */ VectorPF = 14, /* page fault */ Vector15 = 15, /* reserved */ VectorCERR = 16, /* coprocessor error */ VectorAC = 17, /* alignment check */ VectorMC = 18, /* machine check */ VectorSIMD = 19, /* simd error */ VectorPIC = 32, /* external i8259 interrupts */ IrqCLOCK = 0, IrqKBD = 1, IrqUART1 = 3, IrqUART0 = 4, IrqPCMCIA = 5, IrqFLOPPY = 6, IrqLPT = 7, IrqIRQ7 = 7, IrqAUX = 12, /* PS/2 port */ IrqIRQ13 = 13, /* coprocessor on 386 */ IrqATA0 = 14, IrqATA1 = 15, MaxIrqPIC = 15, VectorLAPIC = VectorPIC+16, /* local APIC interrupts */ IrqLINT0 = 16, /* LINT[01] must be offsets 0 and 1 */ IrqLINT1 = 17, IrqTIMER = 18, IrqERROR = 19, IrqPCINT = 20, IrqSPURIOUS = 31, /* must have bits [3-0] == 0x0F */ MaxIrqLAPIC = 31, VectorSYSCALL = 64, VectorAPIC = 65, /* external APIC interrupts */ MaxVectorAPIC = 255, }; typedef struct Vctl { Vctl *next; /* handlers on this vector */ void (*f)(Ureg*, void*); /* handler to call */ void *a; /* argument to call it with */ int (*isr)(int); /* get isr bit for this irq */ int (*eoi)(int); /* eoi */ int (*enable)(Vctl*, int); int (*disable)(Vctl*, int); void *aux; int irq; int tbdf; int vno; int cpu; int local; char name[KNAMELEN]; /* of driver */ /* inferno specific */ int isintr; /* interrupt or fault/trap */ } Vctl; enum { MaxEISA = 16, CfgEISA = 0xC80, }; #define PCIWINDOW 0 #define PCIWADDR(va) (PADDR(va)+PCIWINDOW) #define ISAWINDOW 0 #define ISAWADDR(va) (PADDR(va)+ISAWINDOW) #define BUSUNKNOWN (-1) /* SMBus transactions */ enum { SMBquick, /* sends address only */ /* write */ SMBsend, /* sends address and cmd */ SMBbytewrite, /* sends address and cmd and 1 byte */ SMBwordwrite, /* sends address and cmd and 2 bytes */ /* read */ SMBrecv, /* sends address, recvs 1 byte */ SMBbyteread, /* sends address and cmd, recv's byte */ SMBwordread, /* sends address and cmd, recv's 2 bytes */ }; typedef struct SMBus SMBus; struct SMBus { QLock; /* mutex */ Rendez r; /* rendezvous point for completion interrupts */ void *arg; /* implementation dependent */ ulong base; /* port or memory base of smbus */ int busy; void (*transact)(SMBus*, int, int, int, uchar*); }; /* * PCMCIA support code. */ typedef struct PCMslot PCMslot; typedef struct PCMconftab PCMconftab; /* * Map between ISA memory space and PCMCIA card memory space. */ struct PCMmap { ulong ca; /* card address */ ulong cea; /* card end address */ ulong isa; /* ISA address */ int len; /* length of the ISA area */ int attr; /* attribute memory */ int ref; }; /* configuration table entry */ struct PCMconftab { int index; ushort irqs; /* legal irqs */ uchar irqtype; uchar bit16; /* true for 16 bit access */ struct { ulong start; ulong len; } io[16]; int nio; uchar vpp1; uchar vpp2; uchar memwait; ulong maxwait; ulong readywait; ulong otherwait; }; /* a card slot */ struct PCMslot { Lock; int ref; void *cp; /* controller for this slot */ long memlen; /* memory length */ uchar base; /* index register base */ uchar slotno; /* slot number */ /* status */ uchar special; /* in use for a special device */ uchar already; /* already inited */ uchar occupied; uchar battery; uchar wrprot; uchar powered; uchar configed; uchar enabled; uchar busy; /* cis info */ ulong msec; /* time of last slotinfo call */ char verstr[512]; /* version string */ int ncfg; /* number of configurations */ struct { ushort cpresent; /* config registers present */ ulong caddr; /* relative address of config registers */ } cfg[8]; int nctab; /* number of config table entries */ PCMconftab ctab[8]; PCMconftab *def; /* default conftab */ /* memory maps */ Lock mlock; /* lock down the maps */ int time; PCMmap mmap[4]; /* maps, last is always for the kernel */ };