Пример #1
0
int probe(struct dev *dev)
{
	const char *type_name;
	type_name = "";
	if ((dev->type >= 0) && 
		(dev->type < sizeof(driver_name)/sizeof(driver_name[0]))) {
		type_name = driver_name[dev->type];
	}
	if (dev->how_probe == PROBE_FIRST) {
		dev->to_probe = PROBE_PCI;
		memset(&dev->state, 0, sizeof(dev->state));
	}
	if (dev->to_probe == PROBE_PCI) {
		dev->how_probe = pci_probe(dev, type_name);
		if (dev->how_probe == PROBE_FAILED) {
			dev->to_probe = PROBE_ISA;
		}
	}
	if (dev->to_probe == PROBE_ISA) {
		dev->how_probe = isa_probe(dev, type_name);
		if (dev->how_probe == PROBE_FAILED) {
			dev->to_probe = PROBE_NONE;
		}
	}
	if ((dev->to_probe != PROBE_PCI) &&
		(dev->to_probe != PROBE_ISA)) {
		dev->how_probe = PROBE_FAILED;
		
	}
	return dev->how_probe;
}
Пример #2
0
int
con_hw_init(unsigned short xres, unsigned short yres, unsigned char *bits,
            unsigned short bpl,
	    l4_addr_t vid_mem_addr, l4_size_t vid_mem_size,
	    con_accel_t *accel, l4_uint8_t **map_vid_mem_addr)
{
  if (init_done)
    return -L4_EINVAL;

  l4_calibrate_tsc(l4re_kip());

  hw_vid_mem_addr = vid_mem_addr;
  hw_vid_mem_size = vid_mem_size;
  hw_xres = xres;
  hw_yres = yres;
  hw_bits = *bits;
  hw_bpl  = bpl;

#ifdef ARCH_x86
  if (l4util_kip_kernel_is_ux(l4re_kip()))
    {
      printf("Tuning for Fiasco-UX\n");

      if (ux_probe(accel))
        return -L4_ENODEV;

      *map_vid_mem_addr = (void*)hw_map_vid_mem_addr;
      *bits = hw_bits;

      return 0;
    }
#endif

  radeon_register();
  ati128_register();
  ati_register();
  intel_register();
  matrox_register();
  riva_register();
  savage_register();
  vmware_register();

  if (pci_probe(accel)==0)
    {
      /* set by probe functions */
      printf("Backend scaler: %s, color keying: %s\n",
    	  (accel->caps & (ACCEL_FAST_CSCS_YV12|ACCEL_FAST_CSCS_YUY2)) 
	    ? (accel->caps & ACCEL_FAST_CSCS_YV12) ? "YV12" : "YUY2"
	    : "no",
	  (accel->caps & ACCEL_COLOR_KEY) ? "yes" : "no");
      *map_vid_mem_addr = (void*)hw_map_vid_mem_addr;
      *bits = hw_bits;
//      accel->caps &= ~(ACCEL_FAST_CSCS_YV12|ACCEL_FAST_CSCS_YUY2);
      return 0;
    }

  return -L4_ENODEV;
}
Пример #3
0
void pci_init()
{
	devs = drivs = 0;
	pci_devices = (pci_device **)malloc(32 * sizeof(pci_device));
	pci_drivers = (pci_driver **)malloc(32 * sizeof(pci_driver));
	pci_probe();
	mprint("PCI driver support loaded.\n");
	_kill();
}
Пример #4
0
/**
 * Attach driver to device
 *
 * @v efidev		EFI device
 * @ret rc		Return status code
 */
static int efipci_start ( struct efi_device *efidev ) {
	EFI_HANDLE device = efidev->device;
	struct pci_device *pci;
	int rc;

	/* Allocate PCI device */
	pci = zalloc ( sizeof ( *pci ) );
	if ( ! pci ) {
		rc = -ENOMEM;
		goto err_alloc;
	}

	/* Open PCI device */
	if ( ( rc = efipci_open ( device, ( EFI_OPEN_PROTOCOL_BY_DRIVER |
					    EFI_OPEN_PROTOCOL_EXCLUSIVE ),
				  pci ) ) != 0 ) {
		DBGC ( device, "EFIPCI %s could not open PCI device: %s\n",
		       efi_handle_name ( device ), strerror ( rc ) );
		DBGC_EFI_OPENERS ( device, device, &efi_pci_io_protocol_guid );
		goto err_open;
	}

	/* Find driver */
	if ( ( rc = pci_find_driver ( pci ) ) != 0 ) {
		DBGC ( device, "EFIPCI %s has no driver\n",
		       efi_handle_name ( device ) );
		goto err_find_driver;
	}

	/* Mark PCI device as a child of the EFI device */
	pci->dev.parent = &efidev->dev;
	list_add ( &pci->dev.siblings, &efidev->dev.children );

	/* Probe driver */
	if ( ( rc = pci_probe ( pci ) ) != 0 ) {
		DBGC ( device, "EFIPCI %s could not probe driver \"%s\": %s\n",
		       efi_handle_name ( device ), pci->id->name,
		       strerror ( rc ) );
		goto err_probe;
	}
	DBGC ( device, "EFIPCI %s using driver \"%s\"\n",
	       efi_handle_name ( device ), pci->id->name );

	efidev_set_drvdata ( efidev, pci );
	return 0;

	pci_remove ( pci );
 err_probe:
	list_del ( &pci->dev.siblings );
 err_find_driver:
	efipci_close ( device );
 err_open:
	free ( pci );
 err_alloc:
	return rc;
}
Пример #5
0
Файл: pci.c Проект: levex/levos5
void pci_init()
{
	pdevs = malloc(sizeof(struct pci_device) * 16);
	pci_probe();
	printk("Found a total of %d PCI devices.\n", pci_devices);
}