--- drivers_new/mga_vid.c 2003-03-12 19:19:53.000000000 +0100 +++ drivers_multi_2/mga_vid.c 2003-03-17 09:09:18.000000000 +0100 @@ -270,6 +270,7 @@ static int mga_brightness = 0; // initial brightness static int mga_contrast = 0; // initial contrast +static int mga_number = 0; // which device/card is taken static int major = DEFAULT_MGA_VID_MAJOR; //static int mga_force_memsize = 0; @@ -278,6 +279,8 @@ MODULE_PARM(mga_top_reserved, "i"); MODULE_PARM(mga_brightness, "i"); MODULE_PARM(mga_contrast, "i"); +MODULE_PARM(mga_number, "i"); +MODULE_PARM_DESC(mga_number, "selects matrox device/card, 0=first, etc."); MODULE_PARM(major, "i"); static struct pci_dev *pci_dev; @@ -1310,31 +1313,47 @@ struct pci_dev *dev = NULL; unsigned int card_option; - if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G550, NULL))) + char *mga_dev_name; + int num_found = 0; + while((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_ANY_ID, dev))) { - is_g400 = 1; - printk(KERN_INFO "mga_vid: Found MGA G550\n"); - } - else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G400, NULL))) - { - is_g400 = 1; - printk(KERN_INFO "mga_vid: Found MGA G400/G450\n"); - } - else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_AGP, NULL))) - { - is_g400 = 0; - printk(KERN_INFO "mga_vid: Found MGA G200 AGP\n"); - } - else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_PCI, NULL))) - { - is_g400 = 0; - printk(KERN_INFO "mga_vid: Found MGA G200 PCI\n"); + mga_dev_name = ""; + num_found++; + switch(dev->device) { + case PCI_DEVICE_ID_MATROX_G550: + is_g400 = 1; + mga_dev_name = "MGA G550"; + break; + case PCI_DEVICE_ID_MATROX_G400: + is_g400 = 1; + mga_dev_name = "MGA G400/G450"; + break; + case PCI_DEVICE_ID_MATROX_G200_AGP: + is_g400 = 0; + mga_dev_name = "MGA G200 AGP"; + break; + case PCI_DEVICE_ID_MATROX_G200_PCI: + is_g400 = 0; + mga_dev_name = "MGA G200"; + break; + default: + num_found--; + printk(KERN_INFO "mga_vid: ignoring matrox device (%d) at %s [%s]\n", dev->device, dev->slot_name, dev->name); + break; + } + if(num_found == mga_number+1) + break; } - else + + if(!dev) { - printk(KERN_ERR "mga_vid: No supported cards found\n"); + if(num_found==0) + printk(KERN_ERR "mga_vid: No supported cards found\n"); + else + printk(KERN_ERR "mga_vid: Only %d supported cards found\n", num_found); return FALSE; } + printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, dev->name); pci_dev = dev;