/* attach 2nd winbond 627HF */ void TyanTigerMPinit() { unsigned char c; OpenIO(); if (vendercheck()) { CloseIO(); /* change ISA IO-port to 627HF */ isa_port_base = SENS2_IO_PORT; return; } OUTb(TTPortCTR, 0x87); /* get access to 627HF on TTPortCTR */ OUTb(TTPortCTR, 0x87); OUTb(TTPortCTR, 0x07); OUTb(TTPortDAT, 0x0B); /* want device as 0x0B access */ OUTb(TTPortCTR, 0x60); /* want device 0x0B on ISA port base 0x0C00 */ c = SENS2_IO_PORT >> 8; OUTb(TTPortDAT, c); OUTb(TTPortCTR, 0x61); c = SENS2_IO_PORT & 0xFF; OUTb(TTPortDAT, c); /* change ISA IO-port to 627HF */ isa_port_base = SENS2_IO_PORT; OUTb(TTPortCTR, 0x30); /* now enabled */ OUTb(TTPortDAT, 0x01); #ifdef TyanTigerMP_SMBUS OUTb(TTPortCTR, 0x2B); /* SMBus access enabled */ c = INb(TTPortDAT) & 0x3F; OUTb(TTPortCTR, 0x2B); OUTb(TTPortDAT, c); writebyte(WINBD_SMBADDR, 0x2E); /* set 627HF on SMBus slave 0x5C(0x2E) */ writebyte(WINBD_TEMPADDR, 0x32); /* set temp2,3 on SMBus slave 0x94,0x96 */ #endif writebyte(WINBD_CONFIG, 0x80); /* kickstart it */ writebyte(WINBD_CONFIG, 0x01); CloseIO(); return; }
void cleanup(int kod,char *text) { shutdownnode(NODSER); CloseIO(); if(NiKwind) CloseWindow(NiKwind); if(RexxSysBase) CloseLibrary((struct Library *)RexxSysBase); if(nikomnodeport) { RemPort(nikomnodeport); DeleteMsgPort(nikomnodeport); } if(rexxport) { RemPort(rexxport); DeleteMsgPort(rexxport); } if(NiKomBase) CloseLibrary(NiKomBase); if(UtilityBase) CloseLibrary(UtilityBase); if(IntuitionBase) CloseLibrary((struct Library *)IntuitionBase); printf("%s",text); exit(kod); }
void cleanup(int kod,char *fel) { shutdownnode(NODCON); freealiasmem(); freeeditlist(); CloseIO(); if(NiKwind) CloseWindow(NiKwind); if(RexxSysBase) CloseLibrary((struct Library *)RexxSysBase); if(nikomnodeport) { RemPort(nikomnodeport); DeleteMsgPort(nikomnodeport); } if(rexxport) { RemPort(rexxport); DeleteMsgPort(rexxport); } if(NiKomBase) CloseLibrary(NiKomBase); if(UtilityBase) CloseLibrary(UtilityBase); if(IntuitionBase) CloseLibrary((struct Library *)IntuitionBase); printf("%s",fel); exit(kod); }
void cleanup(int kod,char *text) { CloseCatalog(g_Catalog); freealiasmem(); freeeditlist(); CloseIO(); if(NiKwind) CloseWindow(NiKwind); if(RexxSysBase) CloseLibrary((struct Library *)RexxSysBase); if(nikomnodeport) { RemPort(nikomnodeport); DeleteMsgPort(nikomnodeport); } if(rexxport) { RemPort(rexxport); DeleteMsgPort(rexxport); } shutdownnode(NODSPAWNED); if(NiKomBase) CloseLibrary(NiKomBase); if(UtilityBase) CloseLibrary(UtilityBase); if(LocaleBase) CloseLibrary(LocaleBase); if(IntuitionBase) CloseLibrary((struct Library *)IntuitionBase); printf("%s",text); exit(kod); }
int main() { int i, n; int viahwm_base, smb_base; int Reg47, Reg48, Reg49; char *smb = ""; n = pci_pm_smb_prob(&viahwm_base, &smb_base); if (n <= 0) { fprintf(stderr, "No SMBus candidates found!!\n"); exit(-1); } else if (n > 0) { switch (n) { case VIA686SMB: smb = "VIA686SMB"; break; case VIA686HWM: smb = "VIA686HWM"; break; case VIA596SMB: smb = "VIA596SMB"; break; case PIIX4SMB: smb = "PIIX4SMB"; break; case SRVWSSSMB: smb = "SRVWSSSMB"; break; case VIA8233SMB: smb = "VIA8233SMB"; break; case ICH801SMB: smb = "ICH801SMB"; break; case AMD756SMB: smb = "AMD756SMB"; break; case NFORCESMB: smb = "NFORCESMB"; break; case ALI1535SMB: smb = "ALI1535SMB"; break; case ALI15X3SMB: smb = "ALI15X3SMB"; break; case AMD8111SMB: smb = "AMD8111SMB"; break; case NFORCE2SMB: smb = "NFORCE2SMB"; break; } printf(" *** SMBus %s found! --- SMBus Base=0x%04X.\n", smb, smb_base); } if (n/10 == AMD756SMB/10) smbus = &smbus_amd; else if (n/10 == ALI1535SMB/10) smbus = &smbus_ali; else if (n/10 == AMD8111SMB/10) smbus = &smbus_amd8; else smbus = &smbus_piix4; /* Big loop for smb_base candidates */ fprintf(stderr, "\n*** Testing SMBus base = 0x%04X ***\n", smb_base); if(OpenIO() == -1) return -1; Reg47 = ReadByte(0x47); i = Reg47; printf(" CheckingFanDV(CR47) = %02X\n", i); Reg48 = ReadByte(0x48); i = Reg48&0x7F; printf(" MainSMBusADDR(CR48) = %02X\n", 2*i); Reg49 = ReadByte(0x49); i = Reg49; printf(" DeviceID(CR49&0xFE) = %02X\n", i&0xFE); if (Reg47 == -1 && Reg48 == -1 && Reg49 == -1) { fprintf(stderr, "No Hardware Monitor found on this SMBus base!\n"); goto exit; } WriteByte(0x4E, 0x00); i = ReadByte(0x4F); printf(" VenderID(CR4E=0,CR4F)= %02X\n", i); i = ReadByte(0x58); printf(" ChipID(CR58) = %02X\n", i); i = ReadByte(0x27); printf(" Temp0(CR27) = %02X\n", i); i = ReadByte(0x20); printf(" Vcore(CR20) = %02X\n", i); i = ReadByte(0x22); printf(" V3.3 (CR22) = %02X\n", i); i = ReadByte(0x23); printf(" V5.0 (CR23) = %02X\n", i); i = ReadByte(0x24); printf(" V12.0(CR24) = %02X\n", i); #ifdef FAN_DIV_CHK /* NOTE: I don't know why, but if system function "sleep()" is called while "/dev/io" is being opened, "xmbmon" crashes (it goes into infinite loop somewhere in kernel or shared library). So, it is important to close it when calling sleep()! */ { int reg, i1, i2; CloseIO(); printf("\nFan Devisor(CR47) Check:\n"); if(OpenIO() == -1) return -1; reg = (Reg47 & 0x0F) | 0x00; /* 0000 : divisor 1 1 */ printf(" write(CR47,0?:11) --->"); WriteByte(0x47, reg); CloseIO(); sleep(2); if(OpenIO() == -1) return -1; i = ReadByte(0x28); i1 = ReadByte(0x29); i2 = ReadByte(0x2A); printf(" CR28,CR29,CR2A = %02X,%02X,%02X\n", i, i1, i2); reg = (Reg47 & 0x0F) | 0x10; /* 0001 : divisor 2 1 */ printf(" write(CR47,1?:21) --->"); WriteByte(0x47, reg); CloseIO(); sleep(2); if(OpenIO() == -1) return -1; i = ReadByte(0x28); i1 = ReadByte(0x29); i2 = ReadByte(0x2A); printf(" CR28,CR29,CR2A = %02X,%02X,%02X\n", i, i1, i2); reg = (Reg47 & 0x0F) | 0x20; /* 0010 : divisor 4 1 */ printf(" write(CR47,2?:41) --->"); WriteByte(0x47, reg); CloseIO(); sleep(2); if(OpenIO() == -1) return -1; i = ReadByte(0x28); i1 = ReadByte(0x29); i2 = ReadByte(0x2A); printf(" CR28,CR29,CR2A = %02X,%02X,%02X\n", i, i1, i2); reg = (Reg47 & 0x0F) | 0x30; /* 0011 : divisor 8 1 */ printf(" write(CR47,3?:81) --->"); WriteByte(0x47, reg); CloseIO(); sleep(2); if(OpenIO() == -1) return -1; i = ReadByte(0x28); i1 = ReadByte(0x29); i2 = ReadByte(0x2A); printf(" CR28,CR29,CR2A = %02X,%02X,%02X\n", i, i1, i2); reg = (Reg47 & 0x0F) | 0x40; /* 0100 : divisor 1 2 */ printf(" write(CR47,4?:12) --->"); WriteByte(0x47, reg); CloseIO(); sleep(2); if(OpenIO() == -1) return -1; i = ReadByte(0x28); i1 = ReadByte(0x29); i2 = ReadByte(0x2A); printf(" CR28,CR29,CR2A = %02X,%02X,%02X\n", i, i1, i2); reg = (Reg47 & 0x0F) | 0x80; /* 1000 : divisor 1 4 */ printf(" write(CR47,8?:14) --->"); WriteByte(0x47, reg); CloseIO(); sleep(2); if(OpenIO() == -1) return -1; i = ReadByte(0x28); i1 = ReadByte(0x29); i2 = ReadByte(0x2A); printf(" CR28,CR29,CR2A = %02X,%02X,%02X\n", i, i1, i2); reg = (Reg47 & 0x0F) | 0xC0; /* 1100 : divisor 1 8 */ printf(" write(CR47,C?:18) --->"); WriteByte(0x47, reg); CloseIO(); sleep(2); if(OpenIO() == -1) return -1; i = ReadByte(0x28); i1 = ReadByte(0x29); i2 = ReadByte(0x2A); printf(" CR28,CR29,CR2A = %02X,%02X,%02X\n", i, i1, i2); WriteByte(0x47, Reg47); } #endif exit: CloseIO(); return 0; }
/* * Asynchronous object call for * operation 'odbcas_ASSvc_WouldLikeToLive' */ extern CEE_status odbcas_ASSvc_WouldLikeToLive_pst_( /* In */ const CEE_handle_def *ph_ , /* In */ CEE_tag_def tag_ , /* In */ odbcas_ASSvc_WouldLikeToLive_cct_ rtn_ , /* In */ IDL_long srvrType , /* In */ const IDL_char *srvrObjRef ) { CEE_status retcode = CEE_SUCCESS; bool sts; long wlength,rlength; char* wbuffer, *rbuffer; CFSystemDrvr* FileSystem = GTransport.m_FSystemDrvr_list->ins_node(); if (FileSystem == NULL) return CEE_ALLOCFAIL; FileSystem->odbcAPI = AS_API_WOULDLIKETOLIVE; FileSystem->dialogueId = 0; FileSystem->dwTimeout = 0; // // do marshaling of input parameters // retcode = odbcas_ASSvc_WouldLikeToLive_param_pst_( FileSystem , wbuffer , wlength , srvrType , srvrObjRef); if (retcode != CEE_SUCCESS) goto bailout; sts = OpenIO (FileSystem,srvrGlobal->ASProcessName); if (sts == false) { retcode = GET_ERROR((long)FileSystem); goto bailout; } sts = DoIO (FileSystem, wbuffer, wlength, rbuffer, rlength); if (sts == false) { retcode = GET_ERROR((long)FileSystem); goto bailout; } CloseIO (FileSystem); // // process output parameters // long* param[2]; retcode = decodeParameters(2, param, rbuffer, rlength); if (retcode != CEE_SUCCESS) { //LCOV_EXCL_START strcpy( errStrBuf2, "odbcas_drvr.cpp"); strcpy( errStrBuf3, "SRVR-odbcas_ASSvc_WouldLikeToLive_pst_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "retcode <%d>", retcode); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); SRVR::exitServerProcess(); //LCOV_EXCL_STOP } { void *pv_[3] = {0}; pv_[1] = (void *)param[0]; pv_[2] = (void *)param[1]; odbcas_ASSvc_WouldLikeToLive_ccw_( /* In */ (void *) rtn_ , /* In */ tag_ , /* In */ pv_); } bailout: GTransport.m_FSystemDrvr_list->del_node(FileSystem); return retcode; }
SQLRETURN TERMINATE_DIALOG(SRVR_CALL_CONTEXT *srvrCallContext) { CEE_status sts; long timerTimeout; odbc_SQLSvc_TerminateDialogue_exc_ exception_; CConnect *pConnection = (CConnect *)srvrCallContext->sqlHandle; timerTimeout = srvrCallContext->connectionTimeout > 10 ? srvrCallContext->connectionTimeout : 10; sts = odbc_SQLSvc_TerminateDialogue_(NULL, srvrCallContext, srvrCallContext->dialogueId, &exception_); if (sts != CEE_SUCCESS) { if (sts == CEE_INTERNALFAIL) { pConnection->setDiagRec(DRIVER_ERROR, IDS_EXCEPTION_MSG,0,"SQL SERVER", NULL,SQL_ROW_NUMBER_UNKNOWN,SQL_COLUMN_NUMBER_UNKNOWN,2,"Internal Error","TERMINATE_DIALOG"); return SQL_ERROR; } pConnection->setDiagRec(DRIVER_ERROR, IDS_S1_000, sts, FORMAT_ERROR((long)pConnection->m_srvrTCPIPSystem), NULL, SQL_ROW_NUMBER_UNKNOWN, SQL_COLUMN_NUMBER_UNKNOWN, 1, "TERMINATE_DIALOG failed"); return SQL_SUCCESS_WITH_INFO; } // Start CCF pConnection->setExceptionErrors(exception_.exception_nr, exception_.exception_detail); switch (exception_.exception_nr) { case CEE_SUCCESS: pConnection->resetGetObjRefHdlOutput(); break; case odbc_SQLSvc_TerminateDialogue_SQLError_exn_: if (exception_.exception_detail == 25000) pConnection->setDiagRec(DRIVER_ERROR, IDS_25_000); else pConnection->setDiagRec(&exception_.u.SQLError); break; case odbc_SQLSvc_TerminateDialogue_ParamError_exn_: pConnection->setDiagRec(SERVER_ERROR, IDS_PROGRAM_ERROR, exception_.exception_nr, exception_.u.ParamError.ParamDesc); break; case odbc_SQLSvc_TerminateDialogue_InvalidConnection_exn_: pConnection->sendCDInfo(exception_.exception_nr); pConnection->setDiagRec(SERVER_ERROR, IDS_08_S01); break; default: pConnection->sendCDInfo(exception_.exception_nr); pConnection->setDiagRec(exception_.exception_nr, TERMINATE_DIALOG_PROCNAME, pConnection->getSrvrIdentity()); break; } if (exception_.exception_detail != 25000) CloseIO (pConnection->m_srvrTCPIPSystem); // Close CCF // // cleanup // if(exception_.exception_nr == odbc_SQLSvc_TerminateDialogue_SQLError_exn_ && exception_.u.SQLError.errorList._length > 0 ) delete[] exception_.u.SQLError.errorList._buffer; switch (pConnection->getExceptionNr()) { case CEE_SUCCESS: return SQL_SUCCESS; default: // if transaction is open return SQL_ERROR if (pConnection->getExceptionDetail() == 25000) return -25000; else // Any other errors treat them as if it has been disconnected return SQL_SUCCESS_WITH_INFO; } } // TERMINATE_DIALOG()
extern "C" CEE_status odbcas_ASSvc_GetObjRefHdl_( /* In */ const CEE_handle_def *ph_ , /* In */ CEE_tag_def tag_ , /* In */ const CONNECTION_CONTEXT_def *inContext , /* In */ const USER_DESC_def *userDesc , /* In */ IDL_long srvrType , /* In */ IDL_short retryCount , /* Out */ odbcas_ASSvc_GetObjRefHdl_exc_ *exception_ , /* Out */ char *srvrObjRef , /* Out */ DIALOGUE_ID_def *dialogueId , /* Out */ char *dataSource , /* Out */ USER_SID_def *userSid , /* Out */ VERSION_LIST_def *versionList , /* Out */ IDL_long *isoMapping , /* Out */ IDL_long *srvrNodeId , /* Out */ IDL_long *srvrProcessId , /* Out */ IDL_long_long *timestamp ) { CEE_status retcode; bool sts; IDL_long wlength,rlength; IDL_char* wbuffer, *rbuffer; IDL_char* curptr; IDL_long msg_total_length = 0; IDL_long exceptionLength = 0; IDL_long datasourceLength = 0; IDL_long srvrObjRefLength = 0; IDL_long userSidLength = 0; IDL_long clusternameLength = 0; VERSION_def version[4]; VERSION_def* versionPtr = &version[0]; char srvrHostName[100] = {0}; IDL_long srvrHostNameLength = 0; char srvrProcessName[100] = {0}; IDL_long srvrProcessNameLength = 0; char srvrIpAddress[100] = {0}; IDL_long srvrIpAddressLength = 0; IDL_long srvrPort = 0; SRVR_CALL_CONTEXT *srvrCallContext = (SRVR_CALL_CONTEXT *)tag_; CConnect *pConnection = (CConnect *)srvrCallContext->sqlHandle; pConnection->m_asTCPIPSystem->odbcAPI = AS_API_GETOBJREF; pConnection->m_asTCPIPSystem->dialogueId = srvrCallContext->dialogueId; pConnection->m_asTCPIPSystem->dwTimeout = srvrCallContext->u.connectParams.loginTimeout; // // do marshaling of input parameters // retcode = odbcas_ASSvc_GetObjRefHdl_param_pst_( pConnection->m_asTCPIPSystem , wbuffer , wlength , inContext , userDesc , srvrType , retryCount); if (retcode != CEE_SUCCESS) return retcode; sts = OpenIO (pConnection->m_asTCPIPSystem,pConnection->getAsObjRef()); if (sts == false) return MAP_AS_ERRORS((long)pConnection->m_asTCPIPSystem); sts = DoIO (pConnection->m_asTCPIPSystem, wbuffer, wlength, rbuffer, rlength,pConnection); if (sts == false) return MAP_AS_ERRORS((long)pConnection->m_asTCPIPSystem); CloseIO (pConnection->m_asTCPIPSystem); // // process output parameters // char swap = pConnection->m_asTCPIPSystem->swap(); curptr = rbuffer; // // copy odbcas_ASSvc_GetObjRefHdl_exc_ *exception_ // exception_->exception_nr = *(IDL_long *)(curptr + msg_total_length); msg_total_length += sizeof(exception_->exception_nr); LONG_swap(&exception_->exception_nr,swap); exception_->exception_detail = *(IDL_long *)(curptr + msg_total_length); msg_total_length += sizeof(exception_->exception_detail); LONG_swap(&exception_->exception_detail,swap); exceptionLength = *(IDL_long *)(curptr + msg_total_length); msg_total_length += sizeof(exceptionLength); LONG_swap(&exceptionLength,swap); if(exceptionLength > 0) { exception_->u.ASParamError.ErrorText = (IDL_char*)(curptr+msg_total_length); msg_total_length += exceptionLength; return CEE_SUCCESS; // no point in continuing } // // copy DIALOGUE_ID_def dialogueId // *dialogueId = *(IDL_long *) (curptr + msg_total_length); msg_total_length += sizeof(*dialogueId); LONG_swap(dialogueId,swap); // // copy IDL_char *dataSource // datasourceLength = *(IDL_long *)(curptr + msg_total_length); msg_total_length += sizeof(datasourceLength); LONG_swap(&datasourceLength,swap); if (datasourceLength != 0) { memcpy(dataSource, curptr + msg_total_length, datasourceLength); msg_total_length += datasourceLength; } // copy userSidLength userSid->_length = *(IDL_unsigned_long *)(curptr+msg_total_length); msg_total_length += sizeof(userSid->_length); ULONG_swap(&userSid->_length,swap); // copy userSid if (userSid->_length != 0) { userSid->_buffer = (unsigned char *)(IDL_char*)(curptr+msg_total_length); msg_total_length += userSid->_length+1; } // copy VERSION_LIST_def *versionList versionList->_length = *(IDL_unsigned_long *)(curptr + msg_total_length); msg_total_length += sizeof(versionList->_length); ULONG_swap(&versionList->_length,swap); // Get the versionPtr versionList->_buffer = (VERSION_def *)new char[versionList->_length*sizeof(VERSION_def)]; versionPtr = versionList->_buffer; for (int i = 0; i < versionList->_length; i++) { // copy componentId versionPtr->componentId = *(IDL_short *)(curptr + msg_total_length); msg_total_length += sizeof(versionPtr->componentId); SHORT_swap(&versionPtr->componentId,swap); // copy majorVersion versionPtr->majorVersion = *(IDL_short *)(curptr + msg_total_length); msg_total_length += sizeof(versionPtr->majorVersion); SHORT_swap(&versionPtr->majorVersion,swap); // copy minorVersion versionPtr->minorVersion = *(IDL_short *)(curptr + msg_total_length); msg_total_length += sizeof(versionPtr->minorVersion); SHORT_swap(&versionPtr->minorVersion,swap); // copy buildId versionPtr->buildId = *(IDL_unsigned_long *)(curptr + msg_total_length); msg_total_length += sizeof(versionPtr->buildId); ULONG_swap(&versionPtr->buildId,swap); // Get the next versionlist values versionPtr++; } //Check whether connected to an R2.3 server if (versionList->_buffer->buildId & CHARSET) { // // copy IDL_long isoMapping // *isoMapping = *(IDL_long *) (curptr + msg_total_length); msg_total_length += sizeof(*isoMapping); LONG_swap(isoMapping,swap); } else *isoMapping = NON_CHARSET_SYSTEM ; //Connected to an R2.2 system. // // copy IDL_char *srvrHostName // srvrHostNameLength = *(IDL_long *)(curptr + msg_total_length); msg_total_length += sizeof(srvrHostNameLength); LONG_swap(&srvrHostNameLength,swap); if (srvrHostNameLength != 0) { memcpy(srvrHostName, curptr + msg_total_length, srvrHostNameLength); msg_total_length += srvrHostNameLength; } // // copy IDL_long srvrNodeId // *srvrNodeId = *(IDL_long *) (curptr + msg_total_length); msg_total_length += sizeof(*srvrNodeId); LONG_swap(srvrNodeId,swap); // // copy IDL_long srvrProcessId // *srvrProcessId = *(IDL_long *) (curptr + msg_total_length); msg_total_length += sizeof(*srvrProcessId); LONG_swap(srvrProcessId,swap); // // copy IDL_char *srvrProcessName // srvrProcessNameLength = *(IDL_long *)(curptr + msg_total_length); msg_total_length += sizeof(srvrProcessNameLength); LONG_swap(&srvrProcessNameLength,swap); if (srvrProcessNameLength != 0) { memcpy(srvrProcessName, curptr + msg_total_length, srvrProcessNameLength); msg_total_length += srvrProcessNameLength; } // // copy IDL_char *srvrIpAddress // srvrIpAddressLength = *(IDL_long *)(curptr + msg_total_length); msg_total_length += sizeof(srvrIpAddressLength); LONG_swap(&srvrIpAddressLength,swap); if (srvrProcessNameLength != 0) { memcpy(srvrIpAddress, curptr + msg_total_length, srvrIpAddressLength); msg_total_length += srvrIpAddressLength; } // // copy IDL_long srvrPort // srvrPort = *(IDL_long *) (curptr + msg_total_length); msg_total_length += sizeof(srvrPort); LONG_swap(&srvrPort,swap); sprintf(srvrObjRef,"TCP:%s:%d.%s,%s/%d:ODBC", srvrHostName, *srvrNodeId, srvrProcessName, srvrIpAddress, srvrPort); //Check whether connected to server with password security support if (versionList->_buffer->buildId & PASSWORD_SECURITY) { // // copy IDL_long_long timestamp // *timestamp = *(IDL_long_long *) (curptr + msg_total_length); msg_total_length += sizeof(*timestamp); LONGLONG_swap(timestamp,swap); // // copy clustername // clusternameLength = *(IDL_long *)(curptr + msg_total_length); msg_total_length += sizeof(clusternameLength); LONG_swap(&clusternameLength,swap); if (clusternameLength != 0) { memcpy(pConnection->m_ClusterName, curptr + msg_total_length, clusternameLength); msg_total_length += clusternameLength; } } return CEE_SUCCESS; }
/* * Synchronous object call for * operation 'odbcas_ASSvc_StopSrvr' */ extern "C" void odbcas_ASSvc_StopSrvr( /* In */ const CEE_handle_def *ph_ , /* Out */ struct odbcas_ASSvc_StopSrvr_exc_ *exception_ , /* In */ DIALOGUE_ID_def dialogueId , /* In */ IDL_long srvrType , /* In */ const IDL_char *srvrObjRef , /* In */ IDL_long StopType ) { CEE_status retcode; bool sts; IDL_char *curptr; IDL_long msg_total_len = 0; IDL_long wlength, rlength; IDL_char *wbuffer, *rbuffer; SRVR_CALL_CONTEXT *srvrCallContext = (SRVR_CALL_CONTEXT *)ph_; CConnect *pConnection = (CConnect *)srvrCallContext->sqlHandle; pConnection->m_asTCPIPSystem->odbcAPI = AS_API_STOPSRVR; pConnection->m_asTCPIPSystem->dialogueId = srvrCallContext->dialogueId; pConnection->m_asTCPIPSystem->dwTimeout = srvrCallContext->u.connectParams.loginTimeout; // // do marshaling of input parameters // retcode = odbcas_ASSvc_StopSrvr_param_pst_( pConnection->m_asTCPIPSystem , wbuffer , wlength , dialogueId , srvrType , srvrObjRef , StopType); if (retcode != CEE_SUCCESS) return; sts = OpenIO (pConnection->m_asTCPIPSystem,pConnection->getAsObjRef()); if (sts == false) return; sts = DoIO (pConnection->m_asTCPIPSystem, wbuffer, wlength, rbuffer, rlength,pConnection); if (sts == false) return; CloseIO (pConnection->m_asTCPIPSystem); // // process output parameters // char swap = pConnection->m_asTCPIPSystem->swap(); msg_total_len = 0; curptr = rbuffer; // // exception_ // IDL_long ExceptionLength; // // exception_ ->exception_nr // exception_->exception_nr = *(IDL_long*)(curptr+msg_total_len); msg_total_len += sizeof(exception_->exception_nr); LONG_swap(&exception_->exception_nr,swap); // // exception_ ->exception_detail // exception_->exception_detail = *(IDL_long*)(curptr+msg_total_len); msg_total_len += sizeof(exception_->exception_detail); LONG_swap(&exception_->exception_detail,swap); ExceptionLength = *(IDL_long*)(curptr+msg_total_len); msg_total_len += sizeof(ExceptionLength); LONG_swap(&ExceptionLength,swap); if(ExceptionLength > 0) { exception_->u.ASParamError.ErrorText = (IDL_char*)(curptr+msg_total_len); msg_total_len += ExceptionLength; } return; }
int main() { int smb_base, i, j, k, n, num_smb; u_int chipID; u_int chipA[256]; int smb_baseA[256]; int blacklist[] = {0xD2,-1}; if ((n = pci_smb_prob(smb_baseA, chipA)) == 1) { smb_base = smb_baseA[0]; chipID = chipA[0]; printf("Only one SMBus candidate found! ChipID=0x%08X.\n", chipID); } else if (n == 0) { fprintf(stderr, "No SMBus candidates found!!\n"); exit(-1); } else if (n > 1) { printf("%d SMBus candidates found!??? Checking...\n", n); for(i = 0; i < n; ++i) printf("ChipID=0x%08X SMBus Base(?)=0x%04X.\n",\ chipA[i], smb_baseA[i]); } else if (n == -1) { fprintf(stderr, "Cannot open IO-port, needs privilege!\n"); exit(-1); } /* Big loop for smb_base candidates */ num_smb = n; for (n = 0; n < num_smb; n++) { smb_base = smb_baseA[n]; chipID = chipA[n]; fprintf(stderr, "\n*** Testing SMBus base = 0x%04X ***\n", smb_base); smbus = &smbus_piix4; switch (chipID) { case ID_VIA686: fprintf(stderr, "VIA686(KT133 south) found.\n"); break; case ID_VIA596: case ID_VIA596B: fprintf(stderr, "VIA596 found.\n"); break; case ID_PIIX4: case ID_PII440MX: case ID_EFVIC66: fprintf(stderr, "IntelPIIX4(440BX south) found.\n"); break; case ID_SRVWSB4: case ID_SRVWSB5: fprintf(stderr, "ServerWorks(ServerSet Chipset) found.\n"); break; case ID_VIA8233: case ID_VIA8233A: case ID_VIA8233C: case ID_VIA8235: fprintf(stderr, "VIA8233/A/8235(KT266/KT333/KT400 south) found.\n"); break; case ID_I801AA: case ID_I801AB: case ID_I801BA: case ID_I801CA: fprintf(stderr, "Intel801/810/815 (ICH/ICH2) found.\n"); break; case ID_AMD756: case ID_AMD766: case ID_AMD768: smbus = &smbus_amd; fprintf(stderr, "AMD756/766/768 found.\n"); break; case ID_NFORCE: smbus = &smbus_amd; fprintf(stderr, "NVidia nFORCE found.\n"); break; case ID_ALI7101: smbus = &smbus_ali; fprintf(stderr, "ALi M1535D+ found.\n"); break; case ID_AMD8111: smbus = &smbus_amd8; fprintf(stderr, "AMD8111 found.\n"); break; case ID_NFORCE2: smbus = &smbus_amd8; fprintf(stderr, "NVidia nForce2 found.\n"); break; default: fprintf(stderr, "No known SMBus(I2C) chip found.\n"); goto exit; } if(OpenIO() == -1) return -1; /* Testing SMBus devices */ for (i = 0; i < 255; i += 2) { for (j = 0; blacklist[j] != -1; j++) { if (i != blacklist[j] && (k = smbus->ReadB(smb_base, i, 0x00)) != -1) { printf(" addr:0x%02X ---> byte of Reg0 =0x%02X\n", i, k); } } } CloseIO(); exit: ; /* dummy statment for gcc 3.4 or after */ } /* endo of Big loop for smb_base candidates */ exit (0); }