* Make sym2 driver use pci_enable_device
@ 2003-04-14 23:32 Anton Blanchard
2003-04-15 15:41 ` Anton Blanchard
0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2003-04-14 23:32 UTC (permalink / raw)
To: linux-scsi; +Cc: groudier
Hi,
The sym2 driver should use the generic pci_enable_device() and
pci_set_master() functions.
The next step is to use pci_enable_mwi(), however that needs some more
thought. The current code warns of chip bugs requiring MWI to be enabled.
If this is so we should use the generic MWI hook and if that returns an
error we should warn or fail to load. The driver should not be guessing:
#if defined(__i386__) && !defined(MODULE)
if (!cache_line_size && boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
switch(boot_cpu_data.x86) {
case 4: suggested_cache_line_size = 4; break;
case 6: if (boot_cpu_data.x86_model > 8) break;
case 5: suggested_cache_line_size = 8; break;
}
}
#endif /* __i386__ */
Anton
===== sym_glue.c 1.16 vs edited =====
--- 1.16/drivers/scsi/sym53c8xx_2/sym_glue.c Thu Feb 20 23:16:32 2003
+++ edited/sym_glue.c Tue Apr 15 07:06:05 2003
@@ -2562,41 +2561,8 @@
pci_read_config_word(pdev, PCI_COMMAND, &command);
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache_line_size);
- /*
- * Enable missing capabilities in the PCI COMMAND register.
- */
-#ifdef SYM_CONF_IOMAPPED
-#define PCI_COMMAND_BITS_TO_ENABLE (PCI_COMMAND_IO | \
- PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_PARITY)
-#else
-#define PCI_COMMAND_BITS_TO_ENABLE \
- (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_PARITY)
-#endif
- if ((command & PCI_COMMAND_BITS_TO_ENABLE)
- != PCI_COMMAND_BITS_TO_ENABLE) {
- printf_info("%s: setting%s%s%s%s...\n", sym_name(device),
- (command & PCI_COMMAND_IO) ? "" : " PCI_COMMAND_IO",
- (command & PCI_COMMAND_MEMORY) ? "" : " PCI_COMMAND_MEMORY",
- (command & PCI_COMMAND_MASTER) ? "" : " PCI_COMMAND_MASTER",
- (command & PCI_COMMAND_PARITY) ? "" : " PCI_COMMAND_PARITY");
- command |= PCI_COMMAND_BITS_TO_ENABLE;
- pci_write_config_word(pdev, PCI_COMMAND, command);
- }
-#undef PCI_COMMAND_BITS_TO_ENABLE
-
- /*
- * If cache line size is not configured, suggest
- * a value for well known CPUs.
- */
-#if defined(__i386__) && !defined(MODULE)
- if (!cache_line_size && boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
- switch(boot_cpu_data.x86) {
- case 4: suggested_cache_line_size = 4; break;
- case 6: if (boot_cpu_data.x86_model > 8) break;
- case 5: suggested_cache_line_size = 8; break;
- }
- }
-#endif /* __i386__ */
+ pci_enable_device(pdev);
+ pci_set_master(pdev);
/*
* Some features are required to be enabled in order to
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Make sym2 driver use pci_enable_device
2003-04-14 23:32 Make sym2 driver use pci_enable_device Anton Blanchard
@ 2003-04-15 15:41 ` Anton Blanchard
0 siblings, 0 replies; 2+ messages in thread
From: Anton Blanchard @ 2003-04-15 15:41 UTC (permalink / raw)
To: linux-scsi; +Cc: groudier
> The sym2 driver should use the generic pci_enable_device() and
> pci_set_master() functions.
Sorry, wrong patch. We need to read COMMAND after doing
pci_enable_device/pci_set_master. We should also check the return
valie of pci_enable_device.
Anton
===== drivers/scsi/sym53c8xx_2/sym_glue.c 1.16 vs edited =====
--- 1.16/drivers/scsi/sym53c8xx_2/sym_glue.c Thu Feb 20 23:16:32 2003
+++ edited/drivers/scsi/sym53c8xx_2/sym_glue.c Tue Apr 15 08:51:04 2003
@@ -2556,35 +2556,17 @@
bcopy(chip, &device->chip, sizeof(device->chip));
device->chip.revision_id = revision;
+ if (pci_enable_device(pdev))
+ return -1;
+
+ pci_set_master(pdev);
+
/*
* Read additionnal info from the configuration space.
*/
- pci_read_config_word(pdev, PCI_COMMAND, &command);
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache_line_size);
/*
- * Enable missing capabilities in the PCI COMMAND register.
- */
-#ifdef SYM_CONF_IOMAPPED
-#define PCI_COMMAND_BITS_TO_ENABLE (PCI_COMMAND_IO | \
- PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_PARITY)
-#else
-#define PCI_COMMAND_BITS_TO_ENABLE \
- (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_PARITY)
-#endif
- if ((command & PCI_COMMAND_BITS_TO_ENABLE)
- != PCI_COMMAND_BITS_TO_ENABLE) {
- printf_info("%s: setting%s%s%s%s...\n", sym_name(device),
- (command & PCI_COMMAND_IO) ? "" : " PCI_COMMAND_IO",
- (command & PCI_COMMAND_MEMORY) ? "" : " PCI_COMMAND_MEMORY",
- (command & PCI_COMMAND_MASTER) ? "" : " PCI_COMMAND_MASTER",
- (command & PCI_COMMAND_PARITY) ? "" : " PCI_COMMAND_PARITY");
- command |= PCI_COMMAND_BITS_TO_ENABLE;
- pci_write_config_word(pdev, PCI_COMMAND, command);
- }
-#undef PCI_COMMAND_BITS_TO_ENABLE
-
- /*
* If cache line size is not configured, suggest
* a value for well known CPUs.
*/
@@ -2623,6 +2605,7 @@
sym_name(device), cache_line_size);
}
+ pci_read_config_word(pdev, PCI_COMMAND, &command);
if ((pci_fix_up & 2) && cache_line_size &&
(chip->features & FE_WRIE) && !(command & PCI_COMMAND_INVALIDATE)) {
printf_info("%s: setting PCI_COMMAND_INVALIDATE.\n",
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-04-15 15:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-14 23:32 Make sym2 driver use pci_enable_device Anton Blanchard
2003-04-15 15:41 ` Anton Blanchard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox