Changeset 63
- Timestamp:
- Jan 3, 2006, 11:33:10 PM (20 years ago)
- Location:
- GPL/trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk/alsa-kernel/include/sound/driver.h
r34 r63 536 536 int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); 537 537 538 void *kzalloc(size_t size, unsigned int flags); 539 538 540 /* init.c */ 539 541 -
GPL/trunk/alsa-kernel/pci/intel8x0.c
r35 r63 3164 3164 // { 0x8086, 0x7195, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 440MX */ 3165 3165 // { 0x1039, 0x7012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SI7012 */ 3166 { 0x10de, 0x01b2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* NFORCE */ 3166 //Rudi: this is not a joystick !!!! 3167 // { 0x10de, 0x01b2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* NFORCE */ 3167 3168 // { 0x10de, 0x006b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* NFORCE2 */ 3168 3169 { 0x10de, 0x00db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* NFORCE3 */ -
GPL/trunk/drv32/init.c
r34 r63 44 44 #include "parse.h" 45 45 46 char copyright[]="@#Netlabs:1.13#@.Universal audio driver for OS/2 (c) Netlabs 2005\0x0\0x0\0xb";47 48 46 const char ERR_ERROR[] = "ERROR: "; 49 47 const char ERR_LOCK[] = "Unable to lock 32 bit data & code segments, exiting...\r\r\n"; … … 51 49 const char ERR_NAMES[] = "Query names failed\r\r\n"; 52 50 const char szALSA[] = "\r\n\r\nOS/2 Universal Audio Core Driver v"ALSA_VERSION"\r\n"; 51 53 52 const char szCopyRight1[]= "Copyright 2000-2002 InnoTek Systemberatung GmbH\r\n"; 54 53 const char szCopyRight2[]= "Copyright 2000-2002 The ALSA Project\r\n\r\n"; 54 const char szCopyRight3[]= "Copyright 2005 Netlabs http://www.netlabs.org\r\n"; 55 55 //const char szCopyRight3[]= "Maintained by http://os2.kiev.ua/en/uniaud.php\r\n\r\n"; 56 56 57 const char szCodeStartEnd[] = "Code 0x%0x - 0x%0x\r\n\r\n"; 57 58 const char szMixerFound[]= "Detected Mixer: "; … … 218 219 WriteString(szALSA, sizeof(szALSA)-1); 219 220 WriteString(szCopyRight1, sizeof(szCopyRight1)-1); 221 WriteString(szCopyRight3, sizeof(szCopyRight3)-1); 220 222 WriteString(szCopyRight2, sizeof(szCopyRight2)-1); 221 223 } 222 224 223 // if(fDebug) { 224 if(1) { 225 if(fDebug) { 225 226 sprintf(debugmsg, szCodeStartEnd, OffsetBeginCS32, OffsetFinalCS32); 226 227 WriteString(debugmsg, strlen(debugmsg)); -
GPL/trunk/drv32/irq.cpp
r34 r63 35 35 36 36 // List of handlers here. 37 static FARPTR16 *pISR[ NUM_IRQLEVELS] = {38 NULL,39 NULL,40 NULL,37 static FARPTR16 *pISR[MAX_IRQ_SLOTS] = { 38 &ISR00, 39 &ISR01, 40 &ISR02, 41 41 &ISR03, 42 42 &ISR04, 43 43 &ISR05, 44 NULL, 45 &ISR07, 46 NULL, 47 &ISR09, 48 &ISR10, 49 &ISR11, 50 &ISR12, 51 &ISR13, 52 &ISR14, 53 &ISR15, 44 &ISR06, 45 &ISR07 54 46 }; 55 56 static PFNIRQ pfnAlsaIRQHandler = NULL;57 47 58 48 //****************************************************************************** 59 49 //****************************************************************************** 60 BOOL RMSetIrq(ULONG ulIrq, BOOL fShared, PFNIRQ pfnIrqHandler)50 BOOL ALSA_SetIrq(ULONG ulIrq, ULONG ulSlotNo, BOOL fShared) 61 51 { 62 52 USHORT rc = 1; 63 53 64 if( pISR[ulIrq] == NULL) {54 if( ulSlotNo >= MAX_IRQ_SLOTS ) { 65 55 DebugInt3(); 66 56 return FALSE; 67 57 } 68 if(fShared) 58 59 if(fShared) 69 60 { 70 rc = DevIRQSet((WORD16) *pISR[ ulIrq],61 rc = DevIRQSet((WORD16) *pISR[ulSlotNo], 71 62 (WORD16)ulIrq, 72 63 1 ); // first try shared shared 73 64 } 65 74 66 if (rc != 0) { // If error ... 75 rc = DevIRQSet((WORD16) *pISR[ ulIrq],67 rc = DevIRQSet((WORD16) *pISR[ulSlotNo], 76 68 (WORD16)ulIrq, 77 69 0); // failed, so try exclusive instead 78 70 } 71 79 72 if (rc != 0) { // If error ... 80 dprintf(("ERROR: RMSetIrq %d %d %x FAILED!!", ulIrq, fShared, pfnIrqHandler));73 dprintf(("ERROR: RMSetIrq %d %d %x FAILED!!", ulIrq, fShared, ulSlotNo)); 81 74 DebugInt3(); 82 75 return FALSE; 83 76 } 84 //Always called with the same handler 85 if(pfnAlsaIRQHandler && (pfnAlsaIRQHandler != pfnIrqHandler)) { 86 DebugInt3(); 87 return FALSE; 88 } 89 pfnAlsaIRQHandler = pfnIrqHandler; 77 90 78 return TRUE; 91 79 } 92 80 //****************************************************************************** 93 81 //****************************************************************************** 94 BOOL RMFreeIrq(ULONG ulIrq)82 BOOL ALSA_FreeIrq(ULONG ulIrq) 95 83 { 96 84 return (DevIRQClear((WORD16)ulIrq) == 0); … … 98 86 //****************************************************************************** 99 87 //****************************************************************************** 100 ULONG ALSA_Interrupt(ULONG irqnr);88 ULONG ALSA_Interrupt(ULONG ulSlotNo); 101 89 #pragma aux ALSA_Interrupt "ALSA_Interrupt" parm [ebx] 102 ULONG ALSA_Interrupt(ULONG irqnr)90 ULONG ALSA_Interrupt(ULONG ulSlotNo) 103 91 { 104 if(pfnAlsaIRQHandler == NULL) { 105 DebugInt3(); 106 return FALSE; 107 } 108 #ifdef DEBUG 109 dprintf2(("irq %d",irqnr)); 110 #endif 111 if(pfnAlsaIRQHandler(irqnr)) { 112 cli(); 113 // We've cleared all service requests. Send EOI and clear 114 // the carry flag (tells OS/2 kernel that Int was handled). 115 DevEOI( (WORD16)irqnr ); 116 return TRUE; 92 ULONG ulIrqNo; 93 94 if( process_interrupt(ulSlotNo, &ulIrqNo) ) { 95 cli(); 96 // We've cleared all service requests. Send EOI and clear 97 // the carry flag (tells OS/2 kernel that Int was handled). 98 DevEOI( (WORD16)ulIrqNo ); 99 return TRUE; 117 100 } 118 101 // Indicate Interrupt not serviced by setting carry flag before -
GPL/trunk/drv32/irq.h
r34 r63 25 25 #define __IRQ_H__ 26 26 27 //#define NUM_IRQLEVELS 16 28 #define NUM_IRQLEVELS 256 //ACPI 29 27 extern "C" FARPTR16 ISR00; 28 extern "C" FARPTR16 ISR01; 29 extern "C" FARPTR16 ISR02; 30 30 extern "C" FARPTR16 ISR03; 31 31 extern "C" FARPTR16 ISR04; 32 32 extern "C" FARPTR16 ISR05; 33 extern "C" FARPTR16 ISR06; 33 34 extern "C" FARPTR16 ISR07; 34 extern "C" FARPTR16 ISR09;35 extern "C" FARPTR16 ISR10;36 extern "C" FARPTR16 ISR11;37 extern "C" FARPTR16 ISR12;38 extern "C" FARPTR16 ISR13;39 extern "C" FARPTR16 ISR14;40 extern "C" FARPTR16 ISR15;41 35 42 36 #endif //__IRQ_H__ -
GPL/trunk/drv32/makefile.os2
r62 r63 36 36 TARGET = uniaud32 37 37 LNKFILE = $(OBJDIR)\$(TARGET).lrf 38 DEFFILE = $(OBJDIR)\$(TARGET).def 38 39 MAKEFILE = makefile.os2 39 40 … … 60 61 FILE4 = devhlp.obj 61 62 FILE5 = idc.obj dispatch.obj 62 FILE6 = rm .obj irq.obj util.obj63 FILE6 = rmhelp.obj irq.obj util.obj 63 64 FILE7 = impdos.lib 64 65 !if "$(KEE)" == "1" … … 80 81 81 82 !ifdef USE_WLINK 82 $( OBJDIR)\$(TARGET).lrf: $(MAKEFILE)83 $(LNKFILE): $(MAKEFILE) 83 84 @%write $^@ option quiet 84 85 @%write $^@ option verbose … … 87 88 @%write $^@ option alignment=16 88 89 @%write $^@ option map=$(WMAPNAME) 89 @%write $^@ option description '@$#$(_VENDOR):$(_VERSION)$#@' 90 !if "$(KEE)" == "1" 91 @%write $^@ option description '@$#$(BLDLVL_VENDOR):$(BLDLVL_REVISION)$#@$#$#1$#$# $(BLDLVL_DATETIME) $(BLDLVL_MACHINE)::::$(BLDLVL_FILEVER)::@@$(BLDLVL_PRODUCT) (KEE)' 92 !else 93 @%write $^@ option description '@$#$(BLDLVL_VENDOR):$(BLDLVL_REVISION)$#@$#$#1$#$# $(BLDLVL_DATETIME) $(BLDLVL_MACHINE)::::$(BLDLVL_FILEVER)::@@$(BLDLVL_PRODUCT) (W4)' 94 !endif 90 95 @%write $^@ name $(OBJDIR)\$(TARGET).sys 91 96 @for %f in ($(FILES)) do @%append $^@ file $(OBJDIR)\%f … … 93 98 @%write $^@ library $(%WATCOM)\lib386\os2\clib3r.lib 94 99 !else 95 $( OBJDIR)\$(TARGET).lrf: $(MAKEFILE)100 $(LNKFILE): $(MAKEFILE) 96 101 @%write $^@ /OUT:$(OBJDIR)\$(TARGET).sys 97 102 @%write $^@ /MAP:$(OBJDIR)\$(TARGET).map … … 99 104 @for %f in ($(LIBS)) do @%append $^@ %f 100 105 @%write $^@ $(%WATCOM)\lib386\os2\clib3r.lib 106 @%write $^@ $(DEFFILE) 101 107 !endif 102 108 103 $(OBJDIR)\$(TARGET).def: $(MAKEFILE) 104 @%write $^@ LIBRARY UNIAUD32 105 @%write $^@ DESCRIPTION "@$#Netlabs:1.13$#@Universal audio driver for OS/2 (c) Netlabs 2005" 106 @%write $^@ PROTMODE 109 $(OBJDIR)\$(TARGET).sys: $(LNKFILE) $(FILES) $(LIBS) 110 !if "$(KEE)" == "1" 111 @%write $(DEFFILE) description '@$#$(BLDLVL_VENDOR):$(BLDLVL_REVISION)$#@$#$#1$#$# $(BLDLVL_DATETIME) $(BLDLVL_MACHINE)::::$(BLDLVL_FILEVER)::@@$(BLDLVL_PRODUCT) (KEE)' 112 !else 113 @%write $(DEFFILE) description '@$#$(BLDLVL_VENDOR):$(BLDLVL_REVISION)$#@$#$#1$#$# $(BLDLVL_DATETIME) $(BLDLVL_MACHINE)::::$(BLDLVL_FILEVER)::@@$(BLDLVL_PRODUCT) (W4)' 114 !endif 107 115 108 $(OBJDIR)\$(TARGET).sys: $(OBJDIR)\$(TARGET).lrf $(LNKFILE) $(FILES) $(LIBS) $(OBJDIR)\$(TARGET).def 109 $(LINK) @$(OBJDIR)\$(TARGET).lrf $(OBJDIR)\$(TARGET).DEF 116 $(LINK) @$(LNKFILE) 117 110 118 copy $(OBJDIR)\$(TARGET).sys $(ALSA_BIN) 111 119 !if "$(KEE)" == "1" … … 130 138 -@rm *.err 2>nul 131 139 @cd $(OBJDIR) 132 -rm *.obj *.lnk *. sys *.sym *.lst *.map *.wmap *.lib 2>nul140 -rm *.obj *.lnk *.lrf *.def *.sys *.sym *.lst *.map *.wmap *.lib 2>nul 133 141 @cd ..\.. -
GPL/trunk/drv32/startup.asm
r32 r63 904 904 905 905 ALIGN 2 906 ISR00_16 proc far 907 push ebx 908 mov ebx, 0 909 call far ptr FLAT:Interrupt32 910 pop ebx 911 retf 912 ISR00_16 endp 913 914 ALIGN 2 915 ISR01_16 proc far 916 push ebx 917 mov ebx, 1 918 call far ptr FLAT:Interrupt32 919 pop ebx 920 retf 921 ISR01_16 endp 922 923 ALIGN 2 924 ISR02_16 proc far 925 push ebx 926 mov ebx, 2 927 call far ptr FLAT:Interrupt32 928 pop ebx 929 retf 930 ISR02_16 endp 931 932 ALIGN 2 906 933 ISR03_16 proc far 907 934 push ebx … … 931 958 932 959 ALIGN 2 960 ISR06_16 proc far 961 push ebx 962 mov ebx, 6 963 call far ptr FLAT:Interrupt32 964 pop ebx 965 retf 966 ISR06_16 endp 967 968 ALIGN 2 933 969 ISR07_16 proc far 934 970 push ebx … … 938 974 retf 939 975 ISR07_16 endp 940 941 ALIGN 2942 ISR09_16 proc far943 push ebx944 mov ebx, 9945 call far ptr FLAT:Interrupt32946 pop ebx947 retf948 ISR09_16 endp949 950 ALIGN 2951 ISR10_16 proc far952 push ebx953 mov ebx, 10954 call far ptr FLAT:Interrupt32955 pop ebx956 retf957 ISR10_16 endp958 959 ALIGN 2960 ISR11_16 proc far961 push ebx962 mov ebx, 11963 call far ptr FLAT:Interrupt32964 pop ebx965 retf966 ISR11_16 endp967 968 ALIGN 2969 ISR12_16 proc far970 push ebx971 mov ebx, 12972 call far ptr FLAT:Interrupt32973 pop ebx974 retf975 ISR12_16 endp976 977 ALIGN 2978 ISR13_16 proc far979 push ebx980 mov ebx, 13981 call far ptr FLAT:Interrupt32982 pop ebx983 retf984 ISR13_16 endp985 986 ALIGN 2987 ISR14_16 proc far988 push ebx989 mov ebx, 14990 call far ptr FLAT:Interrupt32991 pop ebx992 retf993 ISR14_16 endp994 995 ALIGN 2996 ISR15_16 proc far997 push ebx998 mov ebx, 15999 call far ptr FLAT:Interrupt321000 pop ebx1001 retf1002 ISR15_16 endp1003 976 1004 977 ;end of 16 bits code segment … … 1541 1514 public RMHandleToResourceHandleList1632 1542 1515 public _TimerHandler16 1516 public _ISR00 1517 public _ISR01 1518 public _ISR02 1543 1519 public _ISR03 1544 1520 public _ISR04 1545 1521 public _ISR05 1522 public _ISR06 1546 1523 public _ISR07 1547 public _ISR091548 public _ISR101549 public _ISR111550 public _ISR121551 public _ISR131552 public _ISR141553 public _ISR151554 1524 1555 1525 IFDEF FLATSTACK … … 1628 1598 1629 1599 ;16:16 addresses of interrupt dispatchers 1600 _ISR00 dw OFFSET CODE16:ISR00_16 1601 dw SEG CODE16:ISR00_16 1602 _ISR01 dw OFFSET CODE16:ISR01_16 1603 dw SEG CODE16:ISR01_16 1604 _ISR02 dw OFFSET CODE16:ISR02_16 1605 dw SEG CODE16:ISR02_16 1630 1606 _ISR03 dw OFFSET CODE16:ISR03_16 1631 1607 dw SEG CODE16:ISR03_16 … … 1634 1610 _ISR05 dw OFFSET CODE16:ISR05_16 1635 1611 dw SEG CODE16:ISR05_16 1612 _ISR06 dw OFFSET CODE16:ISR06_16 1613 dw SEG CODE16:ISR06_16 1636 1614 _ISR07 dw OFFSET CODE16:ISR07_16 1637 1615 dw SEG CODE16:ISR07_16 1638 _ISR09 dw OFFSET CODE16:ISR09_161639 dw SEG CODE16:ISR09_161640 _ISR10 dw OFFSET CODE16:ISR10_161641 dw SEG CODE16:ISR10_161642 _ISR11 dw OFFSET CODE16:ISR11_161643 dw SEG CODE16:ISR11_161644 _ISR12 dw OFFSET CODE16:ISR12_161645 dw SEG CODE16:ISR12_161646 _ISR13 dw OFFSET CODE16:ISR13_161647 dw SEG CODE16:ISR13_161648 _ISR14 dw OFFSET CODE16:ISR14_161649 dw SEG CODE16:ISR14_161650 _ISR15 dw OFFSET CODE16:ISR15_161651 dw SEG CODE16:ISR15_161652 1616 DATA32 ends 1653 1617 -
GPL/trunk/drv32/util.cpp
r32 r63 22 22 * 23 23 */ 24 #define INCL_NOPMAPI 25 #define INCL_DOSINFOSEG 26 #include <os2.h> 24 27 25 26 #include "rm.hpp" // Will include os2.h, etc.27 28 #include <devhelp.h> 28 29 #include <devinfo.h> -
GPL/trunk/howtobuild.txt
r37 r63 1 NOTE! Use OpenWatcom 1.4rc1 or later 2 1 3 1. Run Configure.cmd 4 2 5 2. Enter path to watcom and ddk base 6 3 7 3. within created makefile.inc check for: 4 ALSA_SRC 5 ALSA_LIB_ 6 ALSA_BIN_ 7 defines and create corresponding directories 8 4. add following state if not added by configure 9 ################################################################################ 10 # Include the right watcom makefile 11 ################################################################################ 12 !ifdef 32BIT 13 !include E:\DEV\USS\test\GPL\include\watcom32.mk 14 !include E:\DEV\USS\test\GPL\include\watcom32.mak 15 !else 16 !include E:\DEV\USS\ua2\OCO\include\watcom16.mk 17 !include E:\DEV\USS\ua2\OCO\include\watcom16.mak 18 !endif 8 ALSA_SRC 9 ALSA_LIB_ 10 ALSA_BIN_ 11 define and create corresponding directories 19 12 20 DDK_BASE = e:\ddk\base 21 WATCOM = e:\owatcom 13 4. add following state if not added by configure: 14 ################################################################################ 15 # Include the right watcom makefile 16 ################################################################################ 17 !ifdef 32BIT 18 !include E:\DEV\USS\test\GPL\include\watcom32.mk 19 !include E:\DEV\USS\test\GPL\include\watcom32.mak 20 !else 21 !include E:\DEV\USS\ua2\OCO\include\watcom16.mk 22 !include E:\DEV\USS\ua2\OCO\include\watcom16.mak 23 !endif 24 25 DDK_BASE = e:\ddk\base 26 WATCOM = e:\owatcom 27 28 5. run !m_kee.cmd or !m_v4.cmd scrips 29 -
GPL/trunk/include/asm/string.h
r32 r63 10 10 int strncmp (const char *string1, const char *string2, size_t count); 11 11 12 size_t strlcpy(char *dst, const char *src, size_t size); 13 12 14 #endif 13 15 -
GPL/trunk/include/irqos2.h
r34 r63 25 25 #define __IRQOS2_H__ 26 26 27 //#define MAX_SHAREDIRQS 16 28 //#define MAX_IRQS 16 29 #define MAX_SHAREDIRQS 256 // ACPI 30 #define MAX_IRQS 256 // ACPI 27 #define MAX_SHAREDIRQS 8 28 #define MAX_IRQ_SLOTS 8 31 29 32 //typedef void (NEAR * IRQHANDLER)(int, void *, void *); 33 typedef int (NEAR * IRQHANDLER)(int, void *, void*);30 31 typedef int (NEAR * IRQHANDLER)(int, void *, struct pt_regs *); 34 32 35 33 typedef struct { … … 40 38 } IRQHANDLER_INFO; 41 39 42 typedef BOOL (*PFNIRQ)(int irq); 40 typedef struct 41 { 42 unsigned irqNo; 43 unsigned fEOI; 44 unsigned flHandlers; 45 IRQHANDLER_INFO irqHandlers[MAX_SHAREDIRQS]; 46 } IRQ_SLOT; 47 43 48 44 49 #ifdef __cplusplus … … 46 51 #endif 47 52 48 BOOL RMSetIrq(ULONG ulIrq, BOOL fShared, PFNIRQ pfnIrqHandler);49 BOOL RMFreeIrq(ULONG ulIrq);53 BOOL ALSA_SetIrq(ULONG ulIrq, ULONG ulSlotNo, BOOL fShared); 54 BOOL ALSA_FreeIrq(ULONG ulIrq); 50 55 51 BOOL oss_process_interrupt(int irq);56 BOOL process_interrupt(ULONG ulSlotNo, ULONG *pulIrq); 52 57 53 58 ULONG os2gettimemsec(); 54 59 ULONG os2gettimesec(); 55 56 60 57 61 #ifdef __cplusplus -
GPL/trunk/include/osspci.h
r32 r63 30 30 #endif 31 31 32 #define MAX_RES_IRQ 2 33 #define MAX_RES_DMA 2 34 #define MAX_RES_IO 8 35 #define MAX_RES_MEM 8 36 37 #define RM_PNP_DEVICE 0 38 #define RM_PCI_DEVICE 1 39 40 #define MAX_PCI_DEVICES 16 41 #define MAX_PCI_BUSSES 16 42 43 //#pragma pack(4) !!! by vladest 44 #pragma pack(1) 45 46 typedef struct 47 { 48 ULONG busnr; 49 ULONG devnr; 50 ULONG funcnr; 51 ULONG devfn; 52 USHORT irq[MAX_RES_IRQ]; 53 USHORT dma[MAX_RES_DMA]; 54 USHORT io[MAX_RES_IO]; 55 USHORT iolength[MAX_RES_IO]; 56 ULONG mem[MAX_RES_MEM]; 57 ULONG memlength[MAX_RES_MEM]; 58 } IDC_RESOURCE; 59 60 #pragma pack() 61 62 typedef ULONG HRESMGR; 63 64 HRESMGR RMFindPCIDevice(ULONG vendorid, ULONG deviceid, IDC_RESOURCE *lpResource, int idx); 65 BOOL RMRequestIO(HRESMGR hResMgr, ULONG ulIOBase, ULONG ulIOLength); 66 BOOL RMRequestMem(HRESMGR hResMgr, ULONG ulMemBase, ULONG ulMemLength); 67 BOOL RMRequestIRQ(HRESMGR hResMgr, ULONG ulIrq, BOOL fShared); 68 BOOL RMRequestDMA(HRESMGR hResMgr, ULONG ulDMA); 69 //register resources & destroy resource manager object 70 void RMFinialize(HRESMGR hResMgr); 71 //destroy resource manager object 72 void RMDestroy(HRESMGR hResMgr); 73 74 extern HRESMGR hResMgr; 75 32 VOID RMInit(VOID); 33 BOOL RMRequestIO(ULONG ulIOBase, ULONG ulIOLength); 34 BOOL RMRequestMem(ULONG ulMemBase, ULONG ulMemLength); 35 BOOL RMRequestIRQ(ULONG ulIrq, BOOL fShared); 36 VOID RMDone(ULONG DevID); 76 37 77 38 #ifdef __cplusplus -
GPL/trunk/include/version.h
r32 r63 26 26 #define __UNIAUDVERSION_H__ 27 27 28 29 #define BUILDER_NAME "Netlabs" 30 #define PRODUCT_NAME "OS/2 Universal Audio Driver" 31 #define VENDOR_NAME "Netlabs" 32 #define PRODUCT_VERSION "1.1.4" // version 33 #define PRODUCT_TIMESTAMP 20051231L // YYYYMMDD 34 35 28 36 #define ALSA_VERSION "1.1.3" 29 37 #define RM_DRIVER_NAME "UNIAUD32.SYS" … … 31 39 #define RM_ADAPTER_NAME "OS/2 Universal Audio" 32 40 #define RM_DRIVER_VENDORNAME "InnoTek Systemberatung GmbH" 33 #define RM_DRIVER_BUILDYEAR 2005 34 #define RM_DRIVER_BUILDMONTH 01 35 #define RM_DRIVER_BUILDDAY 06 36 #define UNIAUD_VERSION 113 41 #define RM_DRIVER_BUILDYEAR (PRODUCT_TIMESTAMP / 10000) 42 #define RM_DRIVER_BUILDMONTH ((PRODUCT_TIMESTAMP / 100) % 100) 43 #define RM_DRIVER_BUILDDAY (PRODUCT_TIMESTAMP % 100) 44 #define UNIAUD_VERSION 114 45 37 46 38 47 #endif //__UNIAUDVERSION_H__ -
GPL/trunk/include/version.mak
r32 r63 1 # $Id: version.mak,v 1.1.1.1 2003/07/02 13:56:58 eleph Exp $2 3 1 # 4 5 2 # VERSION.MAK 6 3 # 7 4 # Current build level for File Versioning 8 5 # 9 # This file should reside in the same place as COMMON.MAK6 # Generated file, do NOT edit ! 10 7 # 11 8 12 _VENDOR = "OS/2 Universal Audio Driver" 13 _VERSION = 1.13.001 14 15 FILEVER = @^#$(_VENDOR):$(_VERSION)^#@ 16 9 BLDLVL_VENDOR = NETLABS 10 BLDLVL_PRODUCT = OS/2 Universal Audio Driver 11 BLDLVL_REVISION = 1.1 12 BLDLVL_FILEVER = 4 13 BLDLVL_DATETIME = 04.01.2006 00:19:06 14 BLDLVL_MACHINE = VLAD -
GPL/trunk/lib32/irq.c
r34 r63 37 37 38 38 39 static IRQHANDLER_INFO irqHandlers[MAX_IRQS][MAX_SHAREDIRQS] = {0};40 static ULONG nrIrqHandlers[MAX_IRQS] = {0};41 static ULONG eoiIrq[MAX_IRQS] = {0};42 43 39 BOOL fInInterrupt = FALSE; 44 40 extern BOOL fSuspended; //pci.c 45 41 46 //****************************************************************************** 47 //****************************************************************************** 42 43 //****************************************************************************** 44 //****************************************************************************** 45 46 static IRQ_SLOT arSlots[MAX_IRQ_SLOTS] = { 0 }; 47 48 49 //****************************************************************************** 50 //****************************************************************************** 51 static IRQ_SLOT *FindSlot(unsigned irq) 52 { 53 IRQ_SLOT *pSlot; 54 55 for( pSlot = arSlots; pSlot != &arSlots[MAX_IRQ_SLOTS]; pSlot++ ) 56 { 57 if( pSlot->irqNo == irq ) return pSlot; 58 } 59 60 return NULL; 61 } 62 63 64 //****************************************************************************** 65 //****************************************************************************** 66 48 67 int request_irq(unsigned int irq, 49 68 int (near *handler)(int, void *, struct pt_regs *), 50 69 unsigned long x0, const char *x1, void *x2) 51 70 { 52 int i; 53 54 if(RMRequestIRQ(hResMgr, irq, (x0 & SA_SHIRQ) ? TRUE : FALSE) == FALSE) { 55 dprintf(("RMRequestIRQ failed for irq %d", irq)); 56 return 0; 57 } 58 59 if(irq > 0xF) { 60 DebugInt3(); 61 return 0; 62 } 63 64 for(i=0;i<MAX_SHAREDIRQS;i++) 65 { 66 if(irqHandlers[irq][i].handler == 0) 67 { 68 irqHandlers[irq][i].handler = handler; 69 irqHandlers[irq][i].x0 = x0; 70 irqHandlers[irq][i].x1 = (char *)x1; 71 irqHandlers[irq][i].x2 = x2; 72 nrIrqHandlers[irq]++; 73 74 if(nrIrqHandlers[irq] == 1) 75 { 76 if(RMSetIrq(irq, (x0 & SA_SHIRQ) ? TRUE : FALSE, &oss_process_interrupt) == FALSE) 71 IRQ_SLOT *pSlot = FindSlot(irq); 72 unsigned u, uSlotNo = (unsigned)-1; 73 if( !pSlot ) 74 { 75 // find empty slot 76 for( uSlotNo = 0; uSlotNo < MAX_IRQ_SLOTS; uSlotNo++ ) 77 { 78 if( arSlots[uSlotNo].flHandlers == 0 ) 79 { 80 pSlot = &arSlots[uSlotNo]; break; 81 } 82 } 83 84 } 85 86 if( pSlot ) 87 { 88 if(RMRequestIRQ(/*hResMgr,*/ irq, (x0 & SA_SHIRQ) != 0) == FALSE) { 89 dprintf(("RMRequestIRQ failed for irq %d", irq)); 90 // return 0; 91 } 92 93 for( u = 0; u < MAX_SHAREDIRQS; u++ ) 94 { 95 if( pSlot->irqHandlers[u].handler == NULL ) 96 { 97 pSlot->irqNo = irq; 98 pSlot->irqHandlers[u].handler = handler; 99 pSlot->irqHandlers[u].x0 = x0; 100 pSlot->irqHandlers[u].x1 = (char *)x1; 101 pSlot->irqHandlers[u].x2 = x2; 102 103 if( pSlot->flHandlers != 0 || 104 ALSA_SetIrq(irq, uSlotNo, (x0 & SA_SHIRQ) != 0) ) 77 105 { 78 break; 106 pSlot->flHandlers |= 1 << u; 107 return 0; 79 108 } 109 110 break; 80 111 } 81 return 0;82 112 } 83 113 } 84 dprintf(("request_irq: Unable to register irq handler for irq %d\n", irq)); 114 115 dprintf(("request_irq: Unable to register irq handler for irq %d\n", irq)); 85 116 return 1; 86 117 } 118 119 87 120 //****************************************************************************** 88 121 //****************************************************************************** 89 122 void free_irq(unsigned int irq, void *userdata) 90 123 { 91 int i; 92 93 for(i=0;i<MAX_SHAREDIRQS;i++) 94 { 95 if(irqHandlers[irq][i].x2 == userdata) { 96 irqHandlers[irq][i].handler = 0; 97 irqHandlers[irq][i].x0 = 0; 98 irqHandlers[irq][i].x1 = 0; 99 irqHandlers[irq][i].x2 = 0; 100 if(--nrIrqHandlers[irq] == 0) { 101 RMFreeIrq(irq); 124 unsigned u; 125 IRQ_SLOT *pSlot; 126 127 if( (pSlot = FindSlot(irq)) != NULL ) 128 { 129 for( u = 0; u < MAX_SHAREDIRQS; u++ ) 130 { 131 if( pSlot->irqHandlers[u].x2 == userdata ) 132 { 133 pSlot->flHandlers &= ~(1 << u); 134 if( pSlot->flHandlers == 0 ) 135 { 136 ALSA_FreeIrq(pSlot->irqNo); 137 pSlot->irqNo = 0; 138 // pSlot->fEOI = 0; 102 139 } 103 break; 104 } 105 } 106 } 140 141 pSlot->irqHandlers[u].handler = NULL; 142 pSlot->irqHandlers[u].x0 = 0; 143 pSlot->irqHandlers[u].x1 = NULL; 144 pSlot->irqHandlers[u].x2 = NULL; 145 146 return; 147 148 } 149 } 150 } 151 } 152 153 107 154 //****************************************************************************** 108 155 //****************************************************************************** 109 156 void eoi_irq(unsigned int irq) 110 157 { 111 if(irq > 0xff) { 112 DebugInt3(); 113 return; 114 } 115 eoiIrq[irq]++; 116 } 117 //****************************************************************************** 118 //****************************************************************************** 119 BOOL oss_process_interrupt(int irq) 120 { 158 (void)irq; 159 /* 160 IRQ_SLOT *pSlot = FindSlot(irq); 161 162 if( pSlot ) pSlot->fEOI = 1; 163 */ 164 } 165 166 167 //****************************************************************************** 168 //****************************************************************************** 169 BOOL process_interrupt(ULONG ulSlotNo, ULONG *pulIrq) 170 { 171 unsigned u; 121 172 int rc; 122 int i;173 IRQ_SLOT *pSlot; 123 174 124 175 #ifdef DEBUG … … 137 188 } 138 189 139 for(i=0;i<MAX_SHAREDIRQS;i++) 140 { 141 if(irqHandlers[irq][i].handler != 0) 190 if( ulSlotNo < MAX_IRQ_SLOTS ) 191 { 192 pSlot = &arSlots[ulSlotNo]; 193 194 for( u = 0; u < MAX_SHAREDIRQS; u++ ) 195 { 196 if( pSlot->irqHandlers[u].handler ) 142 197 { 143 198 fInInterrupt = TRUE; 144 rc = irqHandlers[irq][i].handler(irq, irqHandlers[irq][i].x2, 0); 145 //rc = (eoiIrq[irq] >0);199 rc = pSlot->irqHandlers[u].handler(pSlot->irqNo, 200 pSlot->irqHandlers[u].x2, 0); 146 201 fInInterrupt = FALSE; 147 if(rc == 1) { 202 203 if( rc /*== 1 || pSlot->fEOI*/ ) { 204 205 *pulIrq = pSlot->irqNo; 206 // pSlot->fEOI = 0; 207 148 208 //ok, this interrupt was intended for us; notify the 16 bits MMPM/2 driver 149 209 OSS32_ProcessIRQ(); 150 eoiIrq[irq] = 0;151 210 return TRUE; 152 211 } 153 212 } 154 213 } 214 } 215 155 216 return FALSE; 156 217 } 218 219 157 220 //****************************************************************************** 158 221 //****************************************************************************** … … 161 224 return fInInterrupt; 162 225 } 226 227 163 228 //****************************************************************************** 164 229 //****************************************************************************** … … 167 232 dprintf(("disable_irq %d NOT implemented", irq)); 168 233 } 169 //****************************************************************************** 170 //****************************************************************************** 234 235 //****************************************************************************** 236 //****************************************************************************** 237 238 239 -
GPL/trunk/lib32/pci.c
r35 r63 41 41 #include <osspci.h> 42 42 43 #define MAX_PCI_BUSSES 16 44 #define MAX_PCI_DEVICES 16 45 43 46 struct pci_dev pci_devices[MAX_PCI_DEVICES] = {0}; 44 47 struct pci_bus pci_busses[MAX_PCI_BUSSES] = {0}; 45 48 46 HRESMGR hResMgr = 0;47 48 49 BOOL fSuspended = FALSE; 49 50 extern int nrCardsDetected; 50 //****************************************************************************** 51 //****************************************************************************** 52 OSSRET OSS32_APMResume() 53 { 54 int i; 55 struct pci_driver *driver; 56 57 dprintf(("OSS32_APMResume")); 58 for(i=0;i<MAX_PCI_DEVICES;i++) 59 { 60 if(pci_devices[i].devfn) 61 { 62 driver = pci_devices[i].pcidriver; 63 if(driver && driver->resume) { 64 driver->resume(&pci_devices[i]); 65 fSuspended = FALSE; 66 } 67 } 68 } 69 fSuspended = FALSE; 70 return OSSERR_SUCCESS; 71 } 72 //****************************************************************************** 73 //****************************************************************************** 74 OSSRET OSS32_APMSuspend() 75 { 76 int i; 77 struct pci_driver *driver; 78 79 dprintf(("OSS32_APMSuspend")); 80 fSuspended = TRUE; 81 for(i=0;i<MAX_PCI_DEVICES;i++) 82 { 83 if(pci_devices[i].devfn) 84 { 85 driver = pci_devices[i].pcidriver; 86 if(driver && driver->suspend) { 87 driver->suspend(&pci_devices[i], SNDRV_CTL_POWER_D3cold); 88 } 89 } 90 } 91 return OSSERR_SUCCESS; 92 } 93 //****************************************************************************** 94 //****************************************************************************** 95 int pcidev_prepare(struct pci_dev *dev) 96 { 97 dprintf(("pcidev_prepare %x not implemented", dev)); 98 return 1; //todo: correct return value?? 99 } 100 //****************************************************************************** 101 //****************************************************************************** 102 int pcidev_activate(struct pci_dev *dev) 103 { 104 dprintf(("pcidev_activate %x not implemented", dev)); 105 return 1; //todo: correct return value?? 106 } 107 //****************************************************************************** 108 //****************************************************************************** 109 int pcidev_deactivate(struct pci_dev *dev) 110 { 111 dprintf(("pcidev_deactivate %x not implemented", dev)); 112 return 1; //todo: correct return value?? 113 } 51 114 52 115 53 #define PCI_CONFIG_ENABLE 0x80000000 116 54 #define PCI_CONFIG_ADDRESS 0xCF8 117 55 #define PCI_CONFIG_DATA 0xCFC 118 /* 119 * get number of devices of given PCIID 120 */ 121 int pci_get_dev_num(ULONG pciId) 122 { 123 ULONG devNr, busNr, funcNr, temp, cfgaddrreg, detectedId; 124 int found = 0; 56 57 58 //****************************************************************************** 59 #define CONFIG_CMD(dev, where) \ 60 (PCI_CONFIG_ENABLE | (dev->bus->number<<16) | (dev->devfn<<8) | (where & ~3)) 61 //****************************************************************************** 62 int pci_read_config_byte(struct pci_dev *dev, int where, u8 *value) 63 { 64 outl(CONFIG_CMD(dev,where), PCI_CONFIG_ADDRESS); 65 *value = inb(PCI_CONFIG_DATA + (where&3)); 66 return PCIBIOS_SUCCESSFUL; 67 } 68 //****************************************************************************** 69 //****************************************************************************** 70 int pci_read_config_word(struct pci_dev *dev, int where, u16 *value) 71 { 72 outl(CONFIG_CMD(dev,where), PCI_CONFIG_ADDRESS); 73 *value = inw(PCI_CONFIG_DATA + (where&2)); 74 return PCIBIOS_SUCCESSFUL; 75 } 76 //****************************************************************************** 77 //****************************************************************************** 78 int pci_read_config_dword(struct pci_dev *dev, int where, u32 *value) 79 { 80 outl(CONFIG_CMD(dev,where), PCI_CONFIG_ADDRESS); 81 *value = inl(PCI_CONFIG_DATA); 82 return PCIBIOS_SUCCESSFUL; 83 } 84 //****************************************************************************** 85 //****************************************************************************** 86 int pci_write_config_byte(struct pci_dev *dev, int where, u8 value) 87 { 88 outl(CONFIG_CMD(dev,where), PCI_CONFIG_ADDRESS); 89 outb(value, PCI_CONFIG_DATA + (where&3)); 90 return PCIBIOS_SUCCESSFUL; 91 } 92 //****************************************************************************** 93 //****************************************************************************** 94 int pci_write_config_word(struct pci_dev *dev, int where, u16 value) 95 { 96 outl(CONFIG_CMD(dev,where), PCI_CONFIG_ADDRESS); 97 outw(value, PCI_CONFIG_DATA + (where&2)); 98 return PCIBIOS_SUCCESSFUL; 99 } 100 //****************************************************************************** 101 //****************************************************************************** 102 int pci_write_config_dword(struct pci_dev *dev, int where, u32 value) 103 { 104 outl(CONFIG_CMD(dev,where), PCI_CONFIG_ADDRESS); 105 outl(value, PCI_CONFIG_DATA); 106 return PCIBIOS_SUCCESSFUL; 107 } 108 //****************************************************************************** 109 //****************************************************************************** 110 int pcidev_prepare(struct pci_dev *dev) 111 { 112 dprintf(("pcidev_prepare %x not implemented", dev)); 113 return 1; //todo: correct return value?? 114 } 115 //****************************************************************************** 116 //****************************************************************************** 117 int pcidev_activate(struct pci_dev *dev) 118 { 119 dprintf(("pcidev_activate %x not implemented", dev)); 120 return 1; //todo: correct return value?? 121 } 122 //****************************************************************************** 123 //****************************************************************************** 124 int pcidev_deactivate(struct pci_dev *dev) 125 { 126 dprintf(("pcidev_deactivate %x not implemented", dev)); 127 return 1; //todo: correct return value?? 128 } 129 130 131 132 //****************************************************************************** 133 //****************************************************************************** 134 static int pci_query_device(unsigned int vendor, unsigned int device, 135 struct pci_dev near *pcidev, int idx) 136 { 137 int resNo, addr, found = 0; 138 u32 devNr, busNr, funcNr, detectedId, pciId, cfgaddrreg, temp, temp2; 139 u8 headerType; 140 141 pciId = (device << 16) | vendor; 125 142 126 143 cfgaddrreg = inl(PCI_CONFIG_ADDRESS); … … 131 148 for(funcNr=0;funcNr<8;funcNr++) 132 149 { 133 temp = ((ULONG)((ULONG)devNr<<11UL) + ((ULONG)busNr<<16UL) + ((ULONG)funcNr << 8UL));134 135 outl( PCI_CONFIG_ENABLE|temp, PCI_CONFIG_ADDRESS);150 headerType = 0; 151 temp = PCI_CONFIG_ENABLE | (busNr<<16) | (devNr<<11) | (funcNr<<8); 152 outl(temp, PCI_CONFIG_ADDRESS); 136 153 detectedId = inl(PCI_CONFIG_DATA); 137 // printk("det: %x, need: %x\n", detectedId, pciId); 138 if(detectedId == pciId) 139 found++; 154 if( detectedId != 0xffffffff ) 155 { 156 outl(temp | (PCI_HEADER_TYPE & ~3), PCI_CONFIG_ADDRESS); 157 headerType = inb(PCI_CONFIG_DATA + (PCI_HEADER_TYPE & 3)); 158 } 159 // printk("det: %x (%x), need: %x\n", detectedId, headerType, pciId); 160 161 if( detectedId == pciId && 162 (headerType & 0x7f) == PCI_HEADER_TYPE_NORMAL ) 163 { 164 if( found++ == idx ) 165 { 166 memset((void near *)pcidev, 0, sizeof(struct pci_dev)); 167 168 pcidev->vendor = vendor; 169 pcidev->device = device; 170 pcidev->bus = &pci_busses[busNr]; 171 pcidev->bus->number = busNr; 172 pcidev->devfn = (devNr << 3) | funcNr; 173 pcidev->hdr_type = headerType & 0x7f; 174 175 pcidev->prepare = pcidev_prepare; 176 pcidev->activate = pcidev_activate; 177 pcidev->deactivate = pcidev_deactivate; 178 pcidev->active = 1; 179 pcidev->ro = 0; 180 pcidev->sibling = NULL; 181 pcidev->next = NULL; 182 pcidev->dma_mask = 0xFFFFFFFF; 183 184 // Subsystem ID 185 pci_read_config_word(pcidev, PCI_SUBSYSTEM_VENDOR_ID, 186 &pcidev->subsystem_vendor); 187 pci_read_config_word(pcidev, PCI_SUBSYSTEM_ID, 188 &pcidev->subsystem_device); 189 190 // I/O and MEM 191 resNo = 0; 192 for( addr = PCI_BASE_ADDRESS_0; addr <= PCI_BASE_ADDRESS_5; addr += 4 ) 193 { 194 pci_read_config_dword(pcidev, addr, &temp); 195 if( temp != 0 && temp != 0xffffffff ) 196 { 197 pci_write_config_dword(pcidev, addr, 0xffffffff); 198 pci_read_config_dword(pcidev, addr, &temp2); 199 pci_write_config_dword(pcidev, addr, temp); 200 201 if( temp & PCI_BASE_ADDRESS_SPACE_IO ) 202 { 203 pcidev->resource[resNo].flags = IORESOURCE_IO | PCI_BASE_ADDRESS_SPACE_IO; 204 pcidev->resource[resNo].start = temp & PCI_BASE_ADDRESS_IO_MASK; 205 pcidev->resource[resNo].end = pcidev->resource[resNo].start + 206 ~(temp2 & PCI_BASE_ADDRESS_IO_MASK) + 1; 207 } 208 else 209 { 210 pcidev->resource[resNo].flags = IORESOURCE_MEM | IORESOURCE_MEM_WRITEABLE; 211 pcidev->resource[resNo].start = temp & PCI_BASE_ADDRESS_MEM_MASK; 212 pcidev->resource[resNo].end = pcidev->resource[resNo].start + 213 ~(temp2 & PCI_BASE_ADDRESS_MEM_MASK) + 1; 214 } 215 216 resNo++; 217 218 } 219 } 220 221 // IRQ and PIN 222 pci_read_config_dword(pcidev, PCI_INTERRUPT_LINE, &temp); 223 if( (u8)temp && (u8)temp != 0xff ) 224 { 225 pcidev->irq_resource[0].flags = IORESOURCE_IRQ; 226 pcidev->irq_resource[0].start = 227 pcidev->irq_resource[0].end = temp & 0xffff; 228 pcidev->irq = (u8)temp; 229 } 230 231 return 1; 232 } 233 } 234 235 // don't need to check more, if function 0 not present or single 236 if( funcNr == 0 && !(headerType & 0x80) ) break; 140 237 } 141 238 } 142 } 143 144 if(!found) { 145 outl(cfgaddrreg, PCI_CONFIG_ADDRESS); 146 return 0; 147 } 148 return found; 149 } 150 //****************************************************************************** 151 //TODO: Doesn't completely fill in the pci_dev structure 152 //****************************************************************************** 153 int FindPCIDevice(unsigned int vendor, unsigned int device, struct pci_dev near *pcidev, int idx) 154 { 155 IDC_RESOURCE idcres; 156 int i, residx = 0; 157 158 pcidev->prepare = pcidev_prepare; 159 pcidev->activate = pcidev_activate; 160 pcidev->deactivate = pcidev_deactivate; 161 pcidev->active = 1; 162 pcidev->ro = 0; 163 pcidev->sibling = NULL; 164 pcidev->next = NULL; 165 pcidev->vendor = vendor; 166 pcidev->device = device; 167 pcidev->dma_mask = 0xFFFFFFFF; 168 169 170 // printk("FindPCIDevice vend: %x, id: %x\n",vendor, device); 171 hResMgr = 0; 172 hResMgr = RMFindPCIDevice(vendor, device, &idcres, idx); 173 if(hResMgr == 0) { 174 return FALSE; 175 } 176 pcidev->devfn = idcres.devfn; 177 //pcidev->devfn = idcres.devfn + 1; 178 179 for(i=0;i<MAX_RES_IO;i++) { 180 if(idcres.io[i] != 0xffff) { 181 pcidev->resource[residx].name = 0; 182 pcidev->resource[residx].child = 0; 183 pcidev->resource[residx].sibling = 0; 184 pcidev->resource[residx].parent = 0; 185 pcidev->resource[residx].start = idcres.io[i]; 186 pcidev->resource[residx].end = idcres.io[i] + idcres.iolength[i]; //inclusive?? 187 pcidev->resource[residx].flags = IORESOURCE_IO | PCI_BASE_ADDRESS_SPACE_IO; 188 189 residx++; 190 } 191 } 192 for(i=0;i<MAX_RES_MEM;i++) { 193 if(idcres.mem[i] != 0xffffffff) { 194 pcidev->resource[residx].name = 0; 195 pcidev->resource[residx].child = 0; 196 pcidev->resource[residx].sibling = 0; 197 pcidev->resource[residx].parent = 0; 198 pcidev->resource[residx].start = idcres.mem[i]; 199 pcidev->resource[residx].end = idcres.mem[i] + idcres.memlength[i]; //inclusive?? 200 pcidev->resource[residx].flags = IORESOURCE_MEM | IORESOURCE_MEM_WRITEABLE; 201 printk("residx: %i start: %x\n", residx, pcidev->resource[residx].start); 202 residx++; 203 } 204 } 205 for(i=0;i<MAX_RES_DMA;i++) { 206 if(idcres.dma[i] != 0xffff) { 207 pcidev->dma_resource[i].name = 0; 208 pcidev->dma_resource[i].child = 0; 209 pcidev->dma_resource[i].sibling = 0; 210 pcidev->dma_resource[i].parent = 0; 211 pcidev->dma_resource[i].start = idcres.dma[i]; 212 pcidev->dma_resource[i].end = idcres.dma[i]; 213 //todo: 8/16 bits 214 pcidev->dma_resource[i].flags = IORESOURCE_DMA; 215 } 216 } 217 for(i=0;i<MAX_RES_IRQ;i++) { 218 if(idcres.irq[i] != 0xffff) { 219 pcidev->irq_resource[i].name = 0; 220 pcidev->irq_resource[i].child = 0; 221 pcidev->irq_resource[i].sibling = 0; 222 pcidev->irq_resource[i].parent = 0; 223 pcidev->irq_resource[i].start = idcres.irq[i]; 224 pcidev->irq_resource[i].end = idcres.irq[i]; 225 //todo: irq flags 226 pcidev->irq_resource[9].flags = IORESOURCE_IRQ; 227 } 228 } 229 if(pcidev->irq_resource[0].start != 0xffff) { 230 pcidev->irq = pcidev->irq_resource[0].start; 231 } 232 else pcidev->irq = 0; 233 234 if(idcres.busnr > MAX_PCI_BUSSES) { 235 DebugInt3(); 236 return FALSE; 237 } 238 pcidev->bus = &pci_busses[idcres.busnr]; 239 pcidev->bus->number = idcres.busnr; 240 241 pci_read_config_word(pcidev, PCI_SUBSYSTEM_VENDOR_ID, &pcidev->subsystem_vendor); 242 pci_read_config_word(pcidev, PCI_SUBSYSTEM_ID, &pcidev->subsystem_device); 243 244 return TRUE; 245 } 239 } 240 outl(cfgaddrreg, PCI_CONFIG_ADDRESS); 241 return 0; 242 243 } 244 246 245 //****************************************************************************** 247 246 //****************************************************************************** … … 249 248 { 250 249 int i, idx; 251 HRESMGR hResMgrTmp = 0;252 250 253 251 if((int)from < 8) { 254 252 idx = (int)from; // dirty hack 255 // return 0;253 // return 0; 256 254 } else 257 255 idx = 0; 258 // printk("searching device. vendor %x, pci id %x, idx %i\n",vendor,device, idx); 259 //not very pretty 260 if(hResMgr) { 261 hResMgrTmp = hResMgr; 262 hResMgr = 0; 263 } 256 264 257 for(i=0;i<MAX_PCI_DEVICES;i++) 265 258 { 266 259 if(pci_devices[i].devfn == 0) 267 260 { 268 if(FindPCIDevice(vendor, device, (struct pci_dev near *)&pci_devices[i], idx) == TRUE) { 269 if(hResMgrTmp) { 270 RMDestroy(hResMgr); 271 hResMgr = hResMgrTmp; 272 } 273 // pci_read_config_dword(&pci_devices[i], PCI_CLASS_REVISION, &pci_devices[i]._class); 274 // if (((pci_devices[i]._class >> 8) & 0xffff) == PCI_CLASS_MULTIMEDIA_AUDIO) 275 return &pci_devices[i]; 276 } 277 #ifdef DEBUG 278 printk("wrong device. vendor %x, pci id %x\n",vendor,device); 279 #endif 280 break; 281 } 282 } 283 if(hResMgrTmp) { 284 RMDestroy(hResMgr); 285 hResMgr = hResMgrTmp; 286 } 287 return 0; 288 } 289 //****************************************************************************** 290 //****************************************************************************** 291 struct resource * __request_region(struct resource *a, unsigned long start, unsigned long n, const char *name) 292 { 293 struct resource *resource; 261 if( pci_query_device(vendor, device, (struct pci_dev near *)&pci_devices[i], idx) ) 262 return &pci_devices[i]; 263 else 264 break; 265 } 266 } 267 268 return NULL; 269 } 270 //****************************************************************************** 271 //****************************************************************************** 272 struct resource * __request_region(struct resource *a, unsigned long start, 273 unsigned long n, const char *name) 274 { 275 struct resource *resource; 294 276 295 277 if(a->flags & IORESOURCE_MEM) { 296 if(RMRequestMem( hResMgr,start, n) == FALSE) {278 if(RMRequestMem(/*hResMgr,*/ start, n) == FALSE) { 297 279 printk("RMRequestIO failed for io %x, length %x\n", start, n); 298 280 return NULL; 299 281 } 300 282 } 301 else 302 if(a->flags & IORESOURCE_IO) { 303 if(RMRequestIO(hResMgr, start, n) == FALSE) { 283 else if(a->flags & IORESOURCE_IO) { 284 if(RMRequestIO(/*hResMgr,*/ start, n) == FALSE) { 304 285 printk("RMRequestIO failed for io %x, length %x\n", start, n); 305 286 return NULL; … … 307 288 } 308 289 309 resource = kmalloc(sizeof(struct resource), GFP_KERNEL); 310 if (resource == NULL) 311 return NULL; 312 resource->name = name; 313 resource->start = start; 314 resource->end = start + n - 1; 315 resource->flags = a->flags; 316 return resource; 317 } 318 //****************************************************************************** 319 //****************************************************************************** 320 void __release_region(struct resource *resource, unsigned long b, unsigned long c) 321 { 322 if(resource) { 323 kfree(resource); 290 resource = kmalloc(sizeof(struct resource), GFP_KERNEL); 291 if (resource == NULL) 292 return NULL; 293 resource->name = name; 294 resource->start = start; 295 resource->end = start + n; // - 1; 296 resource->flags = a->flags; 297 resource->parent = 298 resource->child = NULL; 299 300 // insert in list 301 resource->sibling = a->sibling; 302 a->sibling = resource; 303 304 return resource; 305 } 306 //****************************************************************************** 307 //****************************************************************************** 308 void __release_region(struct resource *a, 309 unsigned long start, unsigned long n) 310 { 311 struct resource *resource; 312 struct resource **ppres = &a->sibling; 313 unsigned long end = start + n; // - 1; 314 315 while( *ppres ) 316 { 317 resource = *ppres; 318 319 if( resource->start == start && resource->end == end ) 320 { 321 // remove from list 322 *ppres = resource->sibling; 323 kfree(resource); 324 return; 325 } 326 327 ppres = &resource->sibling; 324 328 } 325 329 } … … 335 339 } 336 340 //****************************************************************************** 337 #define CONFIG_CMD(dev, where) (0x80000000 | (dev->bus->number << 16) | (dev->devfn << 8) | (where & ~3))338 //******************************************************************************339 int pci_read_config_byte(struct pci_dev *dev, int where, u8 *value)340 {341 outl(CONFIG_CMD(dev,where), 0xCF8);342 *value = inb(0xCFC + (where&3));343 return PCIBIOS_SUCCESSFUL;344 }345 //******************************************************************************346 //******************************************************************************347 int pci_read_config_word(struct pci_dev *dev, int where, u16 *value)348 {349 outl(CONFIG_CMD(dev,where), 0xCF8);350 *value = inw(0xCFC + (where&2));351 return PCIBIOS_SUCCESSFUL;352 }353 //******************************************************************************354 //******************************************************************************355 int pci_read_config_dword(struct pci_dev *dev, int where, u32 *value)356 {357 outl(CONFIG_CMD(dev,where), 0xCF8);358 *value = inl(0xCFC);359 return PCIBIOS_SUCCESSFUL;360 }361 //******************************************************************************362 //******************************************************************************363 int pci_write_config_byte(struct pci_dev *dev, int where, u8 value)364 {365 outl(CONFIG_CMD(dev,where), 0xCF8);366 outb(value, 0xCFC + (where&3));367 return PCIBIOS_SUCCESSFUL;368 }369 //******************************************************************************370 //******************************************************************************371 int pci_write_config_word(struct pci_dev *dev, int where, u16 value)372 {373 outl(CONFIG_CMD(dev,where), 0xCF8);374 outw(value, 0xCFC + (where&2));375 return PCIBIOS_SUCCESSFUL;376 }377 //******************************************************************************378 //******************************************************************************379 int pci_write_config_dword(struct pci_dev *dev, int where, u32 value)380 {381 outl(CONFIG_CMD(dev,where), 0xCF8);382 outl(value, 0xCFC);383 return PCIBIOS_SUCCESSFUL;384 }385 //******************************************************************************386 341 //****************************************************************************** 387 342 int pcibios_present(void) … … 409 364 int pci_find_capability(struct pci_dev *dev, int cap) 410 365 { 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 366 u16 status; 367 u8 pos, id; 368 int ttl = 48; 369 370 pci_read_config_word(dev, PCI_STATUS, &status); 371 if (!(status & PCI_STATUS_CAP_LIST)) 372 return 0; 373 pci_read_config_byte(dev, PCI_CAPABILITY_LIST, &pos); 374 while (ttl-- && pos >= 0x40) { 375 pos &= ~3; 376 pci_read_config_byte(dev, pos + PCI_CAP_LIST_ID, &id); 377 if (id == 0xff) 378 break; 379 if (id == cap) 380 return pos; 381 pci_read_config_byte(dev, pos + PCI_CAP_LIST_NEXT, &pos); 382 } 383 return 0; 429 384 } 430 385 //****************************************************************************** … … 437 392 int pci_set_power_state(struct pci_dev *dev, int new_state) 438 393 { 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 394 u32 base[5], romaddr; 395 u16 pci_command, pwr_command; 396 u8 pci_latency, pci_cacheline; 397 int i, old_state; 398 int pm = pci_find_capability(dev, PCI_CAP_ID_PM); 399 400 if (!pm) 401 return 0; 402 pci_read_config_word(dev, pm + PCI_PM_CTRL, &pwr_command); 403 old_state = pwr_command & PCI_PM_CTRL_STATE_MASK; 404 if (old_state == new_state) 405 return old_state; 406 if (old_state == 3) { 407 pci_read_config_word(dev, PCI_COMMAND, &pci_command); 408 pci_write_config_word(dev, PCI_COMMAND, pci_command & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)); 409 for (i = 0; i < 5; i++) 410 pci_read_config_dword(dev, PCI_BASE_ADDRESS_0 + i*4, &base[i]); 411 pci_read_config_dword(dev, PCI_ROM_ADDRESS, &romaddr); 412 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &pci_latency); 413 pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &pci_cacheline); 414 pci_write_config_word(dev, pm + PCI_PM_CTRL, new_state); 415 for (i = 0; i < 5; i++) 416 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + i*4, base[i]); 417 pci_write_config_dword(dev, PCI_ROM_ADDRESS, romaddr); 418 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); 419 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, pci_cacheline); 420 pci_write_config_byte(dev, PCI_LATENCY_TIMER, pci_latency); 421 pci_write_config_word(dev, PCI_COMMAND, pci_command); 422 } else 423 pci_write_config_word(dev, pm + PCI_PM_CTRL, (pwr_command & ~PCI_PM_CTRL_STATE_MASK) | new_state); 424 return old_state; 470 425 } 471 426 //****************************************************************************** … … 478 433 int pci_enable_device(struct pci_dev *dev) 479 434 { 480 481 482 483 484 485 486 487 435 u16 pci_command; 436 437 printk("pci_enable_device %x\n", dev); 438 439 pci_read_config_word(dev, PCI_COMMAND, &pci_command); 440 pci_write_config_word(dev, PCI_COMMAND, pci_command | (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)); 441 pci_set_power_state(dev, 0); 442 return 0; 488 443 } 489 444 //****************************************************************************** … … 491 446 int pci_register_driver(struct pci_driver *driver) 492 447 { 493 struct pci_dev *pcidev = NULL; 494 int i = 0, j; 495 int dev_num; 496 ULONG pcidevid; 497 498 while(driver->id_table[i].vendor) 448 int i, j, dev_num; 449 struct pci_dev *pcidev; 450 451 for( i = 0; driver->id_table[i].vendor; i++) 499 452 { 500 pcidevid = ((ULONG)driver->id_table[i].device << 16) | 501 (ULONG)driver->id_table[i].vendor; 502 dev_num = pci_get_dev_num(pcidevid); 503 504 if (dev_num) { 505 printk("found: %i number of %x, id: %x\n",dev_num,driver->id_table[i].vendor, driver->id_table[i].device); 506 507 for (j=0; j < dev_num; j++) // dirty hack for multiply cards with same PCIID 508 { 509 pcidev = pci_find_device(driver->id_table[i].vendor, driver->id_table[i].device, (struct pci_dev *)j); 510 // printk("checking pci vend: %x, id: %x %i\n",driver->id_table[i].vendor, driver->id_table[i].device, i); 511 #ifdef DEBUG 512 // dprintf(("checked device: vendor %x, pci id %x, pcidev %x, probe %x", 513 // driver->id_table[i].vendor,driver->id_table[i].device, pcidev, driver->probe)); 514 #endif 515 if(pcidev && driver->probe) { 516 printk("found: %x, id: %x idx %i\n",driver->id_table[i].vendor, driver->id_table[i].device, j); 517 518 if(driver->probe(pcidev, &driver->id_table[i]) == 0) { 519 //remove resource manager object for this device and 520 //register resources with RM 521 RMFinialize(hResMgr); 522 hResMgr = 0; 523 524 //save driver pointer for suspend/resume calls 525 pcidev->pcidriver = (void *)driver; 526 pcidev->current_state = 4; 527 //return 1; 528 } 529 else pcidev->devfn = 0; 530 531 RMDestroy(hResMgr); 532 hResMgr = 0; 453 dev_num = 0; 454 while( (pcidev = pci_find_device(driver->id_table[i].vendor, 455 driver->id_table[i].device, 456 (struct pci_dev *)dev_num)) != NULL ) 457 { 458 RMInit(); 459 if( driver->probe) { 460 printk("found: %x, id: %x idx %i\n",driver->id_table[i].vendor, driver->id_table[i].device, dev_num); 461 462 if(driver->probe(pcidev, &driver->id_table[i]) == 0) { 463 pcidev->pcidriver = (void *)driver; 464 pcidev->current_state = 4; 465 466 // create adapter 467 RMDone((driver->id_table[i].vendor << 16) | driver->id_table[i].device); 468 469 return 1; 533 470 } 534 } // for j 535 return dev_num; 536 } 537 i++; 471 else pcidev->devfn = 0; 472 } 473 474 RMDone(0); 475 476 dev_num++; 477 478 } 538 479 } 539 480 return 0; … … 578 519 void pci_set_master(struct pci_dev *dev) 579 520 { 580 581 582 583 521 u16 cmd; 522 523 pci_read_config_word(dev, PCI_COMMAND, &cmd); 524 if (! (cmd & PCI_COMMAND_MASTER)) { 584 525 dprintf(("pci_set_master %x", dev)); 585 586 587 526 cmd |= PCI_COMMAND_MASTER; 527 pci_write_config_word(dev, PCI_COMMAND, cmd); 528 } 588 529 return; 589 530 } … … 722 663 int pci_orig_save_state(struct pci_dev *dev, u32 *buffer) 723 664 { 724 725 726 727 728 729 730 665 int i; 666 if (buffer) { 667 /* XXX: 100% dword access ok here? */ 668 for (i = 0; i < 16; i++) 669 pci_read_config_dword(dev, i * 4,&buffer[i]); 670 } 671 return 0; 731 672 } 732 673 … … 740 681 pci_orig_restore_state(struct pci_dev *dev, u32 *buffer) 741 682 { 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 683 int i; 684 685 if (buffer) { 686 for (i = 0; i < 16; i++) 687 pci_write_config_dword(dev,i * 4, buffer[i]); 688 } 689 /* 690 * otherwise, write the context information we know from bootup. 691 * This works around a problem where warm-booting from Windows 692 * combined with a D3(hot)->D0 transition causes PCI config 693 * header data to be forgotten. 694 */ 695 else { 696 for (i = 0; i < 6; i ++) 697 pci_write_config_dword(dev, 698 PCI_BASE_ADDRESS_0 + (i * 4), 699 dev->resource[i].start); 700 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); 701 } 702 return 0; 762 703 } 763 704 764 705 struct saved_config_tbl { 765 766 706 struct pci_dev *pci; 707 u32 config[16]; 767 708 }; 768 709 static struct saved_config_tbl saved_tbl[16]; … … 770 711 void pci_save_state(struct pci_dev *pci) 771 712 { 772 773 774 775 776 777 778 779 780 781 713 int i; 714 /* FIXME: mutex needed for race? */ 715 for (i = 0; i < ARRAY_SIZE(saved_tbl); i++) { 716 if (! saved_tbl[i].pci) { 717 saved_tbl[i].pci = pci; 718 pci_orig_save_state(pci, saved_tbl[i].config); 719 return; 720 } 721 } 722 printk(KERN_DEBUG "snd: no pci config space found!\n"); 782 723 } 783 724 784 725 void pci_restore_state(struct pci_dev *pci) 785 726 { 786 787 788 789 790 791 792 793 794 795 727 int i; 728 /* FIXME: mutex needed for race? */ 729 for (i = 0; i < ARRAY_SIZE(saved_tbl); i++) { 730 if (saved_tbl[i].pci == pci) { 731 saved_tbl[i].pci = NULL; 732 pci_orig_restore_state(pci, saved_tbl[i].config); 733 return; 734 } 735 } 736 printk(KERN_DEBUG "snd: no saved pci config!\n"); 796 737 } 797 738 … … 809 750 int pci_request_region(struct pci_dev *pdev, int bar, char *res_name) 810 751 { 811 int flags; 812 813 if (pci_resource_len(pdev, bar) == 0) 814 return 0; 815 flags = pci_get_flags(pdev, bar); 816 if (flags & IORESOURCE_IO) { 817 if (check_region(pci_resource_start(pdev, bar), pci_resource_len(pdev, bar))) 818 goto err_out; 819 request_region(pci_resource_start(pdev, bar), 820 pci_resource_len(pdev, bar), res_name); 821 } 822 return 0; 752 int flags; 753 754 if (pci_resource_len(pdev, bar) == 0) 755 return 0; 756 flags = pci_get_flags(pdev, bar); 757 if (flags & IORESOURCE_IO) { 758 if (check_region(pci_resource_start(pdev, bar), pci_resource_len(pdev, bar))) 759 goto err_out; 760 request_region(pci_resource_start(pdev, bar), 761 pci_resource_len(pdev, bar), res_name); 762 } 763 else if (flags & IORESOURCE_MEM) { 764 if (check_mem_region(pci_resource_start(pdev, bar), pci_resource_len(pdev, bar))) 765 goto err_out; 766 request_mem_region(pci_resource_start(pdev, bar), 767 pci_resource_len(pdev, bar), res_name); 768 } 769 770 return 0; 823 771 824 772 err_out: 825 826 827 828 829 830 773 printk(KERN_WARNING "PCI: Unable to reserve %s region #%d:%lx@%lx for device %s\n", 774 flags & IORESOURCE_IO ? "I/O" : "mem", 775 bar + 1, /* PCI BAR # */ 776 pci_resource_len(pdev, bar), pci_resource_start(pdev, bar), 777 res_name); 778 return -EBUSY; 831 779 } 832 780 833 781 void pci_release_region(struct pci_dev *pdev, int bar) 834 782 { 835 int flags; 836 837 if (pci_resource_len(pdev, bar) == 0) 838 return; 839 flags = pci_get_flags(pdev, bar); 840 if (flags & IORESOURCE_IO) { 841 release_region(pci_resource_start(pdev, bar), 842 pci_resource_len(pdev, bar)); 843 } 783 int flags; 784 785 if (pci_resource_len(pdev, bar) == 0) 786 return; 787 flags = pci_get_flags(pdev, bar); 788 if (flags & IORESOURCE_IO) { 789 release_region(pci_resource_start(pdev, bar), 790 pci_resource_len(pdev, bar)); 791 } 792 else if (flags & IORESOURCE_MEM) { 793 release_mem_region(pci_resource_start(pdev, bar), 794 pci_resource_len(pdev, bar)); 795 } 844 796 } 845 797 846 798 int pci_request_regions(struct pci_dev *pdev, char *res_name) 847 799 { 848 849 850 851 852 853 854 err:855 856 857 800 int i; 801 802 for (i = 0; i < 6; i++) 803 if (pci_request_region(pdev, i, res_name)) 804 goto err; 805 return 0; 806 err: 807 while (--i >= 0) 808 pci_release_region(pdev, i); 809 return -EBUSY; 858 810 } 859 811 860 812 void pci_release_regions(struct pci_dev *pdev) 861 813 { 862 863 864 814 int i; 815 for (i = 0; i < 6; i++) 816 pci_release_region(pdev, i); 865 817 } 866 818 … … 886 838 int snd_pci_dev_present(const struct pci_device_id *ids) 887 839 { 888 889 890 891 892 893 840 while (ids->vendor || ids->subvendor) { 841 if (pci_find_device(ids->vendor, ids->subvendor, NULL)) 842 return 1; 843 ids++; 844 } 845 return 0; 894 846 } 895 847 … … 940 892 } 941 893 #endif 894 895 896 //****************************************************************************** 897 //****************************************************************************** 898 OSSRET OSS32_APMResume() 899 { 900 int i; 901 struct pci_driver *driver; 902 903 dprintf(("OSS32_APMResume")); 904 905 for(i=0;i<MAX_PCI_DEVICES;i++) 906 { 907 if(pci_devices[i].devfn) 908 { 909 driver = pci_devices[i].pcidriver; 910 if(driver && driver->resume) { 911 driver->resume(&pci_devices[i]); 912 // fSuspended = FALSE; 913 } 914 } 915 } 916 917 fSuspended = FALSE; 918 919 return OSSERR_SUCCESS; 920 } 921 //****************************************************************************** 922 //****************************************************************************** 923 OSSRET OSS32_APMSuspend() 924 { 925 int i; 926 struct pci_driver *driver; 927 928 dprintf(("OSS32_APMSuspend")); 929 930 fSuspended = TRUE; 931 932 for(i=0;i<MAX_PCI_DEVICES;i++) 933 { 934 if(pci_devices[i].devfn) 935 { 936 driver = pci_devices[i].pcidriver; 937 if(driver && driver->suspend) { 938 driver->suspend(&pci_devices[i], SNDRV_CTL_POWER_D3cold); 939 } 940 } 941 } 942 943 return OSSERR_SUCCESS; 944 } 945
Note:
See TracChangeset
for help on using the changeset viewer.