Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Apr 2000 12:59:14 +0100
From:      Brian Somers <brian@Awfulhak.org>
To:        Takahashi Yoshihiro <nyan@wyvern.cc.kogakuin.ac.jp>
Cc:        current@FreeBSD.ORG, brian@hak.lan.Awfulhak.org
Subject:   Re: Please review newbus patch for amd and adv 
Message-ID:  <200004031159.MAA02751@hak.lan.Awfulhak.org>
In-Reply-To: Message from Takahashi Yoshihiro <nyan@wyvern.cc.kogakuin.ac.jp>  of "Sun, 02 Apr 2000 23:05:32 %2B0900." <20000402230532V.nyan@dd.catv.ne.jp> 

next in thread | previous in thread | raw e-mail | index | archive | help
> I converted the amd and adv drivers to new-bus. But, as I am not
> familiar with these drivers and new-bus, maybe I have mistaken.
> 
> Will somebody please review these changes?
> 
> For amd driver:
> http://home.jp.FreeBSD.org/~nyan/patches/amd.diff.gz

Hi,

I'm afraid this code fails in bus_alloc_resource(...SYS_RES_IOPORT...).
I know nothing about what that does, but notice that the old code 
didn't even call pci_map_port() (which makes the compat code call 
bus_alloc_resource)...

I also added these patches - possibly worth leaving in the final 
version of this code ?

Let me know if you need any more data here....

Cheers.
-- 
Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
      <http://www.Awfulhak.org>;                   <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !

--- amd.c.orig	Mon Apr  3 12:20:52 2000
+++ amd.c	Mon Apr  3 12:42:11 2000
@@ -2256,8 +2256,11 @@
 
 	iores = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
 				   RF_ACTIVE);
-	if (iores == NULL)
+	if (iores == NULL) {
+		if (bootverbose)
+			printf("amd_init: bus_alloc_resource failure!\n");
 		return ENXIO;
+	}
 	amd->tag = rman_get_bustag(iores);
 	amd->bsh = rman_get_bushandle(iores);
 
@@ -2271,6 +2274,8 @@
 			       /*maxsegsz*/AMD_MAXTRANSFER_SIZE,
 			       /*flags*/BUS_DMA_ALLOCNOW,
 			       &amd->buffer_dmat) != 0) {
+		if (bootverbose)
+			printf("amd_init: bus_dma_tag_create failure!\n");
 		return ENXIO;
         }
 	TAILQ_INIT(&amd->free_srbs);
@@ -2355,8 +2360,11 @@
 	void		*ih;
 	struct resource	*irqres;
 
-	if (amd_init(dev))
+	if (amd_init(dev)) {
+		if (bootverbose)
+			printf("amd_attach: amd_init failure!\n");
 		return ENXIO;
+	}
 
 	/* Reset Pending INT */
 	intstat = amd_read8(amd, INTSTATREG);
@@ -2379,19 +2387,26 @@
 	 * max_sim_transactions
 	 */
 	devq = cam_simq_alloc(MAX_START_JOB);
-	if (devq == NULL)
+	if (devq == NULL) {
+		if (bootverbose)
+			printf("amd_attach: cam_simq_alloc failure!\n");
 		return ENXIO;
+	}
 
 	amd->psim = cam_sim_alloc(amd_action, amd_poll, "amd",
 				  amd, amd->unit, 1, MAX_TAGS_CMD_QUEUE,
 				  devq);
 	if (amd->psim == NULL) {
 		cam_simq_free(devq);
+		if (bootverbose)
+			printf("amd_attach: cam_sim_alloc failure!\n");
 		return ENXIO;
 	}
 
 	if (xpt_bus_register(amd->psim, 0) != CAM_SUCCESS) {
 		cam_sim_free(amd->psim, /*free_devq*/TRUE);
+		if (bootverbose)
+			printf("amd_attach: xpt_bus_register failure!\n");
 		return ENXIO;
 	}
 
@@ -2400,6 +2415,8 @@
 			    CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
 		xpt_bus_deregister(cam_sim_path(amd->psim));
 		cam_sim_free(amd->psim, /* free_simq */ TRUE);
+		if (bootverbose)
+			printf("amd_attach: xpt_create_path failure!\n");
 		return ENXIO;
 	}
 




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




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