|
|
1.1 root 1: /*
2: * hosts.c Copyright (C) 1992 Drew Eckhardt
3: * mid to lowlevel SCSI driver interface by
4: * Drew Eckhardt
5: *
6: * <[email protected]>
7: */
8:
9:
10: /*
11: This file contains the medium level SCSI
12: host interface initialization, as well as the scsi_hosts array of SCSI
13: hosts currently present in the system.
14: */
15:
16: #include <linux/config.h>
17:
18: #ifdef CONFIG_SCSI
19: #include <linux/kernel.h>
20: #include "scsi.h"
21:
22: #ifndef NULL
23: #define NULL 0L
24: #endif
25:
26: #ifdef FIGURE_MAX_SCSI_HOSTS
27: #define MAX_SCSI_HOSTS
28: #endif
29:
30: #include "hosts.h"
31:
32: #ifdef CONFIG_SCSI_AHA1542
33: #include "aha1542.h"
34: #endif
35:
36: #ifdef CONFIG_SCSI_SEAGATE
37: #include "seagate.h"
38: #endif
39:
40: #ifdef CONFIG_SCSI_ULTRASTOR
41: #include "ultrastor.h"
42: #endif
43:
44: /*
45: static const char RCSid[] = "$Header: /usr/src/linux/kernel/blk_drv/scsi/RCS/hosts.c,v 1.1 1992/04/24 18:01:50 root Exp root $";
46: */
47:
48: /*
49: The scsi host entries should be in the order you wish the
50: cards to be detected. A driver may appear more than once IFF
51: it can deal with being detected (and therefore initialized)
52: with more than one simulatenous host number, can handle being
53: rentrant, etc.
54:
55: They may appear in any order, as each SCSI host is told which host number it is
56: during detection.
57: */
58:
59: /*
60: When figure is run, we don't want to link to any object code. Since
61: the macro for each host will contain function pointers, we cannot
62: use it and instead must use a "blank" that does no such
63: idiocy.
64: */
65:
66: #ifdef FIGURE_MAX_SCSI_HOSTS
67: #define BLANKIFY(what) BLANK_HOST
68: #else
69: #define BLANKIFY(what) what
70: #endif
71:
72: Scsi_Host scsi_hosts[] =
73: {
74: #ifdef CONFIG_SCSI_AHA1542
75: BLANKIFY(AHA1542),
76: #endif
77:
78: #ifdef CONFIG_SCSI_SEAGATE
79: BLANKIFY(SEAGATE_ST0X),
80: #endif
81: #ifdef CONFIG_SCSI_ULTRASTOR
82: BLANKIFY(ULTRASTOR_14F),
83: #endif
84: };
85:
86: #ifdef FIGURE_MAX_SCSI_HOSTS
87: #undef MAX_SCSI_HOSTS
88: #define MAX_SCSI_HOSTS (sizeof(scsi_hosts) / sizeof(Scsi_Host))
89: #endif
90:
91: #ifdef FIGURE_MAX_SCSI_HOSTS
92: #include <stdio.h>
93: void main (void)
94: {
95: printf("%d", MAX_SCSI_HOSTS);
96: }
97: #else
98: /*
99: Our semaphores and timeout counters, where size depends on MAX_SCSI_HOSTS here.
100: */
101:
102: volatile unsigned char host_busy[MAX_SCSI_HOSTS];
103: volatile int host_timeout[MAX_SCSI_HOSTS];
104: volatile Scsi_Cmnd *host_queue[MAX_SCSI_HOSTS];
105: /*
106: scsi_init initializes the scsi hosts.
107: */
108:
109: void scsi_init(void)
110: {
111: static int called = 0;
112: int i, count;
113: if (!called)
114: {
115: called = 1;
116: for (count = i = 0; i < MAX_SCSI_HOSTS; ++i)
117: {
118: /*
119: Initialize our semaphores. -1 is interpreted to mean
120: "inactive" - where as 0 will indicate a time out condition.
121: */
122:
123: host_busy[i] = 0;
124: host_timeout[i] = 0;
125: host_queue[i] = NULL;
126:
127: if ((scsi_hosts[i].detect) && (scsi_hosts[i].present = scsi_hosts[i].detect(i)))
128: {
129: printk ("Host %d is detected as a(n) %s.\n\r",
130: count, scsi_hosts[i].name);
131: printk ("%s", scsi_hosts[i].info());
132: ++count;
133: }
134: }
135: printk ("%d host adapters detected. \n\r", count);
136: }
137:
138: }
139:
140: #endif
141:
142: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.