From 70e2bad8b836175e925957373c8c626ee1c75f4a Mon Sep 17 00:00:00 2001 From: gibbs Date: Tue, 15 Sep 1998 10:05:50 +0000 Subject: Convert SCSI disk bios geometry code to CAM. --- sys/pc98/pc98/pc98_machdep.c | 45 +++++++++++++++++++------------------------- sys/pc98/pc98/pc98_machdep.h | 5 ++--- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/sys/pc98/pc98/pc98_machdep.c b/sys/pc98/pc98/pc98_machdep.c index 05bde12..1b0e75e 100644 --- a/sys/pc98/pc98/pc98_machdep.c +++ b/sys/pc98/pc98/pc98_machdep.c @@ -34,7 +34,8 @@ #include #include -#include +#include +#include #include #include @@ -221,20 +222,9 @@ pc98_getmemsize(void) #endif } -#include "sd.h" - -#if NSD > 0 -/* - * XXX copied from sd.c. - */ -struct disk_parms { - u_char heads; /* Number of heads */ - u_int16_t cyls; /* Number of cylinders */ - u_char sectors; /*dubious *//* Number of sectors/track */ - u_int16_t secsiz; /* Number of bytes/sector */ - u_int32_t disksize; /* total number sectors */ -}; +#include "da.h" +#if NDA > 0 /* * Read a geometry information of SCSI HDD from BIOS work area. * @@ -242,16 +232,20 @@ struct disk_parms { * host adapter support it. */ int -sd_bios_parms(disk_parms, sc_link) - struct disk_parms *disk_parms; - struct scsi_link *sc_link; +scsi_da_bios_params(struct ccb_calc_geometry *ccg) { u_char *tmp; + int target; + int bus; - tmp = (u_char *)&PC98_SYSTEM_PARAMETER(0x460 + sc_link->target*4); - if ((PC98_SYSTEM_PARAMETER(0x482) & ((1 << sc_link->target)&0xff)) != 0) { - disk_parms->sectors = *tmp; - disk_parms->cyls = ((*(tmp+3)<<8)|*(tmp+2))&0xfff; + target = ccg->ccb_h.target_id; + bus = 0; /* If your really need to know, send a PathInq CCB */ + + tmp = (u_char *)&PC98_SYSTEM_PARAMETER(0x460 + target*4); + if ((PC98_SYSTEM_PARAMETER(0x482) & ((1 << target)&0xff)) != 0) { + ccg->secs_per_track = *tmp; + ccg->cylinders = ((*(tmp+3)<<8)|*(tmp+2))&0xfff; +#if 0 switch (*(tmp + 3) & 0x30) { case 0x00: disk_parms->secsiz = 256; @@ -268,14 +262,13 @@ sd_bios_parms(disk_parms, sc_link) printf("Warning!: not supported. But force to 512\n"); break; } +#endif if (*(tmp+3) & 0x40) { - disk_parms->cyls += (*(tmp+1)&0xf0)<<8; - disk_parms->heads = *(tmp+1)&0x0f; + ccg->cylinders += (*(tmp+1)&0xf0)<<8; + ccg->heads = *(tmp+1)&0x0f; } else { - disk_parms->heads = *(tmp+1); + ccg->heads = *(tmp+1); } - disk_parms->disksize = disk_parms->sectors * disk_parms->heads * - disk_parms->cyls; return 1; } return 0; diff --git a/sys/pc98/pc98/pc98_machdep.h b/sys/pc98/pc98/pc98_machdep.h index 116043f..dfadc2d 100644 --- a/sys/pc98/pc98/pc98_machdep.h +++ b/sys/pc98/pc98/pc98_machdep.h @@ -31,9 +31,8 @@ void pc98_init_dmac __P((void)); void pc98_getmemsize __P((void)); -struct disk_parms; -struct scsi_link; -int sd_bios_parms __P((struct disk_parms *, struct scsi_link *)); +struct ccb_calc_geometry; +int scsi_da_bios_params __P((struct ccb_calc_geometry *)); #define PC98_VECTOR_SIZE (0x400) #define PC98_SYSTEM_PARAMETER_SIZE (0x230) -- cgit v1.1