On Wed, Oct 15, 2003 at 02:13:56PM -0700, Usman S. Ansari wrote: > I have a PCI device installed and its driver loaded in the system. Is it legal for me to (from > another driver) access this device configuration and IO space ? If this is OK, than do I need some > setup before I can do this. It's not really "legal" as that device might disappear at any time, and you would not be notified of this, as you did not register with the pci core. > For example, in the original driver, steps are > > - pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); > - pci_enable_device(pdev); > - pci_request_regions(pdev, DRV_NAME); > - pci_set_dma_mask(pdev, ATA_DMA_MASK); > - pci_set_master(pdev); > > And, I have following steps in my driver > > - my_dev = (struct pci_dev *) pci_find_device(VENDOR, DEVICE, NULL) > - pci_read_config_byte(sata_dev, PCI_CLASS_PROG, &tmp8); > - theOffset = pci_resource_start(my_dev, 0); > - STATUS = pci_resource_start(my_dev, 1) | 2; > - outb_p(0, theOffset + FEATURE1); > - outb_p(0, theOffset + FEATURE2); > > Do I need to enable PCI device in my driver ? am I doing this correctly ? Why do you need to modify a device that already has a driver bound to it? That could mess up the other driver pretty badly, right? > Where can I read more about PCI bus and programming pci drivers, what > is the good source ? The MindShare PCI book is quite good for PCI bus info. I don't know of any pci driver info other than the kernel source. Hope this helps, greg k-h -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/