34 #define CODE_STATUS "alpha" 35 #define CODE_VERSION "0.1.3" 51 #define NUM_DRIVERS (sizeof(driver)/(sizeof(struct driver_interact_t))) 60 static void pcmcia_init_all(
void) {
61 u_int i, j,
k,
l, m, n, ui, configs = 0;
64 if (
PDEBUG > 0 )
printf(
"Initializing PCMCIA subsystem (code-status: " CODE_STATUS
", Version " CODE_VERSION
")\n");
66 printf (
"Supporting %d driver(s): ", NUM_DRIVERS );
67 for ( i = 0; i < NUM_DRIVERS; ++i ) {
75 for ( i = 0; i < NUM_DRIVERS; ++i ) {
76 driver[i].
f(
INIT,0,i,0,0);
80 printf (
"Socket %d: ", i );
86 printf (
"PCMCIA controller failed to map attribute memory.\n**** SEVERE ERROR CONDITION. Skipping controller.\n" );
88 printf (
"<press key. THIS CONDITION SHOULD BE REPORTED!>\n" );
getchar();
96 for (
l = 0;
l < 8; ++
l ) multicard[
l] = 0;
98 for (
l = ui = 0; ui < 0x800; ui += uc[(2*ui)+2] + 2 ) {
99 if ( uc[(2*ui)] == 0xff ) {
110 for (
l = ui = 0; ui < 0x800; ui += uc[(2*ui)+2] + 2 ) {
111 if ( uc[(2*ui)] == 0xff )
break;
112 else if ( uc[2*ui] == 0x15 ) {
113 for (
k = 2 * ( ui + 2 ); ( uc[
k] <=
' ' ) && (
k < ( 2 * ( uc[2*(ui+1)] + ui + 2 ) ) ) ;
k += 2 ) { ; }
116 }
else if ( uc[2*ui] == 0x21 ) {
118 }
else if ( uc[2*ui] == 0x1a ) {
119 printf (
"\nConfig map 0x1a found [" );
120 for (
k = 0;
k < uc[2*(ui+1)]; ++
k ) {
121 printf (
"%02x ", uc[2*(ui+
k+2)] );
123 printf (
"]\nHighest config available is %d\n", uc[2*(ui+3)] );
126 for ( j = 0; j <= (m & 3); ++j ) {
130 for ( j = 0; j <= ( ( ( m & 0x3c ) >> 2 ) & 3 ); ++j ) {
134 printf (
"Config offset is %x, card has regs: < %s%s%s%s%s>\n",
pccsock[i].configoffset,
135 j & 1 ?
"COR ":
"", j & 2 ?
"CCSR ":
"", j & 4 ?
"PRR ":
"", j & 8 ?
"SCR ":
"", j & 16?
"ESR ":
"" );
136 printf (
"COR + CCSR contents (si/du) %x %x/%x %x\n", uc[
pccsock[i].configoffset+0],
139 }
else if ( uc[2*ui] == 0x1b ) {
141 for (
k = 0;
k < uc[2*(ui+1)]; ++
k ) {
148 pccconfig[configs].index = uc[
k] & 0x3f;
149 if ( uc[
k] & 0x80 ) {
159 pccconfig[configs].iowin = pccconfig[configs].iolen = 0;
160 if ( 0 != ( uc[
k] & 0x8 ) ) {
163 if ( 0 == ( uc[
k] & 0x80 ) ) {
168 if ( 0 != ( uc[
k] & 0x0f ) ) {
172 j = (uc[
k] & 0x30) >> 4;
173 m = (uc[
k] & 0xc0) >> 6;
177 pccconfig[configs].iowin = 0;
178 pccconfig[configs].iolen = 1;
179 for ( n = 0; n < j; ++n,
k+=2 ) {
180 pccconfig[configs].iowin += uc[
k] << (n*8);
182 for ( n = 0; n < m; ++n,
k+=2 ) {
183 pccconfig[configs].iolen += uc[
k] << (n*8);
187 for ( j = 0; j < (uc[
k] & 3); ++j ) {
193 if (
pccsock[i].stringoffset > 0 ) {
197 printf (
"%c", (j>=
' '? j:
' ' ) );
202 printf (
"MULTI" );
break;
204 printf (
"Memory" );
break;
206 printf (
"Serial" );
break;
208 printf (
"Parallel" );
break;
210 printf (
"Fixed" );
break;
212 printf (
"Video" );
break;
214 printf (
"Network" );
break;
220 printf (
"MULTI, with Network" );
break;
222 printf (
"UNSUPPORTED/UNKNOWN" );
224 printf (
") with %d possible configuration(s)\n", configs );
226 if ( (inited <= 0 ) && (6 == (0xff &
pccsock[i].
type) ) && (0 < configs ) ) {
227 printf (
"activating this device with ioport %x-%x (config #%d)\n",
228 pccconfig[0].iowin, pccconfig[0].iowin+pccconfig[0].iolen-1, pccconfig[0].
index );
231 printf (
"Activating config..." );
233 printf (
"Failure(%d)!",m); inited = -1;
240 printf (
"unsupported - no identifier string found in CIS\n" );
245 printf (
"PCMCIA controller failed to unmap attribute memory.\n**** SEVERE ERROR CONDITION ****\n" );
247 printf (
"<press key. THIS CONDITION SHOULD BE REPORTED!>\n" );
getchar();
254 printf (
"<press key to exit the pcmcia_init_all routine>\n" );
260 static void pcmcia_shutdown_all(
void) {
266 printf(
"Shutdown of PCMCIA subsystem completed");
int printf(const char *fmt,...)
Write a formatted string to the console.
struct pccsock_t pccsock[MAXPCCSOCKS]
uint32_t type
Operating system type.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
int getchar(void)
Read a single character from any console.
static const uint32_t k[64]
MD5 constants.
int(* f)(interface_func_t, int, int, int, int)
int i82365_interfacer(interface_func_t, int, int, int, void *)
unsigned long currticks(void)
Get current system time in ticks.
void * ioremap(unsigned long bus_addr, size_t len)
Map bus address as an I/O address.