예제 #1
0
/*
 * Attach all the sub-devices we can find
 */
int
ahd_attach(struct ahd_softc *ahd)
{
    struct scsibus_attach_args saa;
    char   ahd_info[256];
    int	s;

    ahd_controller_info(ahd, ahd_info, sizeof ahd_info);
    printf("%s\n", ahd_info);
    ahd_lock(ahd, &s);

    /*
     * fill in the prototype scsi_links.
     */
    ahd->sc_channel.adapter_target = ahd->our_id;
    if (ahd->features & AHD_WIDE)
        ahd->sc_channel.adapter_buswidth = 16;
    ahd->sc_channel.adapter_softc = ahd;
    ahd->sc_channel.adapter = &ahd_switch;
    ahd->sc_channel.openings = 16;

    if (bootverbose) {
        ahd_controller_info(ahd, ahd_info, sizeof ahd_info);
        printf("%s: %s\n", ahd->sc_dev.dv_xname, ahd_info);
    }

    ahd_intr_enable(ahd, TRUE);

    if (ahd->flags & AHD_RESET_BUS_A)
        ahd_reset_channel(ahd, 'A', TRUE);

    bzero(&saa, sizeof(saa));
    saa.saa_sc_link = &ahd->sc_channel;

    ahd->sc_child = config_found((void *)&ahd->sc_dev, &saa, scsiprint);

    ahd_unlock(ahd, &s);

    return (1);

}
예제 #2
0
파일: aic79xx_proc.c 프로젝트: 020gzh/linux
/*
 * Return information to handle /proc support for the driver.
 */
int
ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
{
	struct	ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata;
	char	ahd_info[256];
	u_int	max_targ;
	u_int	i;

	seq_printf(m, "Adaptec AIC79xx driver version: %s\n",
		  AIC79XX_DRIVER_VERSION);
	seq_printf(m, "%s\n", ahd->description);
	ahd_controller_info(ahd, ahd_info);
	seq_printf(m, "%s\n", ahd_info);
	seq_printf(m, "Allocated SCBs: %d, SG List Length: %d\n\n",
		  ahd->scb_data.numscbs, AHD_NSEG);

	max_targ = 16;

	if (ahd->seep_config == NULL)
		seq_puts(m, "No Serial EEPROM\n");
	else {
		seq_puts(m, "Serial EEPROM:\n");
		for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) {
			if (((i % 8) == 0) && (i != 0)) {
				seq_putc(m, '\n');
			}
			seq_printf(m, "0x%.4x ",
				  ((uint16_t*)ahd->seep_config)[i]);
		}
		seq_putc(m, '\n');
	}
	seq_putc(m, '\n');

	if ((ahd->features & AHD_WIDE) == 0)
		max_targ = 8;

	for (i = 0; i < max_targ; i++) {

		ahd_dump_target_state(ahd, m, ahd->our_id, 'A',
				      /*target_id*/i);
	}
	return 0;
}
예제 #3
0
/*
 * Return information to handle /proc support for the driver.
 */
int
ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
		    off_t offset, int length, int inout)
{
	struct	ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata;
	struct	info_str info;
	char	ahd_info[256];
	u_int	max_targ;
	u_int	i;
	int	retval;

	 /* Has data been written to the file? */ 
	if (inout == TRUE) {
		retval = ahd_proc_write_seeprom(ahd, buffer, length);
		goto done;
	}

	if (start)
		*start = buffer;

	info.buffer	= buffer;
	info.length	= length;
	info.offset	= offset;
	info.pos	= 0;

	copy_info(&info, "Adaptec AIC79xx driver version: %s\n",
		  AIC79XX_DRIVER_VERSION);
	copy_info(&info, "%s\n", ahd->description);
	ahd_controller_info(ahd, ahd_info);
	copy_info(&info, "%s\n", ahd_info);
	copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n",
		  ahd->scb_data.numscbs, AHD_NSEG);

	max_targ = 15;

	if (ahd->seep_config == NULL)
		copy_info(&info, "No Serial EEPROM\n");
	else {
		copy_info(&info, "Serial EEPROM:\n");
		for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) {
			if (((i % 8) == 0) && (i != 0)) {
				copy_info(&info, "\n");
			}
			copy_info(&info, "0x%.4x ",
				  ((uint16_t*)ahd->seep_config)[i]);
		}
		copy_info(&info, "\n");
	}
	copy_info(&info, "\n");

	if ((ahd->features & AHD_WIDE) == 0)
		max_targ = 7;

	for (i = 0; i <= max_targ; i++) {

		ahd_dump_target_state(ahd, &info, ahd->our_id, 'A',
				      /*target_id*/i, /*target_offset*/i);
	}
	retval = info.pos > info.offset ? info.pos - info.offset : 0;
done:
	return (retval);
}