summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/pcmcia_/probe.c
blob: 88853426d27c26ab154ac3ae4ac102ddff3d73c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
-rw-r--r--perl-install/ChangeLog3
-rw-r--r--perl-install/c/stuff.xs.pm29
-rw-r--r--perl-install/devices.pm13
-rw-r--r--perl-install/fs.pm3
-rw-r--r--perl-install/fsedit.pm2
-rw-r--r--perl-install/loopback.pm2
-rw-r--r--perl-install/modules.pm5
7 files changed, 51 insertions, 6 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog
index b0f8ea58d..2372bfb23 100644
--- a/perl-install/ChangeLog
+++ b/perl-install/ChangeLog
@@ -1,5 +1,8 @@
2000-03-09 Pixel <pixel@mandrakesoft.com>
+ * modules.pm (write_conf): don't add alias block-major-11 in every case
+ * modules.pm (add_alias): special case oss (post-installs modprobe snd-pcm-oss)
+
* fs.pm (format_*): move the @options before the device
* loopback.pm: created, added a lot of stuff for loopback in
diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm
index 5aaef8605..bc405af1d 100644
--- a/perl-install/c/stuff.xs.pm
+++ b/perl-install/c/stuff.xs.pm
@@ -19,6 +19,7 @@ print '
#include <linux/hdreg.h>
#include <linux/vt.h>
#include <linux/cdrom.h>
+#include <linux/loop.h>
#include <net/if.h>
#include <net/route.h>
@@ -242,6 +243,32 @@ kernel_version()
RETVAL
+int
+set_loop(dev_fd, file)
+ int dev_fd
+ char *file
+ CODE:
+ RETVAL = 0;
+{
+ struct loop_info loopinfo;
+ int file_fd = open(file, O_RDWR);
+
+ if (file_fd < 0) return;
+
+ memset(&loopinfo, 0, sizeof (loopinfo));
+ strncpy(loopinfo.lo_name, file, LO_NAME_SIZE);
+ loopinfo.lo_name[LO_NAME_SIZE - 1] = 0;
+
+ if (ioctl(dev_fd, LOOP_SET_FD, file_fd) < 0) return;
+ if (ioctl(dev_fd, LOOP_SET_STATUS, &loopinfo) < 0) {
+ ioctl(dev_fd, LOOP_CLR_FD, 0);
+ return;
+ }
+ close(file_fd);
+ RETVAL = 1;
+}
+ OUTPUT:
+ RETVAL
';
$ENV{C_RPM} and print '
@@ -747,7 +774,7 @@ headerGetEntry_filenames(h)
@macros = (
[ qw(int S_IFCHR S_IFBLK KDSKBENT KT_SPEC NR_KEYS MAX_NR_KEYMAPS BLKRRPART TIOCSCTTY
- HDIO_GETGEO BLKGETSIZE
+ HDIO_GETGEO BLKGETSIZE LOOP_GET_STATUS
MS_MGC_VAL MS_RDONLY O_NONBLOCK SECTORSIZE WNOHANG
VT_ACTIVATE VT_WAITACTIVE VT_GETSTATE CDROM_LOCKDOOR CDROMEJECT
) ],
diff --git a/perl-install/devices.pm b/perl-install/devices.pm
index 5ebee431e..61d6bd4c7 100644
--- a/perl-install/devices.pm
+++ b/perl-install/devices.pm
@@ -35,6 +35,18 @@ sub size($) {
$low + 1;
}
+sub set_loop {
+ my ($file) = @_;
+
+ foreach (0..9) {
+ local *F;
+ my $dev = devices::make("loop$_");
+ sysopen F, $dev, 0 or next;
+ !ioctl(F, c::LOOP_GET_STATUS(), my $tmp) && $! == 6 or next; #- 6 == ENXIO
+ return c::set_loop(fileno F, $file) && $dev;
+ }
+}
+
sub make($) {
local $_ = my $file = $_[0];
my ($type, $major, $minor);
@@ -79,6 +91,7 @@ sub make($) {
@{ ${{"fd" => [ c::S_IFBLK(), 2, 0 ],
"hidbp-mse-" => [ c::S_IFCHR(), 10, 32 ],
"lp" => [ c::S_IFCHR(), 6, 0 ],
+ "loop" => [ c::S_IFBLK(), 7, 0 ],
"md" => [ c::S_IFBLK(), 9, 0 ],
"nst" => [ c::S_IFCHR(), 9, 128],
"scd" => [ c::S_IFBLK(), 11, 0 ],
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 661564ecd..b5d80010e 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -173,8 +173,9 @@ sub mount_part($;$$) {
$part->{isMounted} and return;
unless ($::testing) {
+ local $part->{device} = devices::set_loop(loopback::file($part)) || die if isLoopback($part);
if (isSwap($part)) {
- swap::swapon($part->{device});
+ swap::swapon($part->{device});
} else {
$part->{mntpoint} or die "missing mount point";
mount(devices::make($part->{device}), ($prefix || '') . $part->{mntpoint}, type2fs($part->{type}), $rdonly);
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index c1fd12697..96d572cb5 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -40,7 +40,7 @@ my @suggestions_mntpoints = qw(/mnt/dos);
my @partitions_signatures = (
[ 0x83, 0x438, "\x53\xEF" ],
[ 0x82, 4086, "SWAP-SPACE" ],
- [ 0x7, 0x3, "NTFS" ],
+ [ 0x7, 0x1FE, "\x55\xAA", 0x3, "NTFS" ],
[ 0xc, 0x1FE, "\x55\xAA", 0x52, "FAT32" ],
arch() !~ /^sparc/ ? (
[ 0x6, 0x1FE, "\x55\xAA", 0x36, "FAT" ],
diff --git a/perl-install/loopback.pm b/perl-install/loopback.pm
index d992f4dec..0fdebebaf 100644
--- a/perl-install/loopback.pm
+++ b/perl-install/loopback.pm
@@ -19,8 +19,6 @@ sub file {
$part->{loopback_file};
}
-sub ffile { "$_[0]{device}{mntpoint}$_[0]{loopback_file}" }
-
sub loopbacks {
map { map { @{$_->{loopback} || []} } partition_table::get_normal_parts($_) } @_;
}
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index 8092956df..8ed1be0c9 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -344,6 +344,9 @@ sub add_alias($$) {
$alias .= $scsi++ || '' if $alias eq 'scsi_hostadapter';
log::l("adding alias $alias to $name");
$conf{$alias}{alias} ||= $name;
+ if ($alias eq "sound" && $name =~ /^snd-card-/) {
+ $conf{$name}{"post-install"} = "modprobe snd-pcm-oss";
+ }
$alias;
}
@@ -472,7 +475,7 @@ sub write_conf {
while (my ($k, $v) = each %net) { add_alias($k, $v) }
my @l = sort grep { $conf{$_}{alias} && /scsi_hostadapter/ } keys %conf;
- add_alias('block-major-11', 'scsi_hostadapter');
+ add_alias('block-major-11', 'scsi_hostadapter') if @l;
push @l, "ide-floppy" if detect_devices::zips();
$conf{supermount}{"post-install"} = join " ; ", map { "modprobe $_" } @l if @l;
d='n498' href='#n498'>498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
/*
 * Guillaume Cottenceau (gc@mandrakesoft.com)
 *
 * Copyright 2000-2001 MandrakeSoft
 *
 * This software may be freely redistributed under the terms of the GNU
 * public license.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *
 * Code comes from /anonymous@projects.sourceforge.net:/pub/pcmcia-cs/pcmcia-cs-3.1.29.tar.bz2
 */

/*======================================================================

    PCMCIA controller probe

    probe.c 1.55 2001/08/24 12:19:20

    The contents of this file are subject to the Mozilla Public
    License Version 1.1 (the "License"); you may not use this file
    except in compliance with the License. You may obtain a copy of
    the License at http://www.mozilla.org/MPL/

    Software distributed under the License is distributed on an "AS
    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
    implied. See the License for the specific language governing
    rights and limitations under the License.

    The initial developer of the original code is David A. Hinds
    <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
    are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.

    Alternatively, the contents of this file may be used under the
    terms of the GNU General Public License version 2 (the "GPL"), in
    which case the provisions of the GPL are applicable instead of the
    above.  If you wish to allow the use of your version of this file
    only under the terms of the GPL and not to allow others to use
    your version of this file under the MPL, indicate your decision
    by deleting the provisions above and replace them with the notice
    and other provisions required by the GPL.  If you do not delete
    the provisions above, a recipient may use your version of this
    file under either the MPL or the GPL.
    
======================================================================*/

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>

//mdk-stage1// #include <pcmcia/config.h>
#include "log.h"
#include "pcmcia.h"

/*====================================================================*/

//mdk-stage1// #ifdef CONFIG_PCI

typedef struct {
    u_short	vendor, device;
    char	*modname;
    char	*name;
} pci_id_t;

pci_id_t pci_id[] = {
    { 0x1013, 0x1100, "i82365", "Cirrus Logic CL 6729" },
    { 0x1013, 0x1110, "yenta_socket", "Cirrus Logic PD 6832" },
    { 0x10b3, 0xb106, "yenta_socket", "SMC 34C90" },
    { 0x1180, 0x0465, "yenta_socket", "Ricoh RL5C465" },
    { 0x1180, 0x0466, "yenta_socket", "Ricoh RL5C466" },
    { 0x1180, 0x0475, "yenta_socket", "Ricoh RL5C475" },
    { 0x1180, 0x0476, "yenta_socket", "Ricoh RL5C476" },
    { 0x1180, 0x0477, "yenta_socket", "Ricoh RL5C477" },
    { 0x1180, 0x0478, "yenta_socket", "Ricoh RL5C478" },
    { 0x104c, 0xac12, "yenta_socket", "Texas Instruments PCI1130" }, 
    { 0x104c, 0xac13, "yenta_socket", "Texas Instruments PCI1031" }, 
    { 0x104c, 0xac15, "yenta_socket", "Texas Instruments PCI1131" }, 
    { 0x104c, 0xac1a, "yenta_socket", "Texas Instruments PCI1210" }, 
    { 0x104c, 0xac1e, "yenta_socket", "Texas Instruments PCI1211" }, 
    { 0x104c, 0xac17, "yenta_socket", "Texas Instruments PCI1220" }, 
    { 0x104c, 0xac19, "yenta_socket", "Texas Instruments PCI1221" }, 
    { 0x104c, 0xac1c, "yenta_socket", "Texas Instruments PCI1225" }, 
    { 0x104c, 0xac16, "yenta_socket", "Texas Instruments PCI1250" }, 
    { 0x104c, 0xac1d, "yenta_socket", "Texas Instruments PCI1251A" }, 
    { 0x104c, 0xac1f, "yenta_socket", "Texas Instruments PCI1251B" }, 
    { 0x104c, 0xac50, "yenta_socket", "Texas Instruments PCI1410" }, 
    { 0x104c, 0xac51, "yenta_socket", "Texas Instruments PCI1420" }, 
    { 0x104c, 0xac1b, "yenta_socket", "Texas Instruments PCI1450" }, 
    { 0x104c, 0xac52, "yenta_socket", "Texas Instruments PCI1451" }, 
    { 0x104c, 0xac56, "yenta_socket", "Texas Instruments PCI1510" }, 
    { 0x104c, 0xac55, "yenta_socket", "Texas Instruments PCI1520" }, 
    { 0x104c, 0xac54, "yenta_socket", "Texas Instruments PCI1620" }, 
    { 0x104c, 0xac41, "yenta_socket", "Texas Instruments PCI4410" }, 
    { 0x104c, 0xac40, "yenta_socket", "Texas Instruments PCI4450" }, 
    { 0x104c, 0xac42, "yenta_socket", "Texas Instruments PCI4451" }, 
    { 0x104c, 0xac44, "yenta_socket", "Texas Instruments PCI4510" }, 
    { 0x104c, 0xac46, "yenta_socket", "Texas Instruments PCI4520" }, 
    { 0x104c, 0xac49, "yenta_socket", "Texas Instruments PCI7410" }, 
    { 0x104c, 0xac47, "yenta_socket", "Texas Instruments PCI7510" }, 
    { 0x104c, 0xac48, "yenta_socket", "Texas Instruments PCI7610" }, 
    { 0x1217, 0x6729, "i82365", "O2 Micro 6729" }, 
    { 0x1217, 0x673a, "i82365", "O2 Micro 6730" }, 
    { 0x1217, 0x6832, "yenta_socket", "O2 Micro 6832/6833" }, 
    { 0x1217, 0x6836, "yenta_socket", "O2 Micro 6836/6860" }, 
    { 0x1217, 0x6872, "yenta_socket", "O2 Micro 6812" }, 
    { 0x1217, 0x6925, "yenta_socket", "O2 Micro 6922" }, 
    { 0x1217, 0x6933, "yenta_socket", "O2 Micro 6933" }, 
    { 0x1217, 0x6972, "yenta_socket", "O2 Micro 6912" }, 
    { 0x1179, 0x0603, "i82365", "Toshiba ToPIC95-A" }, 
    { 0x1179, 0x060a, "yenta_socket", "Toshiba ToPIC95-B" }, 
    { 0x1179, 0x060f, "yenta_socket", "Toshiba ToPIC97" }, 
    { 0x1179, 0x0617, "yenta_socket", "Toshiba ToPIC100" }, 
    { 0x119b, 0x1221, "i82365", "Omega Micro 82C092G" }, 
    { 0x1524, 0x1411, "yenta_socket", "ENE Technology CB1411" },
    { 0x8086, 0x1221, "i82092", "Intel 82092AA_0" }, 
    { 0x8086, 0x1222, "i82092", "Intel 82092AA_1" }, 
};
#define PCI_COUNT (sizeof(pci_id)/sizeof(pci_id_t))

char * driver = NULL;

static int pci_probe(void)
{
    char s[256], *name = NULL;
    u_int device, vendor, i;
    FILE *f;
    
//mdk-stage1//     if (!module)
    log_message("PCMCIA: probing PCI bus..");

    if ((f = fopen("/proc/bus/pci/devices", "r")) != NULL) {
	while (fgets(s, 256, f) != NULL) {
	    u_int n = strtoul(s+5, NULL, 16);
	    vendor = (n >> 16); device = (n & 0xffff);
	    for (i = 0; i < PCI_COUNT; i++)
		if ((vendor == pci_id[i].vendor) &&
		    (device == pci_id[i].device)) break;
	    if (i < PCI_COUNT) {
		name = pci_id[i].name;
		driver = pci_id[i].modname;
	    }
	}
    }
//mdk-stage1// else if ((f = fopen("/proc/pci", "r")) != NULL) {
//mdk-stage1// 	while (fgets(s, 256, f) != NULL) {
//mdk-stage1// 	    t = strstr(s, "Device id=");
//mdk-stage1// 	    if (t) {
//mdk-stage1// 		device = strtoul(t+10, NULL, 16);
//mdk-stage1// 		t = strstr(s, "Vendor id=");
//mdk-stage1// 		vendor = strtoul(t+10, NULL, 16);
//mdk-stage1// 		for (i = 0; i < PCI_COUNT; i++)
//mdk-stage1// 		    if ((vendor == pci_id[i].vendor) &&
//mdk-stage1// 			(device == pci_id[i].device)) break;
//mdk-stage1// 	    } else
//mdk-stage1// 		for (i = 0; i < PCI_COUNT; i++)
//mdk-stage1// 		    if (strstr(s, pci_id[i].tag) != NULL) break;
//mdk-stage1// 	    if (i != PCI_COUNT) {
//mdk-stage1// 		name = pci_id[i].name;
//mdk-stage1// 		break;
//mdk-stage1// 	    } else {
//mdk-stage1// 		t = strstr(s, "CardBus bridge");
//mdk-stage1// 		if (t != NULL) {
//mdk-stage1// 		    name = t + 16;
//mdk-stage1// 		    t = strchr(s, '(');
//mdk-stage1// 		    t[-1] = '\0';
//mdk-stage1// 		    break;
//mdk-stage1// 		}
//mdk-stage1// 	    }
//mdk-stage1// 	}
//mdk-stage1//     }
    fclose(f);

    if (name) {
//mdk-stage1// 	if (module)
//mdk-stage1// 	    printf("i82365\n");
//mdk-stage1// 	else
	    log_message("\t%s found, 2 sockets (driver %s).", name, driver);
	return 0;
    } else {
//mdk-stage1// 	if (!module)
	    log_message("\tnot found.");
	return -ENODEV;
    }
}
//mdk-stage1// #endif

/*====================================================================*/

//mdk-stage1// #ifdef CONFIG_ISA
//mdk-stage1// 
//mdk-stage1// #ifdef __GLIBC__
#include <sys/io.h>
//mdk-stage1// #else
//mdk-stage1// #include <asm/io.h>
//mdk-stage1// #endif
typedef u_short ioaddr_t;

#include "i82365.h"
#include "cirrus.h"
#include "vg468.h"

static ioaddr_t i365_base = 0x03e0;

static u_char i365_get(u_short sock, u_short reg)
{
    u_char val = I365_REG(sock, reg);
    outb(val, i365_base); val = inb(i365_base+1);
    return val;
}

static void i365_set(u_short sock, u_short reg, u_char data)
{
    u_char val = I365_REG(sock, reg);
    outb(val, i365_base); outb(data, i365_base+1);
}

static void i365_bset(u_short sock, u_short reg, u_char mask)
{
    u_char d = i365_get(sock, reg);
    d |= mask;
    i365_set(sock, reg, d);
}

static void i365_bclr(u_short sock, u_short reg, u_char mask)
{
    u_char d = i365_get(sock, reg);
    d &= ~mask;
    i365_set(sock, reg, d);
}

int i365_probe(void)
{
    int val, sock, done;
    char *name = "i82365sl";

//mdk-stage1// if (!module)
    log_message("PCMCIA: probing for Intel PCIC (ISA)..");
//mdk-stage1//     if (verbose) printf("\n");
    
    sock = done = 0;
    if (ioperm(i365_base, 4, 1)) {
               log_perror("PCMCIA: ioperm");
               return -1;
    }
    ioperm(0x80, 1, 1);
    for (; sock < 2; sock++) {
	val = i365_get(sock, I365_IDENT);
//mdk-stage1//	if (verbose)
//mdk-stage1//	    printf("  ident(%d)=%#2.2x", sock, val); 
	switch (val) {
	case 0x82:
	    name = "i82365sl A step";
	    break;
	case 0x83:
	    name = "i82365sl B step";
	    break;
	case 0x84:
	    name = "VLSI 82C146";
	    break;
	case 0x88: case 0x89: case 0x8a:
	    name = "IBM Clone";
	    break;
	case 0x8b: case 0x8c:
	    break;
	default:
	    done = 1;
	}
	if (done) break;
    }

//mdk-stage1//    if (verbose) printf("\n  ");
    if (sock == 0) {
//mdk-stage1//	if (!module)
	log_message("\tnot found.");
	return -ENODEV;
    }

    if ((sock == 2) && (strcmp(name, "VLSI 82C146") == 0))
	name = "i82365sl DF";

    /* Check for Vadem chips */
    outb(0x0e, i365_base);
    outb(0x37, i365_base);
    i365_bset(0, VG468_MISC, VG468_MISC_VADEMREV);
    val = i365_get(0, I365_IDENT);
    if (val & I365_IDENT_VADEM) {
	if ((val & 7) < 4)
	    name = "Vadem VG-468";
	else
	    name = "Vadem VG-469";
	i365_bclr(0, VG468_MISC, VG468_MISC_VADEMREV);
    }
    
    /* Check for Cirrus CL-PD67xx chips */
    i365_set(0, PD67_CHIP_INFO, 0);
    val = i365_get(0, PD67_CHIP_INFO);
    if ((val & PD67_INFO_CHIP_ID) == PD67_INFO_CHIP_ID) {
	val = i365_get(0, PD67_CHIP_INFO);
	if ((val & PD67_INFO_CHIP_ID) == 0) {
	    if (val & PD67_INFO_SLOTS)
		name = "Cirrus CL-PD672x";
	    else {
		name = "Cirrus CL-PD6710";
		sock = 1;
	    }
	    i365_set(0, PD67_EXT_INDEX, 0xe5);
	    if (i365_get(0, PD67_EXT_INDEX) != 0xe5)
		name = "VIA VT83C469";
	}
    }

//mdk-stage1//    if (module)
//mdk-stage1//	printf("i82365\n");
//mdk-stage1//    else
	printf("\t%s found, %d sockets.\n", name, sock);
    return 0;
    
} /* i365_probe */

//mdk-stage1//#endif /* CONFIG_ISA */

/*====================================================================*/

//mdk-stage1//#ifdef CONFIG_ISA

#include "tcic.h"

//mdk-stage1//static ioaddr_t tcic_base = TCIC_BASE;

static u_char tcic_getb(ioaddr_t base, u_char reg)
{
    u_char val = inb(base+reg);
    return val;
}

static void tcic_setb(ioaddr_t base, u_char reg, u_char data)
{
    outb(data, base+reg);
}

static u_short tcic_getw(ioaddr_t base, u_char reg)
{
    u_short val = inw(base+reg);
    return val;
}

static void tcic_setw(ioaddr_t base, u_char reg, u_short data)
{
    outw(data, base+reg);
}

static u_short tcic_aux_getw(ioaddr_t base, u_short reg)
{
    u_char mode = (tcic_getb(base, TCIC_MODE) & TCIC_MODE_PGMMASK) | reg;
    tcic_setb(base, TCIC_MODE, mode);
    return tcic_getw(base, TCIC_AUX);
}

static void tcic_aux_setw(ioaddr_t base, u_short reg, u_short data)
{
    u_char mode = (tcic_getb(base, TCIC_MODE) & TCIC_MODE_PGMMASK) | reg;
    tcic_setb(base, TCIC_MODE, mode);
    tcic_setw(base, TCIC_AUX, data);
}

static int get_tcic_id(ioaddr_t base)
{
    u_short id;
    tcic_aux_setw(base, TCIC_AUX_TEST, TCIC_TEST_DIAG);
    id = tcic_aux_getw(base, TCIC_AUX_ILOCK);
    id = (id & TCIC_ILOCKTEST_ID_MASK) >> TCIC_ILOCKTEST_ID_SH;
    tcic_aux_setw(base, TCIC_AUX_TEST, 0);
    return id;
}

int tcic_probe_at(ioaddr_t base)
{
    int i;
    u_short old;
    
    /* Anything there?? */
    for (i = 0; i < 0x10; i += 2)
	if (tcic_getw(base, i) == 0xffff)
	    return -1;

//mdk-stage1//    if (!module)
    log_message("\tat %#3.3x: ", base); fflush(stdout);

    /* Try to reset the chip */
    tcic_setw(base, TCIC_SCTRL, TCIC_SCTRL_RESET);
    tcic_setw(base, TCIC_SCTRL, 0);
    
    /* Can we set the addr register? */
    old = tcic_getw(base, TCIC_ADDR);
    tcic_setw(base, TCIC_ADDR, 0);
    if (tcic_getw(base, TCIC_ADDR) != 0) {
	tcic_setw(base, TCIC_ADDR, old);
	return -2;
    }
    
    tcic_setw(base, TCIC_ADDR, 0xc3a5);
    if (tcic_getw(base, TCIC_ADDR) != 0xc3a5)
	return -3;

    return 2;
}

int tcic_probe(void)
{
    int sock, id;

//mdk-stage1//     if (!module)
    log_message("PCMCIA: probing for Databook TCIC-2 (ISA).."); fflush(stdout);
    
    if (ioperm(TCIC_BASE, 16, 1)) {
	    log_perror("PCMCIA: ioperm");
	    return -1;
    }
    ioperm(0x80, 1, 1);
    sock = tcic_probe_at(TCIC_BASE);
    
    if (sock <= 0) {
//mdk-stage1//	if (!module)
	    log_message("\tnot found.");
	return -ENODEV;
    }

//mdk-stage1//    if (module)
//mdk-stage1//	printf("tcic\n");
//mdk-stage1//    else {
	id = get_tcic_id(TCIC_BASE);
	switch (id) {
	case TCIC_ID_DB86082:
	    log_message("DB86082"); break;
	case TCIC_ID_DB86082A:
	    log_message("DB86082A"); break;
	case TCIC_ID_DB86084:
	    log_message("DB86084"); break;
	case TCIC_ID_DB86084A:
	    log_message("DB86084A"); break;
	case TCIC_ID_DB86072:
	    log_message("DB86072"); break;
	case TCIC_ID_DB86184:
	    log_message("DB86184"); break;
	case TCIC_ID_DB86082B:
	    log_message("DB86082B"); break;
	default:
	    log_message("Unknown TCIC-2 ID 0x%02x", id);
	}
	log_message(" found at %#6x, %d sockets.", TCIC_BASE, sock);
//mdk-stage1//     }
    return 0;
    
} /* tcic_probe */

//mdk-stage1// #endif /* CONFIG_ISA */

//mdk-stage1// /*====================================================================*/
//mdk-stage1// 
//mdk-stage1// int main(int argc, char *argv[])
//mdk-stage1// {
//mdk-stage1//     int optch, errflg;
//mdk-stage1//     extern char *optarg;
//mdk-stage1//     int verbose = 0, module = 0;
//mdk-stage1//     
//mdk-stage1//     errflg = 0;
//mdk-stage1//     while ((optch = getopt(argc, argv, "t:vxm")) != -1) {
//mdk-stage1// 	switch (optch) {
//mdk-stage1// #ifdef CONFIG_ISA
//mdk-stage1// 	case 't':
//mdk-stage1// 	    tcic_base = strtoul(optarg, NULL, 0); break;
//mdk-stage1// #endif
//mdk-stage1// 	case 'v':
//mdk-stage1// 	    verbose = 1; break;
//mdk-stage1// 	case 'm':
//mdk-stage1// 	    module = 1; break;
//mdk-stage1// 	default:
//mdk-stage1// 	    errflg = 1; break;
//mdk-stage1// 	}
//mdk-stage1//     }
//mdk-stage1//     if (errflg || (optind < argc)) {
//mdk-stage1// 	fprintf(stderr, "usage: %s [-t tcic_base] [-v] [-m]\n", argv[0]);
//mdk-stage1// 	exit(EXIT_FAILURE);
//mdk-stage1//     }
//mdk-stage1// 
//mdk-stage1// #ifdef CONFIG_PCI
//mdk-stage1//     if (pci_probe(verbose, module) == 0)
//mdk-stage1// 	exit(EXIT_SUCCESS);
//mdk-stage1// #endif
//mdk-stage1// #ifdef CONFIG_ISA
//mdk-stage1//     if (i365_probe(verbose, module) == 0)
//mdk-stage1// 	exit(EXIT_SUCCESS);
//mdk-stage1//     else if (tcic_probe(verbose, module, tcic_base) == 0)
//mdk-stage1// 	exit(EXIT_SUCCESS);
//mdk-stage1// #endif
//mdk-stage1//     exit(EXIT_FAILURE);
//mdk-stage1//     return 0;
//mdk-stage1// }


char * pcmcia_probe(void)
{
	if (!pci_probe())
		return driver;
	else if (!i365_probe())
		return "i82365";
	else if (!tcic_probe())
		return "tcic";
	else
		return NULL;
}