Changeset 649 for GPL/branches
- Timestamp:
- Jan 23, 2021, 9:53:50 PM (5 years ago)
- Location:
- GPL/branches/uniaud32-next
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/drv32/init.c
r615 r649 38 38 #include <dbgos2.h> 39 39 #include <irqos2.h> 40 #include <osspci.h> 40 41 //#include <bsedos16.h> 41 42 #ifdef KEE … … 206 207 #endif 207 208 //_asm int 3; 209 210 DebugLevel = 1; 211 rp->init_out.usCodeEnd = 0; 212 rp->init_out.usDataEnd = 0; 213 208 214 if(LockSegments()) 209 215 { … … 213 219 } 214 220 215 DebugLevel = 1; 216 rp->init_out.usCodeEnd = 0; 217 rp->init_out.usDataEnd = 0; 221 RMCreateDriverU32(); // register driver in Resource Manager 218 222 219 223 if ( szprintBuf == 0 ) … … 325 329 return RPDONE; 326 330 } 327 -
GPL/branches/uniaud32-next/drv32/rmhelp.c
r587 r649 31 31 #define MAX_RESHANDLES 16 32 32 33 //****************************************************************************** 34 35 //extern PFN RM_Help; 36 //extern PFN RM_Help0; 37 //extern PFN RM_Help3; 38 //extern ULONG RMFlags; 39 40 static HDRIVER DriverHandle = (HDRIVER)-1; 41 static HDEVICE DeviceHandle = 0; 33 static HDRIVER DriverHandle = (HDRIVER)-1; 42 34 static HADAPTER AdapterHandle = 0; 43 static ULONG ctResHandles = 0; 44 static HRESOURCE arResHandles[MAX_RESHANDLES]; 45 46 //****************************************************************************** 47 VOID RMInit(VOID) 48 { 49 APIRET rc; 50 HDRIVER hDriver; 51 DRIVERSTRUCT DriverStruct; 52 char DriverName[sizeof(RM_DRIVER_NAME)]; 53 char VendorName[sizeof(RM_DRIVER_VENDORNAME)]; 54 char DriverDesc[sizeof(RM_DRIVER_DESCRIPTION)]; 55 56 if( DriverHandle == (HDRIVER)-1 ) 57 { 58 memset( (PVOID) &DriverStruct, 0, sizeof(DriverStruct) ); 59 60 //copy strings to stack, because we need to give RM 16:16 pointers 61 //(which can only be (easily) generated from 32 bits stack addresses) 62 strcpy(DriverName, RM_DRIVER_NAME); 63 strcpy(VendorName, RM_DRIVER_VENDORNAME); 64 strcpy(DriverDesc, RM_DRIVER_DESCRIPTION); 65 66 DriverStruct.DrvrName = FlatToSel((ULONG)DriverName); /* ### IHV */ 67 DriverStruct.DrvrDescript = FlatToSel((ULONG)DriverDesc); /* ### IHV */ 68 DriverStruct.VendorName = FlatToSel((ULONG)VendorName); /* ### IHV */ 69 DriverStruct.MajorVer = CMVERSION_MAJOR; //rmbase.h /* ### IHV */ 70 DriverStruct.MinorVer = CMVERSION_MINOR; //rmbase.h /* ### IHV */ 71 DriverStruct.Date.Year = RM_DRIVER_BUILDYEAR; /* ### IHV */ 72 DriverStruct.Date.Month = RM_DRIVER_BUILDMONTH; /* ### IHV */ 73 DriverStruct.Date.Day = RM_DRIVER_BUILDDAY; /* ### IHV */ 74 DriverStruct.DrvrType = DRT_AUDIO; 75 DriverStruct.DrvrSubType = 0; 76 DriverStruct.DrvrCallback = 0; 77 78 rc = RMCreateDriver( FlatToSel((ULONG)&DriverStruct), FlatToSel((ULONG)&hDriver) ); 79 80 if( rc == RMRC_SUCCESS ) DriverHandle = hDriver; 81 dprintf(("RMCreateDriver rc=%d DriverHandle=%x", rc, DriverHandle)); 82 } 83 84 while( ctResHandles ) 85 RMDeallocResource(DriverHandle, arResHandles[--ctResHandles]); 86 } 87 35 36 typedef struct 37 { 38 ULONG NumResource; 39 HRESOURCE hResource[MAX_RESHANDLES]; 40 } RESOURCES; 41 42 static RESOURCES Resource_stt = {0}; 43 44 //****************************************************************************** 45 //****************************************************************************** 46 VOID RMCreateDriverU32(VOID) 47 { 48 HDRIVER hDriver; 49 DRIVERSTRUCT DriverStruct; 50 char DriverName[sizeof(RM_DRIVER_NAME)]; 51 char VendorName[sizeof(RM_DRIVER_VENDORNAME)]; 52 char DriverDesc[sizeof(RM_DRIVER_DESCRIPTION)]; 53 54 //copy strings to stack, because we need to give RM 16:16 pointers 55 //(which can only be (easily) generated from 32 bits stack addresses) 56 strcpy(DriverName, RM_DRIVER_NAME); 57 strcpy(VendorName, RM_DRIVER_VENDORNAME); 58 strcpy(DriverDesc, RM_DRIVER_DESCRIPTION); 59 60 DriverStruct.DrvrName = FlatToSel((ULONG)DriverName); /* ### IHV */ 61 DriverStruct.DrvrDescript = FlatToSel((ULONG)DriverDesc); /* ### IHV */ 62 DriverStruct.VendorName = FlatToSel((ULONG)VendorName); /* ### IHV */ 63 DriverStruct.MajorVer = CMVERSION_MAJOR; //rmbase.h /* ### IHV */ 64 DriverStruct.MinorVer = CMVERSION_MINOR; //rmbase.h /* ### IHV */ 65 DriverStruct.Date.Year = RM_DRIVER_BUILDYEAR; /* ### IHV */ 66 DriverStruct.Date.Month = RM_DRIVER_BUILDMONTH; /* ### IHV */ 67 DriverStruct.Date.Day = RM_DRIVER_BUILDDAY; /* ### IHV */ 68 DriverStruct.DrvrFlags = 0; 69 DriverStruct.DrvrType = DRT_AUDIO; 70 DriverStruct.DrvrSubType = 0; 71 DriverStruct.DrvrCallback = 0; 72 73 APIRET rc = RMCreateDriver( FlatToSel((ULONG)&DriverStruct), 74 FlatToSel((ULONG)&hDriver) ); 75 76 if( rc == RMRC_SUCCESS ) 77 { 78 DriverHandle = hDriver; 79 } 80 dprintf(("RMCreateDriver rc=%d DriverHandle=%x", rc, DriverHandle)); 81 } 82 83 //****************************************************************************** 84 //****************************************************************************** 85 VOID RMCreateAdapterU32(ULONG DevID, ULONG *phAdapter, USHORT BusDevFunc, ULONG CardNum) 86 { 87 APIRET rc; 88 char szAdapterName[128]; 89 char szMixerName[64]; 90 91 szAdapterName[0] = szMixerName[0] = '\0'; 92 93 if(OSS32_QueryNames(CardNum, szAdapterName, sizeof(szAdapterName), 94 szMixerName, sizeof(szMixerName), FALSE) != OSSERR_SUCCESS ) 95 { 96 return; // error 97 } 98 99 switch(DevID) 100 { 101 case PCIID_VIA_686A: 102 case PCIID_VIA_8233: 103 case PCIID_SI_7012: 104 case PCIID_INTEL_82801: 105 case PCIID_INTEL_82901: 106 case PCIID_INTEL_92801BA: 107 case PCIID_INTEL_440MX: 108 case PCIID_INTEL_ICH3: 109 case PCIID_INTEL_ICH4: 110 case PCIID_INTEL_ICH5: 111 case PCIID_INTEL_ICH6: 112 case PCIID_INTEL_ICH7: 113 case PCIID_NVIDIA_MCP_AUDIO: 114 case PCIID_NVIDIA_MCP2_AUDIO: 115 case PCIID_NVIDIA_MCP3_AUDIO: 116 case PCIID_NVIDIA_CK8S_AUDIO: 117 case PCIID_NVIDIA_CK8_AUDIO: 118 strcat(szAdapterName, " with "); 119 strcat(szAdapterName, szMixerName); 120 break; 121 /* 122 case PCIID_CREATIVELABS_SBLIVE: 123 case PCIID_ALS4000: 124 case PCIID_CMEDIA_CM8338A: 125 case PCIID_CMEDIA_CM8338B: 126 case PCIID_CMEDIA_CM8738: 127 case PCIID_CMEDIA_CM8738B: 128 case PCIID_CIRRUS_4281: 129 case PCIID_CIRRUS_4280: 130 case PCIID_CIRRUS_4612: 131 case PCIID_CIRRUS_4615: 132 case PCIID_ESS_ALLEGRO_1: 133 case PCIID_ESS_ALLEGRO: 134 case PCIID_ESS_MAESTRO3: 135 case PCIID_ESS_MAESTRO3_1: 136 case PCIID_ESS_MAESTRO3_HW: 137 case PCIID_ESS_MAESTRO3_2: 138 case PCIID_ESS_CANYON3D_2LE: 139 case PCIID_ESS_CANYON3D_2: 140 case PCIID_ESS_ES1938: 141 case PCIID_AUREAL_VORTEX: 142 case PCIID_AUREAL_VORTEX2: 143 case PCIID_AUREAL_ADVANTAGE: 144 case PCIID_ENSONIQ_CT5880: 145 case PCIID_ENSONIQ_ES1371: 146 case PCIID_YAMAHA_YMF724: 147 case PCIID_YAMAHA_YMF724F: 148 case PCIID_YAMAHA_YMF740: 149 case PCIID_YAMAHA_YMF740C: 150 case PCIID_YAMAHA_YMF744: 151 case PCIID_YAMAHA_YMF754: 152 case PCIID_ESS_M2E: 153 case PCIID_ESS_M2: 154 case PCIID_ESS_M1: 155 case PCIID_ALI_5451: 156 case PCIID_TRIDENT_4DWAVE_DX: 157 case PCIID_TRIDENT_4DWAVE_NX: 158 case PCIID_SI_7018: 159 case PCIID_FM801: 160 case PCIID_ATIIXP_SB200: 161 case PCIID_ATIIXP_SB300: 162 case PCIID_ATIIXP_SB400: 163 case PCIID_AUDIGYLS: 164 case PCIID_AUDIGYLS1: 165 case PCIID_AUDIGYLS2: 166 break; 167 */ 168 } 169 170 if( !szAdapterName[0] ) 171 { 172 strcpy(szAdapterName, "Unknown"); 173 } 174 175 //copy to stack, because we need to give RM 16:16 pointers 176 //(which can only be (easily) generated from 32 bits stack addresses) 177 RESOURCES Resource_loc; 178 // is any resoures detected and registered in RM ? 179 if( Resource_stt.NumResource ) 180 { 181 memcpy( &Resource_loc, &Resource_stt, sizeof(Resource_loc) ); 182 } 183 else 184 { 185 dprintf(("No resources allocated !!!")); 186 Resource_loc.NumResource = 0; 187 } 188 189 ADJUNCT adjBusDevFunc; 190 adjBusDevFunc.pNextAdj = NULL; 191 adjBusDevFunc.AdjLength = sizeof(adjBusDevFunc); 192 adjBusDevFunc.AdjType = ADJ_PCI_DEVFUNC; 193 adjBusDevFunc.PCI_DevFunc = BusDevFunc; 194 195 ADAPTERSTRUCT AdapterStruct; 196 AdapterStruct.AdaptDescriptName = FlatToSel((ULONG)szAdapterName); /* ### IHV */ 197 AdapterStruct.AdaptFlags = AS_16MB_ADDRESS_LIMIT; // AdaptFlags /* ### IHV */ 198 AdapterStruct.BaseType = AS_BASE_MMEDIA; // BaseType 199 AdapterStruct.SubType = AS_SUB_MM_AUDIO; // SubType 200 AdapterStruct.InterfaceType = AS_INTF_GENERIC; // InterfaceType 201 AdapterStruct.HostBusType = AS_HOSTBUS_PCI; // HostBusType /* ### IHV */ 202 AdapterStruct.HostBusWidth = AS_BUSWIDTH_32BIT; // HostBusWidth /* ### IHV */ 203 AdapterStruct.pAdjunctList = FlatToSel((ULONG)&adjBusDevFunc);// pAdjunctList /* ### IHV */ 204 AdapterStruct.Reserved = 0; 205 206 //--- Register adapter. We'll record any error code, but won't fail 207 // the driver initialization and won't return resources. 208 //NOTE: hAdapter must be used as FlatToSel only works for stack variables 209 HADAPTER hAdapter; 210 rc = RMCreateAdapter(DriverHandle, // Handle to driver 211 FlatToSel((ULONG)&hAdapter), // (OUT) Handle to adapter 212 FlatToSel((ULONG)&AdapterStruct), // Adapter structure 213 0, // Parent device (defaults OK) 214 Resource_loc.NumResource ? (FlatToSel((ULONG)&Resource_loc)) : 0); // Allocated resources. 215 216 dprintf(("RMCreateAdapter rc=%d", rc)); 217 218 if( rc == 0 ) 219 { 220 AdapterHandle = hAdapter; 221 *phAdapter = hAdapter; 222 Resource_stt.NumResource = 0; // no resource handles to be freed 223 } 224 else 225 { 226 RMDeallocRes(); 227 } 228 } 88 229 89 230 //****************************************************************************** … … 105 246 FlatToSel((ULONG)&Resource)); // Resource to allocate. 106 247 107 if( rc == 0 && ctResHandles< MAX_RESHANDLES )248 if( rc == 0 && Resource_stt.NumResource < MAX_RESHANDLES ) 108 249 { 109 arResHandles[ctResHandles++] = hres; return TRUE;250 Resource_stt.hResource[Resource_stt.NumResource++] = hres; return TRUE; 110 251 } 111 252 112 dprintf(("RMAllocResource[%d] IO rc = %d", ctResHandles, rc));253 dprintf(("RMAllocResource[%d] IO rc = %d", Resource_stt.NumResource, rc)); 113 254 114 255 return FALSE; … … 133 274 FlatToSel((ULONG)&Resource)); // Resource to allocate. 134 275 135 if( rc == 0 && ctResHandles< MAX_RESHANDLES )276 if( rc == 0 && Resource_stt.NumResource < MAX_RESHANDLES ) 136 277 { 137 arResHandles[ctResHandles++] = hres; return TRUE;278 Resource_stt.hResource[Resource_stt.NumResource++] = hres; return TRUE; 138 279 } 139 280 140 dprintf(("RMAllocResource[%d] MEM rc = %d", ctResHandles, rc));281 dprintf(("RMAllocResource[%d] MEM rc = %d", Resource_stt.NumResource, rc)); 141 282 142 283 return rc == 0; … … 148 289 BOOL RMRequestIRQ(ULONG ulIrq, BOOL fShared, PHRESOURCE phRes) 149 290 { 150 RESOURCESTRUCT Resource; 151 HRESOURCE hRes; 152 APIRET rc; 153 154 Resource.ResourceType = RS_TYPE_IRQ; 155 Resource.IRQResource.IRQLevel = (USHORT)ulIrq & 0xff; 156 Resource.IRQResource.PCIIrqPin = 0; 157 Resource.IRQResource.IRQFlags = ( fShared ) ? RS_IRQ_SHARED : RS_IRQ_EXCLUSIVE; 158 159 rc = RMAllocResource(DriverHandle, // Handle to driver. 160 FlatToSel((ULONG)&hRes), // OUT: "allocated" resource node handle 161 FlatToSel((ULONG)&Resource)); // Resource to allocate. 162 163 164 if (rc == 0) { 165 *phRes = hRes; 166 if (DeviceHandle) { 167 dprintf(("RMRequestIRQ: DriverHandle=%x DeviceHandle=%x hRes=%x", DriverHandle, DeviceHandle, hRes)); 168 rc = RMModifyResources(DriverHandle, DeviceHandle, RM_MODIFY_ADD, hRes); 169 } else { 170 if (ctResHandles < MAX_RESHANDLES ) arResHandles[ctResHandles++] = hRes; 171 } 291 RESOURCESTRUCT Resource; 292 HRESOURCE hRes; 293 APIRET rc; 294 295 memset( &Resource, 0, sizeof(Resource) ); 296 Resource.ResourceType = RS_TYPE_IRQ; 297 Resource.IRQResource.IRQLevel = (USHORT)ulIrq & 0xff; 298 Resource.IRQResource.PCIIrqPin = 0; 299 Resource.IRQResource.IRQFlags = ( fShared ) ? RS_IRQ_SHARED : RS_IRQ_EXCLUSIVE; 300 301 rc = RMAllocResource(DriverHandle, // Handle to driver. 302 FlatToSel((ULONG)&hRes), // OUT: "allocated" resource node handle 303 FlatToSel((ULONG)&Resource)); // Resource to allocate. 304 305 if (rc == 0) 306 { 307 *phRes = hRes; 308 if (AdapterHandle) 309 { 310 dprintf(("RMRequestIRQ: DriverHandle=%x AdapterHandle=%x hRes=%x", DriverHandle, AdapterHandle, hRes)); 311 rc = RMModifyResources(DriverHandle, AdapterHandle, RM_MODIFY_ADD, hRes); 312 } 313 else 314 { 315 if (Resource_stt.NumResource < MAX_RESHANDLES ) 316 { 317 Resource_stt.hResource[Resource_stt.NumResource++] = hRes; 318 } 172 319 } 173 174 dprintf(("RMAllocResource[%d] IRQ=%d rc=%d", ctResHandles, ulIrq, rc)); 320 } 321 dprintf(("RMAllocResource[%d] IRQ=%d rc=%d", Resource_stt.NumResource, ulIrq, rc)); 322 return rc == 0; 323 } 324 325 //****************************************************************************** 326 //****************************************************************************** 327 BOOL RMDeallocateIRQ(HRESOURCE hRes) 328 { 329 APIRET rc; 330 331 dprintf(("RMDeallocateIRQ: DriverHandle=%x AdapterHandle=%x hRes=%x", DriverHandle, AdapterHandle, hRes)); 332 rc = RMModifyResources(DriverHandle, AdapterHandle, RM_MODIFY_DELETE, hRes); 175 333 176 334 return rc == 0; … … 179 337 //****************************************************************************** 180 338 //****************************************************************************** 181 BOOL RMDeallocateIRQ(HRESOURCE hRes) 182 { 183 APIRET rc; 184 185 dprintf(("RMDeallocateIRQ: DriverHandle=%x DeviceHandle=%x hRes=%x", DriverHandle, DeviceHandle, hRes)); 186 rc = RMModifyResources(DriverHandle, DeviceHandle, RM_MODIFY_DELETE, hRes); 187 188 return rc == 0; 189 } 190 191 192 //****************************************************************************** 193 //****************************************************************************** 194 VOID RMDone(ULONG DevID, PHADAPTER phAdapter, PHDEVICE phDevice) 195 { 196 APIRET rc; 197 HDEVICE hDevice; 198 HADAPTER hAdapter; 199 ADAPTERSTRUCT AdapterStruct; 200 DEVICESTRUCT DeviceStruct; 201 char AdapterName[sizeof(RM_ADAPTER_NAME)]; 202 char szDeviceName[128]; 203 char szMixerName[64]; 204 struct { 205 ULONG NumResource; 206 HRESOURCE hResource[MAX_RESHANDLES]; 207 } ahResource; 208 209 szDeviceName[0] = szMixerName[0] = '\0'; 210 211 if( DevID && OSS32_QueryNames(OSS32_DEFAULT_DEVICE, 212 szDeviceName, sizeof(szDeviceName), 213 szMixerName, sizeof(szMixerName), FALSE) == OSSERR_SUCCESS ) 214 { 215 switch(DevID) { 216 case PCIID_VIA_686A: 217 case PCIID_VIA_8233: 218 case PCIID_SI_7012: 219 case PCIID_INTEL_82801: 220 case PCIID_INTEL_82901: 221 case PCIID_INTEL_92801BA: 222 case PCIID_INTEL_440MX: 223 case PCIID_INTEL_ICH3: 224 case PCIID_INTEL_ICH4: 225 case PCIID_INTEL_ICH5: 226 case PCIID_INTEL_ICH6: 227 case PCIID_INTEL_ICH7: 228 case PCIID_NVIDIA_MCP_AUDIO: 229 case PCIID_NVIDIA_MCP2_AUDIO: 230 case PCIID_NVIDIA_MCP3_AUDIO: 231 case PCIID_NVIDIA_CK8S_AUDIO: 232 case PCIID_NVIDIA_CK8_AUDIO: 233 strcat(szDeviceName, " with "); 234 strcat(szDeviceName, szMixerName); 235 break; 236 /* 237 case PCIID_CREATIVELABS_SBLIVE: 238 case PCIID_ALS4000: 239 case PCIID_CMEDIA_CM8338A: 240 case PCIID_CMEDIA_CM8338B: 241 case PCIID_CMEDIA_CM8738: 242 case PCIID_CMEDIA_CM8738B: 243 case PCIID_CIRRUS_4281: 244 case PCIID_CIRRUS_4280: 245 case PCIID_CIRRUS_4612: 246 case PCIID_CIRRUS_4615: 247 case PCIID_ESS_ALLEGRO_1: 248 case PCIID_ESS_ALLEGRO: 249 case PCIID_ESS_MAESTRO3: 250 case PCIID_ESS_MAESTRO3_1: 251 case PCIID_ESS_MAESTRO3_HW: 252 case PCIID_ESS_MAESTRO3_2: 253 case PCIID_ESS_CANYON3D_2LE: 254 case PCIID_ESS_CANYON3D_2: 255 case PCIID_ESS_ES1938: 256 case PCIID_AUREAL_VORTEX: 257 case PCIID_AUREAL_VORTEX2: 258 case PCIID_AUREAL_ADVANTAGE: 259 case PCIID_ENSONIQ_CT5880: 260 case PCIID_ENSONIQ_ES1371: 261 case PCIID_YAMAHA_YMF724: 262 case PCIID_YAMAHA_YMF724F: 263 case PCIID_YAMAHA_YMF740: 264 case PCIID_YAMAHA_YMF740C: 265 case PCIID_YAMAHA_YMF744: 266 case PCIID_YAMAHA_YMF754: 267 case PCIID_ESS_M2E: 268 case PCIID_ESS_M2: 269 case PCIID_ESS_M1: 270 case PCIID_ALI_5451: 271 case PCIID_TRIDENT_4DWAVE_DX: 272 case PCIID_TRIDENT_4DWAVE_NX: 273 case PCIID_SI_7018: 274 case PCIID_FM801: 275 case PCIID_ATIIXP_SB200: 276 case PCIID_ATIIXP_SB300: 277 case PCIID_ATIIXP_SB400: 278 case PCIID_AUDIGYLS: 279 case PCIID_AUDIGYLS1: 280 case PCIID_AUDIGYLS2: 281 break; 282 */ 283 } /* switch */ 284 285 286 if( ctResHandles ) 287 { 288 ahResource.NumResource = ctResHandles; 289 memcpy(ahResource.hResource, 290 arResHandles, ctResHandles * sizeof(arResHandles[0])); 291 292 //copy string to stack, because we need to give RM 16:16 pointers 293 //(which can only be (easily) generated from 32 bits stack addresses) 294 strcpy(AdapterName, RM_ADAPTER_NAME); 295 296 memset( (PVOID) &AdapterStruct, 0, sizeof(AdapterStruct) ); 297 AdapterStruct.AdaptDescriptName = FlatToSel((ULONG)AdapterName); /* ### IHV */ 298 AdapterStruct.AdaptFlags = AS_16MB_ADDRESS_LIMIT; // AdaptFlags /* ### IHV */ 299 AdapterStruct.BaseType = AS_BASE_MMEDIA; // BaseType 300 AdapterStruct.SubType = AS_SUB_MM_AUDIO; // SubType 301 AdapterStruct.InterfaceType = AS_INTF_GENERIC; // InterfaceType 302 AdapterStruct.HostBusType = AS_HOSTBUS_PCI; // HostBusType /* ### IHV */ 303 AdapterStruct.HostBusWidth = AS_BUSWIDTH_32BIT; // HostBusWidth /* ### IHV */ 304 AdapterStruct.pAdjunctList = 0; // pAdjunctList /* ### IHV */ 305 306 //--- Register adapter. We'll record any error code, but won't fail 307 // the driver initialization and won't return resources. 308 //NOTE: hAdapter must be used as FlatToSel only works for stack variables 309 rc = RMCreateAdapter(DriverHandle, // Handle to driver 310 FlatToSel((ULONG)&hAdapter), // (OUT) Handle to adapter 311 FlatToSel((ULONG)&AdapterStruct), // Adapter structure 312 0, // Parent device (defaults OK) 313 0); // Allocated resources. 314 315 dprintf(("RMCreateAdapter rc=%d", rc)); 316 317 if( rc == 0 ) 318 { 319 AdapterHandle = hAdapter; 320 if (phAdapter) *phAdapter = hAdapter; 321 if( !szDeviceName[0] ) strcpy(szDeviceName, "Unknown"); 322 323 //NOTE: Assumes szDeviceName is a stack pointer!! 324 memset( (PVOID) &DeviceStruct, 0, sizeof(DeviceStruct) ); 325 DeviceStruct.DevDescriptName = FlatToSel((ULONG)szDeviceName); 326 DeviceStruct.DevFlags = DS_FIXED_LOGICALNAME; 327 DeviceStruct.DevType = DS_TYPE_AUDIO; 328 DeviceStruct.pAdjunctList = 0; 329 330 rc = RMCreateDevice(DriverHandle, // Handle to driver 331 FlatToSel((ULONG)&hDevice), // (OUT) Handle to device, unused. 332 FlatToSel((ULONG)&DeviceStruct), // Device structure 333 hAdapter, // Parent adapter 334 FlatToSel((ULONG)&ahResource)); // Allocated resources 335 336 dprintf(("RMCreateDevice rc=%d", rc)); 337 338 if( rc == 0 ) 339 { 340 DeviceHandle = hDevice; 341 if (phDevice) *phDevice = hDevice; 342 ctResHandles = 0; // no resource handles to be freed 343 dprintf(("RMDone: DriverHandle=%x DeviceHandle=%x", DriverHandle, DeviceHandle)); 344 return; 345 } 346 347 // !!! Not implemented in startup.asm 348 // RMDestroyAdapter(DriverHandle, hAdapter); 349 } /* if rc == 0 */ 350 } /* ctResHandles */ 351 else dprintf(("No resources allocated !!!")); 352 } /* if DevID */ 353 354 355 // free resource handles 356 while( ctResHandles ) 357 RMDeallocResource(DriverHandle, arResHandles[--ctResHandles]); 358 } 359 339 VOID RMDeallocRes(VOID) 340 { 341 // free resource handles 342 while( Resource_stt.NumResource ) 343 { 344 RMDeallocResource(DriverHandle, Resource_stt.hResource[--Resource_stt.NumResource]); 345 } 346 } 360 347 361 348 /* DAZ - dirty hack so that resource manager is updated correctly 362 349 * when using APIC and multiple adapters */ 363 VOID RMSetHandles(HADAPTER hAdapter , HDEVICE hDevice)350 VOID RMSetHandles(HADAPTER hAdapter) 364 351 { 365 352 AdapterHandle = hAdapter; 366 DeviceHandle = hDevice; 367 } 368 353 } -
GPL/branches/uniaud32-next/include/linux/pci.h
r647 r649 382 382 //DAZ unsigned int apicirq; 383 383 unsigned long hAdapter; 384 unsigned long hDevice;384 //AT unsigned long hDevice; 385 385 void *pcidriver; 386 386 #endif -
GPL/branches/uniaud32-next/include/osspci.h
r547 r649 30 30 #endif 31 31 32 VOID RMInit(VOID); 32 VOID RMCreateDriverU32(VOID); 33 VOID RMCreateAdapterU32(ULONG DevID, ULONG *phAdapter, USHORT BusDevFunc, ULONG CardNum); 33 34 BOOL RMRequestIO(ULONG ulIOBase, ULONG ulIOLength); 34 35 BOOL RMRequestMem(ULONG ulMemBase, ULONG ulMemLength); 35 36 BOOL RMRequestIRQ(ULONG ulIrq, BOOL fShared, ULONG *phRes); 36 37 BOOL RMDeallocateIRQ(ULONG hRes); 37 VOID RMD one(ULONG DevID, ULONG *phAdapter, ULONG *phDevice);38 VOID RMSetHandles(ULONG hAdapter , ULONG hDevice);38 VOID RMDeallocRes(VOID); 39 VOID RMSetHandles(ULONG hAdapter); 39 40 40 41 #ifdef __cplusplus -
GPL/branches/uniaud32-next/lib32/pci.c
r637 r649 536 536 } 537 537 538 RMInit();539 538 if (driver->probe(pcidev, pDriverId) == 0) 540 539 { … … 543 542 544 543 // create adapter 545 RMDone((pcidev->device << 16) | pcidev->vendor, &pcidev->hAdapter, &pcidev->hDevice); 544 RMCreateAdapterU32((pcidev->device << 16) | pcidev->vendor, &pcidev->hAdapter, ulLast, iNumCards); 545 546 546 iNumCards++; 547 547 pcidev = NULL; /* we need a new slot */ 548 548 break; 549 549 } 550 RMDone(0, 0, 0); 550 // release resources which were possibly allocated during probe() 551 RMDeallocRes(); 551 552 } /* for id_table loop */ 552 553 … … 1084 1085 if(pci_devices[i].devfn) 1085 1086 { 1086 RMSetHandles(pci_devices[i].hAdapter , pci_devices[i].hDevice); /* DAZ - dirty hack */1087 RMSetHandles(pci_devices[i].hAdapter); /* DAZ - dirty hack */ 1087 1088 driver = pci_devices[i].pcidriver; 1088 1089 if(driver && driver->resume) { … … 1107 1108 if(pci_devices[i].devfn) 1108 1109 { 1109 RMSetHandles(pci_devices[i].hAdapter , pci_devices[i].hDevice); /* DAZ - dirty hack */1110 RMSetHandles(pci_devices[i].hAdapter); /* DAZ - dirty hack */ 1110 1111 driver = pci_devices[i].pcidriver; 1111 1112 if(driver && driver->suspend) {
Note:
See TracChangeset
for help on using the changeset viewer.