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