Changeset 679 for GPL/trunk/lib32
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (5 years ago)
- Location:
- GPL/trunk
- Files:
-
- 1 deleted
- 17 edited
- 20 copied
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/lib32/Makefile
r604 r679 6 6 !include $(ROOT)\tools\header.mif 7 7 8 # note: Watcom headers must be before DDK headers to avoid conflicts 9 # with C runtime headers 10 %INCLUDE = $(%INCLUDE)$(DDK)\base\h; 8 11 AINCLUDES = $(DDK)\base\H 9 12 … … 21 24 # 22 25 #=================================================================== 23 FILES = spinlock.obj malloc.obj pci.obj irq.obj ioctl.obj &26 FILES = spinlock.obj malloc.obj pci.obj irq.obj ioctl.obj devres.obj & 24 27 memory.obj debug.obj sound.obj soundmixer.obj soundmidi.obj & 25 ossidc.obj semaphore.obj waitqueue.obj misc.obj & 26 strncpy.obj task.obj & 27 strncmp.obj timer.obj & 28 instropl2.obj instropl3.obj vsprintf.obj 29 # ossidc.obj semaphore.obj waitqueue.obj misc.obj fminstrload.obj 30 !if $(KEE) == 0 31 FILES += stack.obj 32 !endif 28 ossidc.obj semaphore.obj waitqueue.obj misc.obj klist.obj kasprintf.obj & 29 seq_file.obj strncpy.obj strscpy.obj task.obj rbtree.obj & 30 strncmp.obj timer.obj kobject.obj driver.obj drivers_base.obj & 31 instropl2.obj instropl3.obj vsprintf.obj bitmap.obj find_next_bit.obj & 32 regmap.obj regcache.obj regcache-flat.obj regcache-rbtree.obj 33 33 34 34 TARGET = linuxlib -
GPL/trunk/lib32/fminstrload.c
r598 r679 215 215 ev.data.ext.ptr = put; 216 216 217 err = pHandle->file.f_op->write(&pHandle->file, (char *) __Stack32ToFlat(&ev), sizeof(ev), &pHandle->file.f_pos);217 err = pHandle->file.f_op->write(&pHandle->file, (char *)&ev, sizeof(ev), &pHandle->file.f_pos); 218 218 if(err < 0) { 219 219 dprintf(("Unable to write an instrument %.3i put event: %x",prg, err)); -
GPL/trunk/lib32/initcall.h
r607 r679 33 33 extern_module_init(alsa_sound_init) 34 34 extern_module_exit(alsa_sound_exit) 35 extern_module_init(alsa_seq_device_init) 36 extern_module_exit(alsa_seq_device_exit) 35 37 extern_module_init(alsa_pcm_init) 36 38 extern_module_exit(alsa_pcm_exit) … … 45 47 extern_module_init(alsa_seq_init) 46 48 extern_module_exit(alsa_seq_exit) 47 extern_module_init(alsa_opl3_init) 48 extern_module_exit(alsa_opl3_exit) 49 extern_module_init(alsa_opl3_seq_init) 50 extern_module_exit(alsa_opl3_seq_exit) 51 extern_module_init(alsa_mpu401_uart_init) 52 extern_module_exit(alsa_mpu401_uart_exit) 49 //extern_module_init(alsa_opl3_init) 50 //extern_module_exit(alsa_opl3_exit) 51 extern_module_init(opl3_seq_driver_init) 52 extern_module_exit(opl3_seq_driver_exit) 53 extern_module_init(regmap_initcall) 54 55 //extern_module_init(alsa_mpu401_uart_init) 56 //extern_module_exit(alsa_mpu401_uart_exit) 53 57 54 58 55 59 //pci cards 56 extern_module_init(alsa_card_ali_init) 57 extern_module_exit(alsa_card_ali_exit) 58 extern_module_init(alsa_card_als4000_init) 59 extern_module_exit(alsa_card_als4000_exit) 60 extern_module_init(alsa_card_cs4281_init) 61 extern_module_exit(alsa_card_cs4281_exit) 62 extern_module_init(alsa_card_cs46xx_init) 63 extern_module_exit(alsa_card_cs46xx_exit) 64 extern_module_init(alsa_card_cs5535audio_init) 65 extern_module_exit(alsa_card_cs5535audio_exit) 66 extern_module_init(alsa_card_cmipci_init) 67 extern_module_exit(alsa_card_cmipci_exit) 68 extern_module_init(alsa_card_emu10k1_init) 69 extern_module_exit(alsa_card_emu10k1_exit) 70 extern_module_init(alsa_card_ens1370_init) 71 extern_module_exit(alsa_card_ens1370_exit) 72 extern_module_init(alsa_card_ens1371_init) 73 extern_module_exit(alsa_card_ens1371_exit) 74 extern_module_init(alsa_card_es1938_init) 75 extern_module_exit(alsa_card_es1938_exit) 76 extern_module_init(alsa_card_es1968_init) 77 extern_module_exit(alsa_card_es1968_exit) 78 extern_module_init(alsa_card_fm801_init) 79 extern_module_exit(alsa_card_fm801_exit) 80 extern_module_init(alsa_card_ice1712_init) 81 extern_module_exit(alsa_card_ice1712_exit) 82 extern_module_init(alsa_card_intel8x0_init) 83 extern_module_exit(alsa_card_intel8x0_exit) 84 extern_module_init(alsa_card_m3_init) 85 extern_module_exit(alsa_card_m3_exit) 86 extern_module_init(alsa_card_nm256_init) 87 extern_module_exit(alsa_card_nm256_exit) 88 extern_module_init(alsa_card_rme96_init) 89 extern_module_exit(alsa_card_rme96_exit) 90 extern_module_init(alsa_card_hammerfall_init) 91 extern_module_exit(alsa_card_hammerfall_exit) 92 extern_module_init(alsa_card_sonicvibes_init) 93 extern_module_exit(alsa_card_sonicvibes_exit) 94 extern_module_init(alsa_card_trident_init) 95 extern_module_exit(alsa_card_trident_exit) 96 extern_module_init(alsa_card_via82xx_init) 97 extern_module_exit(alsa_card_via82xx_exit) 98 extern_module_init(alsa_card_ymfpci_init) 99 extern_module_exit(alsa_card_ymfpci_exit) 100 extern_module_init(alsa_card_vortex_init) 101 extern_module_exit(alsa_card_vortex_exit) 102 extern_module_init(alsa_card_atiixp_init) 103 extern_module_exit(alsa_card_atiixp_exit) 104 extern_module_init(alsa_card_ca0106_init) 105 extern_module_exit(alsa_card_ca0106_exit) 60 extern_module_init(ali5451_driver_init) 61 extern_module_exit(ali5451_driver_exit) 62 extern_module_init(als4000_driver_init) 63 extern_module_exit(als4000_driver_exit) 64 extern_module_init(cs4281_driver_init) 65 extern_module_exit(cs4281_driver_exit) 66 extern_module_init(cs46xx_driver_init) 67 extern_module_exit(cs46xx_driver_exit) 68 extern_module_init(cs5535audio_driver_init) 69 extern_module_exit(cs5535audio_driver_exit) 70 extern_module_init(cmipci_driver_init) 71 extern_module_exit(cmipci_driver_exit) 72 extern_module_init(emu10k1_driver_init) 73 extern_module_exit(emu10k1_driver_exit) 74 extern_module_init(ens137x_driver_init) 75 extern_module_exit(ens137x_driver_exit) 76 extern_module_init(es1938_driver_init) 77 extern_module_exit(es1938_driver_exit) 78 extern_module_init(es1968_driver_init) 79 extern_module_exit(es1968_driver_exit) 80 extern_module_init(fm801_driver_init) 81 extern_module_exit(fm801_driver_exit) 82 extern_module_init(ice1712_driver_init) 83 extern_module_exit(ice1712_driver_exit) 84 extern_module_init(intel8x0_driver_init) 85 extern_module_exit(intel8x0_driver_exit) 86 extern_module_init(m3_driver_init) 87 extern_module_exit(m3_driver_exit) 88 extern_module_init(nm256_driver_init) 89 extern_module_exit(nm256_driver_exit) 90 extern_module_init(rme96_driver_init) 91 extern_module_exit(rme96_driver_exit) 92 extern_module_init(hammerfall_driver_init) 93 extern_module_exit(hammerfall_driver_exit) 94 extern_module_init(sonicvibes_driver_init) 95 extern_module_exit(sonicvibes_driver_exit) 96 extern_module_init(trident_driver_init) 97 extern_module_exit(trident_driver_exit) 98 extern_module_init(via82xx_driver_init) 99 extern_module_exit(via82xx_driver_exit) 100 extern_module_init(ymfpci_driver_init) 101 extern_module_exit(ymfpci_driver_exit) 102 extern_module_init(vortex_driver_init) 103 extern_module_exit(vortex_driver_exit) 104 extern_module_init(atiixp_driver_init) 105 extern_module_exit(atiixp_driver_exit) 106 extern_module_init(ca0106_driver_init) 107 extern_module_exit(ca0106_driver_exit) 106 108 extern_module_init(alsa_card_bt87x_init) 107 109 extern_module_exit(alsa_card_bt87x_exit) 108 extern_module_init(alsa_card_azx_init) 109 extern_module_exit(alsa_card_azx_exit) 110 extern_module_init(patch_analog_init) 111 extern_module_exit(patch_analog_exit) 112 extern_module_init(patch_cmedia_init) 113 extern_module_exit(patch_cmedia_exit) 114 extern_module_init(patch_conexant_init) 115 extern_module_exit(patch_conexant_exit) 116 extern_module_init(patch_realtek_init) 117 extern_module_exit(patch_realtek_exit) 118 extern_module_init(patch_sigmatel_init) 119 extern_module_exit(patch_sigmatel_exit) 120 extern_module_init(patch_via_init) 121 extern_module_exit(patch_via_exit) 110 extern_module_init(ac97_bus_init) 111 112 113 114 //hda 115 extern_module_init(hda_bus_init) 116 extern_module_exit(hda_bus_exit) 117 extern_module_init(generic_driver_init) 118 extern_module_exit(generic_driver_exit) 119 extern_module_init(azx_driver_init) 120 extern_module_exit(azx_driver_exit) 121 extern_module_init(analog_driver_init) 122 extern_module_exit(analog_driver_exit) 123 extern_module_init(cmedia_driver_init) 124 extern_module_exit(cmedia_driver_exit) 125 extern_module_init(ca0110_driver_init) 126 extern_module_exit(ca0110_driver_exit) 127 extern_module_init(cirrus_driver_init) 128 extern_module_exit(cirrus_driver_exit) 129 extern_module_init(conexant_driver_init) 130 extern_module_exit(conexant_driver_exit) 131 extern_module_init(hdmi_driver_init) 132 extern_module_exit(hdmi_driver_exit) 133 extern_module_init(realtek_driver_init) 134 extern_module_exit(realtek_driver_exit) 135 extern_module_init(sigmatel_driver_init) 136 extern_module_exit(sigmatel_driver_exit) 137 extern_module_init(via_driver_init) 138 extern_module_exit(via_driver_exit) 122 139 123 140 -
GPL/trunk/lib32/ioctl.c
r598 r679 21 21 #include "soundoss.h" 22 22 23 #include <kee.h> 24 #include <u32ioctl.h> 25 23 26 POSS32_DEVCAPS pcmcaps[8] = {0,0,0,0,0,0,0,0}; 24 27 extern int pcm_device; … … 34 37 int card_id_changed = 0; 35 38 int unlock_all = 0; 36 int GetUniaudPcmCaps(ULONG deviceid, void *caps);37 void FillCaps(ULONG deviceid);38 39 int pcm_instances(int card_id); 39 40 … … 61 62 { 62 63 int ctl_id; 63 ULONG blkid = 0;64 64 int i = 0; 65 65 … … 77 77 return -ETIME; 78 78 79 MyDevBlock(blkid, 1, 0);79 KernBlock((ULONG)&WaitForControlChange, 1, 0, 0, 0); 80 80 if (unlock_all) 81 81 { … … 89 89 int WaitForPCMInterrupt(void *handle, int timeout) 90 90 { 91 ULONG blkid = 0;92 91 int i = 0; 93 92 int j = 0; … … 143 142 } 144 143 145 MyDevBlock(blkid, 1, 0);144 KernBlock((ULONG)&WaitForPCMInterrupt, 1, 0, 0, 0); 146 145 if (unlock_all) 147 146 { … … 180 179 } 181 180 181 /* 182 182 int GetPcmForChannels(ULONG deviceid, int type, int channels) 183 183 { … … 220 220 return sel_pcm; 221 221 } 222 */ 222 223 223 224 int GetMaxChannels(ULONG deviceid, int type) … … 262 263 returns pcm caps 263 264 */ 264 int GetUniaudPcmCaps1(ULONG deviceid, void *caps)265 static int GetUniaudPcmCaps1(ULONG deviceid, void *caps) 265 266 { 266 267 POSS32_DEVCAPS pcaps = (POSS32_DEVCAPS)caps; … … 302 303 if(ret != OSSERR_SUCCESS) 303 304 { 304 dprintf(("GetUniaudPcmCaps : wave open error %i %s at pcm %i", ret, (j == 0) ?"PLAY":"REC", i));305 dprintf(("GetUniaudPcmCaps1: wave open error %i %s at pcm %i", ret, (j == 0) ?"PLAY":"REC", i)); 305 306 continue; 306 307 //goto fail; … … 316 317 pHandle->file.f_flags = O_NONBLOCK; 317 318 318 dprintf(("GetUniaudPcmCaps: cp1. p handle %x", pHandle));319 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_INFO, (ULONG)pcminfo);319 dprintf(("GetUniaudPcmCaps: cp1. pcm %i, phandle %x", i, pHandle)); 320 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_INFO, (ULONG)pcminfo); 320 321 if(ret != 0) { 321 322 rprintf(("GetUniaudPcmCaps: SNDRV_PCM_IOCTL_INFO error %i", ret)); … … 334 335 pWaveCaps->nrStreams = pcminfo->subdevices_count; 335 336 336 dprintf(("GetUniaudPcmCaps: cp2. nr of streams: %i", pWaveCaps->nrStreams));337 dprintf(("GetUniaudPcmCaps: pcm %i, cp2. nr of streams: %i", i, pWaveCaps->nrStreams)); 337 338 //get all hardware parameters 338 339 _snd_pcm_hw_params_any(params); 339 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)params);340 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)params); 340 341 if(ret != 0) { 341 342 dprintf(("GetUniaudPcmCaps: SNDRV_PCM_IOCTL_HW_REFINE error %i", ret)); … … 362 363 pWaveCaps->ulChanFlags |= OSS32_CAPS_PCM_CHAN_5_1; 363 364 } 364 365 365 pWaveCaps->ulMinRate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min; 366 366 pWaveCaps->ulMaxRate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->max; … … 469 469 } 470 470 //retrieve mixer information 471 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,471 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 472 472 SNDRV_CTL_IOCTL_POWER_STATE, 473 473 (ULONG)state); … … 523 523 } 524 524 //retrieve mixer information 525 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,525 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 526 526 SNDRV_CTL_IOCTL_POWER, 527 527 (ULONG)state); … … 579 579 } 580 580 //retrieve mixer information 581 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,581 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 582 582 SNDRV_CTL_IOCTL_CARD_INFO, 583 583 (ULONG)(struct snd_ctl_card_info *)info); … … 636 636 } 637 637 //retrieve mixer information 638 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,638 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 639 639 SNDRV_CTL_IOCTL_CARD_INFO, 640 640 (ULONG)&pHandle->info); … … 646 646 pHandle->list.offset = 0; 647 647 pHandle->list.space = 0; 648 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,648 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 649 649 SNDRV_CTL_IOCTL_ELEM_LIST, 650 650 (ULONG)&pHandle->list); … … 704 704 } 705 705 //retrieve mixer information 706 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,706 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 707 707 SNDRV_CTL_IOCTL_CARD_INFO, 708 708 (ULONG)&pHandle->info); … … 714 714 pHandle->list.offset = 0; 715 715 pHandle->list.space = 0; 716 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,716 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 717 717 SNDRV_CTL_IOCTL_ELEM_LIST, 718 718 (ULONG)&pHandle->list); … … 733 733 pHandle->list.space = pHandle->list.count; 734 734 pHandle->list.pids = pHandle->pids; 735 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,735 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 736 736 SNDRV_CTL_IOCTL_ELEM_LIST, 737 737 (ULONG)&pHandle->list); … … 807 807 808 808 pElemInfo->id.numid = id; 809 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo);809 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo); 810 810 ret = pHandle->file.f_op->release(&pHandle->inode, &pHandle->file); 811 811 if(pHandle) kfree(pHandle); … … 865 865 pElem->id.numid = id; 866 866 pElem->indirect = 0; 867 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_READ, (ULONG)pElem);867 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_READ, (ULONG)pElem); 868 868 ret = pHandle->file.f_op->release(&pHandle->inode, &pHandle->file); 869 869 if(pHandle) kfree(pHandle); … … 925 925 pElem->indirect = 0; 926 926 927 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem);927 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem); 928 928 ret = pHandle->file.f_op->release(&pHandle->inode, &pHandle->file); 929 929 if(pHandle) kfree(pHandle); … … 953 953 954 954 pHandle->file.f_flags = O_NONBLOCK; 955 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)params);955 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)params); 956 956 return ret; 957 957 } … … 970 970 971 971 pHandle->file.f_flags = O_NONBLOCK; 972 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_HW_PARAMS, (ULONG)params);972 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_PARAMS, (ULONG)params); 973 973 return ret; 974 974 } … … 989 989 pHandle->file.f_flags = O_NONBLOCK; 990 990 991 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_SW_PARAMS, (ULONG)params);991 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_SW_PARAMS, (ULONG)params); 992 992 return ret; 993 993 } … … 1006 1006 pHandle->file.f_flags = O_NONBLOCK; 1007 1007 1008 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)status);1008 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)status); 1009 1009 return ret; 1010 1010 } … … 1055 1055 pHandle->file.f_flags = O_NONBLOCK; 1056 1056 1057 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1057 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1058 1058 return ret; 1059 1059 } … … 1070 1070 pHandle->file.f_flags = O_NONBLOCK; 1071 1071 1072 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, pause);1072 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, pause); 1073 1073 1074 1074 return ret; … … 1086 1086 pHandle->file.f_flags = O_NONBLOCK; 1087 1087 1088 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_START, 0);1088 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_START, 0); 1089 1089 1090 1090 return ret; … … 1102 1102 pHandle->file.f_flags = O_NONBLOCK; 1103 1103 1104 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_DROP, 0);1104 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_DROP, 0); 1105 1105 1106 1106 return ret; -
GPL/trunk/lib32/malloc.c
r587 r679 29 29 30 30 #include <devhelp.h> 31 #ifdef KEE32 31 #include <kee.h> 33 #endif34 32 #include "malloc.h" 35 33 -
GPL/trunk/lib32/memory.c
r587 r679 32 32 #include <stacktoflat.h> 33 33 #include <limits.h> 34 #ifdef KEE35 34 #include <kee.h> 36 #endif37 35 #include "malloc.h" 36 #define _I386_PAGE_H 37 typedef struct { unsigned long pgprot; } pgprot_t; 38 #define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) 39 #define PAGE_SHIFT 12 40 #define __PAGE_OFFSET (0xC0000000) 41 42 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 43 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 44 45 #include <linux/mm.h> 46 #include <linux/slab.h> 47 #include <linux/printk.h> 38 48 39 49 #pragma off (unreferenced) 40 50 41 51 #define PAGE_SIZE 4096 52 #define min(a,b) (((a) < (b)) ? (a) : (b)) 42 53 43 54 int free_pages(unsigned long addr, unsigned long order); … … 60 71 61 72 typedef struct _BaseAddr { 62 ULONG base; 63 ULONG retaddr; 64 ULONG size; 73 ULONG base; // VMAlloc addr 74 ULONG retaddr; // aligned addr returned to caller 75 ULONG size; // VMAlloc size 65 76 struct _BaseAddr NEAR *next; 66 77 } BaseAddr; … … 93 104 //****************************************************************************** 94 105 //****************************************************************************** 95 ULONG GetBaseAddress (ULONG addr, ULONG *pSize)106 ULONG GetBaseAddressAndFree(ULONG addr, ULONG *pSize) 96 107 { 97 108 BaseAddr NEAR *pCur, NEAR *pTemp; … … 102 113 pCur = pBaseAddrHead; 103 114 115 // If address is in list, remove list item and free entry 116 // Caller must VMFree returned address or else 104 117 if(pCur->retaddr == addr) 105 118 { … … 126 139 } 127 140 //****************************************************************************** 141 //****************************************************************************** 142 ULONG GetBaseAddressNoFree(ULONG addr, ULONG *pSize) 143 { 144 BaseAddr NEAR *pCur, NEAR *pTemp; 145 146 if(pBaseAddrHead == NULL) return addr; 147 148 DevCli(); 149 pCur = pBaseAddrHead; 150 151 if(pCur->retaddr == addr) 152 { 153 addr = pCur->base; 154 if(pSize) *pSize = pCur->size; 155 pBaseAddrHead = pCur->next; 156 // _kfree(pCur); 157 } 158 else 159 while(pCur->next) { 160 if(pCur->next->retaddr == addr) { 161 pTemp = pCur->next; 162 addr = pTemp->base; 163 if(pSize) *pSize = pTemp->size; 164 pCur->next = pTemp->next; 165 // _kfree(pTemp); 166 break; 167 } 168 pCur = pCur->next; 169 } 170 DevSti(); 171 return addr; 172 } 173 //****************************************************************************** 128 174 //NOTE: Assumes memory is continuous!! 129 175 //****************************************************************************** 130 176 unsigned long virt_to_phys(void * address) 131 177 { 132 #ifdef KEE133 178 KEEVMPageList pagelist; 134 179 ULONG nrpages; … … 139 184 } 140 185 return pagelist.addr; 141 #else142 LINEAR addr = (LINEAR)address;143 PAGELIST pagelist;144 145 if(DevLinToPageList(addr, PAGE_SIZE, (PAGELIST NEAR *)__Stack32ToFlat((ULONG)&pagelist))) {146 DebugInt3();147 return 0;148 }149 return pagelist.physaddr;150 #endif151 186 } 152 187 //****************************************************************************** … … 157 192 ULONG addr = 0; 158 193 159 #ifdef KEE160 194 SHORT sel; 161 195 rc = KernVMAlloc(PAGE_SIZE, VMDHA_PHYS, (PVOID*)&addr, (PVOID*)&address, &sel); 162 #else163 rc = DevVMAlloc(VMDHA_PHYS, PAGE_SIZE, (LINEAR)&address, __Stack32ToFlat((ULONG)&addr));164 #endif165 196 if (rc != 0) { 166 197 DebugInt3(); … … 184 215 __again: 185 216 186 #ifdef KEE187 188 217 rc = KernVMAlloc(size, flags, (PVOID*)&addr, (PVOID*)-1, &sel); 189 #else190 rc = DevVMAlloc(flags, size, (LINEAR)-1, __Stack32ToFlat((ULONG)&addr));191 #endif192 218 if (rc == 0) { 193 219 *pAddr = (LINEAR)addr; … … 209 235 { 210 236 APIRET rc; 211 212 #ifdef KEE 213 rc = KernVMFree((PVOID)addr); 214 #else 215 rc = DevVMFree((LINEAR)addr); 216 #endif 237 rc = KernVMFree((PVOID)addr); 217 238 if(rc) { 218 239 DebugInt3(); … … 224 245 ULONG ulget_free_pagesMemUsed = 0; 225 246 226 #define GFP_DMA 0x80227 #define GFP_DMAHIGHMEM 0x100228 247 //****************************************************************************** 229 248 //****************************************************************************** … … 243 262 244 263 if(startpage != endpage) { 245 // try once more264 // not in same 32K page, try once more 246 265 rc = VMAlloc(size, flags, (LINEAR *)&tempaddr); 247 266 VMFree((LINEAR)addr); … … 333 352 334 353 if (startpage != endpage) { 354 // Not in same 32K page 335 355 physaddr2 = (startpage+1) << 16; 336 356 … … 363 383 364 384 //check if it really is the base of the allocation (see above) 365 addr = GetBaseAddress (addr, (ULONG NEAR *)__Stack32ToFlat(&size));385 addr = GetBaseAddressAndFree(addr, (ULONG NEAR *)&size); 366 386 367 387 if(VMFree((LINEAR)addr)) { … … 402 422 //****************************************************************************** 403 423 //****************************************************************************** 424 void *__vmalloc(unsigned long size, gfp_t gfp_mask) 425 { 426 return vmalloc(size); 427 } 428 //****************************************************************************** 429 //****************************************************************************** 430 /** 431 * __vmalloc_node - allocate virtually contiguous memory 432 * @size: allocation size 433 * @align: desired alignment 434 * @gfp_mask: flags for the page level allocator 435 * @node: node to use for allocation or NUMA_NO_NODE 436 * @caller: caller's return address 437 * 438 * Allocate enough pages to cover @size from the page level allocator with 439 * @gfp_mask flags. Map them into contiguous kernel virtual space. 440 * 441 * Reclaim modifiers in @gfp_mask - __GFP_NORETRY, __GFP_RETRY_MAYFAIL 442 * and __GFP_NOFAIL are not supported 443 * 444 * Any use of gfp flags outside of GFP_KERNEL should be consulted 445 * with mm people. 446 * 447 * Return: pointer to the allocated memory or %NULL on error 448 */ 449 void *__vmalloc_node(unsigned long size, unsigned long align, 450 gfp_t gfp_mask, int node, const void *caller) 451 { 452 return vmalloc(size); 453 } 454 //****************************************************************************** 455 //****************************************************************************** 404 456 void vfree(void *ptr) 405 457 { … … 407 459 ULONG size = 0; 408 460 409 GetBaseAddress ((ULONG)ptr, (ULONG NEAR *)__Stack32ToFlat(&size));461 GetBaseAddressAndFree((ULONG)ptr, (ULONG NEAR *)&size); 410 462 411 463 if(VMFree((LINEAR)ptr)) { … … 427 479 //****************************************************************************** 428 480 //****************************************************************************** 429 int remap_page_range(unsigned long from, unsigned long to, unsigned long size, unsigned longprot)481 int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot) 430 482 { 431 483 DebugInt3(); … … 452 504 //size &= 0xFFFFF000; 453 505 454 #ifdef KEE455 506 SHORT sel; 456 457 //rc = KernVMAlloc(size, VMDHA_PHYS, (PVOID*)&addr, (PVOID*)&physaddr, &sel); 507 //rc = KernVMAlloc(size, VMDHA_PHYS, (PVOID*)&addr, (PVOID*)&physaddr, &sel); 458 508 rc = KernVMAlloc(Length, VMDHA_PHYS, (PVOID*)&addr, (PVOID*)&PhysicalAddress, &sel); 459 #else460 //rc = DevVMAlloc(VMDHA_PHYS, size, (LINEAR)&physaddr, __Stack32ToFlat((ULONG)&addr));461 rc = DevVMAlloc(VMDHA_PHYS, Length, (LINEAR)&PhysicalAddress, __Stack32ToFlat((ULONG)&addr));462 #endif463 509 if (rc != 0) { 464 510 dprintf(("ioremap error: %x", rc)); … … 497 543 if(n == 0) return; 498 544 499 kmemcpy(to, from, n);545 memcpy(to, from, n); 500 546 } 501 547 //****************************************************************************** … … 509 555 if(n == 0) return 0; 510 556 511 kmemcpy(to, from, n);557 memcpy(to, from, n); 512 558 return 0; 513 559 } … … 534 580 if(n == 0) return 0; 535 581 536 kmemcpy(to, from, n);582 memcpy(to, from, n); 537 583 return 0; 538 584 } … … 547 593 return 0; 548 594 } 549 kmemcpy(dest, src, size);595 memcpy(dest, src, size); 550 596 return 0; 551 597 } … … 638 684 return kzalloc(n * size, flags); 639 685 } 640 686 //****************************************************************************** 687 //****************************************************************************** 688 689 size_t ksize(const void *block) 690 { 691 size_t size; 692 693 if (!block) 694 size = 0; // Bad coder 695 696 else if (block == ZERO_SIZE_PTR) 697 size = 0; // Bad coder 698 699 else if(IsHeapAddr((ULONG)block)) 700 size = _msize((void _near *)block); 701 702 else if (!GetBaseAddressNoFree((ULONG)block, (ULONG NEAR *)&size)) 703 size = 0; // Something wrong 704 705 return size; 706 } 707 //****************************************************************************** 708 //****************************************************************************** 709 static inline void *__do_krealloc(const void *p, size_t new_size, 710 gfp_t flags) 711 { 712 void *ret; 713 size_t ks = 0; 714 715 if (p) 716 ks = ksize(p); 717 718 if (ks >= new_size) 719 return (void *)p; 720 721 ret = __kmalloc(new_size, flags); 722 if (ret && p) 723 memcpy(ret, p, ks); 724 725 return ret; 726 } 727 //****************************************************************************** 728 //****************************************************************************** 729 /** 730 * krealloc - reallocate memory. The contents will remain unchanged. 731 * @p: object to reallocate memory for. 732 * @new_size: how many bytes of memory are required. 733 * @flags: the type of memory to allocate. 734 * 735 * The contents of the object pointed to are preserved up to the 736 * lesser of the new and old sizes. If @p is %NULL, krealloc() 737 * behaves exactly like kmalloc(). If @new_size is 0 and @p is not a 738 * %NULL pointer, the object pointed to is freed. 739 */ 740 void *krealloc(const void *p, size_t new_size, gfp_t flags) 741 { 742 void *ret; 743 744 if (!new_size) { 745 kfree(p); 746 return ZERO_SIZE_PTR; 747 } 748 749 ret = __do_krealloc(p, new_size, flags); 750 if (ret && p != ret) 751 kfree(p); 752 753 return ret; 754 } 755 //****************************************************************************** 756 //****************************************************************************** 757 /** 758 * vzalloc - allocate virtually contiguous memory with zero fill 759 * @size: allocation size 760 * Allocate enough pages to cover @size from the page level 761 * allocator and map them into contiguous kernel virtual space. 762 * The memory allocated is set to zero. 763 * 764 * For tight control over page level allocator and protection flags 765 * use __vmalloc() instead. 766 */ 767 void *vzalloc(unsigned long size) 768 { 769 void *buf; 770 buf = vmalloc(size); 771 if (buf) 772 memset(buf, 0, size); 773 return buf; 774 } 775 //****************************************************************************** 776 //****************************************************************************** 777 /** 778 * kvmalloc_node - attempt to allocate physically contiguous memory, but upon 779 * failure, fall back to non-contiguous (vmalloc) allocation. 780 * @size: size of the request. 781 * @flags: gfp mask for the allocation - must be compatible (superset) with GFP_KERNEL. 782 * @node: numa node to allocate from 783 * 784 * Uses kmalloc to get the memory but if the allocation fails then falls back 785 * to the vmalloc allocator. Use kvfree for freeing the memory. 786 * 787 * Reclaim modifiers - __GFP_NORETRY and __GFP_NOFAIL are not supported. 788 * __GFP_RETRY_MAYFAIL is supported, and it should be used only if kmalloc is 789 * preferable to the vmalloc fallback, due to visible performance drawbacks. 790 * 791 * Please note that any use of gfp flags outside of GFP_KERNEL is careful to not 792 * fall back to vmalloc. 793 * 794 * Return: pointer to the allocated memory of %NULL in case of failure 795 */ 796 void *kvmalloc_node(size_t size, gfp_t flags, int node) 797 { 798 gfp_t kmalloc_flags = flags; 799 void *ret; 800 801 /* 802 * vmalloc uses GFP_KERNEL for some internal allocations (e.g page tables) 803 * so the given set of flags has to be compatible. 804 */ 805 if ((flags & GFP_KERNEL) != GFP_KERNEL) 806 return kmalloc_node(size, flags, node); 807 808 /* 809 * We want to attempt a large physically contiguous block first because 810 * it is less likely to fragment multiple larger blocks and therefore 811 * contribute to a long term fragmentation less than vmalloc fallback. 812 * However make sure that larger requests are not too disruptive - no 813 * OOM killer and no allocation failure warnings as we have a fallback. 814 */ 815 if (size > PAGE_SIZE) { 816 kmalloc_flags |= __GFP_NOWARN; 817 818 if (!(kmalloc_flags & __GFP_RETRY_MAYFAIL)) 819 kmalloc_flags |= __GFP_NORETRY; 820 } 821 822 ret = kmalloc_node(size, kmalloc_flags, node); 823 824 /* 825 * It doesn't really make sense to fallback to vmalloc for sub page 826 * requests 827 */ 828 if (ret || size <= PAGE_SIZE) 829 return ret; 830 831 return __vmalloc_node(size, 1, flags, node, 832 __builtin_return_address(0)); 833 } 834 //****************************************************************************** 835 //****************************************************************************** -
GPL/trunk/lib32/misc.c
r598 r679 29 29 #include <linux/fs.h> 30 30 #include <linux/poll.h> 31 #define CONFIG_PROC_FS 31 #define CONFIG_PROC_FS 1 32 32 #include <linux/proc_fs.h> 33 33 #include <asm/uaccess.h> … … 38 38 #include <linux/workqueue.h> 39 39 #include <linux/firmware.h> 40 #include <linux/ctype.h> 40 41 #include <dbgos2.h> 41 42 … … 84 85 return 0; 85 86 } 87 88 //****************************************************************************** 89 //Save error message in szLastALSAError; if card init failed, then we will 90 //print it in drv32\init.cpp 91 //****************************************************************************** 92 int dev_dbg(const struct device *dev, const char * fmt, ...) 93 { 94 va_list argptr; /* -> variable argument list */ 95 96 char *pszLastALSAError; 97 98 pszLastALSAError= iLastError ? szLastALSAError2 : szLastALSAError1; 99 100 va_start(argptr, fmt); /* get pointer to argument list */ 101 vsprintf(pszLastALSAError, fmt, argptr); 102 // strcat(pszLastALSAError, "\r"); 103 va_end(argptr); /* done with variable arguments */ 104 105 if(szOverrunTest1 != 0xCC || szOverrunTest2 != 0xCC) { 106 DebugInt3(); 107 } 108 109 StringOut(pszLastALSAError); 110 // rprintf( (pszLastALSAError) ); 111 if(++iLastError > 1) { 112 iLastError = 0; 113 } 114 return 0; 115 } 116 //****************************************************************************** 117 int pcm_dbg(struct snd_pcm *dev, const char * fmt, ...) 118 { 119 va_list argptr; /* -> variable argument list */ 120 121 char *pszLastALSAError; 122 123 pszLastALSAError= iLastError ? szLastALSAError2 : szLastALSAError1; 124 125 va_start(argptr, fmt); /* get pointer to argument list */ 126 vsprintf(pszLastALSAError, fmt, argptr); 127 // strcat(pszLastALSAError, "\r"); 128 va_end(argptr); /* done with variable arguments */ 129 130 if(szOverrunTest1 != 0xCC || szOverrunTest2 != 0xCC) { 131 DebugInt3(); 132 } 133 134 StringOut(pszLastALSAError); 135 // rprintf( (pszLastALSAError) ); 136 if(++iLastError > 1) { 137 iLastError = 0; 138 } 139 return 0; 140 } 141 //****************************************************************************** 142 int codec_dbg(struct hda_codec *dev, const char * fmt, ...) 143 { 144 va_list argptr; /* -> variable argument list */ 145 146 char *pszLastALSAError; 147 148 pszLastALSAError= iLastError ? szLastALSAError2 : szLastALSAError1; 149 150 va_start(argptr, fmt); /* get pointer to argument list */ 151 vsprintf(pszLastALSAError, fmt, argptr); 152 // strcat(pszLastALSAError, "\r"); 153 va_end(argptr); /* done with variable arguments */ 154 155 if(szOverrunTest1 != 0xCC || szOverrunTest2 != 0xCC) { 156 DebugInt3(); 157 } 158 159 StringOut(pszLastALSAError); 160 // rprintf( (pszLastALSAError) ); 161 if(++iLastError > 1) { 162 iLastError = 0; 163 } 164 return 0; 165 } 86 166 //****************************************************************************** 87 167 //****************************************************************************** … … 169 249 //****************************************************************************** 170 250 //****************************************************************************** 251 struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, 252 struct proc_dir_entry *parent){ 253 struct proc_dir_entry *proc; 254 proc = (struct proc_dir_entry *)kmalloc(sizeof(struct proc_dir_entry), 0); 255 memset(proc, 0, sizeof(struct proc_dir_entry)); 256 257 proc->name = name; 258 proc->parent = parent; 259 260 return proc; 261 } 262 //****************************************************************************** 263 //****************************************************************************** 264 struct proc_dir_entry *proc_mkdir(const char *name, struct proc_dir_entry *parent) 265 { 266 return proc_mkdir_mode(name, S_IRUGO | S_IXUGO, parent); 267 } 268 //****************************************************************************** 269 //****************************************************************************** 270 struct proc_dir_entry *proc_symlink(const char *name, struct proc_dir_entry *parent, const char *dest) 271 { 272 struct proc_dir_entry *proc; 273 proc = (struct proc_dir_entry *)kmalloc(sizeof(struct proc_dir_entry), 0); 274 memset(proc, 0, sizeof(struct proc_dir_entry)); 275 276 proc->name = name; 277 proc->parent = parent; 278 proc->data = (void*)dest; 279 280 return proc; 281 } 282 //****************************************************************************** 283 //****************************************************************************** 171 284 int fasync_helper(int a, struct file *b, int c, struct fasync_struct **d) 172 285 { … … 175 288 //****************************************************************************** 176 289 //****************************************************************************** 177 void kill_fasync(struct fasync_struct * a, int b, int c)290 void kill_fasync(struct fasync_struct **a, int b, int c) 178 291 { 179 292 } … … 273 386 run_workqueue(wq); 274 387 } else { 275 wait_queue_twait;388 struct wait_queue_entry wait; 276 389 277 390 init_waitqueue_entry(&wait, current); … … 399 512 //****************************************************************************** 400 513 //****************************************************************************** 401 void *memdup_user( void __user *src, size_t len)514 void *memdup_user(const void __user *src, size_t len) 402 515 { 403 516 void *p = kmalloc(len, GFP_KERNEL); … … 425 538 //****************************************************************************** 426 539 //****************************************************************************** 427 int schedule_work(struct work_struct *works) 428 { 429 #ifndef TARGET_OS2 430 return kernel_thread(work_caller, works, 0) >= 0; 431 # else432 return 1;540 struct workqueue_struct *system_wq; 541 542 int schedule_work(struct work_struct *work) 543 { 544 #ifndef TARGET_OS2 // crashes 545 return queue_work(system_wq, work); 433 546 #endif 434 } 547 return 0; 548 } 549 435 550 //****************************************************************************** 436 551 //****************************************************************************** … … 517 632 return -EINVAL; 518 633 } 634 //****************************************************************************** 635 //****************************************************************************** 636 637 static void u32_swap(void *a, void *b, int size) 638 { 639 u32 t = *(u32 *)a; 640 *(u32 *)a = *(u32 *)b; 641 *(u32 *)b = t; 642 } 643 644 static void generic_swap(void *a, void *b, int size) 645 { 646 char t; 647 648 do { 649 t = *(char *)a; 650 *(char *)a++ = *(char *)b; 651 *(char *)b++ = t; 652 } while (--size > 0); 653 } 654 655 /** 656 * sort - sort an array of elements 657 * @base: pointer to data to sort 658 * @num: number of elements 659 * @size: size of each element 660 * @cmp_func: pointer to comparison function 661 * @swap_func: pointer to swap function or NULL 662 * 663 * This function does a heapsort on the given array. You may provide a 664 * swap_func function optimized to your element type. 665 * 666 * Sorting time is O(n log n) both on average and worst-case. While 667 * qsort is about 20% faster on average, it suffers from exploitable 668 * O(n*n) worst-case behavior and extra memory requirements that make 669 * it less suitable for kernel use. 670 */ 671 672 void sort(void *base, size_t num, size_t size, 673 int (*cmp_func)(const void *, const void *), 674 void (*swap_func)(void *, void *, int size)) 675 { 676 /* pre-scale counters for performance */ 677 int i = (num/2 - 1) * size, n = num * size, c, r; 678 679 if (!swap_func) 680 swap_func = (size == 4 ? u32_swap : generic_swap); 681 682 /* heapify */ 683 for ( ; i >= 0; i -= size) { 684 for (r = i; r * 2 + size < n; r = c) { 685 c = r * 2 + size; 686 if (c < n - size && 687 cmp_func(base + c, base + c + size) < 0) 688 c += size; 689 if (cmp_func(base + r, base + c) >= 0) 690 break; 691 swap_func(base + r, base + c, size); 692 } 693 } 694 695 /* sort */ 696 for (i = n - size; i > 0; i -= size) { 697 swap_func(base, base + i, size); 698 for (r = 0; r * 2 + size < i; r = c) { 699 c = r * 2 + size; 700 if (c < i - size && 701 cmp_func(base + c, base + c + size) < 0) 702 c += size; 703 if (cmp_func(base + r, base + c) >= 0) 704 break; 705 swap_func(base + r, base + c, size); 706 } 707 } 708 } 709 //****************************************************************************** 710 //****************************************************************************** 711 712 /** 713 * hex_to_bin - convert a hex digit to its real value 714 * @ch: ascii character represents hex digit 715 * 716 * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad 717 * input. 718 */ 719 int hex_to_bin(char ch) 720 { 721 if ((ch >= '0') && (ch <= '9')) 722 return ch - '0'; 723 ch = tolower(ch); 724 if ((ch >= 'a') && (ch <= 'f')) 725 return ch - 'a' + 10; 726 return -1; 727 } 728 //****************************************************************************** 729 730 731 /* 732 * stream_open is used by subsystems that want stream-like file descriptors. 733 * Such file descriptors are not seekable and don't have notion of position 734 * (file.f_pos is always 0). Contrary to file descriptors of other regular 735 * files, .read() and .write() can run simultaneously. 736 * 737 * stream_open never fails and is marked to return int so that it could be 738 * directly used as file_operations.open . 739 */ 740 int stream_open(struct inode *inode, struct file *filp) 741 { 742 filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE | FMODE_ATOMIC_POS); 743 //DAZ f_mode is 16 bit so FMODE_STREAM doesn't fit, but we don't use this on OS/2. 744 //filp->f_mode |= FMODE_STREAM; 745 return 0; 746 } 747 748 /** 749 * alloc_pages_exact - allocate pages with the given size 750 * @size: the size to allocate in bytes 751 * @gfp_flags: the allocation conditions, GFP_XXX 752 * 753 * Allocates the physically contiguous pages with the given size. 754 * 755 * Return: The pointer of the buffer, or %NULL if no enough memory. 756 */ 757 void *alloc_pages_exact(size_t size, gfp_t gfp_flags) 758 { 759 int pg; 760 761 if (WARN_ON(!size)) 762 return NULL; 763 if (WARN_ON(!gfp_flags)) 764 return NULL; 765 gfp_flags |= __GFP_COMP; /* compound page lets parts be mapped */ 766 pg = get_order(size); 767 return (void *) __get_free_pages(gfp_flags, pg); 768 } 769 770 /** 771 * free_pages_exact - release the pages 772 * @ptr: the buffer pointer to release 773 * @size: the allocated buffer size 774 * 775 * Releases the buffer allocated via snd_malloc_pages(). 776 */ 777 void free_pages_exact(void *ptr, size_t size) 778 { 779 int pg; 780 781 if (ptr == NULL) 782 return; 783 pg = get_order(size); 784 free_pages((unsigned long) ptr, pg); 785 } -
GPL/trunk/lib32/ossidc.c
r607 r679 32 32 #include <unicard.h> 33 33 #include <version.h> 34 #ifdef KEE35 #include <kee.h>36 #endif37 34 #include "initcall.h" 35 #include <u32ioctl.h> 38 36 39 37 extern DWORD TimerHandler16; //drv32\strategy.asm … … 66 64 67 65 cardcalls_t cardcalls[CARDS_NUM] = { 68 { CARD_ICH, &name_module_init(alsa_card_intel8x0_init), &name_module_exit(alsa_card_intel8x0_exit) },69 { CARD_VIA82XX, &name_module_init( alsa_card_via82xx_init), &name_module_exit(alsa_card_via82xx_exit) },70 { CARD_SBLIVE, &name_module_init( alsa_card_emu10k1_init), &name_module_exit(alsa_card_emu10k1_exit) },71 { CARD_CMEDIA, &name_module_init( alsa_card_cmipci_init), &name_module_exit(alsa_card_cmipci_exit) },72 { CARD_ALS4000, &name_module_init(als a_card_als4000_init), &name_module_exit(alsa_card_als4000_exit) },73 { CARD_CS4281, &name_module_init( alsa_card_cs4281_init), &name_module_exit(alsa_card_cs4281_exit) },74 { CARD_CS46XX, &name_module_init( alsa_card_cs46xx_init), &name_module_exit(alsa_card_cs46xx_exit) },75 { CARD_CS5535, &name_module_init( alsa_card_cs5535audio_init), &name_module_exit(alsa_card_cs5535audio_exit) },76 { CARD_ESS1938, &name_module_init( alsa_card_es1938_init), &name_module_exit(alsa_card_es1938_exit) },77 { CARD_ENSONIQ0, &name_module_init( alsa_card_ens1370_init), &name_module_exit(alsa_card_ens1370_exit) },78 { CARD_ENSONIQ1, &name_module_init(alsa_card_ens1371_init), &name_module_exit(alsa_card_ens1371_exit)},79 { CARD_YAMAHA, &name_module_init( alsa_card_ymfpci_init), &name_module_exit(alsa_card_ymfpci_exit) },80 { CARD_MAESTRO, &name_module_init( alsa_card_es1968_init), &name_module_exit(alsa_card_es1968_exit) },81 { CARD_MAESTRO3, &name_module_init( alsa_card_m3_init), &name_module_exit(alsa_card_m3_exit)},82 { CARD_ALI5451, &name_module_init(al sa_card_ali_init), &name_module_exit(alsa_card_ali_exit)},83 { CARD_TRIDENT, &name_module_init( alsa_card_trident_init), &name_module_exit(alsa_card_trident_exit) },66 { CARD_ICH, &name_module_init(intel8x0_driver_init), &name_module_exit(intel8x0_driver_exit) }, 67 { CARD_VIA82XX, &name_module_init(via82xx_driver_init), &name_module_exit(via82xx_driver_exit) }, 68 { CARD_SBLIVE, &name_module_init(emu10k1_driver_init), &name_module_exit(emu10k1_driver_exit) }, 69 { CARD_CMEDIA, &name_module_init(cmipci_driver_init), &name_module_exit(cmipci_driver_exit) }, 70 { CARD_ALS4000, &name_module_init(als4000_driver_init), &name_module_exit(als4000_driver_exit) }, 71 { CARD_CS4281, &name_module_init(cs4281_driver_init), &name_module_exit(cs4281_driver_exit) }, 72 { CARD_CS46XX, &name_module_init(cs46xx_driver_init), &name_module_exit(cs46xx_driver_exit) }, 73 { CARD_CS5535, &name_module_init(cs5535audio_driver_init), &name_module_exit(cs5535audio_driver_exit) }, 74 { CARD_ESS1938, &name_module_init(es1938_driver_init), &name_module_exit(es1938_driver_exit) }, 75 { CARD_ENSONIQ0, &name_module_init(ens137x_driver_init), &name_module_exit(ens137x_driver_exit) }, 76 { CARD_ENSONIQ1, NULL, NULL }, 77 { CARD_YAMAHA, &name_module_init(ymfpci_driver_init), &name_module_exit(ymfpci_driver_exit) }, 78 { CARD_MAESTRO, &name_module_init(es1968_driver_init), &name_module_exit(es1968_driver_exit) }, 79 { CARD_MAESTRO3, &name_module_init(m3_driver_init), &name_module_exit(m3_driver_exit) }, 80 { CARD_ALI5451, &name_module_init(ali5451_driver_init), &name_module_exit(ali5451_driver_exit) }, 81 { CARD_TRIDENT, &name_module_init(trident_driver_init), &name_module_exit(trident_driver_exit) }, 84 82 #ifdef VORTEX 85 { CARD_VORTEX, &name_module_init( alsa_card_vortex_init), &name_module_exit(alsa_card_vortex_exit) },83 { CARD_VORTEX, &name_module_init(vortex_driver_init), &name_module_exit(vortex_driver_exit) }, 86 84 #else 87 { CARD_VORTEX, NULL, NULL},85 { CARD_VORTEX, NULL, NULL }, 88 86 #endif 89 { CARD_NEOMAGIC, &name_module_init( alsa_card_nm256_init), &name_module_exit(alsa_card_nm256_exit)},90 { CARD_FM801, &name_module_init( alsa_card_fm801_init), &name_module_exit(alsa_card_fm801_exit)},91 { CARD_ATIIXP, &name_module_init(a lsa_card_atiixp_init), &name_module_exit(alsa_card_atiixp_exit) },92 { CARD_AUDIGYLS, &name_module_init( alsa_card_ca0106_init), &name_module_exit(alsa_card_ca0106_exit) },93 { CARD_AZX, &name_module_init(alsa_card_azx_init), &name_module_exit(alsa_card_azx_exit)},94 { CARD_BT87X, &name_module_init(alsa_card_bt87x_init), &name_module_exit(alsa_card_bt87x_exit)},87 { CARD_NEOMAGIC, &name_module_init(nm256_driver_init), &name_module_exit(nm256_driver_exit) }, 88 { CARD_FM801, &name_module_init(fm801_driver_init), &name_module_exit(fm801_driver_exit) }, 89 { CARD_ATIIXP, &name_module_init(atiixp_driver_init), &name_module_exit(atiixp_driver_exit) }, 90 { CARD_AUDIGYLS, &name_module_init(ca0106_driver_init), &name_module_exit(ca0106_driver_exit) }, 91 { CARD_AZX, &name_module_init(azx_driver_init), &name_module_exit(azx_driver_exit) }, 92 { CARD_BT87X, &name_module_init(alsa_card_bt87x_init), &name_module_exit(alsa_card_bt87x_exit) }, 95 93 }; 96 94 … … 98 96 int fStrategyInit = FALSE; 99 97 void pcm_info(void); 100 void FillCaps(ULONG deviceid);101 98 102 99 //****************************************************************************** … … 115 112 dprintf(("OSS32_Initialize: Start address: %X", OffsetBeginCS32)); 116 113 117 if(call_module_init(alsa_sound_init) != 0) return OSSERR_INIT_FAILED; 114 if(call_module_init(alsa_sound_init) != 0) return OSSERR_INIT_FAILED; 115 if(call_module_init(alsa_seq_device_init) != 0) return OSSERR_INIT_FAILED; 118 116 dprintf(("OSS32_Initialize1: Start address: %X", OffsetBeginCS32)); 119 if(call_module_init(alsa_pcm_init) != 0) return OSSERR_INIT_FAILED; 120 if(call_module_init(alsa_hwdep_init) != 0) return OSSERR_INIT_FAILED; 121 if(call_module_init(alsa_timer_init) != 0) return OSSERR_INIT_FAILED; 122 123 if(call_module_init(alsa_rawmidi_init) != 0) return OSSERR_INIT_FAILED; 124 if(call_module_init(alsa_seq_init) != 0) return OSSERR_INIT_FAILED; 125 if(call_module_init(alsa_opl3_init) != 0) return OSSERR_INIT_FAILED; 126 if(call_module_init(alsa_opl3_seq_init) != 0) return OSSERR_INIT_FAILED; 127 128 if(call_module_init(alsa_mpu401_uart_init) != 0) return OSSERR_INIT_FAILED; 117 if(call_module_init(alsa_pcm_init) != 0) return OSSERR_INIT_FAILED; 118 if(call_module_init(alsa_hwdep_init) != 0) return OSSERR_INIT_FAILED; 119 if(call_module_init(alsa_timer_init) != 0) return OSSERR_INIT_FAILED; 120 121 if(call_module_init(alsa_rawmidi_init) != 0) return OSSERR_INIT_FAILED; 122 if(call_module_init(alsa_seq_init) != 0) return OSSERR_INIT_FAILED; 123 call_module_init(opl3_seq_driver_init); 124 call_module_init(regmap_initcall); 129 125 130 126 /* Init functions for HDA audio */ 131 call_module_init(patch_analog_init); 132 //call_module_init(patch_atihdmi_init); 133 call_module_init(patch_cmedia_init); 134 call_module_init(patch_conexant_init); 135 call_module_init(patch_realtek_init); 136 call_module_init(patch_sigmatel_init); 137 call_module_init(patch_via_init); 127 call_module_init(hda_bus_init); 128 call_module_init(generic_driver_init); 129 call_module_init(analog_driver_init); 130 call_module_init(ca0110_driver_init); 131 call_module_init(cirrus_driver_init); 132 call_module_init(cmedia_driver_init); 133 call_module_init(conexant_driver_init); 134 // call_module_init(hdmi_driver_init); 135 call_module_init(realtek_driver_init); 136 call_module_init(sigmatel_driver_init); 137 call_module_init(via_driver_init); 138 138 139 139 //dprintf(("OSS32_Initialize: ForceCard=%d", ForceCard)); … … 178 178 } 179 179 180 call_module_exit(alsa_mpu401_uart_exit); 181 call_module_exit(alsa_opl3_seq_exit); 182 call_module_exit(alsa_opl3_exit); 180 call_module_exit(opl3_seq_driver_exit); 183 181 call_module_exit(alsa_seq_exit); 184 182 call_module_exit(alsa_rawmidi_exit); … … 186 184 call_module_exit(alsa_hwdep_exit); 187 185 call_module_exit(alsa_pcm_exit); 186 call_module_exit(alsa_seq_device_exit); 188 187 call_module_exit(alsa_sound_exit); 189 188 … … 208 207 209 208 //****************************************************************************** 210 int MyDevBlock(ULONG id, ULONG tout, char flag)211 {212 return DevBlock(id,tout, flag);213 }214 209 215 210 int OSS32_DebugString(char *buffer, ULONG size) -
GPL/trunk/lib32/pci.c
r604 r679 25 25 * 26 26 */ 27 27 #define CONFIG_PM 28 28 #include "linux.h" 29 29 #include <linux/init.h> 30 30 #include <linux/poll.h> 31 #include <linux/dma-mapping.h> 31 32 #include <asm/uaccess.h> 32 33 #include <asm/hardirq.h> … … 183 184 memset((void near *)pcidev, 0, sizeof(struct pci_dev)); 184 185 185 pcidev-> _class = ulTmp2;186 pcidev->class = ulTmp2; 186 187 pcidev->vendor = detectedId & 0xffff; 187 188 pcidev->device = detectedId >> 16; … … 201 202 pcidev->sibling = NULL; 202 203 pcidev->next = NULL; 203 pcidev->dma_mask = 0xFFFFFFFF; 204 pcidev->dma_mask = 0xffffffff; 205 pcidev->dev.dma_mask = &pcidev->dma_mask; 206 pcidev->dev.coherent_dma_mask = 0xffffffffull; 204 207 205 208 // Subsystem ID 206 209 pci_read_config_word(pcidev, PCI_SUBSYSTEM_VENDOR_ID, &pcidev->subsystem_vendor); 207 210 pci_read_config_word(pcidev, PCI_SUBSYSTEM_ID, &pcidev->subsystem_device); 211 212 // revision 213 pci_read_config_byte(pcidev, PCI_REVISION_ID, &pcidev->revision); 208 214 209 215 // I/O and MEM … … 296 302 if(a->flags & IORESOURCE_MEM) { 297 303 if(RMRequestMem(/*hResMgr,*/ start, n) == FALSE) { 298 printk("RMRequestIO failed for io %x,length %x\n", start, n);304 printk("RMRequestIO failed for mem %x length %x\n", start, n); 299 305 return NULL; 300 306 } … … 302 308 else if(a->flags & IORESOURCE_IO) { 303 309 if(RMRequestIO(/*hResMgr,*/ start, n) == FALSE) { 304 printk("RMRequestIO failed for io %x ,length %x\n", start, n);310 printk("RMRequestIO failed for io %x length %x\n", start, n); 305 311 return NULL; 306 312 } … … 477 483 struct pci_dev *pcidev; 478 484 struct pci_device_id IdTable; 485 USHORT usVendor, usDevice; 479 486 int iAdapter = 0; 480 487 … … 499 506 int iTableIx; 500 507 501 rprintf(("pci_register_driver: query_device found %x %x:%x class=%x checking %s", 502 ulLast, pcidev->vendor, pcidev->device, pcidev->_class, driver->name)); 508 rprintf((__func__": query_device found %x %04x:%04x class=%x checking %s", 509 ulLast, pcidev->vendor, pcidev->device, pcidev->class, driver->name)); 510 511 usVendor = 0; 512 usDevice = 0; 503 513 504 514 for( iTableIx = 0; driver->id_table[iTableIx].vendor; iTableIx++) … … 506 516 struct pci_device_id const *pDriverId = &driver->id_table[iTableIx]; 507 517 508 if ( (pDriverId->class) && ((pcidev-> _class & pDriverId->class_mask) != pDriverId->class) ) continue;518 if ( (pDriverId->class) && ((pcidev->class & pDriverId->class_mask) != pDriverId->class) ) continue; 509 519 if (pDriverId->vendor != pcidev->vendor) continue; 510 520 if ( (pDriverId->device != PCI_ANY_ID) && (pDriverId->device != pcidev->device) ) continue; 511 521 512 rprintf(("pci_register_driver: matched %d %x:%x/%x with %x:%x/%x %x (%s)", iTableIx, 513 pcidev->vendor, pcidev->device, pcidev->_class, 522 /* skip a duplicate device that could be matched by both and exact match and a class match */ 523 if (usVendor == pcidev->vendor && usDevice == pcidev->device) continue; 524 usVendor = pcidev->vendor; 525 usDevice = pcidev->device; 526 527 rprintf((__func__": matched %d %x:%x/%x with %x:%x/%x %x (%s)", iTableIx, 528 pcidev->vendor, pcidev->device, pcidev->class, 514 529 pDriverId->vendor, pDriverId->device, pDriverId->class, pDriverId->class_mask, driver->name)); 515 530 516 531 if ((iAdapterNumber >= 0) && (iAdapter < iAdapterNumber)) 517 532 { 533 rprintf((__func__": AdapterNumber=%x skipping Adapter=%x", iAdapterNumber, iAdapter)); 518 534 iAdapter++; 519 535 continue; 520 536 } 521 537 522 RMInit();523 538 if (driver->probe(pcidev, pDriverId) == 0) 524 539 { … … 527 542 528 543 // create adapter 529 RMDone((pcidev->device << 16) | pcidev->vendor, &pcidev->hAdapter, &pcidev->hDevice); 544 RMCreateAdapterU32((pcidev->device << 16) | pcidev->vendor, &pcidev->hAdapter, ulLast, iNumCards); 545 530 546 iNumCards++; 531 547 pcidev = NULL; /* we need a new slot */ 532 548 break; 533 549 } 534 RMDone(0, 0, 0); 550 // release resources which were possibly allocated during probe() 551 RMDeallocRes(); 535 552 } /* for id_table loop */ 536 553 … … 647 664 //try not to exhaust low memory (< 16mb) so allocate from the high region first 648 665 //if that doesn't satisfy the dma mask requirement, then get it from the low 649 //regi noanyway666 //region anyway 650 667 if(hwdev->dma_mask > 0x00ffffff) { 651 668 order = __compat_get_order(size); … … 666 683 ret = (void *)__get_free_pages(gfp, __compat_get_order(size)); 667 684 } 668 669 685 if (ret != NULL) { 670 686 memset(ret, 0, size); … … 672 688 } 673 689 return ret; 690 } 691 692 #if 0 693 void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, 694 dma_addr_t *dma_handle) 695 { 696 return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); 697 } 698 #endif 699 #if 0 700 void *dma_alloc_coherent(struct device *dev, size_t size, 701 dma_addr_t *dma_handle, gfp_t gfp) 702 { 703 void *ret = NULL; 704 int order; 705 706 dprintf(("dma_alloc_coherent %d mask %x", size, (dev) ? dev->dma_mask : 0)); 707 if (dev == NULL || *dev->dma_mask != 0xffffffff) { 708 dprintf(("dma_alloc_coherent")); 709 //try not to exhaust low memory (< 16mb) so allocate from the high region first 710 //if that doesn't satisfy the dma mask requirement, then get it from the low 711 //region anyway 712 if(*dev->dma_mask > 0x00ffffff) { 713 dprintf(("dma_alloc_coherent2")); 714 order = __compat_get_order(size); 715 ret = (void *)__get_free_pages(gfp|GFP_DMAHIGHMEM, order); 716 *dma_handle = virt_to_bus(ret); 717 if(*dma_handle > *dev->dma_mask) { 718 dprintf(("dma_alloc_coherent3")); 719 free_pages((unsigned long)ret, __compat_get_order(size)); 720 //be sure and allocate below 16 mb 721 gfp |= GFP_DMA; 722 ret = NULL; 723 } 724 dprintf(("dma_alloc_coherent3a")); 725 } 726 else { //must always allocate below 16 mb 727 dprintf(("dma_alloc_coherent4")); 728 gfp |= GFP_DMA; 729 } 730 } 731 if(ret == NULL) { 732 dprintf(("dma_alloc_coherent5")); 733 ret = (void *)__get_free_pages(gfp, __compat_get_order(size)); 734 } 735 736 if (ret != NULL) { 737 memset(ret, 0, size); 738 *dma_handle = virt_to_bus(ret); 739 } 740 return ret; 741 742 } 743 #endif 744 745 int dma_supported(struct device *dev, u64 mask) 746 { 747 return 1; 748 } 749 750 int dma_set_coherent_mask(struct device *dev, u64 mask) 751 { 752 /* 753 * Truncate the mask to the actually supported dma_addr_t width to 754 * avoid generating unsupportable addresses. 755 */ 756 mask = (dma_addr_t)mask; 757 758 if (!dma_supported(dev, mask)) 759 return -EIO; 760 761 dev->coherent_dma_mask = mask; 762 return 0; 763 } 764 765 int dma_set_mask(struct device *dev, u64 mask) 766 { 767 /* 768 * Truncate the mask to the actually supported dma_addr_t width to 769 * avoid generating unsupportable addresses. 770 */ 771 mask = (dma_addr_t)mask; 772 773 if (!dev->dma_mask || !dma_supported(dev, mask)) 774 return -EIO; 775 776 *dev->dma_mask = mask; 777 return 0; 674 778 } 675 779 … … 888 992 } 889 993 890 const struct pci_device_id * pci_match_ device(const struct pci_device_id *ids, struct pci_dev *dev)994 const struct pci_device_id * pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev) 891 995 { 892 996 u16 subsystem_vendor, subsystem_device; … … 900 1004 (ids->subvendor == PCI_ANY_ID || ids->subvendor == subsystem_vendor) && 901 1005 (ids->subdevice == PCI_ANY_ID || ids->subdevice == subsystem_device) && 902 !((ids->class ^ dev-> _class) & ids->class_mask))1006 !((ids->class ^ dev->class) & ids->class_mask)) 903 1007 return ids; 904 1008 ids++; … … 981 1085 if(pci_devices[i].devfn) 982 1086 { 983 RMSetHandles(pci_devices[i].hAdapter , pci_devices[i].hDevice); /* DAZ - dirty hack */1087 RMSetHandles(pci_devices[i].hAdapter); /* DAZ - dirty hack */ 984 1088 driver = pci_devices[i].pcidriver; 985 1089 if(driver && driver->resume) { … … 1004 1108 if(pci_devices[i].devfn) 1005 1109 { 1006 RMSetHandles(pci_devices[i].hAdapter , pci_devices[i].hDevice); /* DAZ - dirty hack */1110 RMSetHandles(pci_devices[i].hAdapter); /* DAZ - dirty hack */ 1007 1111 driver = pci_devices[i].pcidriver; 1008 1112 if(driver && driver->suspend) { … … 1040 1144 #endif 1041 1145 1146 /** 1147 * pci_status_get_and_clear_errors - return and clear error bits in PCI_STATUS 1148 * @pdev: the PCI device 1149 * 1150 * Returns error bits set in PCI_STATUS and clears them. 1151 */ 1152 int pci_status_get_and_clear_errors(struct pci_dev *pdev) 1153 { 1154 u16 status; 1155 int ret; 1156 1157 ret = pci_read_config_word(pdev, PCI_STATUS, &status); 1158 if (ret != PCIBIOS_SUCCESSFUL) 1159 return -EIO; 1160 1161 status &= PCI_STATUS_ERROR_BITS; 1162 if (status) 1163 pci_write_config_word(pdev, PCI_STATUS, status); 1164 1165 return status; 1166 } 1167 -
GPL/trunk/lib32/sound.c
r605 r679 37 37 #include <stdlib.h> 38 38 #include <proto.h> 39 //#include <dbgos2.h>39 #include <u32ioctl.h> 40 40 #include "soundoss.h" 41 41 … … 44 44 #define samples_to_bytes(a) ((a*pHandle->doublesamplesize)/2) 45 45 #define bytes_to_samples(a) (pHandle->doublesamplesize ? ((a*2)/pHandle->doublesamplesize) : a) 46 int GetMaxChannels(ULONG deviceid, int type);47 46 48 47 struct file_operations oss_devices[OSS32_MAX_DEVICES] = {0}; 49 struct file_operations *alsa_fops = NULL;48 const struct file_operations *alsa_fops = NULL; 50 49 int per_bytes = 0; 51 50 int prev_size = 0; … … 80 79 //****************************************************************************** 81 80 //****************************************************************************** 82 int register_chrdev(unsigned int version, const char *name, struct file_operations *fsop)81 int register_chrdev(unsigned int version, const char *name, const struct file_operations *fsop) 83 82 { 84 83 if(!strcmp(name, "alsa")) { … … 369 368 pHandle->file.f_flags = O_NONBLOCK; 370 369 371 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_INFO, (ULONG)pcminfo);370 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_INFO, (ULONG)pcminfo); 372 371 if(ret != 0) { 373 372 rprintf(("OSS32_QueryDevCaps: SNDRV_PCM_IOCTL_INFO error %i\n", ret)); … … 386 385 //get all hardware parameters 387 386 _snd_pcm_hw_params_any(params); 388 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)params);387 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)params); 389 388 if(ret != 0) { 390 389 rprintf(("OSS32_QueryDevCaps: SNDRV_PCM_IOCTL_HW_REFINE error %i\n", ret)); … … 539 538 540 539 ret = alsa_fops->open(&pHandle->inode, &pHandle->file); 540 541 541 //dprintf(("OSS32_WaveOpen. ret: %i\n", ret)); 542 542 /* check if PCM already opened (stupid uniaud16.sys doesnt closes it) */ … … 627 627 { 628 628 /* prepare for reuse */ 629 pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_RESET, 0);630 pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);629 pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_RESET, 0); 630 pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 631 631 } 632 632 break; … … 668 668 pHandle->file.f_flags = O_NONBLOCK; 669 669 670 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);670 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 671 671 if (ret) 672 672 rprintf(("Wave prepare ret = %i, streamid %X\n",ret,(ULONG)pHandle)); … … 687 687 //set operation to non-blocking 688 688 pHandle->file.f_flags = O_NONBLOCK; 689 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_START, 0);689 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_START, 0); 690 690 if (ret) 691 691 rprintf(("Wave start ret = %i, streamid %X\n",ret,(ULONG)pHandle)); … … 707 707 pHandle->file.f_flags = O_NONBLOCK; 708 708 709 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_DROP, 0);709 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_DROP, 0); 710 710 if (ret) 711 711 rprintf(("Wave stop ret = %i. streamid %X\n",ret,(ULONG)pHandle)); … … 727 727 pHandle->file.f_flags = O_NONBLOCK; 728 728 729 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, 0);729 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, 0); 730 730 if (ret) 731 731 rprintf(("Wave pause ret = %i, streamid %X\n",ret,(ULONG)pHandle)); … … 747 747 pHandle->file.f_flags = O_NONBLOCK; 748 748 749 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, 1);749 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, 1); 750 750 if (ret) 751 751 rprintf(("Wave resume ret = %i, streamid %X\n",ret,(ULONG)pHandle)); … … 815 815 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_CHANNELS, 816 816 pHwParams->ulNumChannels, 0); 817 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));817 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 818 818 if (ret == 0) break; 819 819 pHwParams->ulNumChannels--; … … 828 828 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_FORMAT, 829 829 OSSToALSADataType[pHwParams->ulDataType], 0); 830 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));830 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 831 831 if(ret != 0) { 832 832 rprintf(("invalid format %lx\n", OSSToALSADataType[pHwParams->ulDataType])); … … 835 835 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 836 836 pHwParams->ulBitsPerSample, 0); 837 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));837 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 838 838 if(ret != 0) { 839 839 rprintf(("invalid number of sample bits %d\n", pHwParams->ulBitsPerSample)); … … 842 842 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_FRAME_BITS, 843 843 pHwParams->ulBitsPerSample*pHwParams->ulNumChannels, 0); 844 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));844 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 845 845 if(ret != 0) { 846 846 rprintf(("invalid number of frame bits %d\n", pHwParams->ulBitsPerSample*pHwParams->ulNumChannels)); … … 859 859 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_RATE, 860 860 pHwParams->ulSampleRate, 0); 861 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));861 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 862 862 if(ret != 0) { 863 863 rprintf(("32_WSetHwPms (first pass) error %d bps:%d fmt: %d ch: %d sr: %d\n", … … 878 878 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_RATE, 879 879 pHwParams->ulSampleRate, 0); 880 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));880 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 881 881 if(ret == 0) 882 882 { … … 892 892 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_RATE, 893 893 pHwParams->ulSampleRate, 0); 894 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));894 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 895 895 goto __next; 896 896 } … … 1000 1000 pHwParams->ulSampleRate, pHwParams->ulBitsPerSample, pHwParams->ulNumChannels, periodsize, nrperiods)); 1001 1001 1002 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_PARAMS, (ULONG)__Stack32ToFlat(¶ms));1002 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_PARAMS, (ULONG)¶ms); 1003 1003 if (ret == -77 && fTryAgain == FALSE) 1004 1004 { 1005 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1005 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1006 1006 fTryAgain = TRUE; 1007 1007 rprintf((" Error -77 from first IOCTL HW Parms")); … … 1045 1045 swparams.xfer_align = periodsize; 1046 1046 1047 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_SW_PARAMS, (ULONG)__Stack32ToFlat(&swparams));1047 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_SW_PARAMS, (ULONG)&swparams); 1048 1048 } 1049 1049 1050 1050 total = 0; 1051 1051 per_bytes = periodbytes; 1052 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1052 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1053 1053 if ( ((status.state != SNDRV_PCM_STATE_PREPARED) && 1054 1054 (status.state != SNDRV_PCM_STATE_SETUP) && … … 1056 1056 (status.state != SNDRV_PCM_STATE_DRAINING))) { 1057 1057 rprintf(("Device is not in proper state: %lx. Calling prepare\n", status.state)); 1058 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1058 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1059 1059 } 1060 1060 return UNIXToOSSError(ret); … … 1094 1094 1095 1095 /* get the status of the circular dma buffer */ 1096 iRet = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1096 iRet = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1097 1097 1098 1098 if(iRet) { … … 1126 1126 if (status.state == SNDRV_PCM_STATE_XRUN) { 1127 1127 rprintf(("Internal Error: Xrun")); 1128 iRet = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1128 iRet = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1129 1129 if (iRet < 0) { 1130 1130 rprintf(("Prepare failed: state=%x avail=%x ReqSize=%x", status.state, status.avail, ulReqSize)); 1131 1131 return UNIXToOSSError(iRet); 1132 1132 } 1133 iRet = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1133 iRet = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1134 1134 rprintf(("Xrun restarted: state=%x avail=%x ReqSize=%x", status.state, status.avail, ulReqSize)); 1135 1135 if (iRet < 0) return UNIXToOSSError(iRet); … … 1165 1165 while (ulSize && ulJ && iRet) { 1166 1166 for (ulI=0; ulI < 1000; ulI++) { 1167 iRet1 = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1167 iRet1 = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1168 1168 // If here any state and have free buffer to any byte 1169 1169 if ((status.state != SNDRV_PCM_STATE_XRUN ) && samples_to_bytes(status.avail) ) break; … … 1173 1173 if (ulI > 998) { 1174 1174 rprintf(("timeout state=%x avail=%d hw=%d app=%d",status.state,samples_to_bytes(status.avail),samples_to_bytes(status.hw_ptr), samples_to_bytes(status.appl_ptr))); 1175 iRet1 = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1175 iRet1 = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1176 1176 } 1177 1177 } … … 1190 1190 if ( iRet != -11 ) { 1191 1191 rprintf(("Doing prepare")); 1192 iRet1 = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1192 iRet1 = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1193 1193 } 1194 1194 continue; … … 1231 1231 // { 1232 1232 // printk("warning: ulTransferred [%d] less than requested [%d]", *pulTransferred, ulSize); 1233 // iRet1 = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1233 // iRet1 = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1234 1234 // } 1235 1235 … … 1257 1257 1258 1258 //Get the status of the stream 1259 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1259 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1260 1260 1261 1261 if(ret) { … … 1289 1289 1290 1290 //Get the nr of bytes left in the audio buffer 1291 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1291 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1292 1292 1293 1293 if(ret) { … … 1321 1321 1322 1322 //Get the status of the stream 1323 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1323 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1324 1324 1325 1325 if(ret) { … … 1352 1352 1353 1353 //Get the status of the stream 1354 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1354 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1355 1355 if(ret) return UNIXToOSSError(ret); 1356 1356 *pStatus = status.state; … … 1384 1384 1385 1385 dprintf(("OSS32_WaveSetVolume %x to (%d,%d)", streamid, leftvol, rightvol)); 1386 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_SETVOLUME, (ULONG)__Stack32ToFlat(&pcm_volume));1386 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_SETVOLUME, (ULONG)&pcm_volume); 1387 1387 return UNIXToOSSError(ret); 1388 1388 } -
GPL/trunk/lib32/soundmidi.c
r598 r679 120 120 { 121 121 //get the client id 122 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_SEQ_IOCTL_CLIENT_ID, (ULONG)&pHandle->clientid);122 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_SEQ_IOCTL_CLIENT_ID, (ULONG)&pHandle->clientid); 123 123 if(ret) { 124 124 rprintf(("Get client id failed with error %d", ret)); … … 130 130 for(i=64;i<64+((deviceid+1)<<3);i++) 131 131 { 132 memset( (PVOID)__Stack32ToFlat(&clientinfo), 0, sizeof(clientinfo));132 memset(&clientinfo, 0, sizeof(clientinfo)); 133 133 clientinfo.client = i; 134 134 clientinfo.type = KERNEL_CLIENT; 135 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, (ULONG)__Stack32ToFlat(&clientinfo));135 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, (ULONG)&clientinfo); 136 136 if(ret) { 137 137 continue; … … 157 157 portinfo.addr.client = pHandle->clientid; 158 158 portinfo.flags = SNDRV_SEQ_PORT_TYPE_APPLICATION; 159 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_SEQ_IOCTL_CREATE_PORT, (ULONG)__Stack32ToFlat(&portinfo));159 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_SEQ_IOCTL_CREATE_PORT, (ULONG)&portinfo); 160 160 if(ret) { 161 161 rprintf(("subscribe error %d", ret)); … … 172 172 subs.sender.client = pHandle->clientid; 173 173 subs.sender.port = pHandle->clientport; 174 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, (ULONG)__Stack32ToFlat(&subs));174 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, (ULONG)&subs); 175 175 if(ret) { 176 176 rprintf(("subscribe error %d", ret)); … … 212 212 subs.sender.client = pHandle->clientid; 213 213 subs.sender.port = pHandle->clientport; 214 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT, (ULONG)__Stack32ToFlat(&subs));214 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT, (ULONG)&subs); 215 215 if(ret) { 216 216 rprintf(("unsubscribe error %d", ret)); … … 227 227 portinfo.addr.client = pHandle->clientid; 228 228 portinfo.addr.port = pHandle->clientport; 229 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_SEQ_IOCTL_DELETE_PORT, (ULONG)__Stack32ToFlat(&portinfo));229 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_SEQ_IOCTL_DELETE_PORT, (ULONG)&portinfo); 230 230 if(ret) { 231 231 dprintf(("delete port error %d", ret)); … … 300 300 pHandle->file.f_flags = O_NONBLOCK; 301 301 302 memset( (PVOID)__Stack32ToFlat(&fmevent), 0, sizeof(fmevent));302 memset(&fmevent, 0, sizeof(fmevent)); 303 303 switch(Cmd) { 304 304 case IDC32_MIDI_NOTEON: … … 331 331 fmevent.dest.port = pHandle->destport; 332 332 333 transferred = pHandle->file.f_op->write(&pHandle->file, (char *) __Stack32ToFlat(&fmevent), sizeof(fmevent), &pHandle->file.f_pos);333 transferred = pHandle->file.f_op->write(&pHandle->file, (char *)&fmevent, sizeof(fmevent), &pHandle->file.f_pos); 334 334 335 335 if(transferred < 0) { -
GPL/trunk/lib32/soundmixer.c
r604 r679 148 148 } 149 149 //retrieve mixer information 150 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,150 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 151 151 SNDRV_CTL_IOCTL_CARD_INFO, 152 152 (ULONG)&pHandle->info); … … 157 157 pHandle->list.offset = 0; 158 158 pHandle->list.space = 0; 159 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,159 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 160 160 SNDRV_CTL_IOCTL_ELEM_LIST, 161 161 (ULONG)&pHandle->list); … … 172 172 pHandle->list.space = pHandle->list.count; 173 173 pHandle->list.pids = pHandle->pids; 174 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,174 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 175 175 SNDRV_CTL_IOCTL_ELEM_LIST, 176 176 (ULONG)&pHandle->list); … … 271 271 pElemInfo->value.enumerated.item = i; 272 272 pElemInfo->id.numid = pHandle->pids[idx].numid; 273 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo);273 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo); 274 274 if(ret) { 275 275 DebugInt3(); … … 484 484 pElem->value.integer.value[0] = TRUE; //switch, not mute control (inversed) 485 485 pElem->value.integer.value[1] = TRUE; 486 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem);486 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem); 487 487 } 488 488 //request information about mixer control 489 489 pElemInfo->id.numid = pHandle->pids[idx].numid; 490 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo);490 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo); 491 491 if(ret) { 492 492 ret = UNIXToOSSError(ret); … … 515 515 516 516 #if 1 517 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem);517 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem); 518 518 #else 519 519 // looking for more, then one opened streams to prevent of muting active stream … … 528 528 { 529 529 dprintf(("OSS32_MixSetVolume Ioctl")); 530 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem);530 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem); 531 531 532 532 if(idxMute != -1 && volume == 0) { … … 538 538 pElem->value.integer.value[1] = FALSE; 539 539 dprintf(("OSS32_MixSetVolume Ioctl mute")); 540 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem);540 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem); 541 541 } 542 542 } … … 603 603 //request information about mixer control 604 604 pElemInfo->id.numid = pHandle->pids[idx].numid; 605 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo);605 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo); 606 606 if(ret) { 607 607 ret = UNIXToOSSError(ret); … … 621 621 } 622 622 623 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem);623 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem); 624 624 if(ret) { 625 625 ret = UNIXToOSSError(ret); … … 631 631 //request information about mixer control 632 632 pElemInfo->id.numid = pHandle->pids[idx].numid; 633 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo);633 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo); 634 634 if(ret) { 635 635 ret = UNIXToOSSError(ret); … … 678 678 //request information about mixer control 679 679 pElemInfo->id.numid = pHandle->pids[idx].numid; 680 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo);680 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_INFO, (ULONG)pElemInfo); 681 681 if(ret) { 682 682 ret = UNIXToOSSError(ret); … … 707 707 708 708 dprintf(("OSS32_MixSetProperty of %s to %x", pHandle->pids[idx].name, ulValue)); 709 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem);709 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_CTL_IOCTL_ELEM_WRITE, (ULONG)pElem); 710 710 711 711 kfree(pElem); … … 849 849 } 850 850 //retrieve mixer information 851 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,851 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 852 852 SNDRV_CTL_IOCTL_CARD_INFO, 853 853 (ULONG)&pHandle->info); … … 911 911 } 912 912 //retrieve mixer information 913 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file,913 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, 914 914 SNDRV_CTL_IOCTL_CARD_INFO, 915 915 (ULONG)&pHandle->info); -
GPL/trunk/lib32/soundoss.h
r305 r679 69 69 } mixerhandle; 70 70 71 extern struct file_operations *alsa_fops;71 extern const struct file_operations *alsa_fops; 72 72 extern int nrCardsDetected; 73 73 -
GPL/trunk/lib32/task.c
r479 r679 26 26 #include <linux/kernel.h> 27 27 #include <linux/fs.h> 28 #include <linux/tqueue.h>29 28 #include <linux/interrupt.h> 30 29 #define LINUX -
GPL/trunk/lib32/timer.c
r445 r679 30 30 #include <asm/io.h> 31 31 #include <linux/time.h> 32 #include <linux/math64.h> 33 #include <linux/clocksource.h> 32 34 33 35 #define LINUX … … 36 38 #include <dbgos2.h> 37 39 40 #pragma pack(1) 41 #include "infoseg.h" 42 #pragma pack() 43 extern PVOID KernSISData; 44 #define KernSISData ((struct InfoSegGDT *)&KernSISData) 45 38 46 static long jiffiems = 1000/HZ; 39 47 static long lasttime = 0; … … 47 55 long delta, newtime, remainder; 48 56 49 newtime = os2gettimemsec();57 newtime = KernSISData->SIS_MsCount; 50 58 delta = newtime - lasttime; 51 59 … … 95 103 { 96 104 #if 0 97 tv->tv_sec = 0; // os2gettimesec();98 tv->tv_usec = os2gettimemsec()* 1000;105 tv->tv_sec = 0; //KernSISData->SIS_BigTime; 106 tv->tv_usec = KernSISData->SIS_MsCount * 1000; 99 107 #else /* r.ihle patch */ 100 unsigned u = os2gettimemsec();108 unsigned u = KernSISData->SIS_MsCount; 101 109 tv->tv_sec = u / 1000; 102 110 tv->tv_usec = (u % 1000) * 1000; … … 140 148 //****************************************************************************** 141 149 //****************************************************************************** 150 151 /** 152 * ns_to_timespec - Convert nanoseconds to timespec 153 * @nsec: the nanoseconds value to be converted 154 * 155 * Returns the timespec representation of the nsec parameter. 156 */ 157 struct timespec ns_to_timespec(const s64 nsec) 158 { 159 struct timespec ts; 160 s32 rem; 161 162 if (!nsec) { 163 ts.tv_sec = 0; 164 ts.tv_nsec = 0; 165 return ts; 166 } 167 168 ts.tv_sec = div_s64_rem(nsec, NSEC_PER_SEC, &rem); 169 if (unlikely(rem < 0)) { 170 ts.tv_sec--; 171 rem += NSEC_PER_SEC; 172 } 173 ts.tv_nsec = rem; 174 175 return ts; 176 } 177 178 179 //****************************************************************************** 180 //****************************************************************************** 181 182 /** 183 * ns_to_timespec - Convert nanoseconds to timespec 184 * @nsec: the nanoseconds value to be converted 185 * 186 * Returns the timespec representation of the nsec parameter. 187 */ 188 struct timespec64 ns_to_timespec64(const s64 nsec) 189 { 190 struct timespec64 ts; 191 s32 rem; 192 193 if (!nsec) { 194 ts.tv_sec = 0; 195 ts.tv_nsec = 0; 196 return ts; 197 } 198 199 ts.tv_sec = div_s64_rem(nsec, NSEC_PER_SEC, &rem); 200 if (unlikely(rem < 0)) { 201 ts.tv_sec--; 202 rem += NSEC_PER_SEC; 203 } 204 ts.tv_nsec = rem; 205 206 return ts; 207 } 208 //****************************************************************************** 209 //****************************************************************************** 210 211 void timecounter_init(struct timecounter *tc, 212 const struct cyclecounter *cc, 213 u64 start_tstamp) 214 { 215 tc->cc = cc; 216 tc->cycle_last = cc->read(cc); 217 tc->nsec = start_tstamp; 218 } 219 220 /** 221 * timecounter_read_delta - get nanoseconds since last call of this function 222 * @tc: Pointer to time counter 223 * 224 * When the underlying cycle counter runs over, this will be handled 225 * correctly as long as it does not run over more than once between 226 * calls. 227 * 228 * The first call to this function for a new time counter initializes 229 * the time tracking and returns an undefined result. 230 */ 231 static u64 timecounter_read_delta(struct timecounter *tc) 232 { 233 cycle_t cycle_now, cycle_delta; 234 u64 ns_offset; 235 236 /* read cycle counter: */ 237 cycle_now = tc->cc->read(tc->cc); 238 239 /* calculate the delta since the last timecounter_read_delta(): */ 240 cycle_delta = (cycle_now - tc->cycle_last) & tc->cc->mask; 241 242 /* convert to nanoseconds: */ 243 ns_offset = cyclecounter_cyc2ns(tc->cc, cycle_delta); 244 245 /* update time stamp of timecounter_read_delta() call: */ 246 tc->cycle_last = cycle_now; 247 248 return ns_offset; 249 } 250 251 u64 timecounter_read(struct timecounter *tc) 252 { 253 u64 nsec; 254 255 /* increment time by nanoseconds since last call */ 256 nsec = timecounter_read_delta(tc); 257 nsec += tc->nsec; 258 tc->nsec = nsec; 259 260 return nsec; 261 } 262 263 /** 264 * set_normalized_timespec - set timespec sec and nsec parts and normalize 265 * 266 * @ts: pointer to timespec variable to be set 267 * @sec: seconds to set 268 * @nsec: nanoseconds to set 269 * 270 * Set seconds and nanoseconds field of a timespec variable and 271 * normalize to the timespec storage format 272 * 273 * Note: The tv_nsec part is always in the range of 274 * 0 <= tv_nsec < NSEC_PER_SEC 275 * For negative values only the tv_sec field is negative ! 276 */ 277 void set_normalized_timespec64(struct timespec64 *ts, time64_t sec, s64 nsec) 278 { 279 while (nsec >= NSEC_PER_SEC) { 280 /* 281 * The following asm() prevents the compiler from 282 * optimising this loop into a modulo operation. See 283 * also __iter_div_u64_rem() in include/linux/time.h 284 */ 285 // asm("" : "+rm"(nsec)); 286 nsec -= NSEC_PER_SEC; 287 ++sec; 288 } 289 while (nsec < 0) { 290 // asm("" : "+rm"(nsec)); 291 nsec += NSEC_PER_SEC; 292 --sec; 293 } 294 ts->tv_sec = sec; 295 ts->tv_nsec = nsec; 296 } -
GPL/trunk/lib32/waitqueue.c
r32 r679 38 38 //****************************************************************************** 39 39 //****************************************************************************** 40 void add_wait_queue( wait_queue_head_t *q, wait_queue_t* wait)40 void add_wait_queue(struct wait_queue_head *q, struct wait_queue_entry * wait) 41 41 { 42 42 // dprintf3(("WARNING: add_wait_queue STUB")); … … 44 44 //****************************************************************************** 45 45 //****************************************************************************** 46 void add_wait_queue_exclusive( wait_queue_head_t *q)46 void add_wait_queue_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry) 47 47 { 48 48 // dprintf3(("WARNING: add_wait_queue_exclusive STUB")); … … 50 50 //****************************************************************************** 51 51 //****************************************************************************** 52 void remove_wait_queue( wait_queue_head_t *q, wait_queue_t* wait)52 void remove_wait_queue(struct wait_queue_head *q, struct wait_queue_entry * wait) 53 53 { 54 54 // dprintf(("WARNING: remove_wait_queue STUB")); … … 75 75 //****************************************************************************** 76 76 //****************************************************************************** 77 void init_waitqueue_entry( wait_queue_t *q, struct task_struct *p)77 void init_waitqueue_entry(struct wait_queue_entry *wq_entry, struct task_struct *p) 78 78 { 79 79 // dprintf(("WARNING: init_waitqueue_entry STUB")); … … 88 88 //****************************************************************************** 89 89 //****************************************************************************** 90 /** 91 * complete: - signals a single thread waiting on this completion 92 * @x: holds the state of this particular completion 93 * 94 * This will wake up a single thread waiting on this completion. Threads will be 95 * awakened in the same order in which they were queued. 96 * 97 * See also complete_all(), wait_for_completion() and related routines. 98 * 99 * It may be assumed that this function implies a write memory barrier before 100 * changing the task state if and only if any tasks are woken up. 101 */ 102 void complete(struct completion *x) 103 { 104 unsigned long flags; 105 106 spin_lock_irqsave(&x->wait.lock, flags); 107 x->done++; 108 __wake_up_locked(&x->wait, TASK_NORMAL, 1); 109 spin_unlock_irqrestore(&x->wait.lock, flags); 110 } 111 /** 112 * complete_all: - signals all threads waiting on this completion 113 * @x: holds the state of this particular completion 114 * 115 * This will wake up all threads waiting on this particular completion event. 116 * 117 * If this function wakes up a task, it executes a full memory barrier before 118 * accessing the task state. 119 * 120 * Since complete_all() sets the completion of @x permanently to done 121 * to allow multiple waiters to finish, a call to reinit_completion() 122 * must be used on @x if @x is to be used again. The code must make 123 * sure that all waiters have woken and finished before reinitializing 124 * @x. Also note that the function completion_done() can not be used 125 * to know if there are still waiters after complete_all() has been called. 126 */ 127 void complete_all(struct completion *x) 128 { 129 unsigned long flags; 130 131 spin_lock_irqsave(&x->wait.lock, flags); 132 __wake_up_locked(&x->wait, TASK_NORMAL, 1); 133 spin_unlock_irqrestore(&x->wait.lock, flags); 134 } 135 //****************************************************************************** 136 //****************************************************************************** 137 void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr) 138 { 139 dprintf3(("WARNING: __wake_up_locked STUB")); 140 } 141 //****************************************************************************** 142 //****************************************************************************** 143 /** 144 * wait_for_completion: - waits for completion of a task 145 * @x: holds the state of this particular completion 146 * 147 * This waits to be signaled for completion of a specific task. It is NOT 148 * interruptible and there is no timeout. 149 * 150 * See also similar routines (i.e. wait_for_completion_timeout()) with timeout 151 * and interrupt capability. Also see complete(). 152 */ 153 void wait_for_completion(struct completion *x) 154 { 155 dprintf3(("WARNING: wait_for_completion STUB")); 156 } 157 158 159 /** 160 * wait_for_completion_timeout: - waits for completion of a task (w/timeout) 161 * @x: holds the state of this particular completion 162 * @timeout: timeout value in jiffies 163 * 164 * This waits for either a completion of a specific task to be signaled or for a 165 * specified timeout to expire. The timeout is in jiffies. It is not 166 * interruptible. 167 * 168 * Return: 0 if timed out, and positive (at least 1, or number of jiffies left 169 * till timeout) if completed. 170 */ 171 unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout) 172 { 173 dprintf3(("WARNING: wait_for_completion_timeout STUB")); 174 return 1; 175 }
Note:
See TracChangeset
for help on using the changeset viewer.