ncr.c (46024) | ncr.c (46581) |
---|---|
1/************************************************************************** 2** | 1/************************************************************************** 2** |
3** $Id: ncr.c,v 1.142 1999/01/27 23:45:43 dillon Exp $ | 3** $Id: ncr.c,v 1.143 1999/04/24 20:14:02 peter Exp $ |
4** 5** Device driver for the NCR 53C8XX PCI-SCSI-Controller Family. 6** 7**------------------------------------------------------------------------- 8** 9** Written for 386bsd and FreeBSD by 10** Wolfgang Stanglmeier <wolf@cologne.de> 11** Stefan Esser <se@mi.Uni-Koeln.de> --- 1344 unchanged lines hidden (view full) --- 1356** 1357** 1358**========================================================== 1359*/ 1360 1361 1362#if !defined(lint) 1363static const char ident[] = | 4** 5** Device driver for the NCR 53C8XX PCI-SCSI-Controller Family. 6** 7**------------------------------------------------------------------------- 8** 9** Written for 386bsd and FreeBSD by 10** Wolfgang Stanglmeier <wolf@cologne.de> 11** Stefan Esser <se@mi.Uni-Koeln.de> --- 1344 unchanged lines hidden (view full) --- 1356** 1357** 1358**========================================================== 1359*/ 1360 1361 1362#if !defined(lint) 1363static const char ident[] = |
1364 "\n$Id: ncr.c,v 1.142 1999/01/27 23:45:43 dillon Exp $\n"; | 1364 "\n$Id: ncr.c,v 1.143 1999/04/24 20:14:02 peter Exp $\n"; |
1365#endif 1366 1367static const u_long ncr_version = NCR_VERSION * 11 1368 + (u_long) sizeof (struct ncb) * 7 1369 + (u_long) sizeof (struct nccb) * 5 1370 + (u_long) sizeof (struct lcb) * 3 1371 + (u_long) sizeof (struct tcb) * 2; 1372 --- 2644 unchanged lines hidden (view full) --- 4017 4018 nego = 0; 4019 if (tp->nego_cp == NULL) { 4020 4021 if (tp->tinfo.current.width 4022 != tp->tinfo.goal.width) { 4023 tp->nego_cp = cp; 4024 nego = NS_WIDE; | 1365#endif 1366 1367static const u_long ncr_version = NCR_VERSION * 11 1368 + (u_long) sizeof (struct ncb) * 7 1369 + (u_long) sizeof (struct nccb) * 5 1370 + (u_long) sizeof (struct lcb) * 3 1371 + (u_long) sizeof (struct tcb) * 2; 1372 --- 2644 unchanged lines hidden (view full) --- 4017 4018 nego = 0; 4019 if (tp->nego_cp == NULL) { 4020 4021 if (tp->tinfo.current.width 4022 != tp->tinfo.goal.width) { 4023 tp->nego_cp = cp; 4024 nego = NS_WIDE; |
4025 } else if (tp->tinfo.current.period 4026 != tp->tinfo.goal.period) { | 4025 } else if ((tp->tinfo.current.period 4026 != tp->tinfo.goal.period) 4027 || (tp->tinfo.current.offset 4028 != tp->tinfo.goal.offset)) { |
4027 tp->nego_cp = cp; 4028 nego = NS_SYNC; 4029 }; 4030 }; 4031 4032 /*--------------------------------------------------- 4033 ** 4034 ** choose a new tag ... --- 287 unchanged lines hidden (view full) --- 4322 } 4323 4324 /* Filter bus width and sync negotiation settings */ 4325 if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) { 4326 if (cts->bus_width > np->maxwide) 4327 cts->bus_width = np->maxwide; 4328 } 4329 | 4029 tp->nego_cp = cp; 4030 nego = NS_SYNC; 4031 }; 4032 }; 4033 4034 /*--------------------------------------------------- 4035 ** 4036 ** choose a new tag ... --- 287 unchanged lines hidden (view full) --- 4324 } 4325 4326 /* Filter bus width and sync negotiation settings */ 4327 if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) { 4328 if (cts->bus_width > np->maxwide) 4329 cts->bus_width = np->maxwide; 4330 } 4331 |
4330 if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) { 4331 if (cts->sync_period != 0 4332 && (cts->sync_period < np->minsync)) 4333 cts->sync_period = np->minsync; | 4332 if (((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) 4333 || ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)) { 4334 if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) { 4335 if (cts->sync_period != 0 4336 && (cts->sync_period < np->minsync)) 4337 cts->sync_period = np->minsync; 4338 } |
4334 if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0) { 4335 if (cts->sync_offset == 0) 4336 cts->sync_period = 0; 4337 if (cts->sync_offset > np->maxoffs) 4338 cts->sync_offset = np->maxoffs; 4339 } 4340 } 4341 if ((update_type & NCR_TRANS_USER) != 0) { | 4339 if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0) { 4340 if (cts->sync_offset == 0) 4341 cts->sync_period = 0; 4342 if (cts->sync_offset > np->maxoffs) 4343 cts->sync_offset = np->maxoffs; 4344 } 4345 } 4346 if ((update_type & NCR_TRANS_USER) != 0) { |
4342 tp->tinfo.user.period = cts->sync_period; 4343 tp->tinfo.user.offset = cts->sync_offset; 4344 tp->tinfo.user.width = cts->bus_width; | 4347 if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) 4348 tp->tinfo.user.period = cts->sync_period; 4349 if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0) 4350 tp->tinfo.user.offset = cts->sync_offset; 4351 if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) 4352 tp->tinfo.user.width = cts->bus_width; |
4345 } 4346 if ((update_type & NCR_TRANS_GOAL) != 0) { | 4353 } 4354 if ((update_type & NCR_TRANS_GOAL) != 0) { |
4347 tp->tinfo.goal.period = cts->sync_period; 4348 tp->tinfo.goal.offset = cts->sync_offset; 4349 tp->tinfo.goal.width = cts->bus_width; | 4355 if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) 4356 tp->tinfo.goal.period = cts->sync_period; 4357 4358 if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0) 4359 tp->tinfo.goal.offset = cts->sync_offset; 4360 4361 if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) 4362 tp->tinfo.goal.width = cts->bus_width; |
4350 } 4351 splx(s); 4352 ccb->ccb_h.status = CAM_REQ_CMP; 4353 xpt_done(ccb); 4354 break; 4355 } 4356 case XPT_GET_TRAN_SETTINGS: 4357 /* Get default/user set transfer settings for the target */ --- 5 unchanged lines hidden (view full) --- 4363 4364 cts = &ccb->cts; 4365 tp = &np->target[ccb->ccb_h.target_id]; 4366 4367 s = splcam(); 4368 if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) { 4369 tinfo = &tp->tinfo.current; 4370 if (tp->tinfo.disc_tag & NCR_CUR_DISCENB) | 4363 } 4364 splx(s); 4365 ccb->ccb_h.status = CAM_REQ_CMP; 4366 xpt_done(ccb); 4367 break; 4368 } 4369 case XPT_GET_TRAN_SETTINGS: 4370 /* Get default/user set transfer settings for the target */ --- 5 unchanged lines hidden (view full) --- 4376 4377 cts = &ccb->cts; 4378 tp = &np->target[ccb->ccb_h.target_id]; 4379 4380 s = splcam(); 4381 if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) { 4382 tinfo = &tp->tinfo.current; 4383 if (tp->tinfo.disc_tag & NCR_CUR_DISCENB) |
4371 cts->flags = CCB_TRANS_DISC_ENB; | 4384 cts->flags |= CCB_TRANS_DISC_ENB; |
4372 else | 4385 else |
4373 cts->flags = 0; | 4386 cts->flags &= ~CCB_TRANS_DISC_ENB; |
4374 4375 if (tp->tinfo.disc_tag & NCR_CUR_TAGENB) 4376 cts->flags |= CCB_TRANS_TAG_ENB; | 4387 4388 if (tp->tinfo.disc_tag & NCR_CUR_TAGENB) 4389 cts->flags |= CCB_TRANS_TAG_ENB; |
4390 else 4391 cts->flags &= ~CCB_TRANS_TAG_ENB; |
|
4377 } else { 4378 tinfo = &tp->tinfo.user; 4379 if (tp->tinfo.disc_tag & NCR_USR_DISCENB) | 4392 } else { 4393 tinfo = &tp->tinfo.user; 4394 if (tp->tinfo.disc_tag & NCR_USR_DISCENB) |
4380 cts->flags = CCB_TRANS_DISC_ENB; | 4395 cts->flags |= CCB_TRANS_DISC_ENB; |
4381 else | 4396 else |
4382 cts->flags = 0; | 4397 cts->flags &= ~CCB_TRANS_DISC_ENB; |
4383 4384 if (tp->tinfo.disc_tag & NCR_USR_TAGENB) 4385 cts->flags |= CCB_TRANS_TAG_ENB; | 4398 4399 if (tp->tinfo.disc_tag & NCR_USR_TAGENB) 4400 cts->flags |= CCB_TRANS_TAG_ENB; |
4401 else 4402 cts->flags &= ~CCB_TRANS_TAG_ENB; |
|
4386 } 4387 4388 cts->sync_period = tinfo->period; 4389 cts->sync_offset = tinfo->offset; 4390 cts->bus_width = tinfo->width; 4391 4392 splx(s); 4393 --- 59 unchanged lines hidden (view full) --- 4453 cpi->hba_inquiry |= PI_WIDE_16; 4454 cpi->target_sprt = 0; 4455 cpi->hba_misc = 0; 4456 cpi->hba_eng_cnt = 0; 4457 cpi->max_target = (np->features & FE_WIDE) ? 15 : 7; 4458 cpi->max_lun = MAX_LUN - 1; 4459 cpi->initiator_id = np->myaddr; 4460 cpi->bus_id = cam_sim_bus(sim); | 4403 } 4404 4405 cts->sync_period = tinfo->period; 4406 cts->sync_offset = tinfo->offset; 4407 cts->bus_width = tinfo->width; 4408 4409 splx(s); 4410 --- 59 unchanged lines hidden (view full) --- 4470 cpi->hba_inquiry |= PI_WIDE_16; 4471 cpi->target_sprt = 0; 4472 cpi->hba_misc = 0; 4473 cpi->hba_eng_cnt = 0; 4474 cpi->max_target = (np->features & FE_WIDE) ? 15 : 7; 4475 cpi->max_lun = MAX_LUN - 1; 4476 cpi->initiator_id = np->myaddr; 4477 cpi->bus_id = cam_sim_bus(sim); |
4478 cpi->base_transfer_speed = 3300; |
|
4461 strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); 4462 strncpy(cpi->hba_vid, "Symbios", HBA_IDLEN); 4463 strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); 4464 cpi->unit_number = cam_sim_unit(sim); 4465 cpi->ccb_h.status = CAM_REQ_CMP; 4466 xpt_done(ccb); 4467 break; 4468 } --- 311 unchanged lines hidden (view full) --- 4780** 4781** 4782** Start NCR chip. 4783** 4784** 4785**========================================================== 4786*/ 4787 | 4479 strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); 4480 strncpy(cpi->hba_vid, "Symbios", HBA_IDLEN); 4481 strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); 4482 cpi->unit_number = cam_sim_unit(sim); 4483 cpi->ccb_h.status = CAM_REQ_CMP; 4484 xpt_done(ccb); 4485 break; 4486 } --- 311 unchanged lines hidden (view full) --- 4798** 4799** 4800** Start NCR chip. 4801** 4802** 4803**========================================================== 4804*/ 4805 |
4788void ncr_init 4789(ncb_p np, char * msg, u_long code) | 4806void 4807ncr_init(ncb_p np, char * msg, u_long code) |
4790{ 4791 int i; 4792 4793 /* 4794 ** Reset chip. 4795 */ 4796 4797 OUTB (nc_istat, SRST); --- 2271 unchanged lines hidden (view full) --- 7069static void ncr_getclock (ncb_p np, u_char multiplier) 7070{ 7071 unsigned char scntl3; 7072 unsigned char stest1; 7073 scntl3 = INB(nc_scntl3); 7074 stest1 = INB(nc_stest1); 7075 7076 np->multiplier = 1; | 4808{ 4809 int i; 4810 4811 /* 4812 ** Reset chip. 4813 */ 4814 4815 OUTB (nc_istat, SRST); --- 2271 unchanged lines hidden (view full) --- 7087static void ncr_getclock (ncb_p np, u_char multiplier) 7088{ 7089 unsigned char scntl3; 7090 unsigned char stest1; 7091 scntl3 = INB(nc_scntl3); 7092 stest1 = INB(nc_stest1); 7093 7094 np->multiplier = 1; |
7077 /* always false, except for 875 with clock doubler selected */ 7078 if ((stest1 & (DBLEN+DBLSEL)) == DBLEN+DBLSEL) { | 7095 7096 if (multiplier > 1) { |
7079 np->multiplier = multiplier; 7080 np->clock_khz = 40000 * multiplier; 7081 } else { 7082 if ((scntl3 & 7) == 0) { 7083 unsigned f1, f2; 7084 /* throw away first result */ 7085 (void) ncrgetfreq (np, 11); 7086 f1 = ncrgetfreq (np, 11); --- 129 unchanged lines hidden --- | 7097 np->multiplier = multiplier; 7098 np->clock_khz = 40000 * multiplier; 7099 } else { 7100 if ((scntl3 & 7) == 0) { 7101 unsigned f1, f2; 7102 /* throw away first result */ 7103 (void) ncrgetfreq (np, 11); 7104 f1 = ncrgetfreq (np, 11); --- 129 unchanged lines hidden --- |