Skip to contentSkip to conversation

baycom_ser_fdx: also allow i/o ports >= 0x1000 and enhanced failure logging

PATCH In review Folkert van Heusden 5 participants 7 messages Mar 4, 2007 – Mar 5, 2007 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 baycom_ser_fdx: also allow i/o ports >= 0x1000 and enhanced failure logging

Hi,

The baycom_ser_fdx driver did not allow i/o ports >= 0x1000. Now that there are pci cards (with rs232 ports) which use for example 0xb800 this limit should not exists.
Also, for non kernel coders find the cause of problems was challenging so I added extra logging.

drivers/net/hamradio/baycom_ser_fdx.c 2007-03-04 22:25:47.000000000 +0100 renamed from drivers/net/hamradio/baycom_ser_fdx.c.org 2007-03-04 22:24:47.000000000 +0100 +7 -3
@@ -413,11 +413,15 @@
 
        if (!dev || !bc)
                return -ENXIO;
-       if (!dev->base_addr || dev->base_addr > 0x1000-SER12_EXTENT ||
-           dev->irq < 2 || dev->irq > 15)
+       if (!dev->base_addr || dev->base_addr > 0xffff-SER12_EXTENT ||
+           dev->irq < 2 || dev->irq > 15) {
+               printk(KERN_INFO "baycom_ser_fdx: invalid portnumber\n");
                return -ENXIO;
-       if (bc->baud < 300 || bc->baud > 4800)
+       }
+       if (bc->baud < 300 || bc->baud > 4800) {
+               printk(KERN_INFO "baycom_ser_fdx: invalid baudrate\n");
                return -EINVAL;
+       }
        if (!request_region(dev->base_addr, SER12_EXTENT, "baycom_ser_fdx")) {
                printk(KERN_WARNING "BAYCOM_SER_FSX: I/O port 0x%04lx busy \n",
                       dev->base_addr);

Folkert van Heusden

Signature · 9 lines
MultiTail ist eine flexible Applikation um Logfiles und Kommando
Eingaben zu überprüfen. Inkl. Filter, Farben, Zusammenführen,
Ansichten etc. http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
-
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 3 lines

The baycom_ser_fdx driver did not allow i/o ports >= 0x1000. Now that there are pci cards (with rs232 ports) which use for example 0xb800 this limit should not exists.

The IRQ test is also wrong for PCI systems the moment an APIC is present. NR_IRQS is the define to use.

Quoted 2 lines

Also, for non kernel coders find the cause of problems was challenging so I added extra logging.

#2 lore raw
Quoted 5 lines
Quoted 3 lines

The baycom_ser_fdx driver did not allow i/o ports >= 0x1000. Now that there are pci cards (with rs232 ports) which use for example 0xb800 this limit should not exists.

The IRQ test is also wrong for PCI systems the moment an APIC is present. NR_IRQS is the define to use.

Ok, changed:

drivers/net/hamradio/baycom_ser_fdx.c 2007-03-04 22:42:51.000000000 +0100 renamed from drivers/net/hamradio/baycom_ser_fdx.c.org 2007-03-04 22:24:47.000000000 +0100 +7 -3
@@ -413,11 +413,15 @@
 
        if (!dev || !bc)
                return -ENXIO;
-       if (!dev->base_addr || dev->base_addr > 0x1000-SER12_EXTENT ||
-           dev->irq < 2 || dev->irq > 15)
+       if (!dev->base_addr || dev->base_addr > 0xffff-SER12_EXTENT ||
+           dev->irq < 2 || dev->irq > NR_IRQS) {
+               printk(KERN_INFO "baycom_ser_fdx: invalid portnumber (max %u) or irq (2 <= irq <= %d)\n", 0xffff-SER12_EXTENT, NR_IRQS);
                return -ENXIO;
-       if (bc->baud < 300 || bc->baud > 4800)
+       }
+       if (bc->baud < 300 || bc->baud > 4800) {
+               printk(KERN_INFO "baycom_ser_fdx: invalid baudrate (300...4800)\n");
                return -EINVAL;
+       }
        if (!request_region(dev->base_addr, SER12_EXTENT, "baycom_ser_fdx")) {
                printk(KERN_WARNING "BAYCOM_SER_FSX: I/O port 0x%04lx busy \n",
                       dev->base_addr);

Folkert van Heusden

Signature · 9 lines
MultiTail är en flexibel redskap för att fälja logfilar, utför av
commandoer, filtrera, ge färg, sammanfoga, o.s.v. följa.
http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
-
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
In reply to Folkert van Heusden
Quoted 5 lines · Folkert van Heusden

The baycom_ser_fdx driver did not allow i/o ports >= 0x1000. Now that there are pci cards (with rs232 ports) which use for example 0xb800 this limit should not exists.
Also, for non kernel coders find the cause of problems was challenging so I added extra logging.

Ideally it wouldn't have its own 16550 driver.. I have a non-16550 card here (using the parport_serial driver) which then couldn't be used with the baycom.

Hamish

Signature · 1 line
Hamish Moffatt VK3SB <[email protected]> <[email protected]>
#4 lore raw
Quoted 3 lines · Hamish Moffatt

Ideally it wouldn't have its own 16550 driver.. I have a non-16550 card here (using the parport_serial driver) which then couldn't be used with the baycom.

The baycom modem really doesn't have anything to do with RS232, it just uses the RS232 port as a PIO port + timer. That's why it needs its own 16550 driver.

Tom

#5 lore raw
Quoted 3 lines · Thomas Sailer

The baycom modem really doesn't have anything to do with RS232, it just uses the RS232 port as a PIO port + timer. That's why it needs its own 16550 driver.

A few people asked me if it is possible to drive one of those RS232 abusing modems through a USB-to-RS232 converter but I guess the answer is no?

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21
Packet: DL5RB@DB0FHN.#BAY.DEU.EU

#6 lore raw
Quoted 2 lines · On Mon, 2007-03-05 at 18:03 +0000, Ralf Baechle DL5RB wrote:

A few people asked me if it is possible to drive one of those RS232 abusing modems through a USB-to-RS232 converter but I guess the answer is no?

No way. For 9k6 you're polling the RX line say every 25us. That's just not feasible over full speed USB. I'd expect most of these cables to allow modem status line sampling over USB only once per USB frame, i.e. once per 1ms.

OTOH, if you manage to change the firmware of such an adapter (also not very feasible, because normally it's mask rom), then you can have a "non dumb" modem ;-)

If someone has the time one could probably adapt something like a Silabs Toolstick
http://www.silabs.com/tgwWebApp/public/web_content/products/Microcontrollers/en/USBToolStick.htm
to drive a Baycom type modem, they're about the same price as an USB to RS232 adapter...

Tom