mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* RE: Oxford Semiconductor's OXCB950 UART not recognized by serial. c
@ 2002-02-21  0:05 Ed Vance
  2002-02-21  9:56 ` Andrey Panin
  0 siblings, 1 reply; 6+ messages in thread
From: Ed Vance @ 2002-02-21  0:05 UTC (permalink / raw)
  To: 'fabrizio.gennari@philips.com'; +Cc: rmk, linux-kernel

fabrizio.gennari@philips.com wrote:
> 
> We have 32-bit CardBus cards with OXCB950 CardBus (PCI ID 1415:950b) UART 
> chips on them (OXCB950 is the CardBus version of 16C950) . The module 
> serial_cb in the pcmcia-cs package recognizes them correctly. But, when 
> not using serial_cb, the function serial_pci_guess_board in serial.c 
> doesn't (kernel 2.4.17 tested). The problem is that the card advertises 3 
> i/o memory regions and 2 ports. If one replaces the line
> 
> if (num_iomem <= 1 && num_port == 1) {
> 
> with
> 
> if (num_port >= 1) {
> 
> in the function serial_pci_guess_board(), the card is detected and works 
> perfectly. Only, when inserting it, the kernel displays the message:
> 
> Redundant entry in serial pci_table.  Please send the output of
> lspci -vv, this message (1415,950b,1415,0001)
> and the manufacturer and name of serial board or modem board
> to serial-pci-info@lists.sourceforge.net.  

The "Redundant entry" message comes out of serial.c when a card is found in
the PCI ID board list, but which function serial_pci_guess_board() also
detects as a generic single UART card (and overwrites the card's
board->flags field in the pci_boards[] array). 

Does anybody think this is a feature? Did I misunderstand?

I suspect that the thought was to detect and eventually remove pci_boards[]
entries for generic single-port cards that could also be detected by the
serial_pci_guess_board() function. Can anybody confirm or deny? 

Shouldn't the detection process be considered done when the PCI IDs match?
Why should the "guess" function even be called when the card has already
been found in the PCI board table?

---------------------------------------------------------------- 
Ed Vance              edv@macrolink.com
Macrolink, Inc.       1500 N. Kellogg Dr  Anaheim, CA  92807
----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Oxford Semiconductor's OXCB950 UART not recognized by serial. c
  2002-02-21  0:05 Oxford Semiconductor's OXCB950 UART not recognized by serial. c Ed Vance
@ 2002-02-21  9:56 ` Andrey Panin
  0 siblings, 0 replies; 6+ messages in thread
From: Andrey Panin @ 2002-02-21  9:56 UTC (permalink / raw)
  To: Ed Vance; +Cc: linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1834 bytes --]

On Срд, Фев 20, 2002 at 04:05:13 -0800, Ed Vance wrote:
> fabrizio.gennari@philips.com wrote:
> > 
> > We have 32-bit CardBus cards with OXCB950 CardBus (PCI ID 1415:950b) UART 
> > chips on them (OXCB950 is the CardBus version of 16C950) . The module 
> > serial_cb in the pcmcia-cs package recognizes them correctly. But, when 
> > not using serial_cb, the function serial_pci_guess_board in serial.c 
> > doesn't (kernel 2.4.17 tested). The problem is that the card advertises 3 
> > i/o memory regions and 2 ports. If one replaces the line
> > 
> > if (num_iomem <= 1 && num_port == 1) {
> > 
> > with
> > 
> > if (num_port >= 1) {
> > 
> > in the function serial_pci_guess_board(), the card is detected and works 
> > perfectly. Only, when inserting it, the kernel displays the message:
> > 
> > Redundant entry in serial pci_table.  Please send the output of
> > lspci -vv, this message (1415,950b,1415,0001)
> > and the manufacturer and name of serial board or modem board
> > to serial-pci-info@lists.sourceforge.net.  
> 
> The "Redundant entry" message comes out of serial.c when a card is found in
> the PCI ID board list, but which function serial_pci_guess_board() also
> detects as a generic single UART card (and overwrites the card's
> board->flags field in the pci_boards[] array). 
> 
> Does anybody think this is a feature? Did I misunderstand?
> 
> I suspect that the thought was to detect and eventually remove pci_boards[]
> entries for generic single-port cards that could also be detected by the
> serial_pci_guess_board() function. Can anybody confirm or deny? 

You are right.

Does the attached patch remove this message ?

Best regards. 

-- 
Andrey Panin            | Embedded systems software engineer
pazke@orbita1.ru        | PGP key: wwwkeys.eu.pgp.net

[-- Attachment #1.2: patch-serial-rentry --]
[-- Type: text/plain, Size: 1017 bytes --]

diff -urN -X /usr/dontdiff /linux.vanilla/drivers/char/serial.c /linux/drivers/char/serial.c
--- /linux.vanilla/drivers/char/serial.c	Sat Feb  9 19:24:23 2002
+++ /linux/drivers/char/serial.c	Sat Feb  9 20:02:14 2002
@@ -4451,6 +4451,12 @@
 	return 1;
 }
 
+static inline int serial_is_redundant(const struct pci_board *board)
+{
+	return !((board->num_ports > 1) || (board->base_baud != 115200) ||
+		 (board->init_fn) || (board->first_uart_offset));
+}
+
 static int __devinit serial_init_one(struct pci_dev *dev,
 				     const struct pci_device_id *ent)
 {
@@ -4465,7 +4471,8 @@
 	if (ent->driver_data == pbn_default &&
 	    serial_pci_guess_board(dev, board))
 		return -ENODEV;
-	else if (serial_pci_guess_board(dev, &tmp) == 0) {
+	else if ((serial_pci_guess_board(dev, &tmp) == 0) &&
+		 (serial_is_redundant(board))) {
 		printk(KERN_INFO "Redundant entry in serial pci_table.  "
 		       "Please send the output of\n"
 		       "lspci -vv, this message (%04x,%04x,%04x,%04x)\n"

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Oxford Semiconductor's OXCB950 UART not recognized by serial. c
@ 2002-03-06 19:53 Ed Vance
  0 siblings, 0 replies; 6+ messages in thread
From: Ed Vance @ 2002-03-06 19:53 UTC (permalink / raw)
  To: 'fabrizio.gennari@philips.com'
  Cc: 'linux-kernel', 'linux-serial'

On Wed, Mar 06, 2002, fabrizio.gennari@philips.com wrote:
> As you probably have noticed, the last two entries of 
> serial_pci_tbl[] match PCI_ANY_ID for both vendor and device, 
> respectively for serial ports and modems. Therefore, any 
> serial or modem PCI card is in serial_pci_tbl[]! 

Yes I saw that, but it would not probe my ST16C654 based 
card unless there was a specific table entry for it. That's 
why I thought something in there was broken. I will try again 
with an OX16C954 based card. Maybe my 654 card is weird. 

> The associated entry in pci_boards[] is pbn_default (=0). 
> So, all "pbn_default" entries that match 
> serial_pci_guess_board() are marked as redundant!

Yes. Assuming an unknown card can get probed, the code that 
calls serial_pci_guess_board is definitely broken. At least,
the test for "no matching specific list entry" is broken. 
Do you know of any valid reason for the driver to message 
about devices that were found in the specific list entries, 
regardless of what the guess function detects?

> Probably, the right way could be to replace the message 
> "Redundant entry" with something like:
> "The settings of your serial card (vendor_id:dev_id) have 
> been successfully guessed. In order to help developers add 
> a proper entry for your card, send this message along with 
 
If the settings were successfully guessed, why do we need a 
proper entry? Shouldn't the specific id portion of the list 
contain only devices that cannot be successfully guessed? 
In essence, shouldn't all "single bare UART interface" 
serial and modem cards work *without* an id table entry? 
That's what the older driver version does. 

> the output of lspci -vv to an_address_where_somebody_reads_
> your_messages@unlike_serial_pci_info_where_nobody_cares_
> about_you". 

If we must log a message, shouldn't it be PCI id and class 
info about cards that did not match and could not be guessed. 
I think we are not supposed to do that because another driver 
may yet attach the device. (Somebody please correct me if 
that's not right.) 

> By the way, here is a patch that adds OXCB950 properly to 
> serial_pci_tbl[]. pbn_b0_bt_1_115200 has been used instead 
> of pbn_b0_1_115200, because the latter is identical to 
> pbn_default, and the effect should be the same since 
> OXCB950 is single-port. 
> 
> Another proposed change: why not create separate entries in 
> pci_boards[] for pbn_b0_1_115200 and pbn_default?

I already have your patch. Thanks. Yes, the "no matching 
specific list entry" test is broken. 

I have been porting the known patches to 2.4.19-pre2 and 
breaking them down to single ideas, and will start submitting 
them shortly. Everything will be on linux-serial for comment. 

Best regards,
Ed Vance


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Oxford Semiconductor's OXCB950 UART not recognized by serial. c
@ 2002-03-06  9:14 fabrizio.gennari
  0 siblings, 0 replies; 6+ messages in thread
From: fabrizio.gennari @ 2002-03-06  9:14 UTC (permalink / raw)
  To: Ed Vance
  Cc: 'linux-kernel', 'linux-serial',
	'Andrey Panin', 'Russell King'

Hi Ed,

Thank you for the clear explanation.

As you probably have noticed, the last two entries of serial_pci_tbl[] 
match PCI_ANY_ID for both vendor and device, respectively for serial ports 
and modems. Therefore, any serial or modem PCI card is in 
serial_pci_tbl[]! The associated entry in pci_boards[] is pbn_default 
(=0). So, all "pbn_default" entries that match serial_pci_guess_board() 
are marked as redundant!

Probably, the right way could be to replace the message "Redundant entry" 
with something like:
"The settings of your serial card (vendor_id:dev_id) have been 
successfully guessed. In order help developers add a proper entry for your 
card, send this message along with the output of lspci -vv to 
an_address_where_somebody_reads_your_messages@unlike_serial_pci_info_where_nobody_cares_about_you".

By the way, here is a patch that adds OXCB950 properly to 
serial_pci_tbl[]. pbn_b0_bt_1_115200 has been used instead of 
pbn_b0_1_115200, because the latter is identical to pbn_default, and the 
effect should be the same since OXCB950 is single-port.

Another proposed change: why not create separate entries in pci_boards[] 
for pbn_b0_1_115200 and pbn_default?

diff -ruN linux/drivers/char/serial.c linux-new/drivers/char/serial.c
--- linux/drivers/char/serial.c Fri Dec 21 18:41:54 2001
+++ linux-new/drivers/char/serial.c     Fri Mar  1 09:43:42 2002
@@ -4658,6 +4658,9 @@
        {       PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952,
                PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
                pbn_b0_2_115200 },
+       {       PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_OXCB950,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
+               pbn_b0_bt_1_115200 },
 
        /* Digitan DS560-558, from jimd@esoft.com */
        {       PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_ATT_VENUS_MODEM,
diff -ruN linux/include/linux/pci_ids.h linux-new/include/linux/pci_ids.h
--- linux/include/linux/pci_ids.h       Fri Dec 21 18:42:03 2001
+++ linux-new/include/linux/pci_ids.h   Fri Mar  1 09:43:52 2002
@@ -1458,6 +1458,7 @@
 #define PCI_DEVICE_ID_OXSEMI_12PCI840  0x8403
 #define PCI_DEVICE_ID_OXSEMI_16PCI954  0x9501
 #define PCI_DEVICE_ID_OXSEMI_16PCI952  0x950A
+#define PCI_DEVICE_ID_OXSEMI_OXCB950   0x950B
 #define PCI_DEVICE_ID_OXSEMI_16PCI95N  0x9511
 #define PCI_DEVICE_ID_OXSEMI_16PCI954PP        0x9513

Fabrizio Gennari
Philips Research Monza
via G.Casati 23, 20052 Monza (MI), Italy
tel. +39 039 2037816, fax +39 039 2037800




Ed Vance <EdV@macrolink.com>
06/03/2002 01.56

 
        To:     Fabrizio Gennari/MOZ/RESEARCH/PHILIPS@EMEA1
"'Andrey Panin'" <pazke@orbita1.ru>
        cc:     "'Russell King'" <rmk@arm.linux.org.uk>
"'linux-serial'" <linux-serial@vger.kernel.org>
"'linux-kernel'" <linux-kernel@vger.kernel.org>
        Subject:        RE: Oxford Semiconductor's OXCB950 UART not recognized by serial.       c
        Classification: 



Hi Fabrizio and Andrey,

About that function in serial.c, serial_pci_guess_board() ... 

On Wed, Feb 20, 2002 at 7:14 AM, Fabrizio Gennari wrote:
> But, when not using serial_cb, the function serial_pci_guess_board 
> in serial.c doesn't [recognize the 950 UART] (kernel 2.4.17 tested). 
> The problem is that the card advertises 3 i/o memory regions and 2 
> ports. If one replaces the line
> 
> if (num_iomem <= 1 && num_port == 1) {
> 
> with
> 
> if (num_port >= 1) {
> 
> in the function serial_pci_guess_board(), the card is detected and 
> works perfectly. Only, when inserting it, the kernel displays the 
> message:
> 
> Redundant entry in serial pci_table.  Please send the output of
> lspci -vv, this message (1415,950b,1415,0001)
> and the manufacturer and name of serial board or modem board
> to serial-pci-info@lists.sourceforge.net. 

I have dug deeper and found that the "port type guessing" functionality 
was broken when the driver was ported to the newer PCI interfaces. As 
it is, the probe function in serial.c (serial_init_one()) is *never* 
called for devices that do not already match an entry in the PCI id 
table (serial_pci_tbl[]). The probe function is coded as if non-matching 
devices would cause the probe to be called with a default table index of 
zero (pbn_default). This does not happen, because pci_announce_device() 
bypasses the probe call (pci.c:577) when the driver provides an id table 
and pci_match_device() cannot find a match in the id table. (pci.c:574)

There is not much point in trying to guess the type of a port that has 
already been identified. Devices that are not already in the table do 
not cause the probe and guess functions to be called. 

An older serial.c (rev 5.02 2000-08-09) checks each device against the 
PCI id table and only attempts a guess if there were no matches. 

At the very least, we could just rip out the guess function and not 
change the requirement of already being in the table. Or an attempt 
could be made to fix it to guess on devices that do not match the id 
table, as it used to work. This would move the id scan back to serial.c
from the PCI subsystem.

Your opinions please. How should this be fixed? Is there a "right" way?

Best regards,
Ed Vance                                 serial24@macrolink.com




^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Oxford Semiconductor's OXCB950 UART not recognized by serial. c
@ 2002-03-06  0:56 Ed Vance
  0 siblings, 0 replies; 6+ messages in thread
From: Ed Vance @ 2002-03-06  0:56 UTC (permalink / raw)
  To: 'fabrizio.gennari@philips.com', 'Andrey Panin'
  Cc: 'Russell King', 'linux-serial', 'linux-kernel'

Hi Fabrizio and Andrey,

About that function in serial.c, serial_pci_guess_board() ... 

On Wed, Feb 20, 2002 at 7:14 AM, Fabrizio Gennari wrote:
> But, when not using serial_cb, the function serial_pci_guess_board 
> in serial.c doesn't [recognize the 950 UART] (kernel 2.4.17 tested). 
> The problem is that the card advertises 3 i/o memory regions and 2 
> ports. If one replaces the line
> 
> if (num_iomem <= 1 && num_port == 1) {
> 
> with
> 
> if (num_port >= 1) {
> 
> in the function serial_pci_guess_board(), the card is detected and 
> works perfectly. Only, when inserting it, the kernel displays the 
> message:
> 
> Redundant entry in serial pci_table.  Please send the output of
> lspci -vv, this message (1415,950b,1415,0001)
> and the manufacturer and name of serial board or modem board
> to serial-pci-info@lists.sourceforge.net. 

I have dug deeper and found that the "port type guessing" functionality 
was broken when the driver was ported to the newer PCI interfaces. As 
it is, the probe function in serial.c (serial_init_one()) is *never* 
called for devices that do not already match an entry in the PCI id 
table (serial_pci_tbl[]). The probe function is coded as if non-matching 
devices would cause the probe to be called with a default table index of 
zero (pbn_default). This does not happen, because pci_announce_device() 
bypasses the probe call (pci.c:577) when the driver provides an id table 
and pci_match_device() cannot find a match in the id table. (pci.c:574)

There is not much point in trying to guess the type of a port that has 
already been identified. Devices that are not already in the table do 
not cause the probe and guess functions to be called. 

An older serial.c (rev 5.02 2000-08-09) checks each device against the 
PCI id table and only attempts a guess if there were no matches. 

At the very least, we could just rip out the guess function and not 
change the requirement of already being in the table. Or an attempt 
could be made to fix it to guess on devices that do not match the id 
table, as it used to work. This would move the id scan back to serial.c
from the PCI subsystem.

Your opinions please. How should this be fixed? Is there a "right" way?

Best regards,
Ed Vance		serial24@macrolink.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Oxford Semiconductor's OXCB950 UART not recognized by serial. c
@ 2002-02-28 18:07 fabrizio.gennari
  0 siblings, 0 replies; 6+ messages in thread
From: fabrizio.gennari @ 2002-02-28 18:07 UTC (permalink / raw)
  To: Ed Vance; +Cc: linux-kernel, rmk

Ed, you are right, the card matches the entry before the last one in 
serial_pci_tbl[], the one with PCI_ANY_ID for both vendor and device. So I 
would like to add an entry in serial_pci_tbl[] for the vendor 
PCI_VENDOR_ID_OXSEMI and device 950b. However I do not know what to put in 
the field driver_data. Probably pbn_b0_1_115200 would be fine, but this is 
the default, so serial_init_one would try to call serial_pci_guess_board, 
but this fails...

Fabrizio Gennari
Philips Research Monza
via G.Casati 23, 20052 Monza (MI), Italy
tel. +39 039 2037816, fax +39 039 2037800




Ed Vance <EdV@macrolink.com>
21/02/2002 01.05

 
        To:     Fabrizio Gennari/MOZ/RESEARCH/PHILIPS@EMEA1
        cc:     rmk@arm.linux.org.uk
linux-kernel@vger.kernel.org
        Subject:        RE: Oxford Semiconductor's OXCB950 UART not recognized by serial.       c
        Classification: 



fabrizio.gennari@philips.com wrote:
> 
> We have 32-bit CardBus cards with OXCB950 CardBus (PCI ID 1415:950b) 
UART 
> chips on them (OXCB950 is the CardBus version of 16C950) . The module 
> serial_cb in the pcmcia-cs package recognizes them correctly. But, when 
> not using serial_cb, the function serial_pci_guess_board in serial.c 
> doesn't (kernel 2.4.17 tested). The problem is that the card advertises 
3 
> i/o memory regions and 2 ports. If one replaces the line
> 
> if (num_iomem <= 1 && num_port == 1) {
> 
> with
> 
> if (num_port >= 1) {
> 
> in the function serial_pci_guess_board(), the card is detected and works 

> perfectly. Only, when inserting it, the kernel displays the message:
> 
> Redundant entry in serial pci_table.  Please send the output of
> lspci -vv, this message (1415,950b,1415,0001)
> and the manufacturer and name of serial board or modem board
> to serial-pci-info@lists.sourceforge.net. 

The "Redundant entry" message comes out of serial.c when a card is found 
in
the PCI ID board list, but which function serial_pci_guess_board() also
detects as a generic single UART card (and overwrites the card's
board->flags field in the pci_boards[] array). 

Does anybody think this is a feature? Did I misunderstand?

I suspect that the thought was to detect and eventually remove 
pci_boards[]
entries for generic single-port cards that could also be detected by the
serial_pci_guess_board() function. Can anybody confirm or deny? 

Shouldn't the detection process be considered done when the PCI IDs match?
Why should the "guess" function even be called when the card has already
been found in the PCI board table?

---------------------------------------------------------------- 
Ed Vance              edv@macrolink.com
Macrolink, Inc.       1500 N. Kellogg Dr  Anaheim, CA  92807
----------------------------------------------------------------




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-03-06 19:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-21  0:05 Oxford Semiconductor's OXCB950 UART not recognized by serial. c Ed Vance
2002-02-21  9:56 ` Andrey Panin
2002-02-28 18:07 fabrizio.gennari
2002-03-06  0:56 Ed Vance
2002-03-06  9:14 fabrizio.gennari
2002-03-06 19:53 Ed Vance

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®