Lines Matching refs:np

50 void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram)
59 np->rv_scntl0 &= ~0x0a;
60 np->myaddr = nvram->data.Symbios.host_id & 0x0f;
62 np->verbose += 1;
66 np->usrflags |= SYM_AVOID_BUS_RESET;
69 np->myaddr = nvram->data.Tekram.host_id & 0x0f;
74 np->myaddr = nvram->data.parisc.host_id;
76 np->minsync = nvram->data.parisc.factor;
78 np->maxwide = nvram->data.parisc.width;
80 case 0: np->scsi_mode = SMODE_SE; break;
81 case 1: np->scsi_mode = SMODE_HVD; break;
82 case 2: np->scsi_mode = SMODE_LVD; break;
156 static void sym_display_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram)
162 sym_name(np), nvram->host_id & 0x0f,
174 sym_name(np), i,
188 static void sym_display_Tekram_nvram(struct sym_device *np, Tekram_nvram *nvram)
206 sym_name(np), nvram->host_id & 0x0f,
224 sym_name(np), i,
235 static void sym_display_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram) { (void)np; (void)nvram; }
236 static void sym_display_Tekram_nvram(struct sym_device *np, Tekram_nvram *nvram) { (void)np; (void)nvram; }
256 static void S24C16_set_bit(struct sym_device *np, u_char write_bit, u_char *gpreg,
275 OUTB(np, nc_gpreg, *gpreg);
276 INB(np, nc_mbox1);
283 static void S24C16_start(struct sym_device *np, u_char *gpreg)
285 S24C16_set_bit(np, 1, gpreg, SET_BIT);
286 S24C16_set_bit(np, 0, gpreg, SET_CLK);
287 S24C16_set_bit(np, 0, gpreg, CLR_BIT);
288 S24C16_set_bit(np, 0, gpreg, CLR_CLK);
294 static void S24C16_stop(struct sym_device *np, u_char *gpreg)
296 S24C16_set_bit(np, 0, gpreg, SET_CLK);
297 S24C16_set_bit(np, 1, gpreg, SET_BIT);
304 static void S24C16_do_bit(struct sym_device *np, u_char *read_bit, u_char write_bit,
307 S24C16_set_bit(np, write_bit, gpreg, SET_BIT);
308 S24C16_set_bit(np, 0, gpreg, SET_CLK);
310 *read_bit = INB(np, nc_gpreg);
311 S24C16_set_bit(np, 0, gpreg, CLR_CLK);
312 S24C16_set_bit(np, 0, gpreg, CLR_BIT);
319 static void S24C16_write_ack(struct sym_device *np, u_char write_bit, u_char *gpreg,
322 OUTB(np, nc_gpcntl, *gpcntl & 0xfe);
323 S24C16_do_bit(np, NULL, write_bit, gpreg);
324 OUTB(np, nc_gpcntl, *gpcntl);
331 static void S24C16_read_ack(struct sym_device *np, u_char *read_bit, u_char *gpreg,
334 OUTB(np, nc_gpcntl, *gpcntl | 0x01);
335 S24C16_do_bit(np, read_bit, 1, gpreg);
336 OUTB(np, nc_gpcntl, *gpcntl);
343 static void S24C16_write_byte(struct sym_device *np, u_char *ack_data, u_char write_data,
349 S24C16_do_bit(np, NULL, (write_data >> (7 - x)) & 0x01, gpreg);
351 S24C16_read_ack(np, ack_data, gpreg, gpcntl);
358 static void S24C16_read_byte(struct sym_device *np, u_char *read_data, u_char ack_data,
366 S24C16_do_bit(np, &read_bit, 1, gpreg);
370 S24C16_write_ack(np, ack_data, gpreg, gpcntl);
377 static int sym_write_S24C16_nvram(struct sym_device *np, int offset,
386 old_gpreg = INB(np, nc_gpreg);
387 old_gpcntl = INB(np, nc_gpcntl);
391 OUTB(np, nc_gpreg, old_gpreg);
392 OUTB(np, nc_gpcntl, gpcntl);
396 S24C16_set_bit(np, 0, &gpreg, CLR_CLK);
397 S24C16_set_bit(np, 0, &gpreg, CLR_BIT);
400 S24C16_stop(np, &gpreg);
405 S24C16_start(np, &gpreg);
406 S24C16_write_byte(np, &ack_data,
411 S24C16_write_byte(np, &ack_data, (offset+x) & 0xff,
415 S24C16_write_byte(np, &ack_data, data[x+y],
417 S24C16_stop(np, &gpreg);
421 OUTB(np, nc_gpcntl, old_gpcntl);
422 OUTB(np, nc_gpreg, old_gpreg);
431 static int sym_read_S24C16_nvram(struct sym_device *np, int offset, u_char *data, int len)
440 old_gpreg = INB(np, nc_gpreg);
441 old_gpcntl = INB(np, nc_gpcntl);
445 OUTB(np, nc_gpreg, old_gpreg);
446 OUTB(np, nc_gpcntl, gpcntl);
450 S24C16_set_bit(np, 0, &gpreg, CLR_CLK);
451 S24C16_set_bit(np, 0, &gpreg, CLR_BIT);
454 S24C16_stop(np, &gpreg);
457 S24C16_start(np, &gpreg);
460 S24C16_write_byte(np, &ack_data,
466 S24C16_write_byte(np, &ack_data,
472 S24C16_start(np, &gpreg);
475 S24C16_write_byte(np, &ack_data,
482 OUTB(np, nc_gpcntl, gpcntl);
486 S24C16_read_byte(np, &data[x], (x == (len-1)), &gpreg, &gpcntl);
490 OUTB(np, nc_gpcntl, gpcntl);
491 S24C16_stop(np, &gpreg);
495 OUTB(np, nc_gpcntl, old_gpcntl);
496 OUTB(np, nc_gpreg, old_gpreg);
510 static int sym_read_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram)
519 if (sym_read_S24C16_nvram (np, SYMBIOS_NVRAM_ADDRESS, data, len))
551 static void T93C46_Clk(struct sym_device *np, u_char *gpreg)
553 OUTB(np, nc_gpreg, *gpreg | 0x04);
554 INB(np, nc_mbox1);
556 OUTB(np, nc_gpreg, *gpreg);
562 static void T93C46_Read_Bit(struct sym_device *np, u_char *read_bit, u_char *gpreg)
565 T93C46_Clk(np, gpreg);
566 *read_bit = INB(np, nc_gpreg);
572 static void T93C46_Write_Bit(struct sym_device *np, u_char write_bit, u_char *gpreg)
581 OUTB(np, nc_gpreg, *gpreg);
582 INB(np, nc_mbox1);
585 T93C46_Clk(np, gpreg);
591 static void T93C46_Stop(struct sym_device *np, u_char *gpreg)
594 OUTB(np, nc_gpreg, *gpreg);
595 INB(np, nc_mbox1);
598 T93C46_Clk(np, gpreg);
604 static void T93C46_Send_Command(struct sym_device *np, u_short write_data,
611 T93C46_Write_Bit(np, (u_char) (write_data >> (8 - x)), gpreg);
613 *read_bit = INB(np, nc_gpreg);
619 static void T93C46_Read_Word(struct sym_device *np,
627 T93C46_Read_Bit(np, &read_bit, gpreg);
639 static int T93C46_Read_Data(struct sym_device *np, unsigned short *data,
647 T93C46_Send_Command(np, 0x180 | x, &read_bit, gpreg);
650 T93C46_Read_Word(np, &data[x], gpreg);
651 T93C46_Stop(np, gpreg);
660 static int sym_read_T93C46_nvram(struct sym_device *np, Tekram_nvram *nvram)
667 old_gpreg = INB(np, nc_gpreg);
668 old_gpcntl = INB(np, nc_gpcntl);
673 OUTB(np, nc_gpreg, gpreg);
675 OUTB(np, nc_gpcntl, gpcntl);
678 retv = T93C46_Read_Data(np, (u_short *) nvram,
682 OUTB(np, nc_gpcntl, old_gpcntl);
683 OUTB(np, nc_gpreg, old_gpreg);
692 static int sym_read_Tekram_nvram (struct sym_device *np, Tekram_nvram *nvram)
699 switch (np->pdev->device) {
703 x = sym_read_S24C16_nvram(np, TEKRAM_24C16_NVRAM_ADDRESS,
707 x = sym_read_S24C16_nvram(np, TEKRAM_24C16_NVRAM_ADDRESS,
712 x = sym_read_T93C46_nvram(np, nvram);
733 static int sym_read_parisc_pdc(struct sym_device *np, struct pdc_initiator *pdc)
736 get_pci_node_path(np->pdev, &hwpath);
743 static inline int sym_read_parisc_pdc(struct sym_device *np,
753 int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp)
755 if (!sym_read_Symbios_nvram(np, &nvp->data.Symbios)) {
757 sym_display_Symbios_nvram(np, &nvp->data.Symbios);
758 } else if (!sym_read_Tekram_nvram(np, &nvp->data.Tekram)) {
760 sym_display_Tekram_nvram(np, &nvp->data.Tekram);
762 nvp->type = sym_read_parisc_pdc(np, &nvp->data.parisc);