Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Dec 2002 11:27:00 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 22626 for review
Message-ID:  <200212221927.gBMJR0si013191@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help

http://perforce.freebsd.org/chv.cgi?CH=22626

Change 22626 by marcel@marcel_nfs on 2002/12/22 11:26:02

	Convert to the new sioprobe/sioattach interface. Untested.
	While here, break siodetach even more.

Affected files ...

.. //depot/projects/ia64/sys/dev/sio/sio_pccard.c#6 edit

Differences ...

==== //depot/projects/ia64/sys/dev/sio/sio_pccard.c#6 (text+ko) ====

@@ -66,7 +66,7 @@
 static driver_t sio_pccard_driver = {
 	sio_driver_name,
 	sio_pccard_methods,
-	0,
+	sizeof(struct com_s),
 };
 
 static int
@@ -91,27 +91,52 @@
 sio_pccard_probe(dev)
 	device_t	dev;
 {
+	struct com_s *com;
+	struct resource *res;
+	int error, rid;
 
 #ifdef PC98
 	SET_FLAG(dev, SET_IFTYPE(COM_IF_MODEM_CARD));
 #endif
-	/* Do not probe IRQ - pccard doesn't turn on the interrupt line */
-	/* until bus_setup_intr */
-	return (sioprobe(dev, 0, 0UL, 1));
+
+	com = device_get_softc(dev);
+	rid = 0;
+	res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 8,
+	    RF_ACTIVE);
+	if (res == NULL)
+		return (ENXIO);
+	com->bsh = rman_get_bushandle(res);
+	com->bst = rman_get_bustag(res);
+	error = sioprobe(dev);
+	bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
+	return (error);
 }
 
 static int
 sio_pccard_attach(dev)
 	device_t	dev;
 {
-	return (sioattach(dev, 0, 0UL));
+	struct com_s *com;
+	struct resource *res;
+	int error, rid;
+
+	com = device_get_softc(dev);
+	rid = 0;
+	res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 8,
+	    RF_ACTIVE);
+	if (res == NULL)
+		return (ENXIO);
+	error = sioattach(dev);
+	if (error)
+		bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
+	return (error);
 }
 
 static int
 sio_pccard_detach(dev)
 	device_t	dev;
 {
-	return (siodetach(dev));
+	/* XXX broken */
 }
 
 DRIVER_MODULE(sio, pccard, sio_pccard_driver, sio_devclass, 0, 0);

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




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