void i82557eeprom::dumpContents() { EEPROM_t * eeprom_p = &image.fields; IOLog("The EEPROM contains the following information:\n"); IOLog("ethernet address: "); _logAddr((unsigned char *) &eeprom_p->addr); IOLog("\n"); if (eeprom_p->compatibility_0 & EEPROM_C0_MC_10) IOLog("compatibility: MCSETUP workaround required for 10 Mbits\n"); if (eeprom_p->compatibility_0 & EEPROM_C0_MC_100) IOLog("compatibility: MCSETUP workaround required for 100 Mbits\n"); IOLog("connectors: %s %s %s %s\n", eeprom_p->connectors & EEPROM_CON_RJ45 ? "RJ-45" : "", eeprom_p->connectors & EEPROM_CON_BNC ? "BNC" : "", eeprom_p->connectors & EEPROM_CON_AUI ? "AUI" : "", eeprom_p->connectors & EEPROM_CON_MII ? "MII" : ""); IOLog("controller type: %d\n", eeprom_p->controllerType); for (int i = 0; i < NUM_PHYS; i++) { const char * s = (i == PRIMARY_PHY) ? "primary" : "secondary"; UInt16 phy = ReadLE16(&eeprom_p->phys[i]); IOLog("%s PHY: %s\n", s, PHYDeviceNames(CSR_VALUE(EEPROM_PHY_DEVICE, phy))); if (CSR_VALUE(EEPROM_PHY_DEVICE, phy) != PHYDevice_None_e) { if (phy & EEPROM_PHY_VSCR) IOLog("%s PHY: vendor specific code required\n", s); if (phy & EEPROM_PHY_10) IOLog("%s PHY: 10 Mbits only, requires 503 interface\n", s); IOLog("%s PHY address: 0x%x\n", s, CSR_VALUE(EEPROM_PHY_ADDRESS, phy)); } } IOLog("PWA Number: %d %d %d-0%d\n", eeprom_p->PWANumber[1], eeprom_p->PWANumber[0], eeprom_p->PWANumber[3], eeprom_p->PWANumber[2]); IOLog("Checksum: 0x%x\n", ReadLE16(&eeprom_p->checkSum)); #if 0 if (eeprom_p->checkSum != image.words[NUM_EEPROM_WORDS - 1]) IOLog("the checksum in the struct doesn't match that in the array\n"); #endif return; }
forensic1394_result platform_enable_sbp2(forensic1394_bus *bus, const uint32_t *sbp2dir, size_t len) { int i; CFMutableDictionaryRef matchingDict; io_iterator_t iterator; io_object_t currdev; IOCFPlugInInterface **plugIn; SInt32 theScore; // Unused IOFireWireLibDeviceRef localDev; IOFireWireLibLocalUnitDirectoryRef localUnitDir; IOReturn iret; forensic1394_result fret = FORENSIC1394_RESULT_SUCCESS; // We need to get the systems local device node to update the CSR matchingDict = IOServiceMatching("IOFireWireLocalNode"); iret = IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, &iterator); // If the call fails then we do not need to release the iterator require_success(iret, cleanupNull, fret); // There should only be one of these; so grab the first currdev = IOIteratorNext(iterator); // Get a plug-in interface to the device IOCreatePlugInInterfaceForService(currdev, kIOFireWireLibTypeID, kIOCFPlugInInterfaceID, &plugIn, &theScore); // Ensure plugIn is != NULL; otherwise this is a general error require_assertion(plugIn, cleanupCurrdev, fret, FORENSIC1394_RESULT_OTHER_ERROR); // Use this plug-in to get a firewire device interface iret = (*plugIn)->QueryInterface(plugIn, CFUUIDGetUUIDBytes(kIOFireWireDeviceInterfaceID_v9), (void **) &localDev); require_success(iret, cleanupPlugIn, fret); // Use this device interface to open up the device (*localDev)->Open(localDev); // And grab a unit local directory interface localUnitDir = (*localDev)->CreateLocalUnitDirectory(localDev, CFUUIDGetUUIDBytes(kIOFireWireLocalUnitDirectoryInterfaceID)); // Add the unit directory, ignoring the first entry for (i = 1; i < len; i++) { // The entries are passed as <8-bit key><24-bit value> UInt32 key = CSR_KEY(sbp2dir[i]); UInt32 value = CSR_VALUE(sbp2dir[i]); // Add the key-value pair to the local unit directory (*localUnitDir)->AddEntry_UInt32(localUnitDir, key, value, NULL); } // Publish this unit directory (*localUnitDir)->Publish(localUnitDir); // Save the interface references for later bus->pbus->localDev = localDev; bus->pbus->localUnitDir = localUnitDir; cleanupPlugIn: // Release the plug-in interface IODestroyPlugInInterface(plugIn); cleanupCurrdev: // Release the current device io_object IOObjectRelease(currdev); // Release the iterator used to find the device IOObjectRelease(iterator); cleanupNull: // Should be FORENSIC1394_RESULT_SUCCESS unless changed by an error macro return fret; }