Lines Matching refs:np

37 void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram)
46 np->rv_scntl0 &= ~0x0a;
47 np->myaddr = nvram->data.Symbios.host_id & 0x0f;
49 np->verbose += 1;
53 np->usrflags |= SYM_AVOID_BUS_RESET;
56 np->myaddr = nvram->data.Tekram.host_id & 0x0f;
61 np->myaddr = nvram->data.parisc.host_id;
63 np->minsync = nvram->data.parisc.factor;
65 np->maxwide = nvram->data.parisc.width;
67 case 0: np->scsi_mode = SMODE_SE; break;
68 case 1: np->scsi_mode = SMODE_HVD; break;
69 case 2: np->scsi_mode = SMODE_LVD; break;
143 static void sym_display_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram)
149 sym_name(np), nvram->host_id & 0x0f,
161 sym_name(np), i,
175 static void sym_display_Tekram_nvram(struct sym_device *np, Tekram_nvram *nvram)
193 sym_name(np), nvram->host_id & 0x0f,
211 sym_name(np), i,
222 static void sym_display_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram) { (void)np; (void)nvram; }
223 static void sym_display_Tekram_nvram(struct sym_device *np, Tekram_nvram *nvram) { (void)np; (void)nvram; }
243 static void S24C16_set_bit(struct sym_device *np, u_char write_bit, u_char *gpreg,
262 OUTB(np, nc_gpreg, *gpreg);
263 INB(np, nc_mbox1);
270 static void S24C16_start(struct sym_device *np, u_char *gpreg)
272 S24C16_set_bit(np, 1, gpreg, SET_BIT);
273 S24C16_set_bit(np, 0, gpreg, SET_CLK);
274 S24C16_set_bit(np, 0, gpreg, CLR_BIT);
275 S24C16_set_bit(np, 0, gpreg, CLR_CLK);
281 static void S24C16_stop(struct sym_device *np, u_char *gpreg)
283 S24C16_set_bit(np, 0, gpreg, SET_CLK);
284 S24C16_set_bit(np, 1, gpreg, SET_BIT);
291 static void S24C16_do_bit(struct sym_device *np, u_char *read_bit, u_char write_bit,
294 S24C16_set_bit(np, write_bit, gpreg, SET_BIT);
295 S24C16_set_bit(np, 0, gpreg, SET_CLK);
297 *read_bit = INB(np, nc_gpreg);
298 S24C16_set_bit(np, 0, gpreg, CLR_CLK);
299 S24C16_set_bit(np, 0, gpreg, CLR_BIT);
306 static void S24C16_write_ack(struct sym_device *np, u_char write_bit, u_char *gpreg,
309 OUTB(np, nc_gpcntl, *gpcntl & 0xfe);
310 S24C16_do_bit(np, NULL, write_bit, gpreg);
311 OUTB(np, nc_gpcntl, *gpcntl);
318 static void S24C16_read_ack(struct sym_device *np, u_char *read_bit, u_char *gpreg,
321 OUTB(np, nc_gpcntl, *gpcntl | 0x01);
322 S24C16_do_bit(np, read_bit, 1, gpreg);
323 OUTB(np, nc_gpcntl, *gpcntl);
330 static void S24C16_write_byte(struct sym_device *np, u_char *ack_data, u_char write_data,
336 S24C16_do_bit(np, NULL, (write_data >> (7 - x)) & 0x01, gpreg);
338 S24C16_read_ack(np, ack_data, gpreg, gpcntl);
345 static void S24C16_read_byte(struct sym_device *np, u_char *read_data, u_char ack_data,
353 S24C16_do_bit(np, &read_bit, 1, gpreg);
357 S24C16_write_ack(np, ack_data, gpreg, gpcntl);
364 static int sym_write_S24C16_nvram(struct sym_device *np, int offset,
373 old_gpreg = INB(np, nc_gpreg);
374 old_gpcntl = INB(np, nc_gpcntl);
378 OUTB(np, nc_gpreg, old_gpreg);
379 OUTB(np, nc_gpcntl, gpcntl);
383 S24C16_set_bit(np, 0, &gpreg, CLR_CLK);
384 S24C16_set_bit(np, 0, &gpreg, CLR_BIT);
387 S24C16_stop(np, &gpreg);
392 S24C16_start(np, &gpreg);
393 S24C16_write_byte(np, &ack_data,
398 S24C16_write_byte(np, &ack_data, (offset+x) & 0xff,
402 S24C16_write_byte(np, &ack_data, data[x+y],
404 S24C16_stop(np, &gpreg);
408 OUTB(np, nc_gpcntl, old_gpcntl);
409 OUTB(np, nc_gpreg, old_gpreg);
418 static int sym_read_S24C16_nvram(struct sym_device *np, int offset, u_char *data, int len)
427 old_gpreg = INB(np, nc_gpreg);
428 old_gpcntl = INB(np, nc_gpcntl);
432 OUTB(np, nc_gpreg, old_gpreg);
433 OUTB(np, nc_gpcntl, gpcntl);
437 S24C16_set_bit(np, 0, &gpreg, CLR_CLK);
438 S24C16_set_bit(np, 0, &gpreg, CLR_BIT);
441 S24C16_stop(np, &gpreg);
444 S24C16_start(np, &gpreg);
447 S24C16_write_byte(np, &ack_data,
453 S24C16_write_byte(np, &ack_data,
459 S24C16_start(np, &gpreg);
462 S24C16_write_byte(np, &ack_data,
469 OUTB(np, nc_gpcntl, gpcntl);
473 S24C16_read_byte(np, &data[x], (x == (len-1)), &gpreg, &gpcntl);
477 OUTB(np, nc_gpcntl, gpcntl);
478 S24C16_stop(np, &gpreg);
482 OUTB(np, nc_gpcntl, old_gpcntl);
483 OUTB(np, nc_gpreg, old_gpreg);
497 static int sym_read_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram)
506 if (sym_read_S24C16_nvram (np, SYMBIOS_NVRAM_ADDRESS, data, len))
538 static void T93C46_Clk(struct sym_device *np, u_char *gpreg)
540 OUTB(np, nc_gpreg, *gpreg | 0x04);
541 INB(np, nc_mbox1);
543 OUTB(np, nc_gpreg, *gpreg);
549 static void T93C46_Read_Bit(struct sym_device *np, u_char *read_bit, u_char *gpreg)
552 T93C46_Clk(np, gpreg);
553 *read_bit = INB(np, nc_gpreg);
559 static void T93C46_Write_Bit(struct sym_device *np, u_char write_bit, u_char *gpreg)
568 OUTB(np, nc_gpreg, *gpreg);
569 INB(np, nc_mbox1);
572 T93C46_Clk(np, gpreg);
578 static void T93C46_Stop(struct sym_device *np, u_char *gpreg)
581 OUTB(np, nc_gpreg, *gpreg);
582 INB(np, nc_mbox1);
585 T93C46_Clk(np, gpreg);
591 static void T93C46_Send_Command(struct sym_device *np, u_short write_data,
598 T93C46_Write_Bit(np, (u_char) (write_data >> (8 - x)), gpreg);
600 *read_bit = INB(np, nc_gpreg);
606 static void T93C46_Read_Word(struct sym_device *np,
614 T93C46_Read_Bit(np, &read_bit, gpreg);
626 static int T93C46_Read_Data(struct sym_device *np, unsigned short *data,
634 T93C46_Send_Command(np, 0x180 | x, &read_bit, gpreg);
637 T93C46_Read_Word(np, &data[x], gpreg);
638 T93C46_Stop(np, gpreg);
647 static int sym_read_T93C46_nvram(struct sym_device *np, Tekram_nvram *nvram)
654 old_gpreg = INB(np, nc_gpreg);
655 old_gpcntl = INB(np, nc_gpcntl);
660 OUTB(np, nc_gpreg, gpreg);
662 OUTB(np, nc_gpcntl, gpcntl);
665 retv = T93C46_Read_Data(np, (u_short *) nvram,
669 OUTB(np, nc_gpcntl, old_gpcntl);
670 OUTB(np, nc_gpreg, old_gpreg);
679 static int sym_read_Tekram_nvram (struct sym_device *np, Tekram_nvram *nvram)
686 switch (np->pdev->device) {
690 x = sym_read_S24C16_nvram(np, TEKRAM_24C16_NVRAM_ADDRESS,
694 x = sym_read_S24C16_nvram(np, TEKRAM_24C16_NVRAM_ADDRESS,
700 x = sym_read_T93C46_nvram(np, nvram);
721 static int sym_read_parisc_pdc(struct sym_device *np, struct pdc_initiator *pdc)
724 get_pci_node_path(np->pdev, &hwpath);
731 static inline int sym_read_parisc_pdc(struct sym_device *np,
741 int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp)
743 if (!sym_read_Symbios_nvram(np, &nvp->data.Symbios)) {
745 sym_display_Symbios_nvram(np, &nvp->data.Symbios);
746 } else if (!sym_read_Tekram_nvram(np, &nvp->data.Tekram)) {
748 sym_display_Tekram_nvram(np, &nvp->data.Tekram);
750 nvp->type = sym_read_parisc_pdc(np, &nvp->data.parisc);