int ATAManager::Startup() { DeviceInfo tmpInfo; // poll the hardware and insert each device into the map if(GetDeviceInformation(PRIMARY_IDE, DEVICE_0, tmpInfo)) { ATADrivers.insert(pair<string, ATADriver*>(string("/dev/hda"), new ATADriver(PRIMARY_IDE, DEVICE_0))); ATAInformation.insert(pair<string, DeviceInfo>(string("/dev/hda"), tmpInfo)); // PrintATAInfo(tmpInfo); } if(GetDeviceInformation(PRIMARY_IDE, DEVICE_1, tmpInfo)) { ATADrivers.insert(pair<string, ATADriver*>(string("/dev/hdb"), new ATADriver(PRIMARY_IDE, DEVICE_1))); ATAInformation.insert(pair<string, DeviceInfo>(string("/dev/hdb"), tmpInfo)); // PrintATAInfo(tmpInfo); } if(GetDeviceInformation(SECONDARY_IDE, DEVICE_0, tmpInfo)) { ATADrivers.insert(pair<string, ATADriver*>(string("/dev/hdc"), new ATADriver(SECONDARY_IDE, DEVICE_0))); ATAInformation.insert(pair<string, DeviceInfo>(string("/dev/hdc"), tmpInfo)); // PrintATAInfo(tmpInfo); } if(GetDeviceInformation(SECONDARY_IDE, DEVICE_1, tmpInfo)) { ATADrivers.insert(pair<string, ATADriver*>(string("/dev/hdd"), new ATADriver(SECONDARY_IDE, DEVICE_1))); ATAInformation.insert(pair<string, DeviceInfo>(string("/dev/hdd"), tmpInfo)); // PrintATAInfo(tmpInfo); } // once we have all the drives installed, go through and partition them list<ulong> addrList; for(map<string, ATADriver*>::iterator it = ATADrivers.begin(), end = ATADrivers.end(); it != end; ++it) { addrList.clear(); // clear out the list first GetPartitionAddresses((*it).second, addrList); // get the addresses char charCounter = '1'; // go through the list and make devices for each of these for(list<ulong>::iterator jt = addrList.begin(); jt != addrList.end(); ++jt) { ATADriver *tmp = new ATADriver(*((*it).second)); // copy this device string tmpStr(1, charCounter); tmp->ChangeBaseAddress(*jt); // change it's base address // insert the device with it's new name into the manager ATADrivers.insert(pair<string, ATADriver*>((*it).first + tmpStr, tmp)); ++charCounter; } } return(0); }
/* * Function: wimaxcu_get_device_info * Description: Retrive the device info * Return: */ int wimaxcu_get_device_info(WIMAX_API_DEVICE_ID_P p_device_id) { WIMAX_API_RET wmxStatus = WIMAX_API_RET_SUCCESS; // Device Version WIMAX_API_DEVICE_INFO device_info; WIMAX_API_NVM_VERSION nvm_ver; WIMAX_API_WMF_COMPLIANCE_VERSION wmf_ver; wmxStatus = GetDeviceInformation(p_device_id, &device_info); if (WIMAX_API_RET_SUCCESS != wmxStatus) { PrintWmxStatus(wmxStatus); return 1; } wmxStatus = GetWMFComplianceVersion(&wmf_ver); if (WIMAX_API_RET_SUCCESS != wmxStatus) { PrintWmxStatus(wmxStatus); return 1; } wmxStatus = GetNVMImageVersion(p_device_id, &nvm_ver); if (WIMAX_API_RET_SUCCESS != wmxStatus) { PrintWmxStatus(wmxStatus); return 1; } PrintDeviceInfo(&device_info, &wmf_ver, &nvm_ver); return 0; }
void DosCall44h(i86_Regs *regs) { switch (REG_AL) { case 0x00: GetDeviceInformation(regs); break; case 0x01: SetDeviceInformation(regs); break; default: fprintf(stdout, "int21(AX=%04x): not implemented.\n", WORD(REG_AX)); exit(1); break; } }