On 09.09.2004, at 19:37, Jon Smirl wrote:
This is what I'm talking about with hotplug support and BSD not
supporting hotplug. On Linux there are rules for dealing with all of
the resources so that you don't get conflicts with new devices when
they are plugged in. It's the region code that is causing problems
right? If so, register/release regions needs to be moved into the
linux directory and another set of inlines created.

okay, it's two things that need to be abstracted into a OS-dependent layer so that radeon_cp.c stays OS-independent:

+static int radeon_register_regions(struct pci_dev *pdev) {
+ int retcode = -EINVAL;
+
+ /* request the mem regions */
+ if (!request_mem_region (pci_resource_start( pdev, 2 ),
+ pci_resource_len(pdev, 2), DRIVER_NAME)) {
+ printk(KERN_ERR DRIVER_NAME ": cannot reserve MMIO region\n");
+ return retcode;
+ }
+ if (!request_mem_region (pci_resource_start( pdev, 0 ),
+ pci_resource_len(pdev, 0), DRIVER_NAME)) {
+ printk(KERN_ERR DRIVER_NAME ": cannot reserve FB region\n");
+ return retcode;
+ }
+ return 0;
+}
+
+static void radeon_release_regions(struct pci_dev *pdev) {
+ release_mem_region (pci_resource_start( pdev, 2 ), pci_resource_len(pdev, 2));
+ release_mem_region (pci_resource_start( pdev, 0 ), pci_resource_len(pdev, 0));
+}

I'm not sure why this stuff is directly called from radeon_cp.c (and only this driver) and not from within the common code path. Isn't this also done via addmap/initmap or are these maps different? Isn't this code common to all drivers so that it can be placed directly into drm_init?

+ pci_read_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, &save);
+ pci_write_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, save | RADEON_AGP_ENABLE);
+ pci_read_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, &temp);
+ if (temp & RADEON_AGP_ENABLE)
+ dev_priv->flags |= CHIP_IS_AGP;

as far as I understand that (and that's not much), you are checking whether the card is AGP or not. RADEON_AGP_ENABLE == (1<<8) == 0x0100 is a common value, not specific to radeon cards, if I'm reading the BSD kernel source right. shouldn't this be also done in the common driver core (drm_init) and the result made available in drm_device_t?

implementing that stuff for BSD won't be hard, I'd just like to get these (common?) code fragments into the appropriate OS dependent driver core files.

thanks,
  simon

--
/"\
\ /
 \     ASCII Ribbon Campaign
/ \  Against HTML Mail and News


Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to