lkml.org 
[lkml]   [1998]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] de4x5.c [was Re: pre-2.1.116-1 breaks Cyrix 6x86 support]
From
Date
Linus Torvalds <torvalds@transmeta.com> writes:

> On Mon, 10 Aug 1998, Rafael Reilova wrote:
> >
> > If there is no way to force gcc to keep the order right (in all cases),
> > could we keep the fixed inline asm functions for setC6x86() and getC6x86()
> > I sent you and leave this alone, (please!).
>
> Actually, gcc always keeps the order of IO instructions. The problem here
> was that the getcx/setcx stuff was changed to macros, and when used as
> macros the ordering was not well-defined for the case where you nest them.
>
> Fixed, I'll make a pre-116-2 soon for cyrix users to test..
>

Linus, could you please apply appended patch to de4x5.c, unless David
has even newer version (even though this one works perfectly).

Patch allows the kernel to be compiled with egcs/pgcc/gcc 2.8 (without
it kernel would Oops in the early booting stage) and helps to get rid
of the annoying messages also during boot stage (see below). David
wrote the patch, I'm just trying to get it in before the code freezes. :)

without the patch:

eth1: region already allocated at 0xec00.
eth1: region already allocated at 0xec00.
eth2: region already allocated at 0xec00.
eth3: region already allocated at 0xec00.
...
eth7: region already allocated at 0xec00.


Thanks!


diff -urN --exclude-from=exclude linux-old/drivers/net/de4x5.c linux/drivers/net/de4x5.c
--- linux-old/drivers/net/de4x5.c Fri Jul 17 19:14:25 1998
+++ linux/drivers/net/de4x5.c Tue Aug 4 15:58:35 1998
@@ -399,11 +399,16 @@
from report & fix by <paubert@iram.es>.
Fix probe bug with EISA & PCI cards present from
report by <eirik@netcom.com>.
+ 0.541 ??-Aug-98 Fix compiler problems associated with i386-string
+ ops from multiple bug reports and temporary fix
+ from <paubert@iram.es>.
+ Fix pci_probe() to correctly emulate the old
+ pcibios_find_class() function.

=========================================================================
*/

-static const char *version = "de4x5.c:V0.540 1998/7/5 davies@maniac.ultranet.com\n";
+static const char *version = "de4x5.c:T0.5401 1998/7/31 davies@maniac.ultranet.com\n";

#include <linux/config.h>
#include <linux/module.h>
@@ -958,7 +966,8 @@
static void eisa_probe(struct device *dev, u_long iobase);
#endif
static void pci_probe(struct device *dev, u_long iobase);
-static void srom_search(struct pci_dev *pdev);
+static void srom_search(int index);
+static struct pci_dev *de4x5_find_class(u_int class, u_short index);
static char *build_setup_frame(struct device *dev, int mode);
static void disable_ast(struct device *dev);
static void enable_ast(struct device *dev, u32 time_out);
@@ -2103,7 +2112,7 @@
u_int irq = 0, device, class = DE4X5_CLASS_CODE;
u_long iobase = 0; /* Clear upper 32 bits in Alphas */
struct bus_type *lp = &bus;
- struct pci_dev *pdev = NULL;
+ struct pci_dev *pdev;

if (lastPCI == NO_MORE_PCI) return;

@@ -2123,7 +2132,7 @@
dnum = 0;
}

- for (index=lastPCI+1; (pdev=pci_find_class(class, pdev))!=NULL; index++) {
+ for (index=lastPCI+1;(pdev=de4x5_find_class(class, index))!=NULL;index++) {
dev_num = PCI_SLOT(pdev->devfn);
pb = pdev->bus->number;
if ((pbus || dnum) && ((pbus != pb) || (dnum != dev_num))) continue;
@@ -2135,7 +2144,7 @@
/* Search for an SROM on this bus */
if (lp->bus_num != pb) {
lp->bus_num = pb;
- srom_search(pdev);
+ srom_search(index);
}

/* Get the chip configuration revision register */
@@ -2209,7 +2218,7 @@
** For single port cards this is a time waster...
*/
__initfunc(static void
-srom_search(struct pci_dev *pdev))
+srom_search(int index))
{
u_char pb;
u_short vendor, status;
@@ -2217,8 +2226,9 @@
u_long iobase = 0; /* Clear upper 32 bits in Alphas */
int i, j;
struct bus_type *lp = &bus;
+ struct pci_dev *pdev;

- while ((pdev = pci_find_class(class, pdev))!= NULL) {
+ for (; (pdev=de4x5_find_class(class, index))!= NULL; index++) {
if (lp->bus_num != pdev->bus->number) return;
pb = pdev->bus->number;
vendor = pdev->vendor;
@@ -2266,6 +2276,21 @@
return;
}

+__initfunc(static struct pci_dev *
+de4x5_find_class(u_int class, u_short index))
+{
+ struct pci_dev *dev = NULL;
+ static int cnt = 0;
+
+ while ((dev = pci_find_class(class, dev))) {
+ if (index == cnt++) {
+ return dev;
+ }
+ }
+
+ return NULL;
+}
+
__initfunc(static void
link_modules(struct device *dev, struct device *tmp))
{
@@ -3898,7 +3923,7 @@
static int
EISA_signature(char *name, s32 eisa_id)
{
- c_char *signatures[] = DE4X5_SIGNATURE;
+ static c_char *signatures[] = DE4X5_SIGNATURE;
char ManCode[DE4X5_STRLEN];
union {
s32 ID;
@@ -3933,7 +3958,7 @@
static int
PCI_signature(char *name, struct bus_type *lp)
{
- c_char *de4x5_signatures[] = DE4X5_SIGNATURE;
+ static c_char *de4x5_signatures[] = DE4X5_SIGNATURE;
int i, status = 0, siglen = sizeof(de4x5_signatures)/sizeof(c_char *);

if (lp->chipset == DC21040) {
@@ -5789,7 +5814,6 @@
{
int i, j=0;
char name[DE4X5_STRLEN];
- u_char pb, dev_fn;
u_short vendor;
u_int class = DE4X5_CLASS_CODE;
u_int device;
@@ -5804,13 +5828,7 @@
#endif
if (!pcibios_present()) return j;

- for (i=0;
- (pcibios_find_class(class, i, &pb, &dev_fn)!= PCIBIOS_DEVICE_NOT_FOUND);
- i++) {
- for (pdev = pci_devices; pdev; pdev = pdev->next) {
- if ((pdev->bus->number==pb) && (pdev->devfn==dev_fn)) break;
- }
-
+ for (i=0; (pdev=de4x5_find_class(class, i))!= NULL; i++) {
vendor = pdev->vendor;
device = pdev->device << 8;
if (is_DC21040 || is_DC21041 || is_DC21140 || is_DC2114x) j++;
--
Posted by Zlatko Calusic E-mail: <Zlatko.Calusic@CARNet.hr>
---------------------------------------------------------------------
An unbreakable toy is useful for breaking other toys.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.518 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site