Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Aug 2001 20:32:44 -0600
From:      Warner Losh <imp@harmony.village.org>
To:        Allen Landsidel <all@biosys.net>
Cc:        freebsd-mobile@FreeBSD.ORG
Subject:   Re: Getting closer.. 
Message-ID:  <200108300232.f7U2Win16728@harmony.village.org>
In-Reply-To: Your message of "Wed, 29 Aug 2001 21:46:57 EDT." <5.1.0.14.0.20010829214607.00bc6628@rfnj.org> 
References:  <5.1.0.14.0.20010829214607.00bc6628@rfnj.org>  

next in thread | previous in thread | raw e-mail | index | archive | help
In message <5.1.0.14.0.20010829214607.00bc6628@rfnj.org> Allen Landsidel writes:
: At 21:41 8/29/2001 -0400, Allen Landsidel wrote:
: 
: >I just cvsupped again today and tried out the myriad changes made since 
: >the last time.. things still aren't
: 
: Oh... as an addendum to this, I should note that slot-0 is now working 
: properly.  slot-1 however appears to be attached to that bogus pccard1..
: 
: So, is it fair to say we're half-way done? ;)

OK.  I know *EXACTLY* what is going on here.

First, the PnP BIOS says that there's a device at 0xfcfc that's a
pcic.  Second, the CL-PD6729/30 is I/O mapped.  This means that it is
accessed like an ISA device.  However, the PCI attachment code assumes
one PCI device, ONE SLOT.  See the problem?

Maybe this patch will help.  It is two patches, really, the second one
is to get rid of the duplicate insert messages.  Note, it uses magic
numbers that I'd like to not use, but that can be touched up if this
works...

Note, you'll still get the whining about can't get I/O port range, but
just ignore it for now :-)

Warner

Index: pcic_pci.c
===================================================================
RCS file: /cache/ncvs/src/sys/pccard/pcic_pci.c,v
retrieving revision 1.54.2.12
diff -u -r1.54.2.12 pcic_pci.c
--- pcic_pci.c	2001/08/27 16:34:03	1.54.2.12
+++ pcic_pci.c	2001/08/30 02:30:07
@@ -706,8 +706,10 @@
 	struct pcic_slot *sp;
 	struct pcic_softc *sc;
 	u_int32_t sockbase;
+	u_int32_t stat;
 	struct pcic_pci_table *itm;
 	int rid;
+	int i;
 	struct resource *r = NULL;
 	int error;
 	u_long irq = 0;
@@ -732,8 +734,6 @@
 		    &sc->iorid, 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
 		if (sc->iores == NULL)
 			return (ENOMEM);
-		sp->getb = pcic_getb_io;
-		sp->putb = pcic_putb_io;
 		sp->bst = rman_get_bustag(sc->iores);
 		sp->bsh = rman_get_bushandle(sc->iores);
 		sp->offset = pci_get_function(dev) * PCIC_SLOT_SIZE;
@@ -741,6 +741,12 @@
 		sp->revision = 0;
 		sc->flags = PCIC_PD_POWER;
 		itm = pcic_pci_lookup(device_id, &pcic_pci_devs[0]);
+		for (i = 0; i < 2; i++) {
+			sp[i].getb = pcic_getb_io;
+			sp[i].putb = pcic_putb_io;
+			if (sp[i].getb(sp, PCIC_ID_REV) & 0xc0 == 0x80)
+				sp[i].slt = (struct slot *) 1;
+		}
 	} else {
 		sc->memrid = CB_PCI_SOCKET_BASE;
 		sc->memres = bus_alloc_resource(dev, SYS_RES_MEMORY,
@@ -763,11 +769,11 @@
 			sp->revision = 0;
 			sc->flags = PCIC_DF_POWER;
 		}
+		sp->slt = (struct slot *) 1;
 	}
 	sc->dev = dev;
 	sc->csc_route = pcic_intr_path;
 	sc->func_route = pcic_intr_path;
-	sp->slt = (struct slot *) 1;
 
 	if (sc->csc_route == pcic_iw_pci) {
 		rid = 0;
@@ -827,6 +833,8 @@
 		}
 	}
 
+	stat = bus_space_read_4(sp->bst, sp->bsh, CB_SOCKET_STATE);
+	sc->cd_present = (stat & CB_SS_CD) == 0;	
 	return (pcic_attach(dev));
 }


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108300232.f7U2Win16728>