1999-06-17 19:04:56 +00:00
|
|
|
/*
|
|
|
|
* PC-card support for sysinstall
|
|
|
|
*
|
1999-08-28 01:35:59 +00:00
|
|
|
* $FreeBSD$
|
1999-06-17 19:04:56 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) 1997-1999
|
|
|
|
* Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org>. All rights reserved.
|
|
|
|
*
|
|
|
|
* This software may be used, modified, copied, and distributed, in
|
|
|
|
* both source and binary form provided that the above copyright and
|
|
|
|
* these terms are retained. Under no circumstances is the author
|
|
|
|
* responsible for the proper functioning of this software, nor does
|
|
|
|
* the author assume any responsibility for damages incurred with its
|
|
|
|
* use.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sysinstall.h"
|
1999-07-06 09:16:00 +00:00
|
|
|
#include "pccard_conf.h"
|
1999-06-17 19:04:56 +00:00
|
|
|
#include <sys/fcntl.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <pccard/cardinfo.h>
|
|
|
|
|
|
|
|
#ifdef PCCARD
|
|
|
|
|
|
|
|
int pccard_mode = 0;
|
|
|
|
|
|
|
|
DMenu MenuPCICMem = {
|
|
|
|
DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
|
|
|
|
"Please select free address area used by PC-card controller",
|
|
|
|
"PC-card controller uses memory area to get card information.\n"
|
|
|
|
"Please specify an address that is not used by other devices.\n"
|
|
|
|
"If you're uncertain of detailed specification of your hardware,\n"
|
|
|
|
"leave it untouched (default == 0xd0000).",
|
|
|
|
"Press F1 for more HELP",
|
|
|
|
"pccard",
|
|
|
|
{ { "Default", "I/O address 0xd0000 - 0xd3fff",
|
1999-06-30 05:04:37 +00:00
|
|
|
NULL, dmenuSetVariable, NULL, "_pcicmem=0"},
|
1999-06-17 19:04:56 +00:00
|
|
|
{ "D4", "I/O address 0xd4000 - 0xd7fff",
|
1999-06-30 05:04:37 +00:00
|
|
|
NULL, dmenuSetVariable, NULL, "_pcicmem=1"},
|
1999-06-17 19:04:56 +00:00
|
|
|
{ "D8", "I/O address 0xd8000 - 0xdbfff",
|
1999-06-30 05:04:37 +00:00
|
|
|
NULL, dmenuSetVariable, NULL, "_pcicmem=2"},
|
1999-06-17 19:04:56 +00:00
|
|
|
{ "DC", "I/O address 0xdc000 - 0xdffff",
|
1999-06-30 05:04:37 +00:00
|
|
|
NULL, dmenuSetVariable, NULL, "_pcicmem=3"},
|
1999-06-17 19:04:56 +00:00
|
|
|
{ NULL } },
|
|
|
|
};
|
|
|
|
|
|
|
|
DMenu MenuCardIRQ = {
|
|
|
|
DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
|
|
|
|
"Please select IRQs that can be used by PC-cards",
|
|
|
|
"Please specify an IRQs that CANNOT be used by PC-card.\n"
|
|
|
|
"For example, if you have a sound card that can't be probed by\n"
|
|
|
|
"this installation floppy and it uses IRQ 10, you have to \n"
|
|
|
|
"choose \"Option 1\" or \"Option 2\" at this menu.\n",
|
|
|
|
"Press F1 for more HELP",
|
|
|
|
"pccard",
|
|
|
|
{ { "Default", "IRQ 10, 11",
|
1999-06-30 05:04:37 +00:00
|
|
|
NULL, dmenuSetVariable, NULL, "_cardirq=0"},
|
1999-06-17 19:04:56 +00:00
|
|
|
{ "Option 1", "IRQ 5, 11 (ex. soundcard on IRQ 10)",
|
1999-06-30 05:04:37 +00:00
|
|
|
NULL, dmenuSetVariable, NULL, "_cardirq=1"},
|
1999-06-17 19:04:56 +00:00
|
|
|
{ "Option 2", "IRQ 11 (ex. something on IRQ 5 and 10)",
|
1999-06-30 05:04:37 +00:00
|
|
|
NULL, dmenuSetVariable, NULL, "_cardirq=2"},
|
1999-06-17 19:04:56 +00:00
|
|
|
{ NULL } },
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
pccardInitialize(void)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
int t;
|
|
|
|
int pcic_mem = 0xd0000;
|
|
|
|
char card_device[16];
|
|
|
|
char *card_irq = "";
|
|
|
|
char *spcic_mem;
|
|
|
|
char *scard_irq;
|
1999-07-04 15:54:14 +00:00
|
|
|
char pccardd_flags[128];
|
1999-06-17 19:04:56 +00:00
|
|
|
char pccardd_cmd[256];
|
1999-12-14 04:25:29 +00:00
|
|
|
WINDOW *w;
|
|
|
|
|
1999-06-17 19:04:56 +00:00
|
|
|
pccard_mode = 1;
|
|
|
|
|
|
|
|
if (!RunningAsInit && !Fake) {
|
|
|
|
/* It's not my job... */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dmenuOpenSimple(&MenuPCICMem, FALSE);
|
1999-06-30 05:04:37 +00:00
|
|
|
spcic_mem = variable_get("_pcicmem");
|
1999-06-17 19:04:56 +00:00
|
|
|
dmenuOpenSimple(&MenuCardIRQ, FALSE);
|
1999-06-30 05:04:37 +00:00
|
|
|
scard_irq = variable_get("_cardirq");
|
1999-06-17 19:04:56 +00:00
|
|
|
|
|
|
|
sscanf(spcic_mem, "%d", &t);
|
|
|
|
switch (t) {
|
|
|
|
case 0:
|
|
|
|
pcic_mem = 0xd0000;
|
1999-07-04 15:11:23 +00:00
|
|
|
variable_set2("pccard_mem", "DEFAULT", 1);
|
1999-06-17 19:04:56 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
pcic_mem = 0xd4000;
|
1999-07-04 15:11:23 +00:00
|
|
|
variable_set2("pccard_mem", "0xd4000", 1);
|
1999-06-17 19:04:56 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
pcic_mem = 0xd8000;
|
1999-07-04 15:11:23 +00:00
|
|
|
variable_set2("pccard_mem", "0xd8000", 1);
|
1999-06-17 19:04:56 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
pcic_mem = 0xdc000;
|
1999-07-04 15:11:23 +00:00
|
|
|
variable_set2("pccard_mem", "0xdc000", 1);
|
1999-06-17 19:04:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
sscanf(scard_irq, "%d", &t);
|
|
|
|
|
|
|
|
switch (t) {
|
|
|
|
case 0:
|
1999-07-04 15:54:14 +00:00
|
|
|
card_irq = "-i 10 -i 11";
|
1999-06-17 19:04:56 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
1999-07-04 15:54:14 +00:00
|
|
|
card_irq = "-i 5 -i 11";
|
1999-06-17 19:04:56 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
1999-07-04 15:54:14 +00:00
|
|
|
card_irq = "-i 11";
|
1999-06-17 19:04:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(card_device, CARD_DEVICE, 0);
|
1999-12-14 04:25:29 +00:00
|
|
|
|
|
|
|
w = savescr();
|
|
|
|
dialog_clear_norefresh();
|
|
|
|
msgConfirm("Now we start initializing PC-card controller and cards.\n"
|
|
|
|
"If you've executed this installer from a PC-card floppy\n"
|
1999-06-17 19:04:56 +00:00
|
|
|
"drive, this is the last chance to replace it with\n"
|
|
|
|
"installation media (PC-card Ethernet, CDROM, etc.).\n"
|
|
|
|
"Please insert installation media and press [Enter].\n"
|
|
|
|
"If you've not plugged the PC-card installation media\n"
|
1999-12-14 04:25:29 +00:00
|
|
|
"in yet, please plug it in now and press [Enter].\n"
|
1999-06-17 19:04:56 +00:00
|
|
|
"Otherwise, just press [Enter] to proceed.");
|
|
|
|
|
|
|
|
dialog_clear();
|
|
|
|
msgNotify("Initializing PC-card controller....");
|
|
|
|
|
|
|
|
if (!Fake) {
|
|
|
|
if ((fd = open(card_device, O_RDWR)) < 1) {
|
|
|
|
msgNotify("Can't open PC-card controller %s.\n",
|
|
|
|
card_device);
|
1999-12-14 04:25:29 +00:00
|
|
|
restorescr(w);
|
1999-06-17 19:04:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ioctl(fd, PIOCRWMEM, &pcic_mem) < 0){
|
|
|
|
msgNotify("ioctl %s failed.\n", card_device);
|
1999-12-14 04:25:29 +00:00
|
|
|
restorescr(w);
|
1999-06-17 19:04:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(pccardd_cmd, "/stand/pccardd ");
|
|
|
|
strcat(pccardd_cmd, card_irq);
|
|
|
|
strcat(pccardd_cmd, " -z");
|
1999-07-04 15:54:14 +00:00
|
|
|
|
|
|
|
strcpy(pccardd_flags, card_irq);
|
|
|
|
variable_set2("pccardd_flags", card_irq, 1);
|
|
|
|
|
1999-06-17 19:04:56 +00:00
|
|
|
vsystem(pccardd_cmd);
|
1999-12-14 04:25:29 +00:00
|
|
|
restorescr(w);
|
1999-06-17 19:04:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* PCCARD */
|
|
|
|
|
|
|
|
|