static BOOL PatchBrokenCards( struct ISAPNPBase* res ) { struct ISAPNP_Device* dev = NULL; // Patch the wavetable device on SB AWE32 and AWE64 while( ( dev = ISAPNP_FindDevice( dev, ISAPNP_MAKE_ID('C','T','L'), 0x002, 1, res ) ) != NULL ) { struct ISAPNP_ResourceGroup* rg; struct ISAPNP_IOResource* r1; struct ISAPNP_IOResource* r2; struct ISAPNP_IOResource* r3; // Nuke all dependent options while( ( rg = (struct ISAPNP_ResourceGroup*) RemHead( (struct List*) &dev->isapnpd_Options->isapnprg_ResourceGroups ) ) != NULL ) { ISAPNP_FreeResourceGroup( rg, res ); } rg = ISAPNP_AllocResourceGroup( ISAPNP_RG_PRI_ACCEPTABLE, res ); r1 = (struct ISAPNP_IOResource*) ISAPNP_AllocResource( ISAPNP_NT_IO_RESOURCE, res ); r2 = (struct ISAPNP_IOResource*) ISAPNP_AllocResource( ISAPNP_NT_IO_RESOURCE, res ); r3 = (struct ISAPNP_IOResource*) ISAPNP_AllocResource( ISAPNP_NT_IO_RESOURCE, res ); if( rg == NULL || r1 == NULL || r2 == NULL || r3 == NULL ) { ISAPNP_FreeResourceGroup( rg, res ); ISAPNP_FreeResource( (struct ISAPNP_Resource*) r1, res ); ISAPNP_FreeResource( (struct ISAPNP_Resource*) r2, res ); ISAPNP_FreeResource( (struct ISAPNP_Resource*) r3, res ); return FALSE; } r1->isapnpior_Flags = ISAPNP_IORESOURCE_FF_FULL_DECODE; r2->isapnpior_Flags = ISAPNP_IORESOURCE_FF_FULL_DECODE; r3->isapnpior_Flags = ISAPNP_IORESOURCE_FF_FULL_DECODE; r1->isapnpior_Alignment = 1; r2->isapnpior_Alignment = 1; r3->isapnpior_Alignment = 1; r1->isapnpior_Length = 4; r2->isapnpior_Length = 4; r3->isapnpior_Length = 4; r1->isapnpior_MinBase = 0x620; r2->isapnpior_MinBase = 0xa20; r3->isapnpior_MinBase = 0xe20; r1->isapnpior_MaxBase = 0x620; r2->isapnpior_MaxBase = 0xa20; r3->isapnpior_MaxBase = 0xe20; AddTail( (struct List*) &rg->isapnprg_Resources, (struct Node*) r1 ); AddTail( (struct List*) &rg->isapnprg_Resources, (struct Node*) r2 ); AddTail( (struct List*) &rg->isapnprg_Resources, (struct Node*) r3 ); AddTail( (struct List*) &dev->isapnpd_Options->isapnprg_ResourceGroups, (struct Node*) rg ); } return TRUE; }
struct ISAPNP_Resource* CreateResource( struct ResourceIterator* iter, struct ISAPNPBase* res ) { struct ISAPNP_Resource* result = NULL; result = ISAPNP_AllocResource( iter->m_Resource->isapnpr_Type, res ); if( result == NULL ) { return NULL; } switch( iter->m_Resource->isapnpr_Type ) { case ISAPNP_NT_IRQ_RESOURCE: { struct ISAPNP_IRQResource* r; r = (struct ISAPNP_IRQResource*) result; // Make a copy of the iterators resource CopyMem( iter->m_Resource, r, sizeof( *r ) ); r->isapnpirqr_MinNode.mln_Succ = NULL; r->isapnpirqr_MinNode.mln_Pred = NULL; r->isapnpirqr_IRQMask = 1 << iter->m_IRQBit; break; } case ISAPNP_NT_DMA_RESOURCE: { struct ISAPNP_DMAResource* r; r = (struct ISAPNP_DMAResource*) result; // Make a copy of the iterators resource CopyMem( iter->m_Resource, r, sizeof( *r ) ); r->isapnpdmar_MinNode.mln_Succ = NULL; r->isapnpdmar_MinNode.mln_Pred = NULL; r->isapnpdmar_ChannelMask = 1 << iter->m_ChannelBit; break; } case ISAPNP_NT_IO_RESOURCE: { struct ISAPNP_IOResource* r; r = (struct ISAPNP_IOResource*) result; // Make a copy of the iterators resource CopyMem( iter->m_Resource, r, sizeof( *r ) ); r->isapnpior_MinNode.mln_Succ = NULL; r->isapnpior_MinNode.mln_Pred = NULL; r->isapnpior_MinBase = iter->m_Base; r->isapnpior_MaxBase = iter->m_Base; r->isapnpior_Alignment = 1; break; } case ISAPNP_NT_MEMORY_RESOURCE: default: ISAPNP_FreeResource( result, res ); result = NULL; break;; } return result; }