Exemple #1
0
void setup_pci_devs(pci_dt_t *pci_dt)
{
	char *devicepath;
	bool do_eth_devprop, do_gfx_devprop, do_enable_hpet, do_igp_devprop;
	pci_dt_t *current = pci_dt;

	do_eth_devprop = do_gfx_devprop = do_enable_hpet = false;

	getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig);
	getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->chameleonConfig);
    getBoolForKey(kIGPEnabler, &do_igp_devprop, &bootInfo->chameleonConfig);
	getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);

	while (current)
	{
		devicepath = get_pci_dev_path(current);

		switch (current->class_id)
		{
			case PCI_CLASS_BRIDGE_HOST:
					if (current->dev.addr == PCIADDR(0, 0, 0))
						dram_controller_dev = current;
				break;
				
			case PCI_CLASS_NETWORK_ETHERNET: 
				if (do_eth_devprop)
					set_eth_builtin(current);
				break;
				
			case PCI_CLASS_DISPLAY_VGA:
				if (do_gfx_devprop){
					switch (current->vendor_id)
					{
						case PCI_VENDOR_ID_ATI:
							setup_ati_devprop(current); 
							break;
					
						case PCI_VENDOR_ID_INTEL:
							setup_gma_devprop(current);
							break;
					
						case PCI_VENDOR_ID_NVIDIA: 
							setup_nvidia_devprop(current);
							break;
					}
				break;
                } else if (do_igp_devprop){
                        setup_gma_devprop(current);
                        break;
                }

			case PCI_CLASS_SERIAL_USB:
				notify_usb_dev(current);
				break;

			case PCI_CLASS_BRIDGE_ISA:
				if (do_enable_hpet)
					force_enable_hpet(current);
				break;
		}
		
		execute_hook("PCIDevice", current, NULL, NULL, NULL);
		
		setup_pci_devs(current->children);
		current = current->next;
	}
}
Exemple #2
0
void setup_pci_devs(pci_dt_t *pci_dt)
{
	char *devicepath;
	BOOL do_eth_devprop, do_gfx_devprop, fix_ehci, fix_uhci, fix_usb, do_enable_hpet;
	pci_dt_t *current = pci_dt;

	do_eth_devprop = do_gfx_devprop = fix_ehci = fix_uhci = fix_usb = do_enable_hpet = false;

	getBoolForKey("EthernetBuiltIn", &do_eth_devprop, &bootInfo->bootConfig);
	getBoolForKey("GraphicsEnabler", &do_gfx_devprop, &bootInfo->bootConfig);
	if (getBoolForKey("USBBusFix", &fix_usb, &bootInfo->bootConfig) && fix_usb)
		fix_ehci = fix_uhci = true;
	else
	{
		getBoolForKey("EHCIacquire", &fix_ehci, &bootInfo->bootConfig);
		getBoolForKey("UHCIreset", &fix_uhci, &bootInfo->bootConfig);
	}
	getBoolForKey("ForceHPET", &do_enable_hpet, &bootInfo->bootConfig);

	while (current)
	{
		devicepath = get_pci_dev_path(current);

		switch (current->class_id)
		{
			case PCI_CLASS_NETWORK_ETHERNET: 
				if (do_eth_devprop)
					set_eth_builtin(current);
				break;
				
			case PCI_CLASS_DISPLAY_VGA:
				if (do_gfx_devprop)
					switch (current->vendor_id)
					{
						case PCI_VENDOR_ID_ATI:
							verbose("ATI VGA Controller [%04x:%04x] :: %s \n", 
							current->vendor_id, current->device_id, devicepath);
							setup_ati_devprop(current); 
							break;
					
							case PCI_VENDOR_ID_INTEL:
								verbose("Intel Graphics Controller [%04x:%04x] :: %s \n", 
								current->vendor_id, current->device_id, devicepath);
								setup_gma_devprop(current); 
								break;
					
						case PCI_VENDOR_ID_NVIDIA: 
							setup_nvidia_devprop(current);
							break;
					}
				break;

			case PCI_CLASS_SERIAL_USB:
				switch (pci_config_read8(current->dev.addr, PCI_CLASS_PROG))
				{
					/* EHCI */
					case 0x20:
				    	if (fix_ehci)
							ehci_acquire(current);
						break;

					/* UHCI */
					case 0x00:
				    	if (fix_uhci)
							uhci_reset(current);
						break;
				}
				break;

			case PCI_CLASS_BRIDGE_ISA:
				if (do_enable_hpet)
					force_enable_hpet(current);
				break;
		}
		
		setup_pci_devs(current->children);
		current = current->next;
	}
}
Exemple #3
0
void setup_pci_devs(pci_dt_t *pci_dt)
{
	char *devicepath;

	bool do_gfx_devprop = false;
	bool do_skip_n_devprop = false;
	bool do_skip_a_devprop = false;
	bool do_skip_i_devprop = false;

	bool do_enable_hpet = false;
	bool do_hda_devprop = false;

	pci_dt_t *current = pci_dt;

	// GraphicsEnabler
	getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->chameleonConfig);

	// Skip keys
	getBoolForKey(kSkipNvidiaGfx, &do_skip_n_devprop, &bootInfo->chameleonConfig);
	getBoolForKey(kSkipAtiGfx, &do_skip_a_devprop, &bootInfo->chameleonConfig);
	getBoolForKey(kSkipIntelGfx, &do_skip_i_devprop, &bootInfo->chameleonConfig);

	// HDAEnable
	getBoolForKey(kHDAEnabler, &do_hda_devprop, &bootInfo->chameleonConfig);

	// ForceHPET
	getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);

	while (current)
	{
		devicepath = get_pci_dev_path(current);

		switch (current->class_id)
		{
			case PCI_CLASS_BRIDGE_HOST:
				DBG("Setup BRIDGE_HOST \n");
				if (current->dev.addr == PCIADDR(0, 0, 0))
				{
					dram_controller_dev = current;
				}
				break; // PCI_CLASS_BRIDGE_HOST

			case PCI_CLASS_NETWORK_ETHERNET:
				DBG("Setup ETHERNET %s enabled\n", do_eth_devprop? "is":"is not");
				verbose("[ ETHERNET DEVICE INFO ]\n");
				setup_eth_devdrop(current);
				verbose("\n");
				break; // PCI_CLASS_NETWORK_ETHERNET

			case PCI_CLASS_NETWORK_OTHER:
				DBG("Setup WIRELESS %s enabled\n", do_wifi_devprop? "is":"is not");
				verbose("[ WIRELESS DEVICE INFO ]\n");
				setup_wifi_devdrop(current);
				verbose("\n");
				break; // PCI_CLASS_NETWORK_OTHER

			case PCI_CLASS_DISPLAY_VGA:
				DBG("GraphicsEnabler %s enabled\n", do_gfx_devprop? "is":"is not");
				if (do_gfx_devprop)
				{
					switch (current->vendor_id)
					{
						case PCI_VENDOR_ID_ATI:
							if ( do_skip_a_devprop )
							{
								verbose("Skip ATi/AMD gfx device!\n");
							}
							else
							{
								verbose("[ ATi GFX DEVICE INFO ]\n");
								setup_ati_devprop(current);
								verbose("\n");
							}
							break; // PCI_VENDOR_ID_ATI

						case PCI_VENDOR_ID_INTEL:
							if ( do_skip_i_devprop )
							{
								verbose("Skip Intel gfx device!\n");
							}
							else
							{
								verbose("[ INTEL GMA DEVICE INFO ]\n");
								setup_gma_devprop(current);
								verbose("\n");
							}
							break; // PCI_VENDOR_ID_INTEL

						case PCI_VENDOR_ID_NVIDIA:
							if ( do_skip_n_devprop )
							{
								verbose("Skip Nvidia gfx device!\n");
							}
							else
							{
								verbose("[ NVIDIA GFX DEVICE INFO ]\n");
								setup_nvidia_devprop(current);
								verbose("\n");
							}
							break; // PCI_VENDOR_ID_NVIDIA

						default:
							break;
					}
				}
				break; // PCI_CLASS_DISPLAY_VGA

			case PCI_CLASS_MULTIMEDIA_AUDIO_DEV:
				DBG("Setup HDEF %s enabled\n", do_hda_devprop ? "is":"is not");
				if (do_hda_devprop)
				{
					verbose("[ AUDIO DEVICE INFO ]\n");
					setup_hda_devprop(current);
					verbose("\n");
				}
				break; // PCI_CLASS_MULTIMEDIA_AUDIO_DEV

			case PCI_CLASS_SERIAL_USB:
				DBG("USB\n");
				notify_usb_dev(current);
				break; // PCI_CLASS_SERIAL_USB

			case PCI_CLASS_SERIAL_FIREWIRE:
				DBG("FireWire\n");
				verbose("[ FIREWIRE DEVICE INFO ]\n");
				verbose("\tClass code: [%04X]\n\tFireWire device [%04x:%04x]-[%04x:%04x]\n\t%s\n",
					current->class_id,current->vendor_id, current->device_id,
					current->subsys_id.subsys.vendor_id,
					current->subsys_id.subsys.device_id, devicepath);
//				set_fwr_devdrop(current);
				verbose("\n");
				break; // PCI_CLASS_SERIAL_FIREWIRE

			case PCI_CLASS_BRIDGE_ISA:
				DBG("Force HPET %s enabled\n", do_enable_hpet ? "is":"is not");
				if (do_enable_hpet)
				{
					verbose("[ HPET ]\n");
					force_enable_hpet(current);
					verbose("\n");
				}
				break; // PCI_CLASS_BRIDGE_ISA

			}

		execute_hook("PCIDevice", current, NULL, NULL, NULL);
		DBG("setup_pci_devs current device ID = [%04x:%04x]\n", current->vendor_id, current->device_id);
		setup_pci_devs(current->children);
		current = current->next;
	}
}
Exemple #4
0
void setup_pci_devs(pci_dt_t *pci_dt)
{
    char *devicepath;
    bool doit, do_eth_devprop, do_wifi_devprop, /*do_usb_devprop,*/ do_gfx_devprop, do_enable_hpet, do_hda_devprop = false;
    pci_dt_t *current = pci_dt;

    getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig);
    getBoolForKey(kEnableWifi, &do_wifi_devprop, &bootInfo->chameleonConfig);
    getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->chameleonConfig);
//	getBoolForKey(kUsbInject, &do_usb_devprop, &bootInfo->chameleonConfig);
    getBoolForKey(kHDAEnabler, &do_hda_devprop, &bootInfo->chameleonConfig);
    getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);

    while (current)
    {
        devicepath = get_pci_dev_path(current);

        switch (current->class_id)
        {
        case PCI_CLASS_BRIDGE_HOST:
            //DBG("Setup BRIDGE_HOST \n");
            if (current->dev.addr == PCIADDR(0, 0, 0))
            {
                dram_controller_dev = current;
            }
            break;

        case PCI_CLASS_NETWORK_ETHERNET:
            //DBG("Setup ETHERNET %s enabled\n", do_eth_devprop?"":"no");
            if (do_eth_devprop)
            {
                setup_eth_builtin(current);
            }
            break;

        case PCI_CLASS_NETWORK_OTHER:
            //DBG("Setup WIRELESS %s enabled\n", do_wifi_devprop?"":"no");
            if (do_wifi_devprop)
            {
                setup_wifi_airport(current);
            }
            break;

        case PCI_CLASS_DISPLAY_VGA:
            //DBG("GraphicsEnabler %s enabled\n", do_gfx_devprop?"":"no");
            if (do_gfx_devprop)
            {
                switch (current->vendor_id)
                {
                case PCI_VENDOR_ID_ATI:
                    if (getBoolForKey(kSkipAtiGfx, &doit, &bootInfo->chameleonConfig) && doit)
                    {
                        verbose("Skip ATi/AMD gfx device!\n");
                    }
                    else
                    {
                        setup_ati_devprop(current);
                    }
                    break;

                case PCI_VENDOR_ID_INTEL:
                    if (getBoolForKey(kSkipIntelGfx, &doit, &bootInfo->chameleonConfig) && doit)
                    {
                        verbose("Skip Intel gfx device!\n");
                    }
                    else
                    {
                        setup_gma_devprop(current);
                    }
                    break;

                case PCI_VENDOR_ID_NVIDIA:
                    if (getBoolForKey(kSkipNvidiaGfx, &doit, &bootInfo->chameleonConfig) && doit)
                    {
                        verbose("Skip Nvidia gfx device!\n");
                    }
                    else
                    {
                        setup_nvidia_devprop(current);
                    }
                    break;
                }
            }
            break;

        case PCI_CLASS_MULTIMEDIA_AUDIO_DEV:
            //DBG("Setup HDEF %s enabled\n", do_hda_devprop?"":"no");
            if (do_hda_devprop)
            {
                setup_hda_devprop(current);
            }
            break;

        case PCI_CLASS_SERIAL_USB:
            //DBG("USB fix \n");
            notify_usb_dev(current);
            /*if (do_usb_devprop)
            {
            		set_usb_devprop(current);
            	}*/
            break;

        case PCI_CLASS_BRIDGE_ISA:
            //DBG("Force HPET %s enabled\n", do_enable_hpet?"":"no");
            if (do_enable_hpet)
            {
                force_enable_hpet(current);
            }
            break;
        }

        execute_hook("PCIDevice", current, NULL, NULL, NULL);
        //DBG("setup_pci_devs current devID=%08x\n", current->device_id);
        setup_pci_devs(current->children);
        current = current->next;
    }
}