Added configuration for SCSI devices wired in place. The documentation
is in "man 4 scsi".
This commit is contained in:
parent
2460bdf04b
commit
c30c84ed1f
@ -114,6 +114,8 @@ struct device {
|
||||
int d_addr; /* address of csr */
|
||||
int d_unit; /* unit number */
|
||||
int d_drive; /* drive number */
|
||||
int d_target; /* target number */
|
||||
int d_lun; /* unit number */
|
||||
int d_slave; /* slave number */
|
||||
#define QUES -1 /* -1 means '?' */
|
||||
#define UNKNOWN -2 /* -2 means not set yet */
|
||||
@ -193,6 +195,7 @@ int seen_vba;
|
||||
#endif
|
||||
#if MACHINE_I386
|
||||
int seen_isa;
|
||||
int seen_scbus;
|
||||
#endif
|
||||
int seen_cd;
|
||||
|
||||
|
@ -49,9 +49,11 @@
|
||||
%token SIZE
|
||||
%token SLAVE
|
||||
%token SWAP
|
||||
%token TARGET
|
||||
%token TIMEZONE
|
||||
%token TTY
|
||||
%token TRACE
|
||||
%token UNIT
|
||||
%token VECTOR
|
||||
|
||||
%token <str> ID
|
||||
@ -561,6 +563,8 @@ Dev_name:
|
||||
seen_vba = 1;
|
||||
else if (eq($2, "isa"))
|
||||
seen_isa = 1;
|
||||
else if (eq($2, "scbus"))
|
||||
seen_scbus = 1;
|
||||
cur.d_unit = $3;
|
||||
};
|
||||
|
||||
@ -596,6 +600,10 @@ Info_list:
|
||||
Info:
|
||||
CSR NUMBER
|
||||
= { cur.d_addr = $2; } |
|
||||
TARGET NUMBER
|
||||
= { cur.d_target = $2; } |
|
||||
UNIT NUMBER
|
||||
= { cur.d_lun = $2; } |
|
||||
DRIVE NUMBER
|
||||
= { cur.d_drive = $2; } |
|
||||
SLAVE NUMBER
|
||||
@ -904,7 +912,7 @@ init_dev(dp)
|
||||
dp->d_vec = 0;
|
||||
dp->d_addr = dp->d_flags = dp->d_dk = 0;
|
||||
dp->d_pri = -1;
|
||||
dp->d_slave = dp->d_drive = dp->d_unit = UNKNOWN;
|
||||
dp->d_slave = dp->d_lun = dp->d_target = dp->d_drive = dp->d_unit = UNKNOWN;
|
||||
dp->d_port = (char *)0;
|
||||
dp->d_portn = 0;
|
||||
dp->d_irq = -1;
|
||||
|
@ -102,11 +102,13 @@ struct kt {
|
||||
{ "slave", SLAVE },
|
||||
{ "swap", SWAP },
|
||||
{ "tape", DEVICE },
|
||||
{ "target", TARGET },
|
||||
#if MACHINE_I386
|
||||
{ "tty", TTY },
|
||||
#endif MACHINE_I386
|
||||
{ "timezone", TIMEZONE },
|
||||
{ "trace", TRACE },
|
||||
{ "unit", UNIT },
|
||||
{ "vector", VECTOR },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
@ -670,6 +670,9 @@ i386_ioconf()
|
||||
isa_devtab(fp, "net", &dev_id);
|
||||
isa_devtab(fp, "null", &dev_id);
|
||||
}
|
||||
if (seen_scbus) {
|
||||
scbus_devtab(fp, &dev_id);
|
||||
}
|
||||
/* XXX David did this differently!!! */
|
||||
/* pseudo_ioconf(fp); */
|
||||
(void) fclose(fp);
|
||||
@ -734,6 +737,149 @@ isa_devtab(fp, table, dev_idp)
|
||||
fprintf(fp, "0\n};\n");
|
||||
}
|
||||
|
||||
static char *id(int unit)
|
||||
{
|
||||
char *s;
|
||||
switch(unit)
|
||||
{
|
||||
case UNKNOWN:
|
||||
s ="SCCONF_UNSPEC";
|
||||
break;
|
||||
|
||||
case QUES:
|
||||
s ="SCCONF_ANY";
|
||||
break;
|
||||
|
||||
default:
|
||||
s = qu(unit);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static void id_put(fp, unit, s)
|
||||
FILE *fp;
|
||||
int unit;
|
||||
char *s;
|
||||
{
|
||||
fprintf(fp, "%s%s", id(unit), s);
|
||||
}
|
||||
|
||||
struct node
|
||||
{
|
||||
char *id;
|
||||
struct node *next;
|
||||
};
|
||||
|
||||
static void
|
||||
add_unique(struct node *node, char *id)
|
||||
{
|
||||
struct node *prev = node;
|
||||
|
||||
for (prev = node; node; node = node->next)
|
||||
{
|
||||
if (strcmp(node->id, id) == 0) /* Already there */
|
||||
return;
|
||||
|
||||
prev = node;
|
||||
}
|
||||
|
||||
node = (struct node *)malloc(sizeof(node));
|
||||
prev->next = node;
|
||||
|
||||
node->id = id;
|
||||
node->next = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
is_old_scsi_device(char *name)
|
||||
{
|
||||
static char *tab[] = {"cd", "ch", "sd", "st", "uk"};
|
||||
int i;
|
||||
for (i = 0; i < sizeof(tab) / sizeof(tab[0]); i++)
|
||||
if (eq(tab[i], name))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* XXX: dufault@hda.com: wiped out mkioconf.c locally:
|
||||
* All that nice "conflicting SCSI ID checking" is now
|
||||
* lost and should be put back in.
|
||||
*/
|
||||
scbus_devtab(fp, dev_idp)
|
||||
FILE *fp;
|
||||
int *dev_idp;
|
||||
{
|
||||
register struct device *dp, *mp;
|
||||
struct node unique, *node;
|
||||
unique.id = "unique";
|
||||
unique.next = 0;
|
||||
|
||||
fprintf(fp, "#include \"scsi/scsiconf.h\"\n");
|
||||
fprintf(fp, "\nstruct scsi_ctlr_config scsi_cinit[] = {\n");
|
||||
fprintf(fp, "/* unit driver driver unit */\n");
|
||||
|
||||
/* XXX: Why do we always get an entry such as:
|
||||
* { '?', "ncr", '?' },
|
||||
*/
|
||||
|
||||
for (dp = dtab; dp; dp = dp->d_next) {
|
||||
mp = dp->d_conn;
|
||||
if (dp->d_type != CONTROLLER || mp == TO_NEXUS || mp == 0 ||
|
||||
!eq(dp->d_name, "scbus")) {
|
||||
continue;
|
||||
}
|
||||
fprintf(fp, "{ %s, ", id(dp->d_unit));
|
||||
fprintf(fp, "\"%s\", ", mp->d_name);
|
||||
fprintf(fp, "%s },\n", id(mp->d_unit));
|
||||
}
|
||||
fprintf(fp, "{ 0, 0, 0 }\n};\n");
|
||||
|
||||
fprintf(fp, "\nstruct scsi_device_config scsi_dinit[] = {\n");
|
||||
fprintf(fp, "/* name unit cunit target LUN flags */\n");
|
||||
for (dp = dtab; dp; dp = dp->d_next) {
|
||||
if (dp->d_type == CONTROLLER || dp->d_type == MASTER ||
|
||||
dp->d_type == PSEUDO_DEVICE)
|
||||
continue;
|
||||
|
||||
/* For backward compatability we must add the original
|
||||
* SCSI devices by name even if we don't know it is
|
||||
* connected to a SCSI bus.
|
||||
*/
|
||||
if (is_old_scsi_device(dp->d_name))
|
||||
add_unique(&unique, dp->d_name);
|
||||
|
||||
mp = dp->d_conn;
|
||||
if (mp == 0 || !eq(mp->d_name, "scbus")) {
|
||||
continue;
|
||||
}
|
||||
mp = mp->d_conn;
|
||||
if (mp == 0) {
|
||||
printf("%s%s: devices not attached to a SCSI controller\n",
|
||||
dp->d_name, wnum(dp->d_unit));
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(fp, "{ ");
|
||||
fprintf(fp, "\"%s\", ", dp->d_name);
|
||||
id_put(fp, dp->d_unit, ", ");
|
||||
id_put(fp, mp->d_unit, ", ");
|
||||
id_put(fp, dp->d_target, ", ");
|
||||
id_put(fp, dp->d_lun, ", ");
|
||||
fprintf(fp, " 0x%x },\n", dp->d_flags);
|
||||
add_unique(&unique, dp->d_name);
|
||||
}
|
||||
fprintf(fp, "{ 0, 0, 0, 0, 0, 0 }\n};\n");
|
||||
|
||||
for (node = unique.next; node; node = node->next)
|
||||
fprintf(fp, "extern void %sinit();\n", node->id);
|
||||
fprintf(fp, "void (*scsi_tinit[])(void) = {\n");
|
||||
for (node = unique.next; node; node = node->next)
|
||||
fprintf(fp, " %sinit,\n", node->id);
|
||||
fprintf(fp, "0,\n};\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX - there should be a general function to print devtabs instead of these
|
||||
* little pieces of it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user