struct ISAPNPBase* ASMCALL initRoutine( REG( d0, struct ISAPNPBase* res ), REG( a0, APTR seglist ), REG( a6, struct ExecBase* sysbase ) ) { D(bug("[ISAPNP] Init\n")); /* SysBase = sysbase;*/ if(OpenLibs() ) { // Set up the ISAPNPBase structure res->m_Library.lib_Node.ln_Type = NT_RESOURCE; res->m_Library.lib_Node.ln_Name = (STRPTR) ResName; res->m_Library.lib_Flags = LIBF_SUMUSED | LIBF_CHANGED; res->m_Library.lib_Version = VERSION; res->m_Library.lib_Revision = REVISION; res->m_Library.lib_IdString = (STRPTR) IDString; NewList( &res->m_Cards ); /* Base address, on i386 we don't have any mapping res->m_Base = NULL; */ res->m_RegReadData = 0x0000; if( ! ISAPNP_ScanCards( res ) ) { // No cards found Req( "No PnP ISA cards found." ); FreeISAPNPBase( res ); } else { if( ! PatchBrokenCards( res ) ) { FreeISAPNPBase( res ); } else { struct ISAPNP_Card* card; card = ISAPNP_AllocCard( res ); if( card == NULL ) { Req( "Out of memory!" ); FreeISAPNPBase( res ); } else { static const char descr[] = "Non-PnP devices"; char* d; d = AllocVec( sizeof( descr ), MEMF_PUBLIC ); if( d != NULL ) { CopyMem( (void*) descr, d, sizeof( descr ) ); card->isapnpc_Node.ln_Name = d; } card->isapnpc_ID.isapnpid_Vendor[ 0 ] = '?'; card->isapnpc_ID.isapnpid_Vendor[ 1 ] = '?'; card->isapnpc_ID.isapnpid_Vendor[ 2 ] = '?'; card->isapnpc_SerialNumber = -1; // Add *first* AddHead( &res->m_Cards, (struct Node*) card ); // Let's see if we're to disable any cards or devices etc /* TODO: We will start up early because we can have even ISA PnP video cards, disk controllers, etc. Because of this we can't load any list of disabled devices. Think off what to do with them is really a big TODO. if( ! HandleToolTypes( current_binding.cb_ToolTypes, card, res ) ) { // Error requester already displayed. FreeISAPNPBase( res ); } else {*/ if( ! ISAPNP_ConfigureCards( res ) ) { // Unable to configure cards Req( "Unable to configure the cards. This is most likely\n" "because of an unresolvable hardware conflict.\n\n" "Use the DISABLE_DEVICE tool type to disable one of\n" "the devices in conflict." ); FreeISAPNPBase( res ); } else ISAPNPBase = res; /* }*/ } } } } return ISAPNPBase; }
struct ISAPNPBase* ASMCALL initRoutine( REG( d0, struct ISAPNPBase* res ), REG( a0, APTR seglist ), REG( a6, struct ExecBase* sysbase ) ) { SysBase = sysbase; if( ! OpenLibs() ) { // No libraries? Req( "Failed to open required libraries." ); } else { ULONG actual; struct CurrentBinding current_binding; actual = GetCurrentBinding( ¤t_binding, sizeof( current_binding ) ); if( actual < sizeof( current_binding ) ) { // No legal CurrentBinding structure Req( "No legal CurrentBinding structure found." ); } else { struct ConfigDev* cd = current_binding.cb_ConfigDev; if( cd == NULL ) { // No card found Req( "No bridge card found." ); } else { if( cd->cd_Rom.er_Manufacturer != 2150 || cd->cd_Rom.er_Product != 1 ) { // Unsupported ISA bridge Req( "Unsupported ISA bridge: %ld/%ld.\n" "Only the GG2 Bus+ card is supported.", cd->cd_Rom.er_Manufacturer, cd->cd_Rom.er_Product ); } else { if( cd->cd_BoardAddr == NULL ) { // No board address? Req( "No board address?" ); } else { // Set up the ISAPNPBase structure res->m_Library.lib_Node.ln_Type = NT_RESOURCE; res->m_Library.lib_Node.ln_Name = (STRPTR) ResName; res->m_Library.lib_Flags = LIBF_SUMUSED | LIBF_CHANGED; res->m_Library.lib_Version = VERSION; res->m_Library.lib_Revision = REVISION; res->m_Library.lib_IdString = (STRPTR) IDString; NewList( &res->m_Cards ); res->m_Base = cd->cd_BoardAddr; res->m_RegReadData = 0x0000; res->m_ConfigDev = cd; if( ! ISAPNP_ScanCards( res ) ) { // No cards found Req( "No PnP ISA cards found." ); FreeISAPNPBase( res ); } else { struct ISAPNP_Card* card; card = ISAPNP_AllocCard( res ); if( card == NULL ) { Req( "Out of memory!" ); FreeISAPNPBase( res ); } else { static const char descr[] = "Non-PnP devices"; char* d; d = AllocVec( sizeof( descr ), MEMF_PUBLIC ); if( d != NULL ) { CopyMem( (void*) descr, d, sizeof( descr ) ); card->isapnpc_Node.ln_Name = d; } card->isapnpc_ID.isapnpid_Vendor[ 0 ] = '?'; card->isapnpc_ID.isapnpid_Vendor[ 1 ] = '?'; card->isapnpc_ID.isapnpid_Vendor[ 2 ] = '?'; card->isapnpc_SerialNumber = -1; // Add *first* AddHead( &res->m_Cards, (struct Node*) card ); // Let's see if we're to disable any cards or devices etc if( ! HandleToolTypes( current_binding.cb_ToolTypes, card, res ) ) { // Error requester already displayed. FreeISAPNPBase( res ); } else { if( ! ISAPNP_ConfigureCards( res ) ) { // Unable to configure cards Req( "Unable to configure the cards. This is most likely\n" "because of an unresolvable hardware conflict.\n\n" "Use the DISABLE_DEVICE tool type to disable one of\n" "the devices in conflict." ); FreeISAPNPBase( res ); } else { cd->cd_Flags &= ~CDF_CONFIGME; cd->cd_Driver = res; ISAPNPBase = res; } } } } } } } } } return ISAPNPBase; }