summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/pcmcia/probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/pcmcia/probe.c')
-rw-r--r--mdk-stage1/pcmcia/probe.c190
1 files changed, 46 insertions, 144 deletions
diff --git a/mdk-stage1/pcmcia/probe.c b/mdk-stage1/pcmcia/probe.c
index 8f8a4bc8e..240fe3a17 100644
--- a/mdk-stage1/pcmcia/probe.c
+++ b/mdk-stage1/pcmcia/probe.c
@@ -1,7 +1,7 @@
/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
+ * Guillaume Cottenceau (gc)
*
- * Copyright 2000-2001 Mandrakesoft
+ * Copyright 2000-2001 Mandriva
*
* This software may be freely redistributed under the terms of the GNU
* public license.
@@ -12,6 +12,9 @@
*
*
* Code comes from /anonymous@projects.sourceforge.net:/pub/pcmcia-cs/pcmcia-cs-3.1.29.tar.bz2
+ *
+ * FIXME: resync with latest pcmcia-cs-3.2.8 or with pcmciautils-0.18 (which uses sysfs)
+ *
*/
/*======================================================================
@@ -55,14 +58,11 @@
#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;
@@ -70,63 +70,63 @@ typedef struct {
} pci_id_t;
pci_id_t pci_id[] = {
- { 0x1013, 0x1100, "i82365", "Cirrus Logic CL 6729" },
+ { 0x1013, 0x1100, "pd6729", "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, 0x8011, "yenta_socket", "" },
+ { 0x104c, 0x8031, "yenta_socket", "Texas Instruments|PCIxx21/x515 Cardbus Controller" },
+ { 0x104c, 0x8036, "yenta_socket", "Texas Instruments|PCI6515 Cardbus Controller" },
+ { 0x104c, 0x8039, "yenta_socket", "Texas Instruments|PCIxx12 Cardbus Controller " },
{ 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, 0xac16, "yenta_socket", "Texas Instruments PCI1250" },
{ 0x104c, 0xac17, "yenta_socket", "Texas Instruments PCI1220" },
{ 0x104c, 0xac19, "yenta_socket", "Texas Instruments PCI1221" },
+ { 0x104c, 0xac1a, "yenta_socket", "Texas Instruments PCI1210" },
+ { 0x104c, 0xac1b, "yenta_socket", "Texas Instruments PCI1450" },
{ 0x104c, 0xac1c, "yenta_socket", "Texas Instruments PCI1225" },
- { 0x104c, 0xac16, "yenta_socket", "Texas Instruments PCI1250" },
{ 0x104c, 0xac1d, "yenta_socket", "Texas Instruments PCI1251A" },
+ { 0x104c, 0xac1e, "yenta_socket", "Texas Instruments PCI1211" },
{ 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, 0xac41, "yenta_socket", "Texas Instruments PCI4410" },
{ 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" },
+ { 0x104c, 0xac49, "yenta_socket", "Texas Instruments PCI7410" },
+ { 0x104c, 0xac50, "yenta_socket", "Texas Instruments PCI1410" },
+ { 0x104c, 0xac51, "yenta_socket", "Texas Instruments PCI1420" },
+ { 0x104c, 0xac52, "yenta_socket", "Texas Instruments PCI1451" },
+ { 0x104c, 0xac54, "yenta_socket", "Texas Instruments PCI1620" },
+ { 0x104c, 0xac55, "yenta_socket", "Texas Instruments PCI1520" },
+ { 0x104c, 0xac56, "yenta_socket", "Texas Instruments PCI1510" },
+ { 0x104c, 0xac8d, "yenta_socket", "Texas Instruments|PCI7620" },
+ { 0x104c, 0xac8e, "yenta_socket", "Texas Instruments|PCI7420 CardBus Controller" },
{ 0x104c, 0xac8e, "yenta_socket", "Texas Instruments PCI7420" },
- { 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" },
- { 0x1217, 0x7114, "yenta_socket", "O2 Micro 711M1" },
- { 0x1179, 0x0603, "i82365", "Toshiba ToPIC95-A" },
+ { 0x10b3, 0xb106, "yenta_socket", "SMC 34C90" },
+ { 0x1179, 0x0603, "pd6729", "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" },
- { 0x8086, 0x1221, "i82092", "Intel 82092AA_0" },
- { 0x8086, 0x1222, "i82092", "Intel 82092AA_1" },
+ { 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" },
+ { 0x119b, 0x1221, "pd6729", "Omega Micro 82C092G" },
{ 0x1524, 0x1211, "yenta_socket", "ENE 1211" },
{ 0x1524, 0x1225, "yenta_socket", "ENE 1225" },
{ 0x1524, 0x1410, "yenta_socket", "ENE 1410" },
{ 0x1524, 0x1411, "yenta_socket", "ENE Technology CB1411" },
+ { 0x1524, 0x1412, "yenta_socket", "ENE Technology Inc|CB-712/4 Cardbus Controller " },
{ 0x1524, 0x1420, "yenta_socket", "ENE 1420" },
+ { 0x1524, 0x1421, "yenta_socket", "ENE Technology Inc|CB-720/2/4 Cardbus Controller" },
+ { 0x1524, 0x1422, "yenta_socket", "ENE Technology Inc|CB-722/4 Cardbus Controller" },
+ { 0x8086, 0x1221, "i82092", "Intel 82092AA_0" },
+ { 0x8086, 0x1222, "i82092", "Intel 82092AA_1" },
};
#define PCI_COUNT (sizeof(pci_id)/sizeof(pci_id_t))
@@ -138,13 +138,17 @@ static int pci_probe(void)
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);
+ if (vendor == 0x1217) {
+ driver = "yenta_socket";
+ name = "O2 Micro|PCMCIA Controller";
+ break;
+ }
for (i = 0; i < PCI_COUNT; i++)
if ((vendor == pci_id[i].vendor) &&
(device == pci_id[i].device)) break;
@@ -154,58 +158,20 @@ static int pci_probe(void)
}
}
}
-//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"
@@ -246,9 +212,7 @@ 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)) {
@@ -258,8 +222,6 @@ int i365_probe(void)
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";
@@ -281,9 +243,7 @@ int i365_probe(void)
if (done) break;
}
-//mdk-stage1// if (verbose) printf("\n ");
if (sock == 0) {
-//mdk-stage1// if (!module)
log_message("\tnot found.");
return -ENODEV;
}
@@ -322,24 +282,15 @@ int i365_probe(void)
}
}
-//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);
@@ -396,7 +347,6 @@ int tcic_probe_at(ioaddr_t base)
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 */
@@ -422,7 +372,6 @@ 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)) {
@@ -433,14 +382,10 @@ int tcic_probe(void)
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:
@@ -461,64 +406,21 @@ int tcic_probe(void)
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;
+#if !defined(__x86_64__)
else if (!i365_probe())
- return "i82365";
+ return "pd6729";
else if (!tcic_probe())
return "tcic";
+#endif
else
return NULL;
}