See my response below ... --- Greg KH <greg@kroah.com> wrote: > 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. This is gaureented not to happen, device will not be taken out of a running system. I was worried about trying to read/write io/memory from PCI device without registering. I though kernel may block me, but this does not seems to be the case. > > 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? I am writting a utility, which will change device overlay configuration. This will only run one time and the system will be rebooted. We do same thing to ide drives, with any issues. > > 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. Mindshare have couple of books on PCI, do you recommend anyone in particular ? > Hope this helps, > > greg k-h http://www.pacifica.org __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/