move all pci related functions and definitions to io.h from dat.h remove eisa definitions add VectorSIMD remove ISAWINDOW Reference: /n/atom/patch/applied2013/nixpciinio.h Date: Tue Sep 17 00:56:11 CES 2013 Signed-off-by: quanstro@quanstr.net --- /sys/src/nix/k10/options.c Tue Sep 17 00:55:06 2013 +++ /sys/src/nix/k10/options.c Tue Sep 17 00:55:07 2013 @@ -3,6 +3,7 @@ #include "mem.h" #include "dat.h" #include "fns.h" +#include "io.h" #include "adr.h" /* --- /sys/src/nix/k10/dat.h Tue Sep 17 00:55:11 2013 +++ /sys/src/nix/k10/dat.h Tue Sep 17 00:55:12 2013 @@ -1,6 +1,5 @@ typedef struct Conf Conf; typedef struct Fxsave Fxsave; -typedef struct Hwconf Hwconf; typedef struct Label Label; typedef struct Lock Lock; typedef struct MFPU MFPU; @@ -8,7 +7,6 @@ typedef struct Mach Mach; typedef u64int Mpl; typedef struct Page Page; -typedef struct Pciconf Pciconf; typedef struct Pcidev Pcidev; typedef struct PFPU PFPU; typedef struct PMMU PMMU; @@ -269,26 +267,6 @@ int ispanic; /* shutdown in response to a panic */ int thunderbirdsarego; /* lets the added processors continue */ }active; - -/* - * pci device configuration - */ -struct Pciconf { - char *type; - uintmem port; - uintmem mem; - - int irq; - uint tbdf; - - int nopt; - char optbuf[128]; - char *opt[8]; -}; - -struct Hwconf { - Pciconf; -}; /* * The Mach structures must be available via the per-processor --- /sys/src/nix/k10/etherigbe.c Tue Sep 17 00:55:17 2013 +++ /sys/src/nix/k10/etherigbe.c Tue Sep 17 00:55:20 2013 @@ -26,8 +26,8 @@ #include "../port/ethermii.h" #include "../port/netif.h" -#include "etherif.h" #include "io.h" +#include "etherif.h" enum { i82542 = (0x1000<<16)|0x8086, --- /sys/src/nix/k10/fns.h Tue Sep 17 00:55:23 2013 +++ /sys/src/nix/k10/fns.h Tue Sep 17 00:55:25 2013 @@ -86,31 +86,10 @@ void outsl(int, void*, int); void outss(int, void*, int); void pause(void); -int pcicap(Pcidev*, int); -int pcicfgr16(Pcidev*, int); -int pcicfgr32(Pcidev*, int); -int pcicfgr8(Pcidev*, int); -void pcicfgw16(Pcidev*, int, int); -void pcicfgw32(Pcidev*, int, int); -void pcicfgw8(Pcidev*, int, int); -void pciclrbme(Pcidev*); -void pciclriome(Pcidev*); -void pciclrmwi(Pcidev*); -int pciconfig(char*, int, Pciconf*); -int pcigetpms(Pcidev*); -void pcihinv(Pcidev*); -Pcidev* pcimatch(Pcidev*, int, int); -Pcidev* pcimatchtbdf(int); -void pcireset(void); -void pcisetbme(Pcidev*); -void pcisetioe(Pcidev*); -void pcisetmwi(Pcidev*); -int pcisetpms(Pcidev*, int); void physallocdump(void); void printcpufreq(void); int screenprint(char*, ...); /* debugging */ void sfence(void); -int strtotbdf(char*, char**, int); void syscall(uint, Ureg*); void trapenable(int, void (*)(Ureg*, void*), void*, char*); void trapinit(void); --- /sys/src/nix/k10/io.h Tue Sep 17 00:55:27 2013 +++ /sys/src/nix/k10/io.h Tue Sep 17 00:55:29 2013 @@ -1,3 +1,9 @@ +typedef struct Hwconf Hwconf; +typedef struct Pciconf Pciconf; +typedef struct Pcidev Pcidev; +typedef struct Vctl Vctl; +typedef struct Vkey Vkey; + enum { VectorNMI = 2, /* non-maskable interrupt */ VectorBPT = 3, /* breakpoint */ @@ -8,6 +14,7 @@ VectorPF = 14, /* page fault */ Vector15 = 15, /* reserved */ VectorCERR = 16, /* coprocessor error */ + VectorSIMD = 19, /* SIMD error */ VectorPIC = 32, /* external i8259 interrupts */ IrqCLOCK = 0, @@ -58,9 +65,6 @@ IdtMAX = 255, }; -typedef struct Vkey Vkey; -typedef struct Vctl Vctl; - struct Vkey { int tbdf; /* pci: ioapic or msi sources */ int irq; /* 8259-emulating sources */ @@ -113,11 +117,6 @@ #define BUSBDF(tbdf) ((tbdf)&0x00FFFF00) #define BUSUNKNOWN (-1) -enum { - MaxEISA = 16, - CfgEISA = 0xC80, -}; - /* * PCI support code. */ @@ -210,9 +209,7 @@ PciCapHSW = 0x0c, /* hot swap */ }; -typedef struct Pcidev Pcidev; -struct Pcidev -{ +struct Pcidev { int tbdf; /* type+bus+device+function */ ushort vid; /* vendor ID */ ushort did; /* device ID */ @@ -237,11 +234,49 @@ Pcidev* bridge; /* down a bus */ }; +struct Pciconf { + char *type; + uintmem port; + uintmem mem; + + int irq; + int tbdf; + + int nopt; + char optbuf[128]; + char *opt[8]; +}; + +struct Hwconf { + Pciconf; +}; + +void archpciinit(void); +int pcicap(Pcidev*, int); +int pcicfgr16(Pcidev*, int); +int pcicfgr32(Pcidev*, int); +int pcicfgr8(Pcidev*, int); +void pcicfgw16(Pcidev*, int, int); +void pcicfgw32(Pcidev*, int, int); +void pcicfgw8(Pcidev*, int, int); +void pciclrbme(Pcidev*); +void pciclriome(Pcidev*); +void pciclrmwi(Pcidev*); +int pciconfig(char*, int, Pciconf*); +int pcigetpms(Pcidev*); +void pcihinv(Pcidev*); +Pcidev* pcimatch(Pcidev*, int, int); +Pcidev* pcimatchtbdf(int); +void pcireset(void); +void pcisetbme(Pcidev*); +void pcisetioe(Pcidev*); +void pcisetmwi(Pcidev*); +int pcisetpms(Pcidev*, int); +int strtotbdf(char*, char**, int); + #define PCIWINDOW 0 #define PCIWADDR(va) (PADDR(va)+PCIWINDOW) #define Pciwaddrl(va) ((u32int)PCIWADDR(va)) #define Pciwaddrh(va) ((u32int)(PCIWADDR(va)>>32)) -#define ISAWINDOW 0 -#define ISAWADDR(va) (PADDR(va)+ISAWINDOW) #pragma varargck type "T" int