Hello! It seems that during porting to newbus architecture adv_attach was left unchanged and current version (I mean the current version of -STABLE sources, I didn't check -CURRENT) returns incorrect values (1 on success, 0 in all other cases). I've fixed this, the patch is in the attached file. I'm not sure that I put correct error codes for all cases so I think it would be good if someone looks through it. Anyway this code works (at least for me) and -STABLE sources don't. Hope this small work will be useful. -- Oleg Sharoiko. Computer Center of Rostov State University.
Index: advansys.c =================================================================== RCS file: /usr/cvs/FreeBSD/src/sys/dev/advansys/advansys.c,v retrieving revision 1.14.2.1 diff -u -r1.14.2.1 advansys.c --- advansys.c 2000/04/14 13:32:47 1.14.2.1 +++ advansys.c 2000/05/23 07:21:34 @@ -1303,7 +1303,7 @@ M_DEVBUF, M_NOWAIT); if (adv->ccb_infos == NULL) - goto error_exit; + return (ENOMEM); adv->init_level++; @@ -1345,7 +1345,7 @@ /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT, /*flags*/BUS_DMA_ALLOCNOW, &adv->buffer_dmat) != 0) { - goto error_exit; + return (ENXIO); } adv->init_level++; @@ -1358,7 +1358,7 @@ /*nsegments*/1, /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT, /*flags*/0, &adv->sense_dmat) != 0) { - goto error_exit; + return (ENXIO); } adv->init_level++; @@ -1366,7 +1366,7 @@ /* Allocation for our sense buffers */ if (bus_dmamem_alloc(adv->sense_dmat, (void **)&adv->sense_buffers, BUS_DMA_NOWAIT, &adv->sense_dmamap) != 0) { - goto error_exit; + return (ENOMEM); } adv->init_level++; @@ -1385,7 +1385,7 @@ if (adv_start_chip(adv) != 1) { printf("adv%d: Unable to start on board processor. Aborting.\n", adv->unit); - return (0); + return (ENXIO); } /* @@ -1393,7 +1393,7 @@ */ devq = cam_simq_alloc(adv->max_openings); if (devq == NULL) - return (0); + return (ENOMEM); /* * Construct our SIM entry. @@ -1401,7 +1401,7 @@ adv->sim = cam_sim_alloc(adv_action, adv_poll, "adv", adv, adv->unit, 1, adv->max_openings, devq); if (adv->sim == NULL) - return (0); + return (ENOMEM); /* * Register the bus. @@ -1410,21 +1410,18 @@ */ if (xpt_bus_register(adv->sim, 0) != CAM_SUCCESS) { cam_sim_free(adv->sim, /*free devq*/TRUE); - return (0); + return (ENXIO); } if (xpt_create_path(&adv->path, /*periph*/NULL, cam_sim_path(adv->sim), - CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) - == CAM_REQ_CMP) { - xpt_setup_ccb(&csa.ccb_h, adv->path, /*priority*/5); - csa.ccb_h.func_code = XPT_SASYNC_CB; - csa.event_enable = AC_FOUND_DEVICE|AC_LOST_DEVICE; - csa.callback = advasync; - csa.callback_arg = adv; - xpt_action((union ccb *)&csa); - } - return (1); + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) + return (ENXIO); -error_exit: + xpt_setup_ccb(&csa.ccb_h, adv->path, /*priority*/5); + csa.ccb_h.func_code = XPT_SASYNC_CB; + csa.event_enable = AC_FOUND_DEVICE|AC_LOST_DEVICE; + csa.callback = advasync; + csa.callback_arg = adv; + xpt_action((union ccb *)&csa); return (0); }