* [PATCH] parport_pc.c PnP BIOS handling code
@ 2001-09-26 3:33 Thomas Hood
0 siblings, 0 replies; only message in thread
From: Thomas Hood @ 2001-09-26 3:33 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 676 bytes --]
Attached is a patch which, although independent of the
PnP BIOS patch I posted earlier, is the companion of
that patch. This patch modifies init_pnp040x() so
that it checks for the IORESOURCE_UNSET bit which
the PnP BIOS driver uses to indicate that a given
"struct resource" is vacuous.
The parport driver's mysterious rejection of dma==0,
which I asked about before, I now suspect to have been a
workaround for bugs in pnpbios which resulted in pnpbios
reporting dma=0 when in fact the PnP BIOS had reported
no dma resource at all or else dma disabled. Now that
those bugs are getting fixed, it seems okay to allow
the use of DMA0, and the patch does so.
--
Thomas Hood
[-- Attachment #2: parport_pc-patch-20010925-1 --]
[-- Type: text/plain, Size: 1931 bytes --]
--- linux-2.4.9-ac13-mwave/drivers/parport/parport_pc.c_ORIG Fri Sep 21 15:23:19 2001
+++ linux-2.4.9-ac13-mwave/drivers/parport/parport_pc.c Tue Sep 25 23:10:17 2001
@@ -2797,26 +2797,66 @@
return count;
}
#if defined (CONFIG_PNPBIOS) || defined (CONFIG_PNPBIOS_MODULE)
+#define UNSET(res) ((res).flags & IORESOURCE_UNSET)
+
int init_pnp040x(struct pci_dev *dev)
-{ int io,iohi,irq,dma;
+{
+ int io,iohi,irq,dma;
+
+ printk(KERN_INFO
+ "parport: PnP BIOS reports device %s %s (node number 0x%x) is ",
+ dev->name, dev->slot_name, dev->devfn
+ );
+
+ if ( UNSET(dev->resource[0]) ) {
+ printk("not configured.\n");
+ return 0;
+ }
+ io = dev->resource[0].start;
+ printk("configured to use io 0x%04x",io);
+ if ( UNSET(dev->resource[1]) ) {
+ iohi = 0;
+ } else {
+ iohi = dev->resource[1].start;
+ printk(", io 0x%04x",iohi);
+ }
- io=dev->resource[0].start;
- iohi=dev->resource[1].start;
- irq=dev->irq_resource[0].start;
- dma=dev->dma_resource[0].start;
+ if ( UNSET(dev->irq_resource[0]) ) {
+ irq = PARPORT_IRQ_NONE;
+ } else {
+ if ( dev->irq_resource[0].start == -1 ) {
+ irq = PARPORT_IRQ_NONE;
+ printk(", irq disabled");
+ } else {
+ irq = dev->irq_resource[0].start;
+ printk(", irq %d",irq);
+ }
+ }
- if(dma==0) dma=-1;
+ if ( UNSET(dev->dma_resource[0]) ) {
+ dma = PARPORT_DMA_NONE;
+ } else {
+ if ( dev->dma_resource[0].start == -1 ) {
+ dma = PARPORT_DMA_NONE;
+ printk(", dma disabled");
+ } else {
+ dma = dev->dma_resource[0].start;
+ printk(", dma %d",irq);
+ }
+ }
+
+ printk("\n");
- printk(KERN_INFO "PnPBIOS: Parport found %s %s at io=%04x,%04x irq=%d dma=%d\n",
- dev->name,dev->slot_name,io,iohi,irq,dma);
if (parport_pc_probe_port(io,iohi,irq,dma,NULL))
return 1;
+
return 0;
}
+#undef UNSET
#endif
/* This function is called by parport_pc_init if the user didn't
* specify any ports to probe. Its job is to find some ports. Order
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-09-26 3:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-26 3:33 [PATCH] parport_pc.c PnP BIOS handling code Thomas Hood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox