aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig12
-rw-r--r--drivers/char/agp/amd64-agp.c24
-rw-r--r--drivers/char/agp/ati-agp.c20
-rw-r--r--drivers/char/agp/frontend.c28
-rw-r--r--drivers/char/agp/intel-agp.c15
-rw-r--r--drivers/char/agp/isoch.c4
-rw-r--r--drivers/char/amiserial.c1
-rw-r--r--drivers/char/drm/r128_state.c2
-rw-r--r--drivers/char/esp.c3
-rw-r--r--drivers/char/ftape/Kconfig12
-rw-r--r--drivers/char/generic_serial.c1
-rw-r--r--drivers/char/hangcheck-timer.c12
-rw-r--r--drivers/char/hpet.c26
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c8
-rw-r--r--drivers/char/rio/brates.h106
-rw-r--r--drivers/char/rio/chan.h33
-rw-r--r--drivers/char/rio/cmd.h83
-rw-r--r--drivers/char/rio/data.h40
-rw-r--r--drivers/char/rio/debug.h39
-rw-r--r--drivers/char/rio/eisa.h104
-rw-r--r--drivers/char/rio/enable.h48
-rw-r--r--drivers/char/rio/formpkt.h153
-rw-r--r--drivers/char/rio/hosthw.h55
-rw-r--r--drivers/char/rio/lrt.h52
-rw-r--r--drivers/char/rio/ltt.h52
-rw-r--r--drivers/char/rio/lttwake.h50
-rw-r--r--drivers/char/rio/mca.h73
-rw-r--r--drivers/char/rio/mesg.h41
-rw-r--r--drivers/char/rio/poll.h73
-rw-r--r--drivers/char/rio/proto.h244
-rw-r--r--drivers/char/rio/rio_linux.c60
-rw-r--r--drivers/char/rio/rioboot.c61
-rw-r--r--drivers/char/rio/riocmd.c30
-rw-r--r--drivers/char/rio/rioctrl.c111
-rw-r--r--drivers/char/rio/rioinit.c1152
-rw-r--r--drivers/char/rio/riolocks.h43
-rw-r--r--drivers/char/rio/rioparam.c43
-rw-r--r--drivers/char/rio/rioroute.c24
-rw-r--r--drivers/char/rio/riotable.c8
-rw-r--r--drivers/char/rio/riotime.h63
-rw-r--r--drivers/char/rio/riotty.c583
-rw-r--r--drivers/char/rio/riowinif.h1329
-rw-r--r--drivers/char/rio/riscos.h63
-rw-r--r--drivers/char/rio/rtahw.h75
-rw-r--r--drivers/char/rio/rupstat.h50
-rw-r--r--drivers/char/rio/selftest.h73
-rw-r--r--drivers/char/rio/sysmap.h62
-rw-r--r--drivers/char/rio/timeouts.h50
-rw-r--r--drivers/char/riscom8.c1
-rw-r--r--drivers/char/serial167.c1
-rw-r--r--drivers/char/specialix.c3
-rw-r--r--drivers/char/stallion.c128
-rw-r--r--drivers/char/synclink.c1
-rw-r--r--drivers/char/synclink_gt.c2
-rw-r--r--drivers/char/tlclk.c93
-rw-r--r--drivers/char/tpm/tpm_bios.c25
-rw-r--r--drivers/char/tpm/tpm_infineon.c2
-rw-r--r--drivers/char/vt.c1
-rw-r--r--drivers/char/watchdog/Kconfig26
-rw-r--r--drivers/char/watchdog/Makefile2
-rw-r--r--drivers/char/watchdog/mpc83xx_wdt.c229
-rw-r--r--drivers/char/watchdog/sa1100_wdt.c12
-rw-r--r--drivers/char/watchdog/sbc_epx_c3.c216
63 files changed, 712 insertions, 5324 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index d6fcd0a36f9f..4c67727d75b1 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -881,16 +881,6 @@ config FTAPE
881 module. To compile this driver as a module, choose M here: the 881 module. To compile this driver as a module, choose M here: the
882 module will be called ftape. 882 module will be called ftape.
883 883
884 Note that the Ftape-HOWTO is out of date (sorry) and documents the
885 older version 2.08 of this software but still contains useful
886 information. There is a web page with more recent documentation at
887 <http://www.instmath.rwth-aachen.de/~heine/ftape/>. This page
888 always contains the latest release of the ftape driver and useful
889 information (backup software, ftape related patches and
890 documentation, FAQ). Note that the file system interface has
891 changed quite a bit compared to previous versions of ftape. Please
892 read <file:Documentation/ftape.txt>.
893
894source "drivers/char/ftape/Kconfig" 884source "drivers/char/ftape/Kconfig"
895 885
896endmenu 886endmenu
@@ -1002,7 +992,7 @@ config HPET_MMAP
1002 992
1003config HANGCHECK_TIMER 993config HANGCHECK_TIMER
1004 tristate "Hangcheck timer" 994 tristate "Hangcheck timer"
1005 depends on X86 || IA64 || PPC64 || S390 995 depends on X86 || IA64 || PPC64
1006 help 996 help
1007 The hangcheck-timer module detects when the system has gone 997 The hangcheck-timer module detects when the system has gone
1008 out to lunch past a certain margin. It can reboot the system 998 out to lunch past a certain margin. It can reboot the system
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 810679dcbbb0..9964c508c111 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -600,6 +600,26 @@ static void __devexit agp_amd64_remove(struct pci_dev *pdev)
600 agp_put_bridge(bridge); 600 agp_put_bridge(bridge);
601} 601}
602 602
603#ifdef CONFIG_PM
604
605static int agp_amd64_suspend(struct pci_dev *pdev, pm_message_t state)
606{
607 pci_save_state(pdev);
608 pci_set_power_state(pdev, pci_choose_state(pdev, state));
609
610 return 0;
611}
612
613static int agp_amd64_resume(struct pci_dev *pdev)
614{
615 pci_set_power_state(pdev, PCI_D0);
616 pci_restore_state(pdev);
617
618 return amd_8151_configure();
619}
620
621#endif /* CONFIG_PM */
622
603static struct pci_device_id agp_amd64_pci_table[] = { 623static struct pci_device_id agp_amd64_pci_table[] = {
604 { 624 {
605 .class = (PCI_CLASS_BRIDGE_HOST << 8), 625 .class = (PCI_CLASS_BRIDGE_HOST << 8),
@@ -718,6 +738,10 @@ static struct pci_driver agp_amd64_pci_driver = {
718 .id_table = agp_amd64_pci_table, 738 .id_table = agp_amd64_pci_table,
719 .probe = agp_amd64_probe, 739 .probe = agp_amd64_probe,
720 .remove = agp_amd64_remove, 740 .remove = agp_amd64_remove,
741#ifdef CONFIG_PM
742 .suspend = agp_amd64_suspend,
743 .resume = agp_amd64_resume,
744#endif
721}; 745};
722 746
723 747
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 53372a83b675..5b74c36c116c 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -244,6 +244,22 @@ static int ati_configure(void)
244} 244}
245 245
246 246
247#ifdef CONFIG_PM
248static int agp_ati_resume(struct pci_dev *dev)
249{
250 pci_restore_state(dev);
251
252 return ati_configure();
253}
254
255static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state)
256{
257 pci_save_state(dev);
258
259 return 0;
260}
261#endif
262
247/* 263/*
248 *Since we don't need contigious memory we just try 264 *Since we don't need contigious memory we just try
249 * to get the gatt table once 265 * to get the gatt table once
@@ -525,6 +541,10 @@ static struct pci_driver agp_ati_pci_driver = {
525 .id_table = agp_ati_pci_table, 541 .id_table = agp_ati_pci_table,
526 .probe = agp_ati_probe, 542 .probe = agp_ati_probe,
527 .remove = agp_ati_remove, 543 .remove = agp_ati_remove,
544#ifdef CONFIG_PM
545 .resume = agp_ati_resume,
546 .suspend = agp_ati_suspend,
547#endif
528}; 548};
529 549
530static int __init agp_ati_init(void) 550static int __init agp_ati_init(void)
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index 17f520c9d471..97eeb2345b18 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -592,7 +592,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
592 struct agp_file_private *priv = file->private_data; 592 struct agp_file_private *priv = file->private_data;
593 struct agp_kern_info kerninfo; 593 struct agp_kern_info kerninfo;
594 594
595 down(&(agp_fe.agp_mutex)); 595 mutex_lock(&(agp_fe.agp_mutex));
596 596
597 if (agp_fe.backend_acquired != TRUE) 597 if (agp_fe.backend_acquired != TRUE)
598 goto out_eperm; 598 goto out_eperm;
@@ -627,7 +627,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
627 size, vma->vm_page_prot)) { 627 size, vma->vm_page_prot)) {
628 goto out_again; 628 goto out_again;
629 } 629 }
630 up(&(agp_fe.agp_mutex)); 630 mutex_unlock(&(agp_fe.agp_mutex));
631 return 0; 631 return 0;
632 } 632 }
633 633
@@ -643,20 +643,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
643 size, vma->vm_page_prot)) { 643 size, vma->vm_page_prot)) {
644 goto out_again; 644 goto out_again;
645 } 645 }
646 up(&(agp_fe.agp_mutex)); 646 mutex_unlock(&(agp_fe.agp_mutex));
647 return 0; 647 return 0;
648 } 648 }
649 649
650out_eperm: 650out_eperm:
651 up(&(agp_fe.agp_mutex)); 651 mutex_unlock(&(agp_fe.agp_mutex));
652 return -EPERM; 652 return -EPERM;
653 653
654out_inval: 654out_inval:
655 up(&(agp_fe.agp_mutex)); 655 mutex_unlock(&(agp_fe.agp_mutex));
656 return -EINVAL; 656 return -EINVAL;
657 657
658out_again: 658out_again:
659 up(&(agp_fe.agp_mutex)); 659 mutex_unlock(&(agp_fe.agp_mutex));
660 return -EAGAIN; 660 return -EAGAIN;
661} 661}
662 662
@@ -664,7 +664,7 @@ static int agp_release(struct inode *inode, struct file *file)
664{ 664{
665 struct agp_file_private *priv = file->private_data; 665 struct agp_file_private *priv = file->private_data;
666 666
667 down(&(agp_fe.agp_mutex)); 667 mutex_lock(&(agp_fe.agp_mutex));
668 668
669 DBG("priv=%p", priv); 669 DBG("priv=%p", priv);
670 670
@@ -687,7 +687,7 @@ static int agp_release(struct inode *inode, struct file *file)
687 agp_remove_file_private(priv); 687 agp_remove_file_private(priv);
688 kfree(priv); 688 kfree(priv);
689 file->private_data = NULL; 689 file->private_data = NULL;
690 up(&(agp_fe.agp_mutex)); 690 mutex_unlock(&(agp_fe.agp_mutex));
691 return 0; 691 return 0;
692} 692}
693 693
@@ -698,7 +698,7 @@ static int agp_open(struct inode *inode, struct file *file)
698 struct agp_client *client; 698 struct agp_client *client;
699 int rc = -ENXIO; 699 int rc = -ENXIO;
700 700
701 down(&(agp_fe.agp_mutex)); 701 mutex_lock(&(agp_fe.agp_mutex));
702 702
703 if (minor != AGPGART_MINOR) 703 if (minor != AGPGART_MINOR)
704 goto err_out; 704 goto err_out;
@@ -723,13 +723,13 @@ static int agp_open(struct inode *inode, struct file *file)
723 file->private_data = (void *) priv; 723 file->private_data = (void *) priv;
724 agp_insert_file_private(priv); 724 agp_insert_file_private(priv);
725 DBG("private=%p, client=%p", priv, client); 725 DBG("private=%p, client=%p", priv, client);
726 up(&(agp_fe.agp_mutex)); 726 mutex_unlock(&(agp_fe.agp_mutex));
727 return 0; 727 return 0;
728 728
729err_out_nomem: 729err_out_nomem:
730 rc = -ENOMEM; 730 rc = -ENOMEM;
731err_out: 731err_out:
732 up(&(agp_fe.agp_mutex)); 732 mutex_unlock(&(agp_fe.agp_mutex));
733 return rc; 733 return rc;
734} 734}
735 735
@@ -985,7 +985,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
985 int ret_val = -ENOTTY; 985 int ret_val = -ENOTTY;
986 986
987 DBG("priv=%p, cmd=%x", curr_priv, cmd); 987 DBG("priv=%p, cmd=%x", curr_priv, cmd);
988 down(&(agp_fe.agp_mutex)); 988 mutex_lock(&(agp_fe.agp_mutex));
989 989
990 if ((agp_fe.current_controller == NULL) && 990 if ((agp_fe.current_controller == NULL) &&
991 (cmd != AGPIOC_ACQUIRE)) { 991 (cmd != AGPIOC_ACQUIRE)) {
@@ -1055,7 +1055,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
1055 1055
1056ioctl_out: 1056ioctl_out:
1057 DBG("ioctl returns %d\n", ret_val); 1057 DBG("ioctl returns %d\n", ret_val);
1058 up(&(agp_fe.agp_mutex)); 1058 mutex_unlock(&(agp_fe.agp_mutex));
1059 return ret_val; 1059 return ret_val;
1060} 1060}
1061 1061
@@ -1081,7 +1081,7 @@ static struct miscdevice agp_miscdev =
1081int agp_frontend_initialize(void) 1081int agp_frontend_initialize(void)
1082{ 1082{
1083 memset(&agp_fe, 0, sizeof(struct agp_front_data)); 1083 memset(&agp_fe, 0, sizeof(struct agp_front_data));
1084 sema_init(&(agp_fe.agp_mutex), 1); 1084 mutex_init(&(agp_fe.agp_mutex));
1085 1085
1086 if (misc_register(&agp_miscdev)) { 1086 if (misc_register(&agp_miscdev)) {
1087 printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR); 1087 printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR);
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index e7bed5047dcc..631531fd97a5 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -422,7 +422,8 @@ static void intel_i830_init_gtt_entries(void)
422 /* Check it's really I915G */ 422 /* Check it's really I915G */
423 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 423 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
424 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 424 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
425 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) 425 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
426 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB)
426 gtt_entries = MB(48) - KB(size); 427 gtt_entries = MB(48) - KB(size);
427 else 428 else
428 gtt_entries = 0; 429 gtt_entries = 0;
@@ -431,7 +432,8 @@ static void intel_i830_init_gtt_entries(void)
431 /* Check it's really I915G */ 432 /* Check it's really I915G */
432 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 433 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
433 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 434 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
434 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) 435 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
436 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB)
435 gtt_entries = MB(64) - KB(size); 437 gtt_entries = MB(64) - KB(size);
436 else 438 else
437 gtt_entries = 0; 439 gtt_entries = 0;
@@ -1681,6 +1683,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
1681 } 1683 }
1682 name = "945G"; 1684 name = "945G";
1683 break; 1685 break;
1686 case PCI_DEVICE_ID_INTEL_82945GM_HB:
1687 if (find_i830(PCI_DEVICE_ID_INTEL_82945GM_IG)) {
1688 bridge->driver = &intel_915_driver;
1689 } else {
1690 bridge->driver = &intel_845_driver;
1691 }
1692 name = "945GM";
1693 break;
1684 case PCI_DEVICE_ID_INTEL_7505_0: 1694 case PCI_DEVICE_ID_INTEL_7505_0:
1685 bridge->driver = &intel_7505_driver; 1695 bridge->driver = &intel_7505_driver;
1686 name = "E7505"; 1696 name = "E7505";
@@ -1821,6 +1831,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
1821 ID(PCI_DEVICE_ID_INTEL_82915G_HB), 1831 ID(PCI_DEVICE_ID_INTEL_82915G_HB),
1822 ID(PCI_DEVICE_ID_INTEL_82915GM_HB), 1832 ID(PCI_DEVICE_ID_INTEL_82915GM_HB),
1823 ID(PCI_DEVICE_ID_INTEL_82945G_HB), 1833 ID(PCI_DEVICE_ID_INTEL_82945G_HB),
1834 ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
1824 { } 1835 { }
1825}; 1836};
1826 1837
diff --git a/drivers/char/agp/isoch.c b/drivers/char/agp/isoch.c
index 40083241804e..7c14a096b85e 100644
--- a/drivers/char/agp/isoch.c
+++ b/drivers/char/agp/isoch.c
@@ -218,10 +218,8 @@ static int agp_3_5_isochronous_node_enable(struct agp_bridge_data *bridge,
218 master[cdev].rq *= (1 << (master[cdev].y - 1)); 218 master[cdev].rq *= (1 << (master[cdev].y - 1));
219 219
220 tot_rq += master[cdev].rq; 220 tot_rq += master[cdev].rq;
221
222 if (cdev == ndevs-1)
223 master[cdev].n += rem;
224 } 221 }
222 master[ndevs-1].n += rem;
225 223
226 /* Figure the number of isochronous and asynchronous RQ slots the 224 /* Figure the number of isochronous and asynchronous RQ slots the
227 * target is providing. */ 225 * target is providing. */
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index 667a21c72edb..7ac365b5d9ec 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -129,7 +129,6 @@ static struct serial_state rs_table[1];
129 * memory if large numbers of serial ports are open. 129 * memory if large numbers of serial ports are open.
130 */ 130 */
131static unsigned char *tmp_buf; 131static unsigned char *tmp_buf;
132static DECLARE_MUTEX(tmp_buf_sem);
133 132
134#include <asm/uaccess.h> 133#include <asm/uaccess.h>
135 134
diff --git a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c
index caeecc2c36da..a080cdd6081e 100644
--- a/drivers/char/drm/r128_state.c
+++ b/drivers/char/drm/r128_state.c
@@ -220,7 +220,7 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv)
220 ADVANCE_RING(); 220 ADVANCE_RING();
221} 221}
222 222
223static __inline__ void r128_emit_state(drm_r128_private_t * dev_priv) 223static void r128_emit_state(drm_r128_private_t * dev_priv)
224{ 224{
225 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; 225 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
226 unsigned int dirty = sarea_priv->dirty; 226 unsigned int dirty = sarea_priv->dirty;
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index e469f641c728..3f3ac039f4d9 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -160,7 +160,6 @@ static void rs_wait_until_sent(struct tty_struct *, int);
160 * memory if large numbers of serial ports are open. 160 * memory if large numbers of serial ports are open.
161 */ 161 */
162static unsigned char *tmp_buf; 162static unsigned char *tmp_buf;
163static DECLARE_MUTEX(tmp_buf_sem);
164 163
165static inline int serial_paranoia_check(struct esp_struct *info, 164static inline int serial_paranoia_check(struct esp_struct *info,
166 char *name, const char *routine) 165 char *name, const char *routine)
@@ -2493,6 +2492,7 @@ static int __init espserial_init(void)
2493 } 2492 }
2494 2493
2495 memset((void *)info, 0, sizeof(struct esp_struct)); 2494 memset((void *)info, 0, sizeof(struct esp_struct));
2495 spin_lock_init(&info->lock);
2496 /* rx_trigger, tx_trigger are needed by autoconfig */ 2496 /* rx_trigger, tx_trigger are needed by autoconfig */
2497 info->config.rx_trigger = rx_trigger; 2497 info->config.rx_trigger = rx_trigger;
2498 info->config.tx_trigger = tx_trigger; 2498 info->config.tx_trigger = tx_trigger;
@@ -2529,7 +2529,6 @@ static int __init espserial_init(void)
2529 init_waitqueue_head(&info->close_wait); 2529 init_waitqueue_head(&info->close_wait);
2530 init_waitqueue_head(&info->delta_msr_wait); 2530 init_waitqueue_head(&info->delta_msr_wait);
2531 init_waitqueue_head(&info->break_wait); 2531 init_waitqueue_head(&info->break_wait);
2532 spin_lock_init(&info->lock);
2533 ports = info; 2532 ports = info;
2534 printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ", 2533 printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",
2535 info->line, info->port, info->irq); 2534 info->line, info->port, info->irq);
diff --git a/drivers/char/ftape/Kconfig b/drivers/char/ftape/Kconfig
index 7d3ecb56a1bd..0d65189a7ae8 100644
--- a/drivers/char/ftape/Kconfig
+++ b/drivers/char/ftape/Kconfig
@@ -25,17 +25,7 @@ config ZFTAPE
25 support", above) then `zft-compressor' will be loaded 25 support", above) then `zft-compressor' will be loaded
26 automatically by zftape when needed. 26 automatically by zftape when needed.
27 27
28 Despite its name, zftape does NOT use compression by default. The 28 Despite its name, zftape does NOT use compression by default.
29 file <file:Documentation/ftape.txt> contains a short description of
30 the most important changes in the file system interface compared to
31 previous versions of ftape. The ftape home page
32 <http://www.instmath.rwth-aachen.de/~heine/ftape/> contains
33 further information.
34
35 IMPORTANT NOTE: zftape can read archives created by previous
36 versions of ftape and provide file mark support (i.e. fast skipping
37 between tape archives) but previous version of ftape will lack file
38 mark support when reading archives produced by zftape.
39 29
40config ZFT_DFLT_BLK_SZ 30config ZFT_DFLT_BLK_SZ
41 int "Default block size" 31 int "Default block size"
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 204a7302a4a9..e38a5f0e07bb 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -34,7 +34,6 @@
34#define DEBUG 34#define DEBUG
35 35
36static char * tmp_buf; 36static char * tmp_buf;
37static DECLARE_MUTEX(tmp_buf_sem);
38 37
39static int gs_debug; 38static int gs_debug;
40 39
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
index 40a67c86420c..ac626418b329 100644
--- a/drivers/char/hangcheck-timer.c
+++ b/drivers/char/hangcheck-timer.c
@@ -117,12 +117,9 @@ __setup("hcheck_reboot", hangcheck_parse_reboot);
117__setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks); 117__setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks);
118#endif /* not MODULE */ 118#endif /* not MODULE */
119 119
120#if defined(CONFIG_X86) 120#if defined(CONFIG_X86) || defined(CONFIG_S390)
121# define HAVE_MONOTONIC 121# define HAVE_MONOTONIC
122# define TIMER_FREQ 1000000000ULL 122# define TIMER_FREQ 1000000000ULL
123#elif defined(CONFIG_S390)
124/* FA240000 is 1 Second in the IBM time universe (Page 4-38 Principles of Op for zSeries */
125# define TIMER_FREQ 0xFA240000ULL
126#elif defined(CONFIG_IA64) 123#elif defined(CONFIG_IA64)
127# define TIMER_FREQ ((unsigned long long)local_cpu_data->itc_freq) 124# define TIMER_FREQ ((unsigned long long)local_cpu_data->itc_freq)
128#elif defined(CONFIG_PPC64) 125#elif defined(CONFIG_PPC64)
@@ -134,12 +131,7 @@ extern unsigned long long monotonic_clock(void);
134#else 131#else
135static inline unsigned long long monotonic_clock(void) 132static inline unsigned long long monotonic_clock(void)
136{ 133{
137# ifdef __s390__
138 /* returns the TOD. see 4-38 Principles of Op of zSeries */
139 return get_clock();
140# else
141 return get_cycles(); 134 return get_cycles();
142# endif /* __s390__ */
143} 135}
144#endif /* HAVE_MONOTONIC */ 136#endif /* HAVE_MONOTONIC */
145 137
@@ -188,8 +180,6 @@ static int __init hangcheck_init(void)
188 VERSION_STR, hangcheck_tick, hangcheck_margin); 180 VERSION_STR, hangcheck_tick, hangcheck_margin);
189#if defined (HAVE_MONOTONIC) 181#if defined (HAVE_MONOTONIC)
190 printk("Hangcheck: Using monotonic_clock().\n"); 182 printk("Hangcheck: Using monotonic_clock().\n");
191#elif defined(__s390__)
192 printk("Hangcheck: Using TOD.\n");
193#else 183#else
194 printk("Hangcheck: Using get_cycles().\n"); 184 printk("Hangcheck: Using get_cycles().\n");
195#endif /* HAVE_MONOTONIC */ 185#endif /* HAVE_MONOTONIC */
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 3808d9572619..66a2fee06eb9 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -927,9 +927,9 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
927 if (ACPI_SUCCESS(status)) { 927 if (ACPI_SUCCESS(status)) {
928 unsigned long size; 928 unsigned long size;
929 929
930 size = addr.max_address_range - addr.min_address_range + 1; 930 size = addr.maximum - addr.minimum + 1;
931 hdp->hd_phys_address = addr.min_address_range; 931 hdp->hd_phys_address = addr.minimum;
932 hdp->hd_address = ioremap(addr.min_address_range, size); 932 hdp->hd_address = ioremap(addr.minimum, size);
933 933
934 if (hpet_is_known(hdp)) { 934 if (hpet_is_known(hdp)) {
935 printk(KERN_DEBUG "%s: 0x%lx is busy\n", 935 printk(KERN_DEBUG "%s: 0x%lx is busy\n",
@@ -937,15 +937,15 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
937 iounmap(hdp->hd_address); 937 iounmap(hdp->hd_address);
938 return -EBUSY; 938 return -EBUSY;
939 } 939 }
940 } else if (res->id == ACPI_RSTYPE_FIXED_MEM32) { 940 } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) {
941 struct acpi_resource_fixed_mem32 *fixmem32; 941 struct acpi_resource_fixed_memory32 *fixmem32;
942 942
943 fixmem32 = &res->data.fixed_memory32; 943 fixmem32 = &res->data.fixed_memory32;
944 if (!fixmem32) 944 if (!fixmem32)
945 return -EINVAL; 945 return -EINVAL;
946 946
947 hdp->hd_phys_address = fixmem32->range_base_address; 947 hdp->hd_phys_address = fixmem32->address;
948 hdp->hd_address = ioremap(fixmem32->range_base_address, 948 hdp->hd_address = ioremap(fixmem32->address,
949 HPET_RANGE_SIZE); 949 HPET_RANGE_SIZE);
950 950
951 if (hpet_is_known(hdp)) { 951 if (hpet_is_known(hdp)) {
@@ -954,20 +954,20 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
954 iounmap(hdp->hd_address); 954 iounmap(hdp->hd_address);
955 return -EBUSY; 955 return -EBUSY;
956 } 956 }
957 } else if (res->id == ACPI_RSTYPE_EXT_IRQ) { 957 } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) {
958 struct acpi_resource_ext_irq *irqp; 958 struct acpi_resource_extended_irq *irqp;
959 int i; 959 int i;
960 960
961 irqp = &res->data.extended_irq; 961 irqp = &res->data.extended_irq;
962 962
963 if (irqp->number_of_interrupts > 0) { 963 if (irqp->interrupt_count > 0) {
964 hdp->hd_nirqs = irqp->number_of_interrupts; 964 hdp->hd_nirqs = irqp->interrupt_count;
965 965
966 for (i = 0; i < hdp->hd_nirqs; i++) { 966 for (i = 0; i < hdp->hd_nirqs; i++) {
967 int rc = 967 int rc =
968 acpi_register_gsi(irqp->interrupts[i], 968 acpi_register_gsi(irqp->interrupts[i],
969 irqp->edge_level, 969 irqp->triggering,
970 irqp->active_high_low); 970 irqp->polarity);
971 if (rc < 0) 971 if (rc < 0)
972 return AE_ERROR; 972 return AE_ERROR;
973 hdp->hd_irq[i] = rc; 973 hdp->hd_irq[i] = rc;
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index c67ef3e47ad5..6ed213bd702c 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1580,11 +1580,6 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info)
1580 if (! is_new_interface(-1, addr_space, spmi->addr.address)) 1580 if (! is_new_interface(-1, addr_space, spmi->addr.address))
1581 return -ENODEV; 1581 return -ENODEV;
1582 1582
1583 if (! spmi->addr.register_bit_width) {
1584 acpi_failure = 1;
1585 return -ENODEV;
1586 }
1587
1588 /* Figure out the interface type. */ 1583 /* Figure out the interface type. */
1589 switch (spmi->InterfaceType) 1584 switch (spmi->InterfaceType)
1590 { 1585 {
@@ -1634,9 +1629,6 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info)
1634 regspacings[intf_num] = spmi->addr.register_bit_width / 8; 1629 regspacings[intf_num] = spmi->addr.register_bit_width / 8;
1635 info->io.regspacing = spmi->addr.register_bit_width / 8; 1630 info->io.regspacing = spmi->addr.register_bit_width / 8;
1636 } else { 1631 } else {
1637 /* Some broken systems get this wrong and set the value
1638 * to zero. Assume it is the default spacing. If that
1639 * is wrong, too bad, the vendor should fix the tables. */
1640 regspacings[intf_num] = DEFAULT_REGSPACING; 1632 regspacings[intf_num] = DEFAULT_REGSPACING;
1641 info->io.regspacing = DEFAULT_REGSPACING; 1633 info->io.regspacing = DEFAULT_REGSPACING;
1642 } 1634 }
diff --git a/drivers/char/rio/brates.h b/drivers/char/rio/brates.h
deleted file mode 100644
index dd686d58fd66..000000000000
--- a/drivers/char/rio/brates.h
+++ /dev/null
@@ -1,106 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* BRATES.H *******
4 ******* *******
5 ****************************************************************************
6
7 Author : Jeremy Rolls
8 Date : 1 Nov 1990
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef _brates_h
38#ifndef lint
39/* static char * _brates_h_sccs = "@(#)brates.h 1.4"; */
40#endif
41#define _brates_h 1
42/* List of baud rate defines. Most are borrowed from /usr/include/sys/termio.h
43*/
44#ifndef INKERNEL
45
46#define B0 0x00
47#define B50 0x01
48#define B75 0x02
49#define B110 0x03
50#define B134 0x04
51#define B150 0x05
52#define B200 0x06
53#define B300 0x07
54#define B600 0x08
55#define B1200 0x09
56#define B1800 0x0a
57#define B2400 0x0b
58#define B4800 0x0c
59#define B9600 0x0d
60#define B19200 0x0e
61#define B38400 0x0f
62
63#endif
64
65/*
66** The following baudrates may or may not be defined
67** on various UNIX systems.
68** If they are not then we define them.
69** If they are then we do not define them ;-)
70**
71** This is appalling that we use same definitions as UNIX
72** for our own download code as there is no garuntee that
73** B57600 will be defined as 0x11 by a UNIX system....
74** Arghhhhh!!!!!!!!!!!!!!
75*/
76#if !defined(B56000)
77#define B56000 0x10
78#endif
79
80#if !defined(B57600)
81#define B57600 0x11
82#endif
83
84#if !defined(B64000)
85#define B64000 0x12
86#endif
87
88#if !defined(B115200)
89#define B115200 0x13
90#endif
91
92
93#if !defined(B2000)
94#define B2000 0x14
95#endif
96
97
98#define MAX_RATE B2000
99
100struct baud_rate { /* Tag for baud rates */
101 /* short host_rate, *//* As passed by the driver */
102 short divisor, /* The divisor */
103 prescaler; /* The pre-scaler */
104};
105
106#endif
diff --git a/drivers/char/rio/chan.h b/drivers/char/rio/chan.h
deleted file mode 100644
index af14311f9b66..000000000000
--- a/drivers/char/rio/chan.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 *
3 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/
19#ifndef _chan_h
20#define _chan_h
21
22#ifndef lint
23#ifdef SCCS
24static char *_rio_chan_h_sccs = "@(#)chan.h 1.1";
25#endif
26#endif
27
28#define Link0 0
29#define Link1 1
30#define Link2 2
31#define Link3 3
32
33#endif
diff --git a/drivers/char/rio/cmd.h b/drivers/char/rio/cmd.h
deleted file mode 100644
index 797b62400c91..000000000000
--- a/drivers/char/rio/cmd.h
+++ /dev/null
@@ -1,83 +0,0 @@
1
2
3/****************************************************************************
4 ******* *******
5 ******* C O M M A N D P A C K E T H E A D E R S
6 ******* *******
7 ****************************************************************************
8
9 Author : Ian Nandhra
10 Date :
11
12 *
13 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
29 Version : 0.01
30
31
32 Mods
33 ----------------------------------------------------------------------------
34 Date By Description
35 ----------------------------------------------------------------------------
36
37 ***************************************************************************/
38
39
40#ifndef _cmd_h
41#define _cmd_h
42
43#ifndef lint
44#ifdef SCCS
45static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1";
46#endif
47#endif
48
49
50#define PRE_EMPTIVE_CMD 0x80
51#define INLINE_CMD ~PRE_EMPTIVE_CMD
52
53#define CMD_IGNORE_PKT ( (ushort) 0)
54#define CMD_STATUS_REQ ( (ushort) 1)
55#define CMD_UNIT_STATUS_REQ ( (ushort) 2) /* Is this needed ??? */
56#define CMD_CONF_PORT ( (ushort) 3)
57#define CMD_CONF_UNIT ( (ushort) 4)
58#define CMD_ROUTE_MAP_REQ ( (ushort) 5)
59#define CMD_FLUSH_TX ( (ushort) 6)
60#define CMD_FLUSH_RX ( (ushort) 7)
61#define CMD_PARTION_PORT ( (ushort) 8)
62#define CMD_RESET_PORT ( (ushort) 0x0a)
63#define CMD_BOOT_UNIT ( (ushort) 0x0b)
64#define CMD_FOUND_UNIT ( (ushort) 0x0c)
65#define CMD_ATTACHED_RTA_2 ( (ushort) 0x0d)
66#define CMD_PROVIDE_BOOT ( (ushort) 0x0e)
67#define CMD_CIRRUS ( (ushort) 0x0f)
68
69#define FORM_STATUS_PKT ( (ushort) 1 )
70#define FORM_POLL_PKT ( (ushort) 2 )
71#define FORM_LINK_STATUS_PKT ( (ushort) 3 )
72
73
74#define CMD_DATA_PORT ( (ushort) 1 )
75#define CMD_DATA ( (ushort) 2 )
76
77#define CMD_TX_PART ( (ushort) 2 )
78#define CMD_RX_PART ( (ushort) 3 )
79#define CMD_RX_LIMIT ( (ushort) 4 )
80
81#endif
82
83/*********** end of file ***********/
diff --git a/drivers/char/rio/data.h b/drivers/char/rio/data.h
deleted file mode 100644
index dabc2d1fa40f..000000000000
--- a/drivers/char/rio/data.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : data.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:09
26** Retrieved : 11/6/98 11:34:21
27**
28** ident @(#)data.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_datadex__
34#define __rio_datadex__
35
36#ifndef lint
37static char *_data_h_sccs_ = "@(#)data.h 1.2";
38#endif
39
40#endif
diff --git a/drivers/char/rio/debug.h b/drivers/char/rio/debug.h
deleted file mode 100644
index 6ae95c00db4a..000000000000
--- a/drivers/char/rio/debug.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2** File: debug.h
3**
4** Author: David Dix
5**
6** Created: 12th March 1993
7**
8** Last modified: 93/04/27
9**
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26*/
27
28#ifndef _debug_h_
29#define _debug_h_
30
31
32#if defined(DCIRRUS)
33#define DBPACKET(pkt, opt, str, chn) debug_packet((pkt), (opt), (str), (chn))
34#else
35#define DBPACKET(pkt, opt, str, c)
36#endif /* DCIRRUS */
37
38
39#endif /* _debug_h_ */
diff --git a/drivers/char/rio/eisa.h b/drivers/char/rio/eisa.h
deleted file mode 100644
index c2abaf0eab04..000000000000
--- a/drivers/char/rio/eisa.h
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6
7 *
8 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23**
24** Module : eisa.h
25** SID : 1.2
26** Last Modified : 11/6/98 11:34:10
27** Retrieved : 11/6/98 11:34:21
28**
29** ident @(#)eisa.h 1.2
30**
31** -----------------------------------------------------------------------------
32*/
33
34#ifndef __rio_eisa_h__
35#define __rio_eisa_h__
36
37#ifdef SCCS_LABELS
38#ifndef lint
39static char *_eisa_h_sccs_ = "@(#)eisa.h 1.2";
40#endif
41#endif
42
43/*
44** things to do with the EISA bus
45*/
46
47#define RIO_EISA_STRING_ADDRESS 0xfffd9 /* where EISA is stored */
48
49#define RIO_MAX_EISA_SLOTS 16 /* how many EISA slots? */
50
51#define RIO_EISA_IDENT 0x984D /* Specialix */
52#define RIO_EISA_PRODUCT_CODE 0x14 /* Code 14 */
53#define RIO_EISA_ENABLE_BIT 0x01 /* To enable card */
54
55#define EISA_MEMORY_BASE_LO 0xC00 /* A16-A23 */
56#define EISA_MEMORY_BASE_HI 0xC01 /* A24-A31 */
57#define EISA_INTERRUPT_VEC 0xC02 /* see below */
58#define EISA_CONTROL_PORT 0xC02 /* see below */
59#define EISA_INTERRUPT_RESET 0xC03 /* read to clear IRQ */
60
61#define EISA_PRODUCT_IDENT_LO 0xC80 /* where RIO_EISA_IDENT is */
62#define EISA_PRODUCT_IDENT_HI 0xC81
63#define EISA_PRODUCT_NUMBER 0xC82 /* where PROD_CODE is */
64#define EISA_REVISION_NUMBER 0xC83 /* revision (1dp) */
65#define EISA_ENABLE 0xC84 /* set LSB to enable card */
66#define EISA_UNIQUE_NUM_0 0xC88 /* vomit */
67#define EISA_UNIQUE_NUM_1 0xC8A
68#define EISA_UNIQUE_NUM_2 0xC90 /* bit strangely arranged */
69#define EISA_UNIQUE_NUM_3 0xC92
70#define EISA_MANUF_YEAR 0xC98 /* when */
71#define EISA_MANUF_WEEK 0xC9A /* more when */
72
73#define EISA_TP_BOOT_FROM_RAM 0x01
74#define EISA_TP_BOOT_FROM_LINK 0x00
75#define EISA_TP_FAST_LINKS 0x02
76#define EISA_TP_SLOW_LINKS 0x00
77#define EISA_TP_BUS_ENABLE 0x04
78#define EISA_TP_BUS_DISABLE 0x00
79#define EISA_TP_RUN 0x08
80#define EISA_TP_RESET 0x00
81#define EISA_POLLED 0x00
82#define EISA_IRQ_3 0x30
83#define EISA_IRQ_4 0x40
84#define EISA_IRQ_5 0x50
85#define EISA_IRQ_6 0x60
86#define EISA_IRQ_7 0x70
87#define EISA_IRQ_9 0x90
88#define EISA_IRQ_10 0xA0
89#define EISA_IRQ_11 0xB0
90#define EISA_IRQ_12 0xC0
91#define EISA_IRQ_14 0xE0
92#define EISA_IRQ_15 0xF0
93
94#define EISA_INTERRUPT_MASK 0xF0
95#define EISA_CONTROL_MASK 0x0F
96
97#define RIO_EISA_DEFAULT_MODE EISA_TP_SLOW_LINKS
98
99#define RIOEisaToIvec(X) (uchar )((uchar)((X) & EISA_INTERRUPT_MASK)>>4)
100
101#define INBZ(z,x) inb(((z)<<12) | (x))
102#define OUTBZ(z,x,y) outb((((z)<<12) | (x)), y)
103
104#endif /* __rio_eisa_h__ */
diff --git a/drivers/char/rio/enable.h b/drivers/char/rio/enable.h
deleted file mode 100644
index e06673fa48cf..000000000000
--- a/drivers/char/rio/enable.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* E N A B L E H E A D E R S
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef lint
38#ifdef SCCS
39static char *_rio_enable_h_sccs = "@(#)enable.h 1.1";
40#endif
41#endif
42
43
44#define ENABLE_LTT TRUE
45#define ENABLE_LRT TRUE
46
47
48/*********** end of file ***********/
diff --git a/drivers/char/rio/formpkt.h b/drivers/char/rio/formpkt.h
deleted file mode 100644
index 3c7c91ace3ee..000000000000
--- a/drivers/char/rio/formpkt.h
+++ /dev/null
@@ -1,153 +0,0 @@
1
2
3/****************************************************************************
4 ******* *******
5 ******* F O R M P A C K E T H E A D E R F I L E
6 ******* *******
7 ****************************************************************************
8
9 Author : Ian Nandhra
10 Date :
11
12 *
13 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
29 Version : 0.01
30
31
32 Mods
33 ----------------------------------------------------------------------------
34 Date By Description
35 ----------------------------------------------------------------------------
36
37 ***************************************************************************/
38
39#ifndef _formpkt_h
40#define _formpkt_h 1
41
42#ifndef lint
43#ifdef SCCS
44static char *_rio_formpkt_h_sccs = "@(#)formpkt.h 1.1";
45#endif
46#endif
47
48typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1;
49struct FORM_BOOT_PKT_1 {
50 ushort pkt_number;
51 ushort pkt_total;
52 ushort boot_top;
53};
54
55typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2;
56struct FORM_BOOT_PKT_2 {
57 ushort pkt_number;
58 char boot_data[10];
59};
60
61
62typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA;
63struct FORM_ATTACH_RTA {
64 char cmd_code;
65 char booter_serial[4];
66 char booter_link;
67 char bootee_serial[4];
68 char bootee_link;
69};
70
71
72typedef struct FORM_BOOT_ID FORM_BOOT_ID;
73struct FORM_BOOT_ID {
74 char cmd_code;
75 char bootee_serial[4];
76 char bootee_prod_id;
77 char bootee_link;
78};
79
80
81
82typedef struct FORM_ROUTE_1 FORM_ROUTE_1;
83struct FORM_ROUTE_1 {
84 char cmd_code;
85 char pkt_number;
86 char total_in_sequence;
87 char unit_id;
88 char host_unit_id;
89};
90
91typedef struct FORM_ROUTE_2 FORM_ROUTE_2;
92struct FORM_ROUTE_2 {
93 char cmd_code;
94 char pkt_number;
95 char total_in_sequence;
96 char route_data[9];
97};
98
99typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ;
100struct FORM_ROUTE_REQ {
101 char cmd_code;
102 char pkt_number;
103 char total_in_sequence;
104 char route_data[10];
105};
106
107
108typedef struct FORM_ERROR FORM_ERROR;
109struct FORM_ERROR {
110 char cmd_code;
111 char error_code;
112
113};
114
115typedef struct FORM_STATUS FORM_STATUS;
116struct FORM_STATUS {
117 char cmd_code;
118 char status_code;
119 char last_packet_valid;
120 char tx_buffer;
121 char rx_buffer;
122 char port_status;
123 char phb_status;
124};
125
126
127typedef struct FORM_LINK_STATUS FORM_LINK_STATUS;
128struct FORM_LINK_STATUS {
129 char cmd_code;
130 char status_code;
131 char link_number;
132 ushort rx_errors;
133 ushort tx_errors;
134 ushort csum_errors;
135 ushort disconnects;
136};
137
138
139
140typedef struct FORM_PARTITION FORM_PARTITION;
141struct FORM_PARTITION {
142 char cmd_code;
143 char status_code;
144 char port_number;
145 char tx_max;
146 char rx_max;
147 char rx_limit;
148};
149
150
151#endif
152
153/*********** end of file ***********/
diff --git a/drivers/char/rio/hosthw.h b/drivers/char/rio/hosthw.h
deleted file mode 100644
index 6281fe47f4e9..000000000000
--- a/drivers/char/rio/hosthw.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* H O S T H A R D W A R E
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra / Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37
38#ifndef lint
39#ifdef SCCS_LABELS
40static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2";
41#endif
42#endif
43
44#define SET_OTHER_INTERRUPT ( (volatile u_short *) 0x7c80 )
45#define SET_EISA_INTERRUPT ( (volatile u_short *) 0x7ef0 )
46
47#define EISA_HOST 0x30
48#define AT_HOST 0xa0
49#define MCA_HOST 0xb0
50#define PCI_HOST 0xd0
51
52#define PRODUCT_MASK 0xf0
53
54
55/*********** end of file ***********/
diff --git a/drivers/char/rio/lrt.h b/drivers/char/rio/lrt.h
deleted file mode 100644
index b41764d7a22a..000000000000
--- a/drivers/char/rio/lrt.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* L R T
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra / Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef lint
38#ifdef SCCS_LABELS
39static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1";
40#endif
41#endif
42
43
44#ifdef DCIRRUS
45#define LRT_STACK (unsigned short) 600
46#else
47#define LRT_STACK (ushort) 200
48#endif
49
50
51
52/*********** end of file ***********/
diff --git a/drivers/char/rio/ltt.h b/drivers/char/rio/ltt.h
deleted file mode 100644
index ab04004d4048..000000000000
--- a/drivers/char/rio/ltt.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* L T T
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra / Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef lint
38#ifdef SCCS_LABELS
39static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1";
40#endif
41#endif
42
43#ifdef DCIRRUS
44#define LTT_STACK (unsigned short) 600
45#else
46#define LTT_STACK (ushort) 200
47#endif
48
49
50
51
52/*********** end of file ***********/
diff --git a/drivers/char/rio/lttwake.h b/drivers/char/rio/lttwake.h
deleted file mode 100644
index fdf0c1f250ab..000000000000
--- a/drivers/char/rio/lttwake.h
+++ /dev/null
@@ -1,50 +0,0 @@
1
2
3
4/****************************************************************************
5 ******* *******
6 ******* L T T W A K E U P H E A D E R
7 ******* *******
8 ****************************************************************************
9
10 Author : Ian Nandhra
11 Date :
12
13 *
14 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
30 Version : 0.01
31
32
33 Mods
34 ----------------------------------------------------------------------------
35 Date By Description
36 ----------------------------------------------------------------------------
37
38 ***************************************************************************/
39
40#ifndef lint
41#ifdef SCCS_LABELS
42static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1";
43#endif
44#endif
45
46#define LTT_WAKEUP_STACK 500
47#define LTT_WAKEUP_INTERVAL (int) (500 * MILLISECOND)
48
49
50/*********** end of file ***********/
diff --git a/drivers/char/rio/mca.h b/drivers/char/rio/mca.h
deleted file mode 100644
index d01e76be7a17..000000000000
--- a/drivers/char/rio/mca.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : mca.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:11
26** Retrieved : 11/6/98 11:34:21
27**
28** ident @(#)mca.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_mca_h__
34#define __rio_mca_h__
35
36#ifdef SCCS_LABELS
37static char *_mca_h_sccs_ = "@(#)mca.h 1.2";
38#endif
39
40/*
41** Micro Channel stuff
42*/
43
44#define McaMaxSlots 8
45#define McaSlotSelect 0x96
46#define McaSlotEnable 0x08
47#define McaIdLow 0x100
48#define McaIdHigh 0x101
49#define McaIrqEnable 0x102
50#define McaMemory 0x103
51#define McaRIOId 0x6a5c
52#define McaIrq9 0x00
53#define McaIrq3 0x02
54#define McaIrq4 0x04
55#define McaIrq7 0x06
56#define McaIrq10 0x08
57#define McaIrq11 0x0A
58#define McaIrq12 0x0C
59#define McaIrq15 0x0E
60#define McaIrqMask 0x0E
61#define McaCardEnable 0x01
62#define McaAddress(X) (((X)&0xFF)<<16)
63
64#define McaTpFastLinks 0x40
65#define McaTpSlowLinks 0x00
66#define McaTpBootFromRam 0x01
67#define McaTpBootFromLink 0x00
68#define McaTpBusEnable 0x02
69#define McaTpBusDisable 0x00
70
71#define RIO_MCA_DEFAULT_MODE SLOW_LINKS
72
73#endif /* __rio_mca_h__ */
diff --git a/drivers/char/rio/mesg.h b/drivers/char/rio/mesg.h
deleted file mode 100644
index dd9be586ec6f..000000000000
--- a/drivers/char/rio/mesg.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : mesg.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:12
26** Retrieved : 11/6/98 11:34:21
27**
28** ident @(#)mesg.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_mesg_h__
34#define __rio_mesg_h__
35
36#ifdef SCCS_LABELS
37static char *_mesg_h_sccs_ = "@(#)mesg.h 1.2";
38#endif
39
40
41#endif /* __rio_mesg_h__ */
diff --git a/drivers/char/rio/poll.h b/drivers/char/rio/poll.h
deleted file mode 100644
index 9616ee4c6cd5..000000000000
--- a/drivers/char/rio/poll.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* P O L L
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra / Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef _poll_h
38#define _poll_h
39
40#ifndef lint
41#ifdef SCCS_LABELS
42static char *_rio_poll_h_sccs = "@(#)poll.h 1.2";
43#endif
44#endif
45
46
47#ifdef HOST
48#define POLL_STACK 100
49#endif
50#ifdef RTA
51#define POLL_STACK 200
52#endif
53
54#define POLL_PERIOD (int) SECOND
55
56/* The various poll commands */
57#define POLL_POLL 0 /* We are connected and happy.. */
58#define POLL_INTRO 1 /* Introduction packet */
59#define POLL_TOPOLOGY 2 /* Topology update */
60#define POLL_ASSIGN 3 /* ID assign */
61#define POLL_FOAD 4 /* F*** Off And Die */
62#define POLL_LMD 5 /* Let Me Die */
63#define POLL_DYB 6 /* Die You Ba***** */
64
65/* The way data fields are split up for POLL packets */
66#define POLL_HOST_SERIAL 2 /* Host who booted me */
67#define POLL_MY_SERIAL 6 /* My serial number */
68#define POLL_YOUR_ID 1 /* Your ID number */
69#define POLL_TOPOLOGY_FIELDS 2 /* Topology maps */
70
71#endif
72
73/*********** end of file ***********/
diff --git a/drivers/char/rio/proto.h b/drivers/char/rio/proto.h
deleted file mode 100644
index f9a3376333e5..000000000000
--- a/drivers/char/rio/proto.h
+++ /dev/null
@@ -1,244 +0,0 @@
1/*
2 *
3 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19#ifndef _prototypes_h
20#define _prototypes_h
21
22
23/*
24** boot.c
25*/
26void init_boot(char *p, short stage);
27
28/*
29** disconct.c
30*/
31void kill_boot(LPB * link);
32void disconnected(LPB * link);
33short boot_3(LPB * link, PKT * pkt);
34short send_3_pkt(LPB * link, PKT * pkt);
35
36/*
37** error.c
38*/
39void du_error(void);
40
41/*
42** formpkt.c
43*/
44ushort sum_it(PKT * pkt);
45void form_rup_pkt(RUP * form_rup, PKT * pkt);
46void form_poll_pkt(int type, LPB * link, int node);
47void form_route_pkt(int type, PKT * pkt, LPB * link);
48
49/*
50** idle.c
51*/
52void idle(Process * idle_p);
53
54/*
55** init.c
56*/
57void general_init(void);
58void mem_halt(int error);
59
60/*
61** linkinit.c
62*/
63void initlink(u_short number, LPB * link);
64void runlink(LPB * link);
65
66/*
67** list.c
68*/
69PKT *get_free_start(void);
70void put_free_start(PKT * pkt);
71
72#ifdef HOST
73int can_remove_transmit(PKT ** pkt, PKT * pointer);
74#endif
75
76#ifdef RTA
77int spl7(void);
78int spl0(void);
79Q_BUF *get_free_q(void);
80PKT *get_free_end(void);
81int add_end(PKT * pkt, PHB * phb, int type);
82unsigned short free_packets(PHB * phb, int type);
83int can_remove_start(PKT ** pkt, PHB * phb, int type);
84int can_add_start(PHB * phb, int type);
85int can_add_end(PHB * phb, int type);
86void put_free_end(PKT * pkt);
87int remove_start(PKT ** pkt, PHB * phb, int type);
88#endif
89
90/*
91** Lrt.c
92*/
93void lrt(Process * lrt_p, LPB * link);
94
95#ifdef RTA
96void set_led_red(LPB * link);
97#endif
98
99/*
100** ltt.c
101*/
102void ltt(Process * ltt_p, LPB * link, PHB * phb_ptr[]);
103void send_poll(LPB * link);
104void request_id(LPB * link);
105void send_topology_update(LPB * link);
106void send_topology(LPB * link);
107void supply_id(LPB * link);
108
109#ifdef RTA
110void redirect_queue(LPB * link, ushort flush);
111int obtain_rup(int rup_number, PKT ** pkt_address, LPB * link);
112#endif
113
114#ifdef TESTING_PERF
115int consume_cpu(void);
116#endif
117
118/*
119** lttwake.c
120*/
121#ifdef HOST
122void ltt_wakeup(Process * ltt_wakeup_p);
123#endif
124
125/*
126** mapgen.c
127*/
128void generate_id_map(short mapping, ROUTE_STR route[]);
129void gen_map(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl);
130void adjust_ttl(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl);
131void init_sys_map(void);
132
133/*
134** mmu.c
135*/
136char *rio_malloc(unsigned int amount);
137char *rio_calloc(unsigned int num, unsigned int size);
138ERROR rio_mmu_init(uint total_mem);
139
140/*
141** partn.c
142*/
143void partition_tx(struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit);
144
145/*
146** poll.c
147*/
148void tx_poll(Process * tx_poll_p);
149
150/*
151** process.c
152*/
153int get_proc_space(Process ** pd, int **pws, int wssize);
154
155/*
156** readrom.c
157*/
158void read_serial_number(char *buf);
159
160/*
161** rio.c
162*/
163int main(void);
164
165/*
166** route.c
167*/
168void route_update(PKT * pkt, LPB * link);
169
170/*
171** rtainit.c
172*/
173#if defined(RTA)
174void rta_init(ushort RtaType);
175#endif /* defined(RTA) */
176
177/*
178** rupboot.c
179*/
180void rup_boot(PKT * pkt, RUP * this_rup, LPB * link);
181
182#ifdef RTA
183void kill_your_neighbour(int link_to_kill);
184#endif
185
186/*
187** rupcmd.c
188*/
189void rup_command(PKT * pkt, struct RUP *this_rup, LPB * link);
190
191/*
192** ruperr.c
193*/
194void rup_error(PKT * pkt, RUP * this_rup, LPB * link);
195void illegal_cmd(PKT * src_pkt);
196
197/*
198** ruppoll.c
199*/
200void rup_poll(PKT * pkt, RUP * this_rup, LPB * link);
201
202/*
203** ruppower.c
204*/
205void rup_power(PKT * pkt, RUP * this_rup, LPB * link);
206
207/*
208** ruprm.c
209*/
210void rup_route_map(PKT * pkt, RUP * this_rup, LPB * link);
211
212/*
213** rupstat.c
214*/
215void rup_status(PKT * pkt, RUP * this_rup, LPB * link);
216
217/*
218** rupsync.c
219*/
220void rup_sync(PKT * pkt);
221
222/*
223** rxpkt.c
224*/
225ERROR rx_pkt(PKT_ptr_ptr pkt_address, LPB * link);
226
227/*
228** sendsts.c
229*/
230void send_status(PKT * requesting_pkt, RUP * this_rup);
231
232/*
233** serial.c
234*/
235void assign_serial(char *ser_in, char *ser_out);
236int cmp_serial(char *ser_1, char *ser_2);
237
238/*
239** txpkt.c
240*/
241ERROR tx_pkt(PKT * pkt, LPB * link);
242short send_sync(LPB * link);
243
244#endif /* _prototypes_h */
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 8825bd61b7d0..c9af283a811d 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -132,16 +132,6 @@ more than 512 ports.... */
132*/ 132*/
133#define IRQ_RATE_LIMIT 200 133#define IRQ_RATE_LIMIT 200
134 134
135#if 0
136/* Not implemented */
137/*
138 * The following defines are mostly for testing purposes. But if you need
139 * some nice reporting in your syslog, you can define them also.
140 */
141#define RIO_REPORT_FIFO
142#define RIO_REPORT_OVERRUN
143#endif
144
145 135
146/* These constants are derived from SCO Source */ 136/* These constants are derived from SCO Source */
147static struct Conf 137static struct Conf
@@ -573,21 +563,6 @@ static void rio_shutdown_port(void *ptr)
573 563
574 PortP = (struct Port *) ptr; 564 PortP = (struct Port *) ptr;
575 PortP->gs.tty = NULL; 565 PortP->gs.tty = NULL;
576#if 0
577 port->gs.flags &= ~GS_ACTIVE;
578 if (!port->gs.tty) {
579 rio_dprintk(RIO_DBUG_TTY, "No tty.\n");
580 return;
581 }
582 if (!port->gs.tty->termios) {
583 rio_dprintk(RIO_DEBUG_TTY, "No termios.\n");
584 return;
585 }
586 if (port->gs.tty->termios->c_cflag & HUPCL) {
587 rio_setsignals(port, 0, 0);
588 }
589#endif
590
591 func_exit(); 566 func_exit();
592} 567}
593 568
@@ -663,11 +638,6 @@ static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd
663 638
664 rc = 0; 639 rc = 0;
665 switch (cmd) { 640 switch (cmd) {
666#if 0
667 case TIOCGSOFTCAR:
668 rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), (unsigned int *) arg);
669 break;
670#endif
671 case TIOCSSOFTCAR: 641 case TIOCSSOFTCAR:
672 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { 642 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
673 tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); 643 tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0);
@@ -709,36 +679,6 @@ static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd
709 if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct))) 679 if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct)))
710 rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); 680 rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg);
711 break; 681 break;
712#if 0
713 /*
714 * note: these IOCTLs no longer reach here. Use
715 * tiocmset/tiocmget driver methods instead. The
716 * #if 0 disablement predates this comment.
717 */
718 case TIOCMGET:
719 rc = -EFAULT;
720 if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(unsigned int))) {
721 rc = 0;
722 ival = rio_getsignals(port);
723 put_user(ival, (unsigned int *) arg);
724 }
725 break;
726 case TIOCMBIS:
727 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
728 rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), ((ival & TIOCM_RTS) ? 1 : -1));
729 }
730 break;
731 case TIOCMBIC:
732 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
733 rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), ((ival & TIOCM_RTS) ? 0 : -1));
734 }
735 break;
736 case TIOCMSET:
737 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
738 rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), ((ival & TIOCM_RTS) ? 1 : 0));
739 }
740 break;
741#endif
742 default: 682 default:
743 rc = -ENOIOCTLCMD; 683 rc = -ENOIOCTLCMD;
744 break; 684 break;
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c
index 34cbb13aad4b..92df43552f15 100644
--- a/drivers/char/rio/rioboot.c
+++ b/drivers/char/rio/rioboot.c
@@ -665,13 +665,6 @@ struct PKT *PacketP;
665 struct CmdBlk *CmdBlkP; 665 struct CmdBlk *CmdBlkP;
666 uint sequence; 666 uint sequence;
667 667
668#ifdef CHECK
669 CheckHost(Host);
670 CheckRup(Rup);
671 CheckHostP(HostP);
672 CheckPacketP(PacketP);
673#endif
674
675 /* 668 /*
676 ** If we haven't been told what to boot, we can't boot it. 669 ** If we haven't been told what to boot, we can't boot it.
677 */ 670 */
@@ -956,11 +949,6 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
956 MyType = "RTA"; 949 MyType = "RTA";
957 MyName = HostP->Mapping[Rup].Name; 950 MyName = HostP->Mapping[Rup].Name;
958 } 951 }
959#ifdef CHECK
960 CheckString(MyType);
961 CheckString(MyName);
962#endif
963
964 MyLink = RBYTE(PktCmdP->LinkNum); 952 MyLink = RBYTE(PktCmdP->LinkNum);
965 953
966 /* 954 /*
@@ -1309,52 +1297,3 @@ struct Host *HostP;
1309 } 1297 }
1310} 1298}
1311 1299
1312#if 0
1313/*
1314 Function: This function is to disable the disk interrupt
1315 Returns : Nothing
1316*/
1317void
1318disable_interrupt(vector)
1319int vector;
1320{
1321 int ps;
1322 int val;
1323
1324 disable(ps);
1325 if (vector > 40) {
1326 val = 1 << (vector - 40);
1327 __outb(S8259+1, __inb(S8259+1) | val);
1328 }
1329 else {
1330 val = 1 << (vector - 32);
1331 __outb(M8259+1, __inb(M8259+1) | val);
1332 }
1333 restore(ps);
1334}
1335
1336/*
1337 Function: This function is to enable the disk interrupt
1338 Returns : Nothing
1339*/
1340void
1341enable_interrupt(vector)
1342int vector;
1343{
1344 int ps;
1345 int val;
1346
1347 disable(ps);
1348 if (vector > 40) {
1349 val = 1 << (vector - 40);
1350 val = ~val;
1351 __outb(S8259+1, __inb(S8259+1) & val);
1352 }
1353 else {
1354 val = 1 << (vector - 32);
1355 val = ~val;
1356 __outb(M8259+1, __inb(M8259+1) & val);
1357 }
1358 restore(ps);
1359}
1360#endif
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index b97dd9fdb6ba..694bfb9d9378 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/char/rio/riocmd.c
@@ -387,12 +387,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
387 387
388 func_enter(); 388 func_enter();
389 389
390#ifdef CHECK
391 CheckHost(Host);
392 CheckHostP(HostP);
393 CheckPacketP(PacketP);
394#endif
395
396 /* 390 /*
397 ** 16 port RTA note: 391 ** 16 port RTA note:
398 ** Command rup packets coming from the RTA will have pkt->data[1] (which 392 ** Command rup packets coming from the RTA will have pkt->data[1] (which
@@ -406,10 +400,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
406 SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA); 400 SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA);
407 rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); 401 rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
408 402
409#ifdef CHECK
410 CheckRup(rup);
411 CheckUnixRupP(UnixRupP);
412#endif
413 if (UnixRupP->BaseSysPort == NO_PORT) { 403 if (UnixRupP->BaseSysPort == NO_PORT) {
414 rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); 404 rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n");
415 rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); 405 rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n");
@@ -429,9 +419,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
429 rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); 419 rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command);
430 return TRUE; 420 return TRUE;
431 } 421 }
432#ifdef CHECK
433 CheckSysPort(SysPort);
434#endif
435 PortP = p->RIOPortp[SysPort]; 422 PortP = p->RIOPortp[SysPort];
436 rio_spin_lock_irqsave(&PortP->portSem, flags); 423 rio_spin_lock_irqsave(&PortP->portSem, flags);
437 switch (RBYTE(PktCmdP->Command)) { 424 switch (RBYTE(PktCmdP->Command)) {
@@ -604,11 +591,6 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
604 struct UnixRup *UnixRupP; 591 struct UnixRup *UnixRupP;
605 unsigned long flags; 592 unsigned long flags;
606 593
607#ifdef CHECK
608 CheckHostP(HostP);
609 CheckRup(Rup);
610 CheckCmdBlkP(CmdBlkP);
611#endif
612 if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) { 594 if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) {
613 rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); 595 rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup);
614 RIOFreeCmdBlk(CmdBlkP); 596 RIOFreeCmdBlk(CmdBlkP);
@@ -806,9 +788,6 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
806 ** If it returns RIO_FAIL then don't 788 ** If it returns RIO_FAIL then don't
807 ** send this command yet! 789 ** send this command yet!
808 */ 790 */
809#ifdef CHECK
810 CheckCmdBlkP(CmdBlkP);
811#endif
812 if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { 791 if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) {
813 rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP); 792 rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP);
814 } else { 793 } else {
@@ -816,9 +795,6 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
816 /* 795 /*
817 ** Whammy! blat that pack! 796 ** Whammy! blat that pack!
818 */ 797 */
819#ifdef CHECK
820 CheckPacketP((PKT *) RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt));
821#endif
822 HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); 798 HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
823 799
824 /* 800 /*
@@ -852,9 +828,6 @@ int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
852 unsigned long flags; 828 unsigned long flags;
853 829
854 rio_spin_lock_irqsave(&PortP->portSem, flags); 830 rio_spin_lock_irqsave(&PortP->portSem, flags);
855#ifdef CHECK
856 CheckPortP(PortP);
857#endif
858 PortP->WflushFlag++; 831 PortP->WflushFlag++;
859 PortP->MagicFlags |= MAGIC_FLUSH; 832 PortP->MagicFlags |= MAGIC_FLUSH;
860 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 833 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
@@ -894,9 +867,6 @@ int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
894 867
895 rio_spin_lock_irqsave(&PortP->portSem, flags); 868 rio_spin_lock_irqsave(&PortP->portSem, flags);
896 869
897#ifdef CHECK
898 CheckPortP(PortP);
899#endif
900 rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n"); 870 rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n");
901 871
902 if (PortP->InUse) { 872 if (PortP->InUse) {
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c
index 0b7700d2f049..fcf18a061228 100644
--- a/drivers/char/rio/rioctrl.c
+++ b/drivers/char/rio/rioctrl.c
@@ -308,12 +308,7 @@ int su;
308 } 308 }
309 309
310 case RIO_DEBUG_MEM: 310 case RIO_DEBUG_MEM:
311#ifdef DEBUG_MEM_SUPPORT 311 return -EPERM;
312 RIO_DEBUG_CTRL, if (su)
313 return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg);
314 else
315#endif
316 return -EPERM;
317 312
318 case RIO_ALL_MODEM: 313 case RIO_ALL_MODEM:
319 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); 314 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n");
@@ -591,12 +586,7 @@ int su;
591 586
592 case RIO_GET_LOG: 587 case RIO_GET_LOG:
593 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); 588 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n");
594#ifdef LOGGING
595 RIOGetLog(arg);
596 return 0;
597#else
598 return -EINVAL; 589 return -EINVAL;
599#endif
600 590
601 case RIO_GET_MODTYPE: 591 case RIO_GET_MODTYPE:
602 if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) { 592 if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) {
@@ -684,52 +674,6 @@ int su;
684 rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); 674 rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To);
685 for (loop = PortSetup.From; loop <= PortSetup.To; loop++) { 675 for (loop = PortSetup.From; loop <= PortSetup.To; loop++) {
686 rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); 676 rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop);
687#if 0
688 PortP = p->RIOPortp[loop];
689 if (!PortP->TtyP)
690 PortP->TtyP = &p->channel[loop];
691
692 rio_spin_lock_irqsave(&PortP->portSem, flags);
693 if (PortSetup.IxAny)
694 PortP->Config |= RIO_IXANY;
695 else
696 PortP->Config &= ~RIO_IXANY;
697 if (PortSetup.IxOn)
698 PortP->Config |= RIO_IXON;
699 else
700 PortP->Config &= ~RIO_IXON;
701
702 /*
703 ** If the port needs to wait for all a processes output
704 ** to drain before closing then this flag will be set.
705 */
706 if (PortSetup.Drain) {
707 PortP->Config |= RIO_WAITDRAIN;
708 } else {
709 PortP->Config &= ~RIO_WAITDRAIN;
710 }
711 /*
712 ** Store settings if locking or unlocking port or if the
713 ** port is not locked, when setting the store option.
714 */
715 if (PortP->Mapped && ((PortSetup.Lock && !PortP->Lock) || (!PortP->Lock && (PortSetup.Store && !PortP->Store)))) {
716 PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag;
717 PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag;
718 PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag;
719 PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag;
720 PortP->StoredTty.line = PortP->TtyP->tm.c_line;
721 bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, NCC + 5);
722 }
723 PortP->Lock = PortSetup.Lock;
724 PortP->Store = PortSetup.Store;
725 PortP->Xprint.XpCps = PortSetup.XpCps;
726 bcopy(PortSetup.XpOn, PortP->Xprint.XpOn, MAX_XP_CTRL_LEN);
727 bcopy(PortSetup.XpOff, PortP->Xprint.XpOff, MAX_XP_CTRL_LEN);
728 PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
729 PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
730 PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn) + RIOStrlen(PortP->Xprint.XpOff);
731 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
732#endif
733 } 677 }
734 rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); 678 rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop);
735 rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval); 679 rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval);
@@ -801,12 +745,6 @@ int su;
801 745
802 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); 746 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
803 PortP = (p->RIOPortp[PortTty.port]); 747 PortP = (p->RIOPortp[PortTty.port]);
804#if 0
805 PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag;
806 PortTty.Tty.tm.c_oflag = PortP->TtyP->tm.c_oflag;
807 PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag;
808 PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag;
809#endif
810 if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) { 748 if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) {
811 p->RIOError.Error = COPYOUT_FAILED; 749 p->RIOError.Error = COPYOUT_FAILED;
812 return -EFAULT; 750 return -EFAULT;
@@ -824,15 +762,6 @@ int su;
824 return -ENXIO; 762 return -ENXIO;
825 } 763 }
826 PortP = (p->RIOPortp[PortTty.port]); 764 PortP = (p->RIOPortp[PortTty.port]);
827#if 0
828 rio_spin_lock_irqsave(&PortP->portSem, flags);
829 PortP->TtyP->tm.c_iflag = PortTty.Tty.tm.c_iflag;
830 PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag;
831 PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag;
832 PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag;
833 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
834#endif
835
836 RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP); 765 RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP);
837 return retval; 766 return retval;
838 767
@@ -909,23 +838,6 @@ int su;
909 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 838 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
910 return retval; 839 return retval;
911 840
912#ifdef DEBUG_SUPPORTED
913 case RIO_READ_LEVELS:
914 {
915 int num;
916 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n");
917 for (num = 0; RIODbInf[num].Flag; num++);
918 rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copy\n", num);
919 if (copyout((caddr_t) RIODbInf, (int) arg, sizeof(struct DbInf) * (num + 1)) == COPYFAIL) {
920 rio_dprintk(RIO_DEBUG_CTRL, "ReadLevels Copy failed\n");
921 p->RIOError.Error = COPYOUT_FAILED;
922 return -EFAULT;
923 }
924 rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copied\n", num);
925 return retval;
926 }
927#endif
928
929 case RIO_READ_CONFIG: 841 case RIO_READ_CONFIG:
930 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); 842 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
931 if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) { 843 if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) {
@@ -1084,30 +996,13 @@ int su;
1084 (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot); 996 (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot);
1085 bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags)); 997 bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags));
1086 p->RIOHosts[Host].Flags = RC_WAITING; 998 p->RIOHosts[Host].Flags = RC_WAITING;
1087#if 0
1088 RIOSetupDataStructs(p);
1089#endif
1090 } 999 }
1091 RIOFoadWakeup(p); 1000 RIOFoadWakeup(p);
1092 p->RIONumBootPkts = 0; 1001 p->RIONumBootPkts = 0;
1093 p->RIOBooting = 0; 1002 p->RIOBooting = 0;
1094
1095#ifdef RINGBUFFER_SUPPORT
1096 for (loop = 0; loop < RIO_PORTS; loop++)
1097 if (p->RIOPortp[loop]->TxRingBuffer)
1098 sysfree((void *) p->RIOPortp[loop]->TxRingBuffer, RIOBufferSize);
1099#endif
1100#if 0
1101 bzero((caddr_t) & p->RIOPortp[0], RIO_PORTS * sizeof(struct Port));
1102#else
1103 printk("HEEEEELP!\n"); 1003 printk("HEEEEELP!\n");
1104#endif
1105 1004
1106 for (loop = 0; loop < RIO_PORTS; loop++) { 1005 for (loop = 0; loop < RIO_PORTS; loop++) {
1107#if 0
1108 p->RIOPortp[loop]->TtyP = &p->channel[loop];
1109#endif
1110
1111 spin_lock_init(&p->RIOPortp[loop]->portSem); 1006 spin_lock_init(&p->RIOPortp[loop]->portSem);
1112 p->RIOPortp[loop]->InUse = NOT_INUSE; 1007 p->RIOPortp[loop]->InUse = NOT_INUSE;
1113 } 1008 }
@@ -1653,10 +1548,6 @@ uchar Cmd;
1653 ushort rup; 1548 ushort rup;
1654 int port; 1549 int port;
1655 1550
1656#ifdef CHECK
1657 CheckPortP(PortP);
1658#endif
1659
1660 if (PortP->State & RIO_DELETED) { 1551 if (PortP->State & RIO_DELETED) {
1661 rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); 1552 rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n");
1662 return RIO_FAIL; 1553 return RIO_FAIL;
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c
index 898a126ae3e6..0d44ef464e6b 100644
--- a/drivers/char/rio/rioinit.c
+++ b/drivers/char/rio/rioinit.c
@@ -87,222 +87,8 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3";
87 87
88int RIOPCIinit(struct rio_info *p, int Mode); 88int RIOPCIinit(struct rio_info *p, int Mode);
89 89
90#if 0
91static void RIOAllocateInterrupts(struct rio_info *);
92static int RIOReport(struct rio_info *);
93static void RIOStopInterrupts(struct rio_info *, int, int);
94#endif
95
96static int RIOScrub(int, BYTE *, int); 90static int RIOScrub(int, BYTE *, int);
97 91
98#if 0
99extern int rio_intr();
100
101/*
102** Init time code.
103*/
104void
105rioinit( p, info )
106struct rio_info * p;
107struct RioHostInfo * info;
108{
109 /*
110 ** Multi-Host card support - taking the easy way out - sorry !
111 ** We allocate and set up the Host and Port structs when the
112 ** driver is called to 'install' the first host.
113 ** We check for this first 'call' by testing the RIOPortp pointer.
114 */
115 if ( !p->RIOPortp )
116 {
117 rio_dprintk (RIO_DEBUG_INIT, "Allocating and setting up driver data structures\n");
118
119 RIOAllocDataStructs(p); /* allocate host/port structs */
120 RIOSetupDataStructs(p); /* setup topology structs */
121 }
122
123 RIOInitHosts( p, info ); /* hunt down the hardware */
124
125 RIOAllocateInterrupts(p); /* allocate interrupts */
126 RIOReport(p); /* show what we found */
127}
128
129/*
130** Initialise the Cards
131*/
132void
133RIOInitHosts(p, info)
134struct rio_info * p;
135struct RioHostInfo * info;
136{
137/*
138** 15.10.1998 ARG - ESIL 0762 part fix
139** If there is no ISA card definition - we always look for PCI cards.
140** As we currently only support one host card this lets an ISA card
141** definition take precedence over PLUG and PLAY.
142** No ISA card - we are PLUG and PLAY with PCI.
143*/
144
145 /*
146 ** Note - for PCI both these will be zero, that's okay because
147 ** RIOPCIInit() fills them in if a card is found.
148 */
149 p->RIOHosts[p->RIONumHosts].Ivec = info->vector;
150 p->RIOHosts[p->RIONumHosts].PaddrP = info->location;
151
152 /*
153 ** Check that we are able to accommodate another host
154 */
155 if ( p->RIONumHosts >= RIO_HOSTS )
156 {
157 p->RIOFailed++;
158 return;
159 }
160
161 if ( info->bus & ISA_BUS )
162 {
163 rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (ISA)\n", p->RIONumHosts);
164 RIOISAinit(p, p->mode);
165 }
166 else
167 {
168 rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (PCI)\n", p->RIONumHosts);
169 RIOPCIinit(p, RIO_PCI_DEFAULT_MODE);
170 }
171
172 rio_dprintk (RIO_DEBUG_INIT, "Total hosts initialised so far : %d\n", p->RIONumHosts);
173
174
175#ifdef FUTURE_RELEASE
176 if (p->bus & EISA_BUS)
177 /* EISA card */
178 RIOEISAinit(p, RIO_EISA_DEFAULT_MODE);
179
180 if (p->bus & MCA_BUS)
181 /* MCA card */
182 RIOMCAinit(p, RIO_MCA_DEFAULT_MODE);
183#endif
184}
185
186/*
187** go through memory for an AT host that we pass in the device info
188** structure and initialise
189*/
190void
191RIOISAinit(p, mode)
192struct rio_info * p;
193int mode;
194{
195
196 /* XXX Need to implement this. */
197#if 0
198 p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec,
199 (int (*)())rio_intr, (char*)p->RIONumHosts);
200
201 rio_dprintk (RIO_DEBUG_INIT, "Set interrupt handler, intr_tid = 0x%x\n", p->intr_tid );
202
203 if (RIODoAT(p, p->RIOHosts[p->RIONumHosts].PaddrP, mode)) {
204 return;
205 }
206 else {
207 rio_dprintk (RIO_DEBUG_INIT, "RIODoAT failed\n");
208 p->RIOFailed++;
209 }
210#endif
211
212}
213
214/*
215** RIODoAT :
216**
217** Map in a boards physical address, check that the board is there,
218** test the board and if everything is okay assign the board an entry
219** in the Rio Hosts structure.
220*/
221int
222RIODoAT(p, Base, mode)
223struct rio_info * p;
224int Base;
225int mode;
226{
227#define FOUND 1
228#define NOT_FOUND 0
229
230 caddr_t cardAddr;
231
232 /*
233 ** Check to see if we actually have a board at this physical address.
234 */
235 if ((cardAddr = RIOCheckForATCard(Base)) != 0) {
236 /*
237 ** Now test the board to see if it is working.
238 */
239 if (RIOBoardTest(Base, cardAddr, RIO_AT, 0) == RIO_SUCCESS) {
240 /*
241 ** Fill out a slot in the Rio host structure.
242 */
243 if (RIOAssignAT(p, Base, cardAddr, mode)) {
244 return(FOUND);
245 }
246 }
247 RIOMapout(Base, RIO_AT_MEM_SIZE, cardAddr);
248 }
249 return(NOT_FOUND);
250}
251
252caddr_t
253RIOCheckForATCard(Base)
254int Base;
255{
256 int off;
257 struct DpRam *cardp; /* (Points at the host) */
258 caddr_t virtAddr;
259 unsigned char RIOSigTab[24];
260/*
261** Table of values to search for as prom signature of a host card
262*/
263 strcpy(RIOSigTab, "JBJGPGGHINSMJPJR");
264
265 /*
266 ** Hey! Yes, You reading this code! Yo, grab a load a this:
267 **
268 ** IF the card is using WORD MODE rather than BYTE MODE
269 ** then it will occupy 128K of PHYSICAL memory area. So,
270 ** you might think that the following Mapin is wrong. Well,
271 ** it isn't, because the SECOND 64K of occupied space is an
272 ** EXACT COPY of the FIRST 64K. (good?), so, we need only
273 ** map it in in one 64K block.
274 */
275 if (RIOMapin(Base, RIO_AT_MEM_SIZE, &virtAddr) == -1) {
276 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't map the board in!\n");
277 return((caddr_t)0);
278 }
279
280 /*
281 ** virtAddr points to the DP ram of the system.
282 ** We now cast this to a pointer to a RIO Host,
283 ** and have a rummage about in the PROM.
284 */
285 cardp = (struct DpRam *)virtAddr;
286
287 for (off=0; RIOSigTab[off]; off++) {
288 if ((RBYTE(cardp->DpSignature[off]) & 0xFF) != RIOSigTab[off]) {
289 /*
290 ** Signature mismatch - card not at this address
291 */
292 RIOMapout(Base, RIO_AT_MEM_SIZE, virtAddr);
293 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't match the signature 0x%x 0x%x!\n",
294 (int)cardp, off);
295 return((caddr_t)0);
296 }
297 }
298
299 /*
300 ** If we get here then we must have found a valid board so return
301 ** its virtual address.
302 */
303 return(virtAddr);
304}
305#endif
306 92
307/** 93/**
308** RIOAssignAT : 94** RIOAssignAT :
@@ -367,667 +153,6 @@ int mode;
367 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base); 153 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base);
368 return(1); 154 return(1);
369} 155}
370#if 0
371#ifdef FUTURE_RELEASE
372int RIOMCAinit(int Mode)
373{
374 uchar SlotNumber;
375 caddr_t Caddr;
376 uint Paddr;
377 uint Ivec;
378 int Handle;
379 int ret = 0;
380
381 /*
382 ** Valid mode information for MCA cards
383 ** is only FAST LINKS
384 */
385 Mode = (Mode & FAST_LINKS) ? McaTpFastLinks : McaTpSlowLinks;
386 rio_dprintk (RIO_DEBUG_INIT, "RIOMCAinit(%d)\n",Mode);
387
388
389 /*
390 ** Check out each of the slots
391 */
392 for (SlotNumber = 0; SlotNumber < McaMaxSlots; SlotNumber++) {
393 /*
394 ** Enable the slot we want to talk to
395 */
396 outb( McaSlotSelect, SlotNumber | McaSlotEnable );
397
398 /*
399 ** Read the ID word from the slot
400 */
401 if (((inb(McaIdHigh)<< 8)|inb(McaIdLow)) == McaRIOId)
402 {
403 rio_dprintk (RIO_DEBUG_INIT, "Potential MCA card in slot %d\n", SlotNumber);
404
405 /*
406 ** Card appears to be a RIO MCA card!
407 */
408 RIOMachineType |= (1<<RIO_MCA);
409
410 /*
411 ** Just check we haven't found too many wonderful objects
412 */
413 if ( RIONumHosts >= RIO_HOSTS )
414 {
415 Rprintf(RIOMesgTooManyCards);
416 return(ret);
417 }
418
419 /*
420 ** McaIrqEnable contains the interrupt vector, and a card
421 ** enable bit.
422 */
423 Ivec = inb(McaIrqEnable);
424
425 rio_dprintk (RIO_DEBUG_INIT, "Ivec is %x\n", Ivec);
426
427 switch ( Ivec & McaIrqMask )
428 {
429 case McaIrq9:
430 rio_dprintk (RIO_DEBUG_INIT, "IRQ9\n");
431 break;
432 case McaIrq3:
433 rio_dprintk (RIO_DEBUG_INIT, "IRQ3\n");
434 break;
435 case McaIrq4:
436 rio_dprintk (RIO_DEBUG_INIT, "IRQ4\n");
437 break;
438 case McaIrq7:
439 rio_dprintk (RIO_DEBUG_INIT, "IRQ7\n");
440 break;
441 case McaIrq10:
442 rio_dprintk (RIO_DEBUG_INIT, "IRQ10\n");
443 break;
444 case McaIrq11:
445 rio_dprintk (RIO_DEBUG_INIT, "IRQ11\n");
446 break;
447 case McaIrq12:
448 rio_dprintk (RIO_DEBUG_INIT, "IRQ12\n");
449 break;
450 case McaIrq15:
451 rio_dprintk (RIO_DEBUG_INIT, "IRQ15\n");
452 break;
453 }
454
455 /*
456 ** If the card enable bit isn't set, then set it!
457 */
458 if ((Ivec & McaCardEnable) != McaCardEnable) {
459 rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable not set - setting!\n");
460 outb(McaIrqEnable,Ivec|McaCardEnable);
461 } else
462 rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable already set\n");
463
464 /*
465 ** Convert the IRQ enable mask into something useful
466 */
467 Ivec = RIOMcaToIvec[Ivec & McaIrqMask];
468
469 /*
470 ** Find the physical address
471 */
472 rio_dprintk (RIO_DEBUG_INIT, "inb(McaMemory) is %x\n", inb(McaMemory));
473 Paddr = McaAddress(inb(McaMemory));
474
475 rio_dprintk (RIO_DEBUG_INIT, "MCA card has Ivec %d Addr %x\n", Ivec, Paddr);
476
477 if ( Paddr != 0 )
478 {
479
480 /*
481 ** Tell the memory mapper that we want to talk to it
482 */
483 Handle = RIOMapin( Paddr, RIO_MCA_MEM_SIZE, &Caddr );
484
485 if ( Handle == -1 ) {
486 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n", RIO_MCA_MEM_SIZE, Paddr;
487 continue;
488 }
489
490 rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr);
491
492 /*
493 ** And check that it is actually there!
494 */
495 if ( RIOBoardTest( Paddr,Caddr,RIO_MCA,SlotNumber ) == RIO_SUCCESS )
496 {
497 rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n");
498 rio_dprintk (RIO_DEBUG_INIT, "Slot %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n",
499 SlotNumber, RIO_MCA, Paddr, Caddr, Mode);
500
501 /*
502 ** Board has passed its scrub test. Fill in all the
503 ** transient stuff.
504 */
505 p->RIOHosts[RIONumHosts].Slot = SlotNumber;
506 p->RIOHosts[RIONumHosts].Ivec = Ivec;
507 p->RIOHosts[RIONumHosts].Type = RIO_MCA;
508 p->RIOHosts[RIONumHosts].Copy = bcopy;
509 p->RIOHosts[RIONumHosts].PaddrP = Paddr;
510 p->RIOHosts[RIONumHosts].Caddr = Caddr;
511 p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr;
512 p->RIOHosts[RIONumHosts].Mode = Mode;
513 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt , 0xff);
514 p->RIOHosts[RIONumHosts].UniqueNum =
515 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)|
516 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)|
517 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)|
518 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24);
519 RIONumHosts++;
520 ret++;
521 }
522 else
523 {
524 /*
525 ** It failed the test, so ignore it.
526 */
527 rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n");
528 RIOMapout(Paddr, RIO_MCA_MEM_SIZE, Caddr );
529 }
530 }
531 else
532 {
533 rio_dprintk (RIO_DEBUG_INIT, "Slot %d - Paddr zero!\n", SlotNumber);
534 }
535 }
536 else
537 {
538 rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber);
539 }
540 }
541 /*
542 ** Now we have checked all the slots, turn off the MCA slot selector
543 */
544 outb(McaSlotSelect,0);
545 rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber);
546 return ret;
547}
548
549int RIOEISAinit( int Mode )
550{
551 static int EISADone = 0;
552 uint Paddr;
553 int PollIntMixMsgDone = 0;
554 caddr_t Caddr;
555 ushort Ident;
556 uchar EisaSlot;
557 uchar Ivec;
558 int ret = 0;
559
560 /*
561 ** The only valid mode information for EISA hosts is fast or slow
562 ** links.
563 */
564 Mode = (Mode & FAST_LINKS) ? EISA_TP_FAST_LINKS : EISA_TP_SLOW_LINKS;
565
566 if ( EISADone )
567 {
568 rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit() - already done, return.\n");
569 return(0);
570 }
571
572 EISADone++;
573
574 rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit()\n");
575
576
577 /*
578 ** First check all cards to see if ANY are set for polled mode operation.
579 ** If so, set ALL to polled.
580 */
581
582 for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ )
583 {
584 Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) |
585 INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO);
586
587 if ( Ident == RIO_EISA_IDENT )
588 {
589 rio_dprintk (RIO_DEBUG_INIT, "Found Specialix product\n");
590
591 if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE )
592 {
593 rio_dprintk (RIO_DEBUG_INIT, "Not Specialix RIO - Product number %x\n",
594 INBZ(EisaSlot, EISA_PRODUCT_NUMBER));
595 continue; /* next slot */
596 }
597 /*
598 ** Its a Specialix RIO!
599 */
600 rio_dprintk (RIO_DEBUG_INIT, "RIO Revision %d\n",
601 INBZ(EisaSlot, EISA_REVISION_NUMBER));
602
603 RIOMachineType |= (1<<RIO_EISA);
604
605 /*
606 ** Just check we haven't found too many wonderful objects
607 */
608 if ( RIONumHosts >= RIO_HOSTS )
609 {
610 Rprintf(RIOMesgTooManyCards);
611 return 0;
612 }
613
614 /*
615 ** Ensure that the enable bit is set!
616 */
617 OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT );
618
619 /*
620 ** EISA_INTERRUPT_VEC contains the interrupt vector.
621 */
622 Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC);
623
624#ifdef RIODEBUG
625 switch ( Ivec & EISA_INTERRUPT_MASK )
626 {
627 case EISA_IRQ_3:
628 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 3\n");
629 break;
630 case EISA_IRQ_4:
631 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 4\n");
632 break;
633 case EISA_IRQ_5:
634 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 5\n");
635 break;
636 case EISA_IRQ_6:
637 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 6\n");
638 break;
639 case EISA_IRQ_7:
640 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 7\n");
641 break;
642 case EISA_IRQ_9:
643 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 9\n");
644 break;
645 case EISA_IRQ_10:
646 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 10\n");
647 break;
648 case EISA_IRQ_11:
649 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 11\n");
650 break;
651 case EISA_IRQ_12:
652 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 12\n");
653 break;
654 case EISA_IRQ_14:
655 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 14\n");
656 break;
657 case EISA_IRQ_15:
658 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 15\n");
659 break;
660 case EISA_POLLED:
661 rio_dprintk (RIO_DEBUG_INIT, "EISA POLLED\n");
662 break;
663 default:
664 rio_dprintk (RIO_DEBUG_INIT, NULL,DBG_INIT|DBG_FAIL,"Shagged interrupt number!\n");
665 Ivec &= EISA_CONTROL_MASK;
666 }
667#endif
668
669 if ( (Ivec & EISA_INTERRUPT_MASK) ==
670 EISA_POLLED )
671 {
672 RIOWillPoll = 1;
673 break; /* From EisaSlot loop */
674 }
675 }
676 }
677
678 /*
679 ** Do it all again now we know whether to change all cards to polled
680 ** mode or not
681 */
682
683 for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ )
684 {
685 Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) |
686 INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO);
687
688 if ( Ident == RIO_EISA_IDENT )
689 {
690 if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE )
691 continue; /* next slot */
692
693 /*
694 ** Its a Specialix RIO!
695 */
696
697 /*
698 ** Ensure that the enable bit is set!
699 */
700 OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT );
701
702 /*
703 ** EISA_INTERRUPT_VEC contains the interrupt vector.
704 */
705 Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC);
706
707 if ( RIOWillPoll )
708 {
709 /*
710 ** If we are going to operate in polled mode, but this
711 ** board is configured to be interrupt driven, display
712 ** the message explaining the situation to the punter,
713 ** assuming we haven't already done so.
714 */
715
716 if ( !PollIntMixMsgDone &&
717 (Ivec & EISA_INTERRUPT_MASK) != EISA_POLLED )
718 {
719 Rprintf(RIOMesgAllPolled);
720 PollIntMixMsgDone = 1;
721 }
722
723 /*
724 ** Ungraciously ignore whatever the board reports as its
725 ** interrupt vector...
726 */
727
728 Ivec &= ~EISA_INTERRUPT_MASK;
729
730 /*
731 ** ...and force it to dance to the poll tune.
732 */
733
734 Ivec |= EISA_POLLED;
735 }
736
737 /*
738 ** Convert the IRQ enable mask into something useful (0-15)
739 */
740 Ivec = RIOEisaToIvec(Ivec);
741
742 rio_dprintk (RIO_DEBUG_INIT, "EISA host in slot %d has Ivec 0x%x\n",
743 EisaSlot, Ivec);
744
745 /*
746 ** Find the physical address
747 */
748 Paddr = (INBZ(EisaSlot,EISA_MEMORY_BASE_HI)<<24) |
749 (INBZ(EisaSlot,EISA_MEMORY_BASE_LO)<<16);
750
751 rio_dprintk (RIO_DEBUG_INIT, "EISA card has Ivec %d Addr %x\n", Ivec, Paddr);
752
753 if ( Paddr == 0 )
754 {
755 rio_dprintk (RIO_DEBUG_INIT,
756 "Board in slot %d configured for address zero!\n", EisaSlot);
757 continue;
758 }
759
760 /*
761 ** Tell the memory mapper that we want to talk to it
762 */
763 rio_dprintk (RIO_DEBUG_INIT, "About to map EISA card \n");
764
765 if (RIOMapin( Paddr, RIO_EISA_MEM_SIZE, &Caddr) == -1) {
766 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n",
767 RIO_EISA_MEM_SIZE,Paddr);
768 continue;
769 }
770
771 rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr);
772
773 /*
774 ** And check that it is actually there!
775 */
776 if ( RIOBoardTest( Paddr,Caddr,RIO_EISA,EisaSlot) == RIO_SUCCESS )
777 {
778 rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n");
779 rio_dprintk (RIO_DEBUG_INIT,
780 "Slot %d. Ivec %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n",
781 EisaSlot,Ivec,RIO_EISA,Paddr,Caddr,Mode);
782
783 /*
784 ** Board has passed its scrub test. Fill in all the
785 ** transient stuff.
786 */
787 p->RIOHosts[RIONumHosts].Slot = EisaSlot;
788 p->RIOHosts[RIONumHosts].Ivec = Ivec;
789 p->RIOHosts[RIONumHosts].Type = RIO_EISA;
790 p->RIOHosts[RIONumHosts].Copy = bcopy;
791 p->RIOHosts[RIONumHosts].PaddrP = Paddr;
792 p->RIOHosts[RIONumHosts].Caddr = Caddr;
793 p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr;
794 p->RIOHosts[RIONumHosts].Mode = Mode;
795 /*
796 ** because the EISA prom is mapped into IO space, we
797 ** need to copy the unqiue number into the memory area
798 ** that it would have occupied, so that the download
799 ** code can determine its ID and card type.
800 */
801 WBYTE(p->RIOHosts[RIONumHosts].Unique[0],INBZ(EisaSlot,EISA_UNIQUE_NUM_0));
802 WBYTE(p->RIOHosts[RIONumHosts].Unique[1],INBZ(EisaSlot,EISA_UNIQUE_NUM_1));
803 WBYTE(p->RIOHosts[RIONumHosts].Unique[2],INBZ(EisaSlot,EISA_UNIQUE_NUM_2));
804 WBYTE(p->RIOHosts[RIONumHosts].Unique[3],INBZ(EisaSlot,EISA_UNIQUE_NUM_3));
805 p->RIOHosts[RIONumHosts].UniqueNum =
806 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)|
807 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)|
808 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)|
809 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24);
810 INBZ(EisaSlot,EISA_INTERRUPT_RESET);
811 RIONumHosts++;
812 ret++;
813 }
814 else
815 {
816 /*
817 ** It failed the test, so ignore it.
818 */
819 rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n");
820
821 RIOMapout(Paddr, RIO_EISA_MEM_SIZE, Caddr );
822 }
823 }
824 }
825 if (RIOMachineType & RIO_EISA)
826 return ret+1;
827 return ret;
828}
829#endif
830
831
832#ifndef linux
833
834#define CONFIG_ADDRESS 0xcf8
835#define CONFIG_DATA 0xcfc
836#define FORWARD_REG 0xcfa
837
838
839static int
840read_config(int bus_number, int device_num, int r_number)
841{
842 unsigned int cav;
843 unsigned int val;
844
845/*
846 Build config_address_value:
847
848 31 24 23 16 15 11 10 8 7 0
849 ------------------------------------------------------
850 |1| 0000000 | bus_number | device # | 000 | register |
851 ------------------------------------------------------
852*/
853
854 cav = r_number & 0xff;
855 cav |= ((device_num & 0x1f) << 11);
856 cav |= ((bus_number & 0xff) << 16);
857 cav |= 0x80000000; /* Enable bit */
858 outpd(CONFIG_ADDRESS,cav);
859 val = inpd(CONFIG_DATA);
860 outpd(CONFIG_ADDRESS,0);
861 return val;
862}
863
864static
865write_config(bus_number,device_num,r_number,val)
866{
867 unsigned int cav;
868
869/*
870 Build config_address_value:
871
872 31 24 23 16 15 11 10 8 7 0
873 ------------------------------------------------------
874 |1| 0000000 | bus_number | device # | 000 | register |
875 ------------------------------------------------------
876*/
877
878 cav = r_number & 0xff;
879 cav |= ((device_num & 0x1f) << 11);
880 cav |= ((bus_number & 0xff) << 16);
881 cav |= 0x80000000; /* Enable bit */
882 outpd(CONFIG_ADDRESS, cav);
883 outpd(CONFIG_DATA, val);
884 outpd(CONFIG_ADDRESS, 0);
885 return val;
886}
887#else
888/* XXX Implement these... */
889static int
890read_config(int bus_number, int device_num, int r_number)
891{
892 return 0;
893}
894
895static int
896write_config(int bus_number, int device_num, int r_number)
897{
898 return 0;
899}
900
901#endif
902
903int
904RIOPCIinit(p, Mode)
905struct rio_info *p;
906int Mode;
907{
908 #define MAX_PCI_SLOT 32
909 #define RIO_PCI_JET_CARD 0x200011CB
910
911 static int slot; /* count of machine's PCI slots searched so far */
912 caddr_t Caddr; /* Virtual address of the current PCI host card. */
913 unsigned char Ivec; /* interrupt vector for the current PCI host */
914 unsigned long Paddr; /* Physical address for the current PCI host */
915 int Handle; /* Handle to Virtual memory allocated for current PCI host */
916
917
918 rio_dprintk (RIO_DEBUG_INIT, "Search for a RIO PCI card - start at slot %d\n", slot);
919
920 /*
921 ** Initialise the search status
922 */
923 p->RIOLastPCISearch = RIO_FAIL;
924
925 while ( (slot < MAX_PCI_SLOT) & (p->RIOLastPCISearch != RIO_SUCCESS) )
926 {
927 rio_dprintk (RIO_DEBUG_INIT, "Currently testing slot %d\n", slot);
928
929 if (read_config(0,slot,0) == RIO_PCI_JET_CARD) {
930 p->RIOHosts[p->RIONumHosts].Ivec = 0;
931 Paddr = read_config(0,slot,0x18);
932 Paddr = Paddr - (Paddr & 0x1); /* Mask off the io bit */
933
934 if ( (Paddr == 0) || ((Paddr & 0xffff0000) == 0xffff0000) ) {
935 rio_dprintk (RIO_DEBUG_INIT, "Goofed up slot\n"); /* what! */
936 slot++;
937 continue;
938 }
939
940 p->RIOHosts[p->RIONumHosts].PaddrP = Paddr;
941 Ivec = (read_config(0,slot,0x3c) & 0xff);
942
943 rio_dprintk (RIO_DEBUG_INIT, "PCI Host at 0x%x, Intr %d\n", (int)Paddr, Ivec);
944
945 Handle = RIOMapin( Paddr, RIO_PCI_MEM_SIZE, &Caddr );
946 if (Handle == -1) {
947 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at 0x%x\n", RIO_PCI_MEM_SIZE, (int)Paddr);
948 slot++;
949 continue;
950 }
951 p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32;
952 p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec,
953 (int (*)())rio_intr, (char *)p->RIONumHosts);
954 if (RIOBoardTest( Paddr, Caddr, RIO_PCI, 0 ) == RIO_SUCCESS) {
955 rio_dprintk (RIO_DEBUG_INIT, ("Board has passed test\n");
956 rio_dprintk (RIO_DEBUG_INIT, ("Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", Paddr, Caddr, Mode);
957
958 /*
959 ** Board has passed its scrub test. Fill in all the
960 ** transient stuff.
961 */
962 p->RIOHosts[p->RIONumHosts].Slot = 0;
963 p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32;
964 p->RIOHosts[p->RIONumHosts].Type = RIO_PCI;
965 p->RIOHosts[p->RIONumHosts].Copy = rio_pcicopy;
966 p->RIOHosts[p->RIONumHosts].PaddrP = Paddr;
967 p->RIOHosts[p->RIONumHosts].Caddr = Caddr;
968 p->RIOHosts[p->RIONumHosts].CardP = (struct DpRam *)Caddr;
969 p->RIOHosts[p->RIONumHosts].Mode = Mode;
970
971#if 0
972 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
973 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
974 p->RIOHosts[p->RIONumHosts].Mode |
975 INTERRUPT_DISABLE );
976 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
977 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
978 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
979 p->RIOHosts[p->RIONumHosts].Mode |
980 INTERRUPT_DISABLE );
981 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
982#else
983 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
984#endif
985 p->RIOHosts[p->RIONumHosts].UniqueNum =
986 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)|
987 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)|
988 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)|
989 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24);
990
991 rio_dprintk (RIO_DEBUG_INIT, "Unique no 0x%x.\n",
992 p->RIOHosts[p->RIONumHosts].UniqueNum);
993
994 p->RIOLastPCISearch = RIO_SUCCESS;
995 p->RIONumHosts++;
996 }
997 }
998 slot++;
999 }
1000
1001 if ( slot >= MAX_PCI_SLOT ) {
1002 rio_dprintk (RIO_DEBUG_INIT, "All %d PCI slots have tested for RIO cards !!!\n",
1003 MAX_PCI_SLOT);
1004 }
1005
1006
1007 /*
1008 ** I don't think we want to do this anymore
1009 **
1010
1011 if (!p->RIOLastPCISearch == RIO_FAIL ) {
1012 p->RIOFailed++;
1013 }
1014
1015 **
1016 */
1017}
1018
1019#ifdef FUTURE_RELEASE
1020void riohalt( void )
1021{
1022 int host;
1023 for ( host=0; host<p->RIONumHosts; host++ )
1024 {
1025 rio_dprintk (RIO_DEBUG_INIT, "Stop host %d\n", host);
1026 (void)RIOBoardTest( p->RIOHosts[host].PaddrP, p->RIOHosts[host].Caddr, p->RIOHosts[host].Type,p->RIOHosts[host].Slot );
1027 }
1028}
1029#endif
1030#endif
1031 156
1032static uchar val[] = { 157static uchar val[] = {
1033#ifdef VERY_LONG_TEST 158#ifdef VERY_LONG_TEST
@@ -1262,200 +387,6 @@ int size;
1262 return RIO_SUCCESS; 387 return RIO_SUCCESS;
1263} 388}
1264 389
1265/*
1266** try to ensure that every host is either in polled mode
1267** or is in interrupt mode. Only allow interrupt mode if
1268** all hosts can interrupt (why?)
1269** and force into polled mode if told to. Patch up the
1270** interrupt vector & salute The Queen when you've done.
1271*/
1272#if 0
1273static void
1274RIOAllocateInterrupts(p)
1275struct rio_info * p;
1276{
1277 int Host;
1278
1279 /*
1280 ** Easy case - if we have been told to poll, then we poll.
1281 */
1282 if (p->mode & POLLED_MODE) {
1283 RIOStopInterrupts(p, 0, 0);
1284 return;
1285 }
1286
1287 /*
1288 ** check - if any host has been set to polled mode, then all must be.
1289 */
1290 for (Host=0; Host<p->RIONumHosts; Host++) {
1291 if ( (p->RIOHosts[Host].Type != RIO_AT) &&
1292 (p->RIOHosts[Host].Ivec == POLLED) ) {
1293 RIOStopInterrupts(p, 1, Host );
1294 return;
1295 }
1296 }
1297 for (Host=0; Host<p->RIONumHosts; Host++) {
1298 if (p->RIOHosts[Host].Type == RIO_AT) {
1299 if ( (p->RIOHosts[Host].Ivec - 32) == 0) {
1300 RIOStopInterrupts(p, 2, Host );
1301 return;
1302 }
1303 }
1304 }
1305}
1306
1307/*
1308** something has decided that we can't be doing with these
1309** new-fangled interrupt thingies. Set everything up to just
1310** poll.
1311*/
1312static void
1313RIOStopInterrupts(p, Reason, Host)
1314struct rio_info * p;
1315int Reason;
1316int Host;
1317{
1318#ifdef FUTURE_RELEASE
1319 switch (Reason) {
1320 case 0: /* forced into polling by rio_polled */
1321 break;
1322 case 1: /* SCU has set 'Host' into polled mode */
1323 break;
1324 case 2: /* there aren't enough interrupt vectors for 'Host' */
1325 break;
1326 }
1327#endif
1328
1329 for (Host=0; Host<p->RIONumHosts; Host++ ) {
1330 struct Host *HostP = &p->RIOHosts[Host];
1331
1332 switch (HostP->Type) {
1333 case RIO_AT:
1334 /*
1335 ** The AT host has it's interrupts disabled by clearing the
1336 ** int_enable bit.
1337 */
1338 HostP->Mode &= ~INTERRUPT_ENABLE;
1339 HostP->Ivec = POLLED;
1340 break;
1341#ifdef FUTURE_RELEASE
1342 case RIO_EISA:
1343 /*
1344 ** The EISA host has it's interrupts disabled by setting the
1345 ** Ivec to zero
1346 */
1347 HostP->Ivec = POLLED;
1348 break;
1349#endif
1350 case RIO_PCI:
1351 /*
1352 ** The PCI host has it's interrupts disabled by clearing the
1353 ** int_enable bit, like a regular host card.
1354 */
1355 HostP->Mode &= ~RIO_PCI_INT_ENABLE;
1356 HostP->Ivec = POLLED;
1357 break;
1358#ifdef FUTURE_RELEASE
1359 case RIO_MCA:
1360 /*
1361 ** There's always one, isn't there?
1362 ** The MCA host card cannot have it's interrupts disabled.
1363 */
1364 RIOPatchVec(HostP);
1365 break;
1366#endif
1367 }
1368 }
1369}
1370
1371/*
1372** This function is called at init time to setup the data structures.
1373*/
1374void
1375RIOAllocDataStructs(p)
1376struct rio_info * p;
1377{
1378 int port,
1379 host,
1380 tm;
1381
1382 p->RIOPortp = (struct Port *)sysbrk(RIO_PORTS * sizeof(struct Port));
1383 if (!p->RIOPortp) {
1384 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for port structures\n");
1385 p->RIOFailed++;
1386 return;
1387 }
1388 bzero( p->RIOPortp, sizeof(struct Port) * RIO_PORTS );
1389 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for port structs\n");
1390 rio_dprintk (RIO_DEBUG_INIT, "First RIO port struct @0x%x, size=0x%x bytes\n",
1391 (int)p->RIOPortp, sizeof(struct Port));
1392
1393 for( port=0; port<RIO_PORTS; port++ ) {
1394 p->RIOPortp[port].PortNum = port;
1395 p->RIOPortp[port].TtyP = &p->channel[port];
1396 sreset (p->RIOPortp[port].InUse); /* Let the first guy uses it */
1397 p->RIOPortp[port].portSem = -1; /* Let the first guy takes it */
1398 p->RIOPortp[port].ParamSem = -1; /* Let the first guy takes it */
1399 p->RIOPortp[port].timeout_id = 0; /* Let the first guy takes it */
1400 }
1401
1402 p->RIOHosts = (struct Host *)sysbrk(RIO_HOSTS * sizeof(struct Host));
1403 if (!p->RIOHosts) {
1404 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for host structures\n");
1405 p->RIOFailed++;
1406 return;
1407 }
1408 bzero(p->RIOHosts, sizeof(struct Host)*RIO_HOSTS);
1409 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for host structs\n");
1410 rio_dprintk (RIO_DEBUG_INIT, "First RIO host struct @0x%x, size=0x%x bytes\n",
1411 (int)p->RIOHosts, sizeof(struct Host));
1412
1413 for( host=0; host<RIO_HOSTS; host++ ) {
1414 spin_lock_init (&p->RIOHosts[host].HostLock);
1415 p->RIOHosts[host].timeout_id = 0; /* Let the first guy takes it */
1416 }
1417 /*
1418 ** check that the buffer size is valid, round down to the next power of
1419 ** two if necessary; if the result is zero, then, hey, no double buffers.
1420 */
1421 for ( tm = 1; tm && tm <= p->RIOConf.BufferSize; tm <<= 1 )
1422 ;
1423 tm >>= 1;
1424 p->RIOBufferSize = tm;
1425 p->RIOBufferMask = tm ? tm - 1 : 0;
1426}
1427
1428/*
1429** this function gets called whenever the data structures need to be
1430** re-setup, for example, after a riohalt (why did I ever invent it?)
1431*/
1432void
1433RIOSetupDataStructs(p)
1434struct rio_info * p;
1435{
1436 int host, entry, rup;
1437
1438 for ( host=0; host<RIO_HOSTS; host++ ) {
1439 struct Host *HostP = &p->RIOHosts[host];
1440 for ( entry=0; entry<LINKS_PER_UNIT; entry++ ) {
1441 HostP->Topology[entry].Unit = ROUTE_DISCONNECT;
1442 HostP->Topology[entry].Link = NO_LINK;
1443 }
1444 bcopy("HOST X", HostP->Name, 7);
1445 HostP->Name[5] = '1'+host;
1446 for (rup=0; rup<(MAX_RUP + LINKS_PER_UNIT); rup++) {
1447 if (rup < MAX_RUP) {
1448 for (entry=0; entry<LINKS_PER_UNIT; entry++ ) {
1449 HostP->Mapping[rup].Topology[entry].Unit = ROUTE_DISCONNECT;
1450 HostP->Mapping[rup].Topology[entry].Link = NO_LINK;
1451 }
1452 RIODefaultName(p, HostP, rup);
1453 }
1454 spin_lock_init(&HostP->UnixRups[rup].RupLock);
1455 }
1456 }
1457}
1458#endif
1459 390
1460int 391int
1461RIODefaultName(p, HostP, UnitId) 392RIODefaultName(p, HostP, UnitId)
@@ -1463,10 +394,6 @@ struct rio_info * p;
1463struct Host * HostP; 394struct Host * HostP;
1464uint UnitId; 395uint UnitId;
1465{ 396{
1466#ifdef CHECK
1467 CheckHost( Host );
1468 CheckUnitId( UnitId );
1469#endif
1470 bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17); 397 bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17);
1471 HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); 398 HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts);
1472 if ((UnitId+1) > 9) { 399 if ((UnitId+1) > 9) {
@@ -1483,33 +410,6 @@ uint UnitId;
1483#define RIO_RELEASE "Linux" 410#define RIO_RELEASE "Linux"
1484#define RELEASE_ID "1.0" 411#define RELEASE_ID "1.0"
1485 412
1486#if 0
1487static int
1488RIOReport(p)
1489struct rio_info * p;
1490{
1491 char * RIORelease = RIO_RELEASE;
1492 char * RIORelID = RELEASE_ID;
1493 int host;
1494
1495 rio_dprintk (RIO_DEBUG_INIT, "RIO : Release: %s ID: %s\n", RIORelease, RIORelID);
1496
1497 if ( p->RIONumHosts==0 ) {
1498 rio_dprintk (RIO_DEBUG_INIT, "\nNo Hosts configured\n");
1499 return(0);
1500 }
1501
1502 for ( host=0; host < p->RIONumHosts; host++ ) {
1503 struct Host *HostP = &p->RIOHosts[host];
1504 switch ( HostP->Type ) {
1505 case RIO_AT:
1506 rio_dprintk (RIO_DEBUG_INIT, "AT BUS : found the card at 0x%x\n", HostP->PaddrP);
1507 }
1508 }
1509 return 0;
1510}
1511#endif
1512
1513static struct rioVersion stVersion; 413static struct rioVersion stVersion;
1514 414
1515struct rioVersion * 415struct rioVersion *
@@ -1523,27 +423,6 @@ RIOVersid(void)
1523 return &stVersion; 423 return &stVersion;
1524} 424}
1525 425
1526#if 0
1527int
1528RIOMapin(paddr, size, vaddr)
1529paddr_t paddr;
1530int size;
1531caddr_t * vaddr;
1532{
1533 *vaddr = (caddr_t)permap( (long)paddr, size);
1534 return ((int)*vaddr);
1535}
1536
1537void
1538RIOMapout(paddr, size, vaddr)
1539paddr_t paddr;
1540long size;
1541caddr_t vaddr;
1542{
1543}
1544#endif
1545
1546
1547void 426void
1548RIOHostReset(Type, DpRamP, Slot) 427RIOHostReset(Type, DpRamP, Slot)
1549uint Type; 428uint Type;
@@ -1570,31 +449,6 @@ uint Slot;
1570 WBYTE(DpRamP->DpResetTpu, 0xFF); 449 WBYTE(DpRamP->DpResetTpu, 0xFF);
1571 udelay(3); 450 udelay(3);
1572 break; 451 break;
1573#ifdef FUTURE_RELEASE
1574 case RIO_EISA:
1575 /*
1576 ** Bet this doesn't work!
1577 */
1578 OUTBZ( Slot, EISA_CONTROL_PORT,
1579 EISA_TP_RUN | EISA_TP_BUS_DISABLE |
1580 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1581 OUTBZ( Slot, EISA_CONTROL_PORT,
1582 EISA_TP_RESET | EISA_TP_BUS_DISABLE |
1583 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1584 suspend( 3 );
1585 OUTBZ( Slot, EISA_CONTROL_PORT,
1586 EISA_TP_RUN | EISA_TP_BUS_DISABLE |
1587 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1588 break;
1589 case RIO_MCA:
1590 WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable );
1591 WBYTE(DpRamP->DpResetTpu , 0xFF );
1592 suspend( 3 );
1593 WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable );
1594 WBYTE(DpRamP->DpResetTpu , 0xFF );
1595 suspend( 3 );
1596 break;
1597#endif
1598 case RIO_PCI: 452 case RIO_PCI:
1599 rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); 453 rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n");
1600 DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; 454 DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM;
@@ -1604,12 +458,6 @@ uint Slot;
1604 /* for (i=0; i<6000; i++); */ 458 /* for (i=0; i<6000; i++); */
1605 /* suspend( 3 ); */ 459 /* suspend( 3 ); */
1606 break; 460 break;
1607#ifdef FUTURE_RELEASE
1608 default:
1609 Rprintf(RIOMesgNoSupport,Type,DpRamP,Slot);
1610 return;
1611#endif
1612
1613 default: 461 default:
1614 rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); 462 rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n");
1615 break; 463 break;
diff --git a/drivers/char/rio/riolocks.h b/drivers/char/rio/riolocks.h
deleted file mode 100644
index 0e0cdacebe0b..000000000000
--- a/drivers/char/rio/riolocks.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : riolocks.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:13
26** Retrieved : 11/6/98 11:34:22
27**
28** ident @(#)riolocks.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_riolocks_h__
34#define __rio_riolocks_h__
35
36#ifdef SCCS_LABELS
37static char *_riolocks_h_sccs_ = "@(#)riolocks.h 1.2";
38#endif
39
40#define LOCKB(lk) lockb(lk);
41#define UNLOCKB(lk, oldspl) unlockb(lk, oldspl);
42
43#endif
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c
index 4cc7f4942bfc..c622f46d6d77 100644
--- a/drivers/char/rio/rioparam.c
+++ b/drivers/char/rio/rioparam.c
@@ -195,27 +195,6 @@ int SleepFlag;
195 ** paramed with OPEN, we want to restore the saved port termio, but 195 ** paramed with OPEN, we want to restore the saved port termio, but
196 ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot. 196 ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot.
197 */ 197 */
198#if 0
199 if (PortP->FirstOpen) {
200 PortP->StoredTty.iflag = TtyP->tm.c_iflag;
201 PortP->StoredTty.oflag = TtyP->tm.c_oflag;
202 PortP->StoredTty.cflag = TtyP->tm.c_cflag;
203 PortP->StoredTty.lflag = TtyP->tm.c_lflag;
204 PortP->StoredTty.line = TtyP->tm.c_line;
205 for (i = 0; i < NCC + 5; i++)
206 PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i];
207 PortP->FirstOpen = 0;
208 } else if (PortP->Store || PortP->Lock) {
209 rio_dprintk(RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n");
210 TtyP->tm.c_iflag = PortP->StoredTty.iflag;
211 TtyP->tm.c_oflag = PortP->StoredTty.oflag;
212 TtyP->tm.c_cflag = PortP->StoredTty.cflag;
213 TtyP->tm.c_lflag = PortP->StoredTty.lflag;
214 TtyP->tm.c_line = PortP->StoredTty.line;
215 for (i = 0; i < NCC + 5; i++)
216 TtyP->tm.c_cc[i] = PortP->StoredTty.cc[i];
217 }
218#endif
219 } 198 }
220 199
221 /* 200 /*
@@ -273,16 +252,6 @@ int SleepFlag;
273 phb_param_ptr = (struct phb_param *) PacketP->data; 252 phb_param_ptr = (struct phb_param *) PacketP->data;
274 253
275 254
276#if 0
277 /*
278 ** COR 1
279 */
280 if (TtyP->tm.c_iflag & INPCK) {
281 rio_dprintk(RIO_DEBUG_PARAM, "Parity checking on input enabled\n");
282 Cor1 |= COR1_INPCK;
283 }
284#endif
285
286 switch (TtyP->termios->c_cflag & CSIZE) { 255 switch (TtyP->termios->c_cflag & CSIZE) {
287 case CS5: 256 case CS5:
288 { 257 {
@@ -524,10 +493,6 @@ int SleepFlag;
524 if (TtyP->termios->c_cflag & XMT1EN) 493 if (TtyP->termios->c_cflag & XMT1EN)
525 rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n"); 494 rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n");
526#endif 495#endif
527#if 0
528 if (TtyP->termios->c_cflag & LOBLK)
529 rio_dprintk(RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n");
530#endif
531 if (TtyP->termios->c_lflag & ISIG) 496 if (TtyP->termios->c_lflag & ISIG)
532 rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); 497 rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n");
533 if (TtyP->termios->c_lflag & ICANON) 498 if (TtyP->termios->c_lflag & ICANON)
@@ -572,14 +537,6 @@ int SleepFlag;
572 rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n"); 537 rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n");
573 if (TtyP->termios->c_oflag & TABDLY) 538 if (TtyP->termios->c_oflag & TABDLY)
574 rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n"); 539 rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n");
575#if 0
576 if (TtyP->termios->c_oflag & BSDLY)
577 rio_dprintk(RIO_DEBUG_PARAM, "Back-space delay set\n");
578 if (TtyP->termios->c_oflag & VTDLY)
579 rio_dprintk(RIO_DEBUG_PARAM, "Vertical tab delay set\n");
580 if (TtyP->termios->c_oflag & FFDLY)
581 rio_dprintk(RIO_DEBUG_PARAM, "Form-feed delay set\n");
582#endif
583 /* 540 /*
584 ** These things are kind of useful in a later life! 541 ** These things are kind of useful in a later life!
585 */ 542 */
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c
index 0f4cd33ba641..f98888f52659 100644
--- a/drivers/char/rio/rioroute.c
+++ b/drivers/char/rio/rioroute.c
@@ -112,15 +112,6 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
112 int Lies; 112 int Lies;
113 unsigned long flags; 113 unsigned long flags;
114 114
115#ifdef STACK
116 RIOStackCheck("RIORouteRup");
117#endif
118#ifdef CHECK
119 CheckPacketP(PacketP);
120 CheckHostP(HostP);
121 CheckRup(Rup);
122 CheckHost(Host);
123#endif
124 /* 115 /*
125 ** Is this unit telling us it's current link topology? 116 ** Is this unit telling us it's current link topology?
126 */ 117 */
@@ -540,9 +531,6 @@ uint unit;
540 531
541 for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { 532 for (port = 0; port < PORTS_PER_RTA; port++, PortN++) {
542 ushort dest_port = port + 8; 533 ushort dest_port = port + 8;
543#if 0
544 uint PktInt;
545#endif
546 WORD *TxPktP; 534 WORD *TxPktP;
547 PKT *Pkt; 535 PKT *Pkt;
548 536
@@ -623,10 +611,6 @@ uint UnitId;
623 unsigned long flags; 611 unsigned long flags;
624 rio_spin_lock_irqsave(&HostP->HostLock, flags); 612 rio_spin_lock_irqsave(&HostP->HostLock, flags);
625 613
626#ifdef CHECK
627 CheckHostP(HostP);
628 CheckUnitId(UnitId);
629#endif
630 if (RIOCheck(HostP, UnitId)) { 614 if (RIOCheck(HostP, UnitId)) {
631 rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); 615 rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId);
632 rio_spin_unlock_irqrestore(&HostP->HostLock, flags); 616 rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
@@ -651,10 +635,6 @@ uint UnitId;
651{ 635{
652 uint link, unit; 636 uint link, unit;
653 637
654#ifdef CHECK
655 CheckHostP(HostP);
656 CheckUnitId(UnitId);
657#endif
658 UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ 638 UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */
659 639
660 if (UnitId >= MAX_RUP) /* dontcha just lurv unsigned maths! */ 640 if (UnitId >= MAX_RUP) /* dontcha just lurv unsigned maths! */
@@ -684,10 +664,6 @@ uint UnitId;
684{ 664{
685 unsigned char link; 665 unsigned char link;
686 666
687#ifdef CHECK
688 CheckHostP(HostP);
689 CheckUnitId(UnitId);
690#endif
691/* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ 667/* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */
692 rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); 668 rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId);
693 669
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index 42c3dffcbbb2..a86b216ab653 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -754,11 +754,6 @@ struct Map *HostMapP;
754 ushort RtaType; 754 ushort RtaType;
755 unsigned long flags; 755 unsigned long flags;
756 756
757#ifdef CHECK
758 CheckHostP(HostP);
759 CheckHostMapP(HostMapP);
760#endif
761
762 rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID); 757 rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID);
763 758
764 /* 759 /*
@@ -784,9 +779,6 @@ struct Map *HostMapP;
784 779
785 rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); 780 rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp);
786 PortP = p->RIOPortp[SysPort]; 781 PortP = p->RIOPortp[SysPort];
787#if 0
788 PortP->TtyP = &p->channel[SysPort];
789#endif
790 rio_dprintk(RIO_DEBUG_TABLE, "Map port\n"); 782 rio_dprintk(RIO_DEBUG_TABLE, "Map port\n");
791 783
792 /* 784 /*
diff --git a/drivers/char/rio/riotime.h b/drivers/char/rio/riotime.h
deleted file mode 100644
index 35e01cd103d0..000000000000
--- a/drivers/char/rio/riotime.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* T I M E
4 ******* *******
5 ****************************************************************************
6
7 Author : Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
28 Version : 0.01
29
30
31 Mods
32 ----------------------------------------------------------------------------
33 Date By Description
34 ----------------------------------------------------------------------------
35
36 ***************************************************************************/
37
38#ifndef _riotime_h
39#define _riotime_h 1
40
41#ifndef lint
42#ifdef SCCS
43static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1";
44#endif
45#endif
46
47#define TWO_POWER_FIFTEEN (ushort)32768
48#define RioTime() riotime
49#define RioTimeAfter(time1,time2) ((ushort)time1 - (ushort)time2) < TWO_POWER_FIFTEEN
50#define RioTimePlus(time1,time2) ((ushort)time1 + (ushort)time2)
51
52/**************************************
53 * Convert a RIO tick (1/10th second)
54 * into transputer low priority ticks
55 *************************************/
56#define RioTimeToLow(time) (time*(100000 / 64))
57#define RioLowToTime(time) ((time*64)/100000)
58
59#define RIOTENTHSECOND (ushort)1
60#define RIOSECOND (ushort)(RIOTENTHSECOND * 10)
61#endif
62
63/*********** end of file ***********/
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index 5894a25b0113..6379816ed173 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -89,16 +89,9 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
89#include "list.h" 89#include "list.h"
90#include "sam.h" 90#include "sam.h"
91 91
92#if 0
93static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int);
94#endif
95
96static void RIOClearUp(struct Port *PortP); 92static void RIOClearUp(struct Port *PortP);
97int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); 93int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
98 94
99#if 0
100static int RIOCookMode(struct ttystatics *);
101#endif
102 95
103extern int conv_vb[]; /* now defined in ttymgr.c */ 96extern int conv_vb[]; /* now defined in ttymgr.c */
104extern int conv_bv[]; /* now defined in ttymgr.c */ 97extern int conv_bv[]; /* now defined in ttymgr.c */
@@ -226,33 +219,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
226 ** until the RTA is present then we must spin here waiting for 219 ** until the RTA is present then we must spin here waiting for
227 ** the RTA to boot. 220 ** the RTA to boot.
228 */ 221 */
229#if 0
230 if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
231 if (PortP->WaitUntilBooted) {
232 rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot\n");
233 do {
234 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
235 rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
236 func_exit();
237 return -EINTR;
238 }
239 if (repeat_this-- <= 0) {
240 rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
241 RIOPreemptiveCmd(p, PortP, FCLOSE);
242 pseterr(EINTR);
243 func_exit();
244 return -EIO;
245 }
246 } while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED));
247 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
248 } else {
249 rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n");
250 pseterr(ENXIO);
251 func_exit();
252 return 0;
253 }
254 }
255#else
256 /* I find the above code a bit hairy. I find the below code 222 /* I find the above code a bit hairy. I find the below code
257 easier to read and shorter. Now, if it works too that would 223 easier to read and shorter. Now, if it works too that would
258 be great... -- REW 224 be great... -- REW
@@ -281,21 +247,10 @@ int riotopen(struct tty_struct *tty, struct file *filp)
281 } 247 }
282 } 248 }
283 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); 249 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
284#endif
285#if 0
286 tp = PortP->TtyP; /* get tty struct */
287#endif
288 rio_spin_lock_irqsave(&PortP->portSem, flags); 250 rio_spin_lock_irqsave(&PortP->portSem, flags);
289 if (p->RIOHalted) { 251 if (p->RIOHalted) {
290 goto bombout; 252 goto bombout;
291 } 253 }
292#if 0
293 retval = gs_init_port(&PortP->gs);
294 if (retval) {
295 func_exit();
296 return retval;
297 }
298#endif
299 254
300 /* 255 /*
301 ** If the port is in the final throws of being closed, 256 ** If the port is in the final throws of being closed,
@@ -363,11 +318,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
363 command piggybacks the parameters immediately. 318 command piggybacks the parameters immediately.
364 -- REW */ 319 -- REW */
365 RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */ 320 RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */
366#if 0
367 /* This delay of 1 second was annoying. I removed it. -- REW */
368 RIODelay(PortP, HUNDRED_MS * 10);
369 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); /* Config the port */
370#endif
371 rio_spin_lock_irqsave(&PortP->portSem, flags); 321 rio_spin_lock_irqsave(&PortP->portSem, flags);
372 322
373 /* 323 /*
@@ -439,9 +389,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
439 PortP->State |= RIO_WOPEN; 389 PortP->State |= RIO_WOPEN;
440 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 390 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
441 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) 391 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL)
442#if 0
443 if (sleep((caddr_t) & tp->tm.c_canqo, TTIPRI | PCATCH))
444#endif
445 { 392 {
446 /* 393 /*
447 ** ACTION: verify that this is a good thing 394 ** ACTION: verify that this is a good thing
@@ -505,10 +452,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
505*/ 452*/
506int riotclose(void *ptr) 453int riotclose(void *ptr)
507{ 454{
508#if 0
509 register uint SysPort = dev;
510 struct ttystatics *tp; /* pointer to our ttystruct */
511#endif
512 struct Port *PortP = ptr; /* pointer to the port structure */ 455 struct Port *PortP = ptr; /* pointer to the port structure */
513 int deleted = 0; 456 int deleted = 0;
514 int try = -1; /* Disable the timeouts by setting them to -1 */ 457 int try = -1; /* Disable the timeouts by setting them to -1 */
@@ -534,13 +477,6 @@ int riotclose(void *ptr)
534 end_time = jiffies + MAX_SCHEDULE_TIMEOUT; 477 end_time = jiffies + MAX_SCHEDULE_TIMEOUT;
535 478
536 Modem = rio_ismodem(tty); 479 Modem = rio_ismodem(tty);
537#if 0
538 /* What F.CKING cache? Even then, a higly idle multiprocessor,
539 system with large caches this won't work . Better find out when
540 this doesn't work asap, and fix the cause. -- REW */
541
542 RIODelay(PortP, HUNDRED_MS * 10); /* To flush the cache */
543#endif
544 rio_spin_lock_irqsave(&PortP->portSem, flags); 480 rio_spin_lock_irqsave(&PortP->portSem, flags);
545 481
546 /* 482 /*
@@ -703,45 +639,6 @@ int riotclose(void *ptr)
703} 639}
704 640
705 641
706/*
707** decide if we need to use the line discipline.
708** This routine can return one of three values:
709** COOK_RAW if no processing has to be done by the line discipline or the card
710** COOK_WELL if the line discipline must be used to do the processing
711** COOK_MEDIUM if the card can do all the processing necessary.
712*/
713#if 0
714static int RIOCookMode(struct ttystatics *tp)
715{
716 /*
717 ** We can't handle tm.c_mstate != 0 on SCO
718 ** We can't handle mapping
719 ** We can't handle non-ttwrite line disc.
720 ** We can't handle lflag XCASE
721 ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3)
722 */
723
724#ifdef CHECK
725 CheckTtyP(tp);
726#endif
727 if (!(tp->tm.c_oflag & OPOST)) /* No post processing */
728 return COOK_RAW; /* Raw mode o/p */
729
730 if (tp->tm.c_lflag & XCASE)
731 return COOK_WELL; /* Use line disc */
732
733 if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3))
734 return COOK_WELL; /* Use line disc for strange modes */
735
736 if (tp->tm.c_oflag == OPOST) /* If only OPOST is set, do RAW */
737 return COOK_RAW;
738
739 /*
740 ** So, we need to output process!
741 */
742 return COOK_MEDIUM;
743}
744#endif
745 642
746static void RIOClearUp(PortP) 643static void RIOClearUp(PortP)
747struct Port *PortP; 644struct Port *PortP;
@@ -776,11 +673,6 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len
776 unsigned long flags; 673 unsigned long flags;
777 674
778 rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n"); 675 rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n");
779#ifdef CHECK
780 CheckPortP(PortP);
781 if (len < 1 || len > 2)
782 cprintf(("STUPID LENGTH %d\n", len));
783#endif
784 676
785 if (PortP->State & RIO_DELETED) { 677 if (PortP->State & RIO_DELETED) {
786 rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); 678 rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
@@ -852,478 +744,3 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len
852} 744}
853 745
854 746
855#if 0
856/*
857** This is an ioctl interface. This is the twentieth century. You know what
858** its all about.
859*/
860int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
861{
862 register struct Port *PortP;
863 register struct ttystatics *tp;
864 int current;
865 int ParamSemIncremented = 0;
866 int old_oflag, old_cflag, old_iflag, changed, oldcook;
867 int i;
868 unsigned char sio_regs[5]; /* Here be magic */
869 short vpix_cflag;
870 short divisor;
871 int baud;
872 uint SysPort = rio_minor(tty);
873 int Modem = rio_ismodem(tty);
874 int ioctl_processed;
875
876 rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty");
877
878 if (SysPort >= RIO_PORTS) {
879 rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort);
880 return -ENXIO;
881 }
882
883 PortP = p->RIOPortp[SysPort];
884 tp = PortP->TtyP;
885
886 rio_spin_lock_irqsave(&PortP->portSem, flags);
887
888#ifdef STATS
889 PortP->Stat.IoctlCnt++;
890#endif
891
892 if (PortP->State & RIO_DELETED) {
893 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
894 return -EIO;
895 }
896
897
898 if (p->RIOHalted) {
899 RIOClearUp(PortP);
900 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
901 return -EIO;
902 }
903
904 /*
905 ** Count ioctls for port statistics reporting
906 */
907 if (PortP->statsGather)
908 PortP->ioctls++;
909
910 /*
911 ** Specialix RIO Ioctl calls
912 */
913 switch (cmd) {
914
915 case TCRIOTRIAD:
916 if (arg)
917 PortP->State |= RIO_TRIAD_MODE;
918 else
919 PortP->State &= ~RIO_TRIAD_MODE;
920 /*
921 ** Normally, when istrip is set on a port, a config is
922 ** sent to the RTA instructing the CD1400 to do the
923 ** stripping. In TRIAD mode, the interrupt receive routine
924 ** must do the stripping instead, since it has to detect
925 ** an 8 bit function key sequence. If istrip is set with
926 ** TRIAD mode on(off), and 8 bit data is being read by
927 ** the port, the user then turns TRIAD mode off(on), the RTA
928 ** must be reconfigured (not) to do the stripping.
929 ** Hence we call RIOParam here.
930 */
931 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
932 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
933 return 0;
934
935 case TCRIOTSTATE:
936 rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis");
937 /* MonitorTstate = 0 ; */
938 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
939 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
940 return 0;
941
942 case TCRIOSTATE: /* current state of Modem input pins */
943 rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE\n");
944 if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL)
945 rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n");
946 PortP->State |= RIO_BUSY;
947 current = PortP->ModemState;
948 if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) {
949 rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n");
950 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
951 pseterr(EFAULT);
952 }
953 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
954 return 0;
955
956 case TCRIOMBIS: /* Set modem lines */
957 case TCRIOMBIC: /* Clear modem lines */
958 rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n");
959 if (cmd == TCRIOMBIS) {
960 uint state;
961 state = (uint) arg;
962 PortP->ModemState |= (ushort) state;
963 PortP->ModemLines = (ulong) arg;
964 if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL)
965 rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n");
966 } else {
967 uint state;
968
969 state = (uint) arg;
970 PortP->ModemState &= ~(ushort) state;
971 PortP->ModemLines = (ulong) arg;
972 if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL)
973 rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIC command failed\n");
974 }
975 PortP->State |= RIO_BUSY;
976 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
977 return 0;
978
979 case TCRIOXPON: /* set Xprint ON string */
980 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n");
981 if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) {
982 rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
983 PortP->Xprint.XpOn[0] = '\0';
984 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
985 pseterr(EFAULT);
986 }
987 PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
988 PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
989 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
990 return 0;
991
992 case TCRIOXPOFF: /* set Xprint OFF string */
993 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n");
994 if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) {
995 rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
996 PortP->Xprint.XpOff[0] = '\0';
997 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
998 pseterr(EFAULT);
999 }
1000 PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
1001 PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
1002 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1003 return 0;
1004
1005 case TCRIOXPCPS: /* set Xprint CPS string */
1006 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n");
1007 if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) {
1008 rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg);
1009 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1010 pseterr(EINVAL);
1011 return 0;
1012 }
1013 PortP->Xprint.XpCps = (uint) arg;
1014 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1015 return 0;
1016
1017 case TCRIOXPRINT:
1018 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n");
1019 if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) {
1020 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1021 pseterr(EFAULT);
1022 }
1023 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1024 return 0;
1025
1026 case TCRIOIXANYON:
1027 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYON\n");
1028 PortP->Config |= RIO_IXANY;
1029 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1030 return 0;
1031
1032 case TCRIOIXANYOFF:
1033 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYOFF\n");
1034 PortP->Config &= ~RIO_IXANY;
1035 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1036 return 0;
1037
1038 case TCRIOIXONON:
1039 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONON\n");
1040 PortP->Config |= RIO_IXON;
1041 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1042 return 0;
1043
1044 case TCRIOIXONOFF:
1045 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONOFF\n");
1046 PortP->Config &= ~RIO_IXON;
1047 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1048 return 0;
1049
1050/*
1051** 15.10.1998 ARG - ESIL 0761 part fix
1052** Added support for CTS and RTS flow control ioctls :
1053*/
1054 case TCRIOCTSFLOWEN:
1055 rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n");
1056 PortP->Config |= RIO_CTSFLOW;
1057 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1058 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1059 return 0;
1060
1061 case TCRIOCTSFLOWDIS:
1062 rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n");
1063 PortP->Config &= ~RIO_CTSFLOW;
1064 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1065 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1066 return 0;
1067
1068 case TCRIORTSFLOWEN:
1069 rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n");
1070 PortP->Config |= RIO_RTSFLOW;
1071 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1072 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1073 return 0;
1074
1075 case TCRIORTSFLOWDIS:
1076 rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n");
1077 PortP->Config &= ~RIO_RTSFLOW;
1078 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1079 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1080 return 0;
1081
1082/* end ESIL 0761 part fix */
1083
1084 }
1085
1086
1087 /* Lynx IOCTLS */
1088 switch (cmd) {
1089 case TIOCSETP:
1090 case TIOCSETN:
1091 case OTIOCSETP:
1092 case OTIOCSETN:
1093 ioctl_processed++;
1094 ttyseth(PortP, tp, (struct old_sgttyb *) arg);
1095 break;
1096 case TCSETA:
1097 case TCSETAW:
1098 case TCSETAF:
1099 ioctl_processed++;
1100 rio_dprintk(RIO_DEBUG_TTY, "NON POSIX ioctl\n");
1101 ttyseth_pv(PortP, tp, (struct termios *) arg, 0);
1102 break;
1103 case TCSETAP: /* posix tcsetattr() */
1104 case TCSETAWP: /* posix tcsetattr() */
1105 case TCSETAFP: /* posix tcsetattr() */
1106 rio_dprintk(RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n");
1107 ttyseth_pv(PortP, tp, (struct termios *) arg, 1);
1108 ioctl_processed++;
1109 break;
1110 }
1111
1112 /*
1113 ** If its any of the commands that require the port to be in the
1114 ** non-busy state wait until all output has drained
1115 */
1116 if (!ioctl_processed)
1117 switch (cmd) {
1118 case TCSETAW:
1119 case TCSETAF:
1120 case TCSETA:
1121 case TCSBRK:
1122#define OLD_POSIX ('x' << 8)
1123#define OLD_POSIX_SETA (OLD_POSIX | 2)
1124#define OLD_POSIX_SETAW (OLD_POSIX | 3)
1125#define OLD_POSIX_SETAF (OLD_POSIX | 4)
1126#define NEW_POSIX (('i' << 24) | ('X' << 16))
1127#define NEW_POSIX_SETA (NEW_POSIX | 2)
1128#define NEW_POSIX_SETAW (NEW_POSIX | 3)
1129#define NEW_POSIX_SETAF (NEW_POSIX | 4)
1130 case OLD_POSIX_SETA:
1131 case OLD_POSIX_SETAW:
1132 case OLD_POSIX_SETAF:
1133 case NEW_POSIX_SETA:
1134 case NEW_POSIX_SETAW:
1135 case NEW_POSIX_SETAF:
1136#ifdef TIOCSETP
1137 case TIOCSETP:
1138#endif
1139 case TIOCSETD:
1140 case TIOCSETN:
1141 rio_dprintk(RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n");
1142 /*
1143 ** Wait for drain here, at least as far as the double buffer
1144 ** being empty.
1145 */
1146 /* XXX Does the above comment mean that this has
1147 still to be implemented? -- REW */
1148 /* XXX Is the locking OK together with locking
1149 in txenable? (Deadlock?) -- REW */
1150
1151 RIOTxEnable((char *) PortP);
1152 break;
1153 default:
1154 break;
1155 }
1156
1157 old_cflag = tp->tm.c_cflag;
1158 old_iflag = tp->tm.c_iflag;
1159 old_oflag = tp->tm.c_oflag;
1160 oldcook = PortP->CookMode;
1161
1162 if (p->RIOHalted) {
1163 RIOClearUp(PortP);
1164 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1165 pseterr(EIO);
1166 return 0;
1167 }
1168
1169 PortP->FlushCmdBodge = 0;
1170
1171 /*
1172 ** If the port is locked, and it is reconfigured, we want
1173 ** to restore the state of the tty structure so the change is NOT
1174 ** made.
1175 */
1176 if (PortP->Lock) {
1177 tp->tm.c_iflag = PortP->StoredTty.iflag;
1178 tp->tm.c_oflag = PortP->StoredTty.oflag;
1179 tp->tm.c_cflag = PortP->StoredTty.cflag;
1180 tp->tm.c_lflag = PortP->StoredTty.lflag;
1181 tp->tm.c_line = PortP->StoredTty.line;
1182 for (i = 0; i < NCC + 1; i++)
1183 tp->tm.c_cc[i] = PortP->StoredTty.cc[i];
1184 } else {
1185 /*
1186 ** If the port is set to store the parameters, and it is
1187 ** reconfigured, we want to save the current tty struct so it
1188 ** may be restored on the next open.
1189 */
1190 if (PortP->Store) {
1191 PortP->StoredTty.iflag = tp->tm.c_iflag;
1192 PortP->StoredTty.oflag = tp->tm.c_oflag;
1193 PortP->StoredTty.cflag = tp->tm.c_cflag;
1194 PortP->StoredTty.lflag = tp->tm.c_lflag;
1195 PortP->StoredTty.line = tp->tm.c_line;
1196 for (i = 0; i < NCC + 1; i++)
1197 PortP->StoredTty.cc[i] = tp->tm.c_cc[i];
1198 }
1199 }
1200
1201 changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag);
1202
1203 PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */
1204
1205 rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook);
1206
1207#ifdef MODEM_SUPPORT
1208 /*
1209 ** kludge to force CARR_ON if CLOCAL set
1210 */
1211 if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
1212 tp->tm.c_state |= CARR_ON;
1213 wakeup((caddr_t) & tp->tm.c_canq);
1214 }
1215#endif
1216
1217 if (p->RIOHalted) {
1218 RIOClearUp(PortP);
1219 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1220 pseterr(EIO);
1221 return 0;
1222 }
1223 /*
1224 ** Re-configure if modes or cooking have changed
1225 */
1226 if (changed || oldcook != PortP->CookMode || (ioctl_processed)) {
1227 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1228 rio_dprintk(RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n");
1229 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1230 rio_spin_lock_irqsave(&PortP->portSem, flags);
1231 }
1232
1233 if (p->RIOHalted) {
1234 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1235 RIOClearUp(PortP);
1236 pseterr(EIO);
1237 return 0;
1238 }
1239 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1240 return 0;
1241}
1242
1243/*
1244 ttyseth -- set hardware dependent tty settings
1245*/
1246void ttyseth(PortP, s, sg)
1247struct Port *PortP;
1248struct ttystatics *s;
1249struct old_sgttyb *sg;
1250{
1251 struct old_sgttyb *tsg;
1252 struct termios *tp = &s->tm;
1253
1254 tsg = &s->sg;
1255
1256 if (sg->sg_flags & (EVENP | ODDP)) {
1257 tp->c_cflag &= PARENB;
1258 if (sg->sg_flags & EVENP) {
1259 if (sg->sg_flags & ODDP) {
1260 tp->c_cflag &= V_CS7;
1261 tp->c_cflag &= ~PARENB;
1262 } else {
1263 tp->c_cflag &= V_CS7;
1264 tp->c_cflag &= PARENB;
1265 tp->c_cflag &= PARODD;
1266 }
1267 } else if (sg->sg_flags & ODDP) {
1268 tp->c_cflag &= V_CS7;
1269 tp->c_cflag &= PARENB;
1270 tp->c_cflag &= PARODD;
1271 } else {
1272 tp->c_cflag &= V_CS7;
1273 tp->c_cflag &= PARENB;
1274 }
1275 }
1276/*
1277 * Use ispeed as the desired speed. Most implementations don't handle
1278 * separate input and output speeds very well. If the RIO handles this,
1279 * I will have to use separate sets of flags to store them in the
1280 * Port structure.
1281 */
1282 if (!sg->sg_ospeed)
1283 sg->sg_ospeed = sg->sg_ispeed;
1284 else
1285 sg->sg_ispeed = sg->sg_ospeed;
1286 if (sg->sg_ispeed > V_EXTB)
1287 sg->sg_ispeed = V_EXTB;
1288 if (sg->sg_ispeed < V_B0)
1289 sg->sg_ispeed = V_B0;
1290 *tsg = *sg;
1291 tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int) sg->sg_ispeed];
1292}
1293
1294/*
1295 ttyseth_pv -- set hardware dependent tty settings using either the
1296 POSIX termios structure or the System V termio structure.
1297 sysv = 0 => (POSIX): struct termios *sg
1298 sysv != 0 => (System V): struct termio *sg
1299*/
1300static void ttyseth_pv(PortP, s, sg, sysv)
1301struct Port *PortP;
1302struct ttystatics *s;
1303struct termios *sg;
1304int sysv;
1305{
1306 int speed;
1307 unsigned char csize;
1308 unsigned char cread;
1309 unsigned int lcr_flags;
1310 int ps;
1311
1312 if (sysv) {
1313 /* sg points to a System V termio structure */
1314 csize = ((struct termio *) sg)->c_cflag & CSIZE;
1315 cread = ((struct termio *) sg)->c_cflag & CREAD;
1316 speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD];
1317 } else {
1318 /* sg points to a POSIX termios structure */
1319 csize = sg->c_cflag & CSIZE;
1320 cread = sg->c_cflag & CREAD;
1321 speed = conv_vb[sg->c_cflag & V_CBAUD];
1322 }
1323 if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) {
1324 s->sg.sg_ispeed = speed;
1325 s->sg.sg_ospeed = speed;
1326 s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed];
1327 }
1328}
1329#endif
diff --git a/drivers/char/rio/riowinif.h b/drivers/char/rio/riowinif.h
deleted file mode 100644
index f802d7593b80..000000000000
--- a/drivers/char/rio/riowinif.h
+++ /dev/null
@@ -1,1329 +0,0 @@
1/************************************************************************/
2/* */
3/* Title : RIO Shared Memory Window Inteface */
4/* */
5/* Author : N.P.Vassallo */
6/* */
7/* Creation : 7th June 1999 */
8/* */
9/* Version : 1.0.0 */
10/* */
11/* Copyright : (c) Specialix International Ltd. 1999 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * */
26/* Description : Prototypes, structures and definitions */
27/* describing RIO host card shared memory */
28/* window interface structures: */
29/* PARMMAP */
30/* RUP */
31/* PHB */
32/* LPB */
33/* PKT */
34/* */
35/************************************************************************/
36
37/* History...
38
391.0.0 07/06/99 NPV Creation. (based on PARMMAP.H)
40
41*/
42
43#ifndef _riowinif_h /* If RIOWINDIF.H not already defined */
44#define _riowinif_h 1
45
46/*****************************************************************************
47******************************** *********************************
48******************************** General *********************************
49******************************** *********************************
50*****************************************************************************/
51
52#define TPNULL ((_u16)(0x8000))
53
54/*****************************************************************************
55******************************** ********************************
56******************************** PARM_MAP ********************************
57******************************** ********************************
58*****************************************************************************/
59
60/* The PARM_MAP structure defines global values relating to the Host Card / RTA
61 and is the main structure from which all other structures are referenced. */
62
63typedef struct _PARM_MAP {
64 _u16 phb_ptr; /* 0x00 Pointer to the PHB array */
65 _u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */
66 _u16 free_list; /* 0x04 Free List pointer */
67 _u16 free_list_end; /* 0x06 Free List End pointer */
68 _u16 q_free_list_ptr; /* 0x08 Ptr to Q_BUF variable */
69 _u16 unit_id_ptr; /* 0x0A Unit Id */
70 _u16 link_str_ptr; /* 0x0C Link Structure Array */
71 _u16 bootloader_1; /* 0x0E 1st Stage Boot Loader */
72 _u16 bootloader_2; /* 0x10 2nd Stage Boot Loader */
73 _u16 port_route_map_ptr; /* 0x12 Port Route Map */
74 _u16 route_ptr; /* 0x14 Route Map */
75 _u16 map_present; /* 0x16 Route Map present */
76 _u16 pkt_num; /* 0x18 Total number of packets */
77 _u16 q_num; /* 0x1A Total number of Q packets */
78 _u16 buffers_per_port; /* 0x1C Number of buffers per port */
79 _u16 heap_size; /* 0x1E Initial size of heap */
80 _u16 heap_left; /* 0x20 Current Heap left */
81 _u16 error; /* 0x22 Error code */
82 _u16 tx_max; /* 0x24 Max number of tx pkts per phb */
83 _u16 rx_max; /* 0x26 Max number of rx pkts per phb */
84 _u16 rx_limit; /* 0x28 For high / low watermarks */
85 _u16 links; /* 0x2A Links to use */
86 _u16 timer; /* 0x2C Interrupts per second */
87 _u16 rups; /* 0x2E Pointer to the RUPs */
88 _u16 max_phb; /* 0x30 Mostly for debugging */
89 _u16 living; /* 0x32 Just increments!! */
90 _u16 init_done; /* 0x34 Initialisation over */
91 _u16 booting_link; /* 0x36 */
92 _u16 idle_count; /* 0x38 Idle time counter */
93 _u16 busy_count; /* 0x3A Busy counter */
94 _u16 idle_control; /* 0x3C Control Idle Process */
95 _u16 tx_intr; /* 0x3E TX interrupt pending */
96 _u16 rx_intr; /* 0x40 RX interrupt pending */
97 _u16 rup_intr; /* 0x42 RUP interrupt pending */
98
99} PARM_MAP;
100
101/* Same thing again, but defined as offsets... */
102
103#define PM_phb_ptr 0x00 /* 0x00 Pointer to the PHB array */
104#define PM_phb_num_ptr 0x02 /* 0x02 Ptr to Number of PHB's */
105#define PM_free_list 0x04 /* 0x04 Free List pointer */
106#define PM_free_list_end 0x06 /* 0x06 Free List End pointer */
107#define PM_q_free_list_ptr 0x08 /* 0x08 Ptr to Q_BUF variable */
108#define PM_unit_id_ptr 0x0A /* 0x0A Unit Id */
109#define PM_link_str_ptr 0x0C /* 0x0C Link Structure Array */
110#define PM_bootloader_1 0x0E /* 0x0E 1st Stage Boot Loader */
111#define PM_bootloader_2 0x10 /* 0x10 2nd Stage Boot Loader */
112#define PM_port_route_map_ptr 0x12 /* 0x12 Port Route Map */
113#define PM_route_ptr 0x14 /* 0x14 Route Map */
114#define PM_map_present 0x16 /* 0x16 Route Map present */
115#define PM_pkt_num 0x18 /* 0x18 Total number of packets */
116#define PM_q_num 0x1A /* 0x1A Total number of Q packets */
117#define PM_buffers_per_port 0x1C /* 0x1C Number of buffers per port */
118#define PM_heap_size 0x1E /* 0x1E Initial size of heap */
119#define PM_heap_left 0x20 /* 0x20 Current Heap left */
120#define PM_error 0x22 /* 0x22 Error code */
121#define PM_tx_max 0x24 /* 0x24 Max number of tx pkts per phb */
122#define PM_rx_max 0x26 /* 0x26 Max number of rx pkts per phb */
123#define PM_rx_limit 0x28 /* 0x28 For high / low watermarks */
124#define PM_links 0x2A /* 0x2A Links to use */
125#define PM_timer 0x2C /* 0x2C Interrupts per second */
126#define PM_rups 0x2E /* 0x2E Pointer to the RUPs */
127#define PM_max_phb 0x30 /* 0x30 Mostly for debugging */
128#define PM_living 0x32 /* 0x32 Just increments!! */
129#define PM_init_done 0x34 /* 0x34 Initialisation over */
130#define PM_booting_link 0x36 /* 0x36 */
131#define PM_idle_count 0x38 /* 0x38 Idle time counter */
132#define PM_busy_count 0x3A /* 0x3A Busy counter */
133#define PM_idle_control 0x3C /* 0x3C Control Idle Process */
134#define PM_tx_intr 0x3E /* 0x4E TX interrupt pending */
135#define PM_rx_intr 0x40 /* 0x40 RX interrupt pending */
136#define PM_rup_intr 0x42 /* 0x42 RUP interrupt pending */
137#define sizeof_PARM_MAP 0x44 /* structure size = 0x44 */
138
139/* PARM_MAP.error definitions... */
140#define E_NO_ERROR 0x00
141#define E_PROCESS_NOT_INIT 0x01
142#define E_LINK_TIMEOUT 0x02
143#define E_NO_ROUTE 0x03
144#define E_CONFUSED 0x04
145#define E_HOME 0x05
146#define E_CSUM_FAIL 0x06
147#define E_DISCONNECTED 0x07
148#define E_BAD_RUP 0x08
149#define E_NO_VIRGIN 0x09
150#define E_BOOT_RUP_BUSY 0x10
151#define E_CHANALLOC 0x80
152#define E_POLL_ALLOC 0x81
153#define E_LTTWAKE 0x82
154#define E_LTT_ALLOC 0x83
155#define E_LRT_ALLOC 0x84
156#define E_CIRRUS 0x85
157#define E_MONITOR 0x86
158#define E_PHB_ALLOC 0x87
159#define E_ARRAY_ALLOC 0x88
160#define E_QBUF_ALLOC 0x89
161#define E_PKT_ALLOC 0x8a
162#define E_GET_TX_Q_BUF 0x8b
163#define E_GET_RX_Q_BUF 0x8c
164#define E_MEM_OUT 0x8d
165#define E_MMU_INIT 0x8e
166#define E_LTT_INIT 0x8f
167#define E_LRT_INIT 0x90
168#define E_LINK_RUN 0x91
169#define E_MONITOR_ALLOC 0x92
170#define E_MONITOR_INIT 0x93
171#define E_POLL_INIT 0x94
172
173/* PARM_MAP.links definitions... */
174#define RIO_LINK_ENABLE 0x80FF
175
176/*****************************************************************************
177********************************** ***********************************
178********************************** RUP ***********************************
179********************************** ***********************************
180*****************************************************************************/
181
182/* The RUP (Remote Unit Port) structure relates to the Remote Terminal Adapters
183 attached to the system and there is normally an array of MAX_RUPS (=16) structures
184 in a host card, defined by PARM_MAP->rup. */
185
186typedef struct _RUP {
187 _u16 txpkt; /* 0x00 Outgoing packet */
188 _u16 rxpkt; /* 0x02 ncoming packet */
189 _u16 link; /* 0x04 Which link to send packet down ? */
190 _u8 rup_dest_unit[2]; /* 0x06 Destination Unit */
191 _u16 handshake; /* 0x08 Handshaking */
192 _u16 timeout; /* 0x0A Timeout */
193 _u16 status; /* 0x0C Status */
194 _u16 txcontrol; /* 0x0E Transmit control */
195 _u16 rxcontrol; /* 0x10 Receive control */
196
197} RUP;
198
199/* Same thing again, but defined as offsets... */
200
201#define RUP_txpkt 0x00 /* 0x00 Outgoing packet */
202#define RUP_rxpkt 0x02 /* 0x02 Incoming packet */
203#define RUP_link 0x04 /* 0x04 Which link to send packet down ? */
204#define RUP_rup_dest_unit 0x06 /* 0x06 Destination Unit */
205#define RUP_handshake 0x08 /* 0x08 Handshaking */
206#define RUP_timeout 0x0A /* 0x0A Timeout */
207#define RUP_status 0x0C /* 0x0C Status */
208#define RUP_txcontrol 0x0E /* 0x0E Transmit control */
209#define RUP_rxcontrol 0x10 /* 0x10 Receive control */
210#define sizeof_RUP 0x12 /* structure size = 0x12 */
211
212#define MAX_RUP 16
213
214/* RUP.txcontrol definitions... */
215#define TX_RUP_INACTIVE 0 /* Nothing to transmit */
216#define TX_PACKET_READY 1 /* Transmit packet ready */
217#define TX_LOCK_RUP 2 /* Transmit side locked */
218
219/* RUP.txcontrol definitions... */
220#define RX_RUP_INACTIVE 0 /* Nothing received */
221#define RX_PACKET_READY 1 /* Packet received */
222
223#define RUP_NO_OWNER 0xFF /* RUP not owned by any process */
224
225/*****************************************************************************
226********************************** ***********************************
227********************************** PHB ***********************************
228********************************** ***********************************
229*****************************************************************************/
230
231/* The PHB (Port Header Block) structure relates to the serial ports attached
232 to the system and there is normally an array of MAX_PHBS (=128) structures
233 in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */
234
235typedef struct _PHB {
236 _u16 source; /* 0x00 Location of the PHB in the host card */
237 _u16 handshake; /* 0x02 Used to manage receive packet flow control */
238 _u16 status; /* 0x04 Internal port transmit/receive status */
239 _u16 timeout; /* 0x06 Time period to wait for an ACK */
240 _u16 link; /* 0x08 The host link associated with the PHB */
241 _u16 destination; /* 0x0A Location of the remote port on the network */
242
243 _u16 tx_start; /* 0x0C first entry in the packet array for transmit packets */
244 _u16 tx_end; /* 0x0E last entry in the packet array for transmit packets */
245 _u16 tx_add; /* 0x10 position in the packet array for new transmit packets */
246 _u16 tx_remove; /* 0x12 current position in the packet pointer array */
247
248 _u16 rx_start; /* 0x14 first entry in the packet array for receive packets */
249 _u16 rx_end; /* 0x16 last entry in the packet array for receive packets */
250 _u16 rx_add; /* 0x18 position in the packet array for new receive packets */
251 _u16 rx_remove; /* 0x1A current position in the packet pointer array */
252
253} PHB;
254
255/* Same thing again, but defined as offsets... */
256
257#define PHB_source 0x00 /* 0x00 Location of the PHB in the host card */
258#define PHB_handshake 0x02 /* 0x02 Used to manage receive packet flow control */
259#define PHB_status 0x04 /* 0x04 Internal port transmit/receive status */
260#define PHB_timeout 0x06 /* 0x06 Time period to wait for an ACK */
261#define PHB_link 0x08 /* 0x08 The host link associated with the PHB */
262#define PHB_destination 0x0A /* 0x0A Location of the remote port on the network */
263#define PHB_tx_start 0x0C /* 0x0C first entry in the packet array for transmit packets */
264#define PHB_tx_end 0x0E /* 0x0E last entry in the packet array for transmit packets */
265#define PHB_tx_add 0x10 /* 0x10 position in the packet array for new transmit packets */
266#define PHB_tx_remove 0x12 /* 0x12 current position in the packet pointer array */
267#define PHB_rx_start 0x14 /* 0x14 first entry in the packet array for receive packets */
268#define PHB_rx_end 0x16 /* 0x16 last entry in the packet array for receive packets */
269#define PHB_rx_add 0x18 /* 0x18 position in the packet array for new receive packets */
270#define PHB_rx_remove 0x1A /* 0x1A current position in the packet pointer array */
271#define sizeof_PHB 0x1C /* structure size = 0x1C */
272
273/* PHB.handshake definitions... */
274#define PHB_HANDSHAKE_SET 0x0001 /* Set by LRT */
275#define PHB_HANDSHAKE_RESET 0x0002 /* Set by ISR / driver */
276#define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET|PHB_HANDSHAKE_SET)
277 /* Reset by ltt */
278
279#define MAX_PHB 128 /* range 0-127 */
280
281/*****************************************************************************
282********************************** ***********************************
283********************************** LPB ***********************************
284********************************** ***********************************
285*****************************************************************************/
286
287/* The LPB (Link Parameter Block) structure relates to a RIO Network Link
288 and there is normally an array of MAX_LINKS (=4) structures in a host card,
289 defined by PARM_MAP->link_str_ptr. */
290
291typedef struct _LPB {
292 _u16 link_number; /* 0x00 Link Number */
293 _u16 in_ch; /* 0x02 Link In Channel */
294 _u16 out_ch; /* 0x04 Link Out Channel */
295 _u8 attached_serial[4]; /* 0x06 Attached serial number */
296 _u8 attached_host_serial[4]; /* 0x0A Serial number of Host who booted other end */
297 _u16 descheduled; /* 0x0E Currently Descheduled */
298 _u16 state; /* 0x10 Current state */
299 _u16 send_poll; /* 0x12 Send a Poll Packet */
300 _u16 ltt_p; /* 0x14 Process Descriptor */
301 _u16 lrt_p; /* 0x16 Process Descriptor */
302 _u16 lrt_status; /* 0x18 Current lrt status */
303 _u16 ltt_status; /* 0x1A Current ltt status */
304 _u16 timeout; /* 0x1C Timeout value */
305 _u16 topology; /* 0x1E Topology bits */
306 _u16 mon_ltt; /* 0x20 */
307 _u16 mon_lrt; /* 0x22 */
308 _u16 num_pkts; /* 0x24 */
309 _u16 add_packet_list; /* 0x26 Add packets to here */
310 _u16 remove_packet_list; /* 0x28 Send packets from here */
311
312 _u16 lrt_fail_chan; /* 0x2A Lrt's failure channel */
313 _u16 ltt_fail_chan; /* 0x2C Ltt's failure channel */
314
315 RUP rup; /* 0x2E RUP structure for HOST to driver comms */
316 RUP link_rup; /* 0x40 RUP for the link (POLL, topology etc.) */
317 _u16 attached_link; /* 0x52 Number of attached link */
318 _u16 csum_errors; /* 0x54 csum errors */
319 _u16 num_disconnects; /* 0x56 number of disconnects */
320 _u16 num_sync_rcvd; /* 0x58 # sync's received */
321 _u16 num_sync_rqst; /* 0x5A # sync requests */
322 _u16 num_tx; /* 0x5C Num pkts sent */
323 _u16 num_rx; /* 0x5E Num pkts received */
324 _u16 module_attached; /* 0x60 Module tpyes of attached */
325 _u16 led_timeout; /* 0x62 LED timeout */
326 _u16 first_port; /* 0x64 First port to service */
327 _u16 last_port; /* 0x66 Last port to service */
328
329} LPB;
330
331/* Same thing again, but defined as offsets... */
332
333#define LPB_link_number 0x00 /* 0x00 Link Number */
334#define LPB_in_ch 0x02 /* 0x02 Link In Channel */
335#define LPB_out_ch 0x04 /* 0x04 Link Out Channel */
336#define LPB_attached_serial 0x06 /* 0x06 Attached serial number */
337#define LPB_attached_host_serial 0x0A /* 0x0A Serial number of Host who booted other end */
338#define LPB_descheduled 0x0E /* 0x0E Currently Descheduled */
339#define LPB_state 0x10 /* 0x10 Current state */
340#define LPB_send_poll 0x12 /* 0x12 Send a Poll Packet */
341#define LPB_ltt_p 0x14 /* 0x14 Process Descriptor */
342#define LPB_lrt_p 0x16 /* 0x16 Process Descriptor */
343#define LPB_lrt_status 0x18 /* 0x18 Current lrt status */
344#define LPB_ltt_status 0x1A /* 0x1A Current ltt status */
345#define LPB_timeout 0x1C /* 0x1C Timeout value */
346#define LPB_topology 0x1E /* 0x1E Topology bits */
347#define LPB_mon_ltt 0x20 /* 0x20 */
348#define LPB_mon_lrt 0x22 /* 0x22 */
349#define LPB_num_pkts 0x24 /* 0x24 */
350#define LPB_add_packet_list 0x26 /* 0x26 Add packets to here */
351#define LPB_remove_packet_list 0x28 /* 0x28 Send packets from here */
352#define LPB_lrt_fail_chan 0x2A /* 0x2A Lrt's failure channel */
353#define LPB_ltt_fail_chan 0x2C /* 0x2C Ltt's failure channel */
354#define LPB_rup 0x2E /* 0x2E RUP structure for HOST to driver comms */
355#define LPB_link_rup 0x40 /* 0x40 RUP for the link (POLL, topology etc.) */
356#define LPB_attached_link 0x52 /* 0x52 Number of attached link */
357#define LPB_csum_errors 0x54 /* 0x54 csum errors */
358#define LPB_num_disconnects 0x56 /* 0x56 number of disconnects */
359#define LPB_num_sync_rcvd 0x58 /* 0x58 # sync's received */
360#define LPB_num_sync_rqst 0x5A /* 0x5A # sync requests */
361#define LPB_num_tx 0x5C /* 0x5C Num pkts sent */
362#define LPB_num_rx 0x5E /* 0x5E Num pkts received */
363#define LPB_module_attached 0x60 /* 0x60 Module tpyes of attached */
364#define LPB_led_timeout 0x62 /* 0x62 LED timeout */
365#define LPB_first_port 0x64 /* 0x64 First port to service */
366#define LPB_last_port 0x66 /* 0x66 Last port to service */
367#define sizeof_LPB 0x68 /* structure size = 0x68 */
368
369#define LINKS_PER_UNIT 4 /* number of links from a host */
370
371/*****************************************************************************
372******************************** *******************************
373******************************** FREE_LIST *******************************
374******************************** *******************************
375*****************************************************************************/
376
377/* Used to overlay packet headers when allocating/freeing packets from the free list */
378
379typedef struct _FREE_LIST {
380 _u16 next; /* 0x00 offset of next list item */
381 _u16 prev; /* 0x02 offset of previous list item */
382
383} FREE_LIST;
384
385/* Same thing again, but defined as offsets... */
386
387#define FL_next 0x00 /* 0x00 offset of next list item */
388#define FL_prev 0x02 /* 0x02 offset of previous list item */
389
390/*****************************************************************************
391********************************** ***********************************
392********************************** PKT ***********************************
393********************************** ***********************************
394*****************************************************************************/
395
396/* The PKT is the main unit of communication between Host Cards and RTAs across
397 the RIO network. */
398
399#define PKT_MAX_DATA_LEN 72 /* Size of packet data */
400
401typedef struct _PKT {
402 _u8 dest_unit; /* 0x00 Destination Unit Id */
403 _u8 dest_port; /* 0x01 Destination Port */
404 _u8 src_unit; /* 0x02 Source Unit Id */
405 _u8 src_port; /* 0x03 Source Port */
406 _u8 len; /* 0x04 Length (in bytes) of data field */
407 _u8 control; /* 0x05 */
408 _u8 data[PKT_MAX_DATA_LEN]; /* 0x06 Actual data */
409 _u16 csum; /* 0x4E C-SUM */
410
411} PKT;
412
413/* Same thing again, but defined as offsets... */
414
415#define PKT_dest_unit 0x00 /* 0x00 Destination Unit Id */
416#define PKT_dest_port 0x01 /* 0x01 Destination Port */
417#define PKT_src_unit 0x02 /* 0x02 Source Unit Id */
418#define PKT_src_port 0x03 /* 0x03 Source Port */
419#define PKT_len 0x04 /* 0x04 Length (in bytes) of data field */
420#define PKT_control 0x05 /* 0x05 */
421#define PKT_data 0x06 /* 0x06 Actual data */
422#define PKT_csum 0x4E /* 0x4E C-SUM */
423#define sizeof_PKT 0x50 /* structure size = 0x50 */
424
425/* PKT.len definitions... */
426#define PKT_CMD_BIT 0x80
427#define PKT_CMD_DATA 0x80
428#define PKT_LEN_MASK 0x7F
429
430/* PKT.control definitions... */
431#define PKT_ACK 0x40
432#define PKT_TGL 0x20
433#define DATA_WNDW 0x10
434#define PKT_TTL_MASK 0x0F
435#define MAX_TTL 0x0F
436
437/*****************************************************************************
438***************************** ****************************
439***************************** Control Packets ****************************
440***************************** ****************************
441*****************************************************************************/
442
443/* The following definitions and structures define the control packets sent
444 between the driver and RIO Ports, RTAs and Host Cards. */
445
446#define PRE_EMPTIVE 0x80 /* Pre-emptive command (sent via port's RUP) */
447
448/* "in-band" and "pre-emptive" port commands... */
449#define OPEN 0x00 /* Driver->RIO Open a port */
450#define CONFIG 0x01 /* Driver->RIO Configure a port */
451#define MOPEN 0x02 /* Driver->RIO Modem open (wait for DCD) */
452#define CLOSE 0x03 /* Driver->RIO Close a port */
453#define WFLUSH (0x04|PRE_EMPTIVE) /* Driver->RIO Write flush */
454#define RFLUSH (0x05|PRE_EMPTIVE) /* Driver->RIO Read flush */
455#define RESUME (0x06|PRE_EMPTIVE) /* Driver->RIO Behave as if XON received */
456#define SBREAK 0x07 /* Driver->RIO Start break */
457#define EBREAK 0x08 /* Driver->RIO End break */
458#define SUSPEND (0x09|PRE_EMPTIVE) /* Driver->RIO Behave as if XOFF received */
459#define FCLOSE (0x0A|PRE_EMPTIVE) /* Driver->RIO Force close */
460#define XPRINT 0x0B /* Driver->RIO Xprint packet */
461#define MBIS (0x0C|PRE_EMPTIVE) /* Driver->RIO Set modem lines */
462#define MBIC (0x0D|PRE_EMPTIVE) /* Driver->RIO Clear modem lines */
463#define MSET (0x0E|PRE_EMPTIVE) /* Driver->RIO Set modem lines */
464#define PCLOSE 0x0F /* Driver->RIO Pseudo close */
465#define MGET (0x10|PRE_EMPTIVE) /* Driver->RIO Force update of modem status */
466#define MEMDUMP (0x11|PRE_EMPTIVE) /* Driver->RIO DEBUG request for RTA memory */
467#define READ_REGISTER (0x12|PRE_EMPTIVE) /* Driver->RIO DEBUG read CD1400 register */
468
469/* Remote Unit Port (RUP) packet definitions... (specified in PKT.dest_unit and PKT.src_unit) */
470#define SYNC_RUP 0xFF /* Download internal */
471#define COMMAND_RUP 0xFE /* Command ack/status */
472#define ERROR_RUP 0xFD /* Download internal */
473#define POLL_RUP 0xFC /* Download internal */
474#define BOOT_RUP 0xFB /* Used to boot RTAs */
475#define ROUTE_RUP 0xFA /* Used to specify routing/topology */
476#define STATUS_RUP 0xF9 /* Not used */
477#define POWER_RUP 0xF8 /* Download internal */
478
479/* COMMAND_RUP definitions... */
480#define COMPLETE (0x20|PRE_EMPTIVE) /* RIO->Driver Command complete */
481#define BREAK_RECEIVED (0x21|PRE_EMPTIVE) /* RIO->Driver Break received */
482#define MODEM_STATUS (0x22|PRE_EMPTIVE) /* RIO->Driver Modem status change */
483
484/* BOOT_RUP definitions... */
485#define BOOT_REQUEST 0x00 /* RIO->Driver Request for boot */
486#define BOOT_ABORT 0x01 /* Driver->RIO Abort a boot */
487#define BOOT_SEQUENCE 0x02 /* Driver->RIO Packet with firmware details */
488#define BOOT_COMPLETED 0x03 /* RIO->Driver Boot completed */
489#define IFOAD 0x2F /* Driver->RIO Shutdown/Reboot RTA (Fall Over And Die) */
490#define IDENTIFY 0x30 /* Driver->RIO Identify RTA */
491#define ZOMBIE 0x31 /* Driver->RIO Shutdown/Flash LEDs */
492#define UFOAD 0x32 /* Driver->RIO Shutdown/Reboot neighbouring RTA */
493#define IWAIT 0x33 /* Driver->RIO Pause booting process */
494
495/* ROUTE_RUP definitions... */
496#define ROUTE_REQUEST 0x00 /* RIO->Driver Request an ID */
497#define ROUTE_FOAD 0x01 /* Driver->RIO Shutdown/reboot RTA */
498#define ROUTE_ALREADY 0x02 /* Driver->RIO Not used */
499#define ROUTE_USED 0x03 /* Driver->RIO Not used */
500#define ROUTE_ALLOCATE 0x04 /* Driver->RIO Allocate RTA RUP numbers */
501#define ROUTE_REQ_TOP 0x05 /* Driver->RIO Not used */
502#define ROUTE_TOPOLOGY 0x06 /* RIO->Driver Route/Topology status */
503
504/*****************************************************************************
505********************************** **********************************
506********************************** OPEN **********************************
507********************************** **********************************
508*****************************************************************************/
509
510/* (Driver->RIO,in-band)
511
512 Sent to open a port.
513 Structure of configuration info used with OPEN, CONFIG and MOPEN packets... */
514
515#define PKT_Cmd (PKT_Data+0) /* Command code */
516#define PKT_Cor1 (PKT_Data+1) /* Channel Option Register 1 */
517#define PKT_Cor2 (PKT_Data+2) /* Channel Option Register 2 */
518#define PKT_Cor4 (PKT_Data+3) /* Channel Option Register 4 */
519#define PKT_Cor5 (PKT_Data+4) /* Channel Option Register 5 */
520#define PKT_TxXon (PKT_Data+5) /* Transmit XON character */
521#define PKT_TxXoff (PKT_Data+6) /* Transmit XOFF character */
522#define PKT_RxXon (PKT_Data+7) /* Receive XON character */
523#define PKT_RxXoff (PKT_Data+8) /* Receive XOFF character */
524#define PKT_Lnext (PKT_Data+9) /* Lnext character */
525#define PKT_TxBaud (PKT_Data+10) /* Transmit baud rate */
526#define PKT_RxBaud (PKT_Data+11) /* Receive baud rate */
527
528/* COR1 definitions... */
529#define COR1_PARITY 0xE0 /* Parity mask */
530#define COR1_NONE 0x00 /* No parity */
531#define COR1_SPACE 0x20 /* Space parity */
532#define COR1_EVEN 0x40 /* Even parity */
533#define COR1_MARK 0xA0 /* Mark parity */
534#define COR1_ODD 0xC0 /* Odd parity */
535
536#define COR1_STOPBITS 0x0C /* Stop bits mask */
537#define COR1_STOP1 0x00 /* 1 stop bit */
538#define COR1_STOP1_5 0x04 /* 1.5 stop bits */
539#define COR1_STOP2 0x08 /* 2 stop bits */
540
541#define COR1_DATABITS 0x03 /* Data bits mask */
542#define COR1_DATA5 0x00 /* 5 data bits */
543#define COR1_DATA6 0x01 /* 6 data bits */
544#define COR1_DATA7 0x02 /* 7 data bits */
545#define COR1_DATA8 0x03 /* 8 data bits */
546
547/* COR2 definitions... */
548#define COR2_XON_TXFLOW 0x40 /* XON/XOFF Transmit Flow */
549#define COR2_XANY_TXFLOW 0xC0 /* XON/XANY Transmit Flow */
550#define COR2_HUPCL 0x20 /* Hang Up On Close */
551#define COR2_DSR_TXFLOW 0x08 /* DSR Transmit Flow Control */
552#define COR2_RTS_RXFLOW 0x04 /* RTS Receive Flow Control */
553#define COR2_CTS_TXFLOW 0x02 /* CTS Transmit Flow Control */
554#define COR2_XON_RXFLOW 0x01 /* XON/XOFF Receive Flow */
555
556/* COR4 definition... */
557#define COR4_IGNCR 0x80 /* Discard received CR */
558#define COR4_ICRNL 0x40 /* Map received CR -> NL */
559#define COR4_INLCR 0x20 /* Map received NL -> CR */
560#define COR4_IGNBRK 0x10 /* Ignore Received Break */
561#define COR4_NBRKINT 0x08 /* No interrupt on rx Break */
562#define COR4_IGNPAR 0x04 /* ignore rx parity error chars */
563#define COR4_PARMRK 0x02 /* Mark rx parity error chars */
564#define COR4_RAISEMOD 0x01 /* Raise modem lines on !0 baud */
565
566/* COR5 definitions... */
567#define COR5_ISTRIP 0x80 /* Strip input chars to 7 bits */
568#define COR5_LNE 0x40 /* Enable LNEXT processing */
569#define COR5_CMOE 0x20 /* Match good & error characters */
570#define COR5_TAB3 0x10 /* TAB3 mode */
571#define COR5_TSTATE_ON 0x08 /* Enable tbusy/tstop monitoring */
572#define COR5_TSTATE_OFF 0x04 /* Disable tbusy/tstop monitoring */
573#define COR5_ONLCR 0x02 /* NL -> CR NL on output */
574#define COR5_OCRNL 0x01 /* CR -> NL on output */
575
576/* RxBaud and TxBaud definitions... */
577#define RIO_B0 0x00 /* RTS / DTR signals dropped */
578#define RIO_B50 0x01 /* 50 baud */
579#define RIO_B75 0x02 /* 75 baud */
580#define RIO_B110 0x03 /* 110 baud */
581#define RIO_B134 0x04 /* 134.5 baud */
582#define RIO_B150 0x05 /* 150 baud */
583#define RIO_B200 0x06 /* 200 baud */
584#define RIO_B300 0x07 /* 300 baud */
585#define RIO_B600 0x08 /* 600 baud */
586#define RIO_B1200 0x09 /* 1200 baud */
587#define RIO_B1800 0x0A /* 1800 baud */
588#define RIO_B2400 0x0B /* 2400 baud */
589#define RIO_B4800 0x0C /* 4800 baud */
590#define RIO_B9600 0x0D /* 9600 baud */
591#define RIO_B19200 0x0E /* 19200 baud */
592#define RIO_B38400 0x0F /* 38400 baud */
593#define RIO_B56000 0x10 /* 56000 baud */
594#define RIO_B57600 0x11 /* 57600 baud */
595#define RIO_B64000 0x12 /* 64000 baud */
596#define RIO_B115200 0x13 /* 115200 baud */
597#define RIO_B2000 0x14 /* 2000 baud */
598
599/*****************************************************************************
600********************************* *********************************
601********************************* CONFIG *********************************
602********************************* *********************************
603*****************************************************************************/
604
605/* (Driver->RIO,in-band)
606
607 CONFIG is sent from the driver to configure an already opened port.
608 Packet structure is same as OPEN. */
609
610/*****************************************************************************
611********************************* **********************************
612********************************* MOPEN **********************************
613********************************* **********************************
614*****************************************************************************/
615
616/* (Driver->RIO,in-band)
617
618 MOPEN is sent from the driver to open a port attached to a modem. (in-band)
619 Packet structure is same as OPEN. */
620
621/*****************************************************************************
622********************************* **********************************
623********************************* CLOSE **********************************
624********************************* **********************************
625*****************************************************************************/
626
627/* (Driver->RIO,in-band)
628
629 CLOSE is sent from the driver to close a previously opened port.
630 No parameters.
631 */
632#if 0
633#define PKT_Cmd (PKT_Data+0) /* Command code */
634#endif
635/*****************************************************************************
636********************************* *********************************
637********************************* WFLUSH *********************************
638********************************* *********************************
639*****************************************************************************/
640
641/* (Driver->RIO,pre-emptive)
642
643 WFLUSH is sent pre-emptively from the driver to flush the write buffers and
644 packets of a port. (pre-emptive)
645
646 WFLUSH is also sent in-band from the driver to a port as a marker to end
647 write flushing previously started by a pre-emptive WFLUSH packet. (in-band)
648 */
649#if 0
650#define PKT_Cmd (PKT_Data+0) /* Command code */
651#endif
652#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
653
654/*****************************************************************************
655********************************* *********************************
656********************************* RFLUSH *********************************
657********************************* *********************************
658*****************************************************************************/
659
660/* (Driver->RIO,pre-emptive)
661
662 RFLUSH is sent pre-emptively from the driver to flush the read buffers and
663 packets of a port.
664 */
665#if 0
666#define PKT_Cmd (PKT_Data+0) /* Command code */
667#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
668#endif
669
670/*****************************************************************************
671********************************* *********************************
672********************************* RESUME *********************************
673********************************* *********************************
674*****************************************************************************/
675
676/* (Driver->RIO,pre-emptive)
677
678 RESUME is sent pre-emptively from the driver to cause a port to resume
679 transmission of data if blocked by XOFF. (as if XON had been received)
680 */
681#if 0
682#define PKT_Cmd (PKT_Data+0) /* Command code */
683#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
684#endif
685
686/*****************************************************************************
687********************************* *********************************
688********************************* SBREAK *********************************
689********************************* *********************************
690*****************************************************************************/
691
692/* (Driver->RIO,in-band)
693
694 SBREAK is sent in-band from the driver to a port to suspend data and start
695 break signal transmission.
696
697 If the break delay is 0, the break signal will be acknowledged with a
698 RUP_COMMAND, COMPLETE packet and continue until an EBREAK packet is received.
699
700 Otherwise, there is no acknowledgement and the break signal will last for the
701 specified number of mS.
702 */
703#if 0
704#define PKT_Cmd (PKT_Data+0) /* Command code */
705#endif
706#define PKT_BreakDelay (PKT_Data+1) /* Break delay in mS */
707
708/*****************************************************************************
709********************************* *********************************
710********************************* EBREAK *********************************
711********************************* *********************************
712*****************************************************************************/
713
714/* (Driver->RIO,in-band)
715
716 EBREAK is sent in-band from the driver to a port to stop transmission of a
717 break signal.
718
719 No parameters. */
720
721/*****************************************************************************
722********************************* ********************************
723********************************* SUSPEND ********************************
724********************************* ********************************
725*****************************************************************************/
726
727/* (Driver->RIO,pre-emptive)
728
729 SUSPEND is sent pre-emptively from the driver to cause a port to suspend
730 transmission of data. (as if XOFF had been received)
731 */
732#if 0
733#define PKT_Cmd (PKT_Data+0) /* Command code */
734#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
735#endif
736
737/*****************************************************************************
738********************************* *********************************
739********************************* FCLOSE *********************************
740********************************* *********************************
741*****************************************************************************/
742
743/* (Driver->RIO,pre-emptive)
744
745 FCLOSE is sent pre-emptively from the driver to force close a port.
746 A force close flushes receive and transmit queues, and also lowers all output
747 modem signals if the COR5_HUPCL (Hang Up On Close) flag is set.
748 */
749#if 0
750#define PKT_Cmd (PKT_Data+0) /* Command code */
751#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
752#endif
753
754/*****************************************************************************
755********************************* *********************************
756********************************* XPRINT *********************************
757********************************* *********************************
758*****************************************************************************/
759
760/* (Driver->RIO,in-band)
761
762 XPRINT is sent as a normal I/O data packet except that the PKT_CMD_BIT of
763 the "len" field is set, and the first "data" byte is XPRINT.
764
765 The I/O data in the XPRINT packet will contain the following:
766 - Transparent Print Start Sequence
767 - Transparent Print Data
768 - Transparent Print Stop Sequence.
769 */
770#if 0
771#define PKT_Cmd (PKT_Data+0) /* Command code */
772#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
773#endif
774
775/*****************************************************************************
776********************************** **********************************
777********************************** MBIS **********************************
778********************************** **********************************
779*****************************************************************************/
780
781/* (Driver->RIO,pre-emptive)
782
783 MBIS is sent pre-emptively from the driver to set a port's modem signals.
784 */
785#if 0
786#define PKT_Cmd (PKT_Data+0) /* Command code */
787#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
788#endif
789#define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */
790
791/* ModemSet definitions... */
792#define MBIS_RTS 0x01 /* RTS modem signal */
793#define MBIS_DTR 0x02 /* DTR modem signal */
794
795/*****************************************************************************
796********************************** **********************************
797********************************** MBIC **********************************
798********************************** **********************************
799*****************************************************************************/
800
801/* (Driver->RIO,pre-emptive)
802
803 MBIC is sent pre-emptively from the driver to clear a port's modem signals.
804 */
805#if 0
806#define PKT_Cmd (PKT_Data+0) /* Command code */
807#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
808#endif
809
810#define PKT_ModemClear (PKT_Data+4) /* Modem clear signals mask */
811
812/* ModemClear definitions... */
813#define MBIC_RTS 0x01 /* RTS modem signal */
814#define MBIC_DTR 0x02 /* DTR modem signal */
815
816/*****************************************************************************
817********************************** **********************************
818********************************** MSET **********************************
819********************************** **********************************
820*****************************************************************************/
821
822/* (Driver->RIO,pre-emptive)
823
824 MSET is sent pre-emptively from the driver to set/clear a port's modem signals. */
825#if 0
826#define PKT_Cmd (PKT_Data+0) /* Command code */
827#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
828#endif
829
830#define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */
831
832/* ModemSet definitions... */
833#define MSET_RTS 0x01 /* RTS modem signal */
834#define MSET_DTR 0x02 /* DTR modem signal */
835
836/*****************************************************************************
837********************************* *********************************
838********************************* PCLOSE *********************************
839********************************* *********************************
840*****************************************************************************/
841
842/* (Driver->RIO,in-band)
843
844 PCLOSE is sent from the driver to pseudo close a previously opened port.
845
846 The port will close when all data has been sent/received, however, the
847 port's transmit / receive and modem signals will be left enabled and the
848 port marked internally as Pseudo Closed. */
849
850#define PKT_Cmd (PKT_Data+0) /* Command code */
851
852/*****************************************************************************
853********************************** **********************************
854********************************** MGET **********************************
855********************************** **********************************
856*****************************************************************************/
857
858/* (Driver->RIO,pre-emptive)
859
860 MGET is sent pre-emptively from the driver to request the port's current modem signals. */
861
862#define PKT_Cmd (PKT_Data+0) /* Command code */
863#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
864
865/*****************************************************************************
866********************************* ********************************
867********************************* MEMDUMP ********************************
868********************************* ********************************
869*****************************************************************************/
870
871/* (Driver->RIO,pre-emptive)
872
873 MEMDUMP is sent pre-emptively from the driver to request a dump of 32 bytes
874 of the specified port's RTA address space.
875 */
876#if 0
877#define PKT_Cmd (PKT_Data+0) /* Command code */
878#endif
879#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
880#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
881#define PKT_Address (PKT_Data+6) /* Requested address */
882
883/*****************************************************************************
884****************************** *****************************
885****************************** READ_REGISTER *****************************
886****************************** *****************************
887*****************************************************************************/
888
889/* (Driver->RIO,pre-emptive)
890
891 READ_REGISTER is sent pre-emptively from the driver to request the contents
892 of the CD1400 register specified in address.
893 */
894#if 0
895#define PKT_Cmd (PKT_Data+0) /* Command code */
896#endif
897#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
898#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
899#define PKT_Address (PKT_Data+6) /* Requested address */
900
901/*****************************************************************************
902************************ **************************
903************************ COMMAND_RUP - COMPLETE **************************
904************************ **************************
905*****************************************************************************/
906
907/* (RIO->Driver,pre-emptive)
908
909 COMMAND_RUP - COMPLETE is sent in response to all port I/O control command
910 packets, except MEMDUMP and READ_REGISTER.
911 */
912#if 0
913#define PKT_Cmd (PKT_Data+0) /* Command code */
914#endif
915#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
916#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
917#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */
918#define PKT_PortStatus (PKT_Data+4) /* Port signal status */
919#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
920
921/* ModemStatus definitions... */
922#define MODEM_DSR 0x80 /* Data Set Ready modem state */
923#define MODEM_CTS 0x40 /* Clear To Send modem state */
924#define MODEM_RI 0x20 /* Ring Indicate modem state */
925#define MODEM_CD 0x10 /* Carrier Detect modem state */
926#define MODEM_TSTOP 0x08 /* Transmit Stopped state */
927#define MODEM_TEMPTY 0x04 /* Transmit Empty state */
928#define MODEM_DTR 0x02 /* DTR modem output state */
929#define MODEM_RTS 0x01 /* RTS modem output state */
930
931/* PortStatus definitions... */
932#define PORT_ISOPEN 0x01 /* Port open ? */
933#define PORT_HUPCL 0x02 /* Hangup on close? */
934#define PORT_MOPENPEND 0x04 /* Modem open pending */
935#define PORT_ISPARALLEL 0x08 /* Parallel port */
936#define PORT_BREAK 0x10 /* Port on break */
937#define PORT_STATUSPEND 0020 /* Status packet pending */
938#define PORT_BREAKPEND 0x40 /* Break packet pending */
939#define PORT_MODEMPEND 0x80 /* Modem status packet pending */
940
941/*****************************************************************************
942************************ **************************
943************************ COMMAND_RUP - COMPLETE **************************
944************************ **************************
945*****************************************************************************/
946
947/* (RIO->Driver,pre-emptive)
948
949 COMMAND_RUP - COMPLETE is sent in response to all port I/O control command
950 packets, except MEMDUMP and READ_REGISTER.
951 */
952#if 0
953#define PKT_Cmd (PKT_Data+0) /* Command code */
954#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
955#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
956#endif
957#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */
958#define PKT_PortStatus (PKT_Data+4) /* Port signal status */
959#if 0
960#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
961#endif
962
963/* ModemStatus definitions... */
964#define MODEM_DSR 0x80 /* Data Set Ready modem state */
965#define MODEM_CTS 0x40 /* Clear To Send modem state */
966#define MODEM_RI 0x20 /* Ring Indicate modem state */
967#define MODEM_CD 0x10 /* Carrier Detect modem state */
968#define MODEM_TSTOP 0x08 /* Transmit Stopped state */
969#define MODEM_TEMPTY 0x04 /* Transmit Empty state */
970#define MODEM_DTR 0x02 /* DTR modem output state */
971#define MODEM_RTS 0x01 /* RTS modem output state */
972
973/* PortStatus definitions... */
974#define PORT_ISOPEN 0x01 /* Port open ? */
975#define PORT_HUPCL 0x02 /* Hangup on close? */
976#define PORT_MOPENPEND 0x04 /* Modem open pending */
977#define PORT_ISPARALLEL 0x08 /* Parallel port */
978#define PORT_BREAK 0x10 /* Port on break */
979#define PORT_STATUSPEND 0020 /* Status packet pending */
980#define PORT_BREAKPEND 0x40 /* Break packet pending */
981#define PORT_MODEMPEND 0x80 /* Modem status packet pending */
982
983/*****************************************************************************
984******************** ********************
985******************** COMMAND_RUP - COMPLETE - MEMDUMP ********************
986******************** ********************
987*****************************************************************************/
988
989/* (RIO->Driver,pre-emptive)
990
991 COMMAND_RUP - COMPLETE - MEMDUMP is sent as an acknowledgement for a MEMDUMP
992 port I/O control command packet.
993 */
994#if 0
995#define PKT_Cmd (PKT_Data+0) /* Command code */
996#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
997#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
998#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */
999#define PKT_PortStatus (PKT_Data+4) /* Port signal status */
1000#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
1001#define PKT_Address (PKT_Data+6) /* Requested address */
1002#endif
1003#define PKT_Dump (PKT_Data+8) /* 32bytes of requested dump data */
1004
1005/*****************************************************************************
1006***************** *****************
1007***************** COMMAND_RUP - COMPLETE - READ_REGISTER *****************
1008***************** *****************
1009*****************************************************************************/
1010
1011/* (RIO->Driver,pre-emptive)
1012
1013 COMMAND_RUP - COMPLETE - READ_REGISTER is sent as an acknowledgement for a
1014 READ_REGISTER port I/O control command packet.
1015 */
1016#if 0
1017#define PKT_Cmd (PKT_Data+0) /*Command code */
1018#define PKT_PhbNum (PKT_Data+1) /*Port number wrt RTA */
1019#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
1020#endif
1021#define PKT_RegisterValue (PKT_Data+3) /* Modem signal status */
1022#if 0
1023#define PKT_PortStatus (PKT_Data+4) /* Port signal status */
1024#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
1025#endif
1026
1027/*****************************************************************************
1028********************* ***********************
1029********************* COMMAND_RUP - BREAK_RECEIVED ***********************
1030********************* ***********************
1031*****************************************************************************/
1032
1033/* (RIO->Driver,pre-emptive)
1034
1035 COMMAND_RUP - BREAK_RECEIVED packets are sent when the port detects a receive BREAK signal.
1036 */
1037#if 0
1038#define PKT_Cmd (PKT_Data+0) /* Command code */
1039#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
1040#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
1041#endif
1042
1043/*****************************************************************************
1044********************* *************************
1045********************* COMMAND_RUP - MODEM_STATUS *************************
1046********************* *************************
1047*****************************************************************************/
1048
1049/* (RIO->Driver,pre-emptive)
1050
1051 COMMAND_RUP - MODEM_STATUS packets are sent whenever the port detects a
1052 change in the input modem signal states.
1053
1054 */
1055#if 0
1056#define PKT_Cmd (PKT_Data+0) /* Command code */
1057#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
1058#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
1059#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */
1060#endif
1061
1062/*****************************************************************************
1063************************ *************************
1064************************ BOOT_RUP - BOOT_REQUEST *************************
1065************************ *************************
1066*****************************************************************************/
1067
1068/* (RIO->Driver,pre-emptive)
1069
1070 BOOT_RUP - BOOT_REQUEST packets are sent to the Driver from RIO to request
1071 firmware code to load onto attached RTAs.
1072 */
1073#if 0
1074#define PKT_Cmd (PKT_Data+0) /* Command code */
1075#endif
1076
1077/*****************************************************************************
1078************************ ************************
1079************************ BOOT_RUP - BOOT_SEQUENCE ************************
1080************************ ************************
1081*****************************************************************************/
1082
1083/* (Driver->RIO,pre-emptive)
1084
1085 BOOT_RUP - BOOT_SEQUENCE packets are sent from the Driver to RIO in response
1086 to a BOOT_RUP - BOOT_REQUEST packet.
1087 */
1088#if 0
1089#define PKT_Cmd (PKT_Data+0) /* Command code */
1090#endif
1091#define PKT_NumPackets (PKT_Data+2) /* Packets required to load firmware */
1092#define PKT_LoadBase (PKT_Data+4) /* RTA firmware load address */
1093#define PKT_CodeSize (PKT_Data+6) /* Size of firmware in bytes */
1094#define PKT_CmdString (PKT_Data+8) /* Command string */
1095
1096/*****************************************************************************
1097************************ ***********************
1098************************ BOOT_RUP - BOOT_COMPLETED ***********************
1099************************ ***********************
1100*****************************************************************************/
1101
1102/* (RIO->Driver,pre-emptive)
1103
1104 BOOT_RUP - BOOT_COMPLETE is sent to the Driver from RIO when downloading of
1105 RTA firmware has completed.
1106 */
1107#if 0
1108#define PKT_Cmd (PKT_Data+0) /* Command code */
1109#endif
1110#define PKT_LinkNumber (PKT_Data+1) /* Link number RTA booted on */
1111#define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */
1112
1113/*****************************************************************************
1114************************ ***********************
1115************************ BOOT_RUP - Packet Request ***********************
1116************************ ***********************
1117*****************************************************************************/
1118
1119/* (RIO->Driver,pre-emptive)
1120
1121 BOOT_RUP packet without the PKT_CMD_BIT set in the PKT->len field is sent
1122 from RIO to the Driver as a request for a firmware boot packet. */
1123
1124#define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */
1125
1126/*****************************************************************************
1127*********************** ***********************
1128*********************** BOOT_RUP - Packet Response ***********************
1129*********************** ***********************
1130*****************************************************************************/
1131
1132/* (Driver->RIO,pre-emptive)
1133
1134 In response to a BOOT_RUP boot packet request, the driver fills out the response
1135 packet with the 70 bytes of the requested sequence.
1136 */
1137#if 0
1138#define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */
1139#endif
1140#define PKT_FirmwarePacket (PKT_Data+2) /* Firmware packet */
1141
1142/*****************************************************************************
1143**************************** ****************************
1144**************************** BOOT_RUP - IFOAD ****************************
1145**************************** ****************************
1146*****************************************************************************/
1147
1148/* (Driver->RIO,pre-emptive)
1149
1150 BOOT_RUP - IFOAD packets are sent from the Driver to an RTA to cause the
1151 RTA to shut down and reboot.
1152 */
1153#if 0
1154#define PKT_Cmd (PKT_Data+0) /* Command code */
1155#endif
1156#define PKT_IfoadId1 (PKT_Data+2) /* IFOAD Id 1 */
1157#define PKT_IfoadId2 (PKT_Data+3) /* IFOAD Id 2 */
1158
1159#define IFOADID1 0xAD
1160#define IFOADID2 0xF0
1161
1162/*****************************************************************************
1163************************** ***************************
1164************************** BOOT_RUP - IDENTIFY ***************************
1165************************** ***************************
1166*****************************************************************************/
1167
1168/* (Driver->RIO,pre-emptive)
1169
1170 BOOT_RUP - IDENTIFY packets are sent from the Driver to an RTA to cause the
1171 RTA to flash its LEDs for a period of time.
1172 */
1173#if 0
1174#define PKT_Cmd (PKT_Data+0) /* Command code */
1175#endif
1176#define PKT_IdentifyId (PKT_Data+2) /* defines pattern to flash */
1177
1178/*****************************************************************************
1179**************************** ***************************
1180**************************** BOOT_RUP - ZOMBIE ***************************
1181**************************** ***************************
1182*****************************************************************************/
1183
1184/* (Driver->RIO,pre-emptive)
1185
1186 BOOT_RUP - ZOMBIE packets are sent from the Driver to an RTA to cause the
1187 RTA to shut down and flash it's LEDs.
1188 */
1189#if 0
1190#define PKT_Cmd (PKT_Data+0) /* Command code */
1191#endif
1192#define PKT_ZombieId1 (PKT_Data+2) /* ZOMBIE Id 1 */
1193#define PKT_ZombieId2 (PKT_Data+3) /* ZOMBIE Id 2 */
1194
1195#define ZOMBIEID1 0x52
1196#define ZOMBIEID2 0x21
1197
1198/*****************************************************************************
1199**************************** ****************************
1200**************************** BOOT_RUP - UFOAD ****************************
1201**************************** ****************************
1202*****************************************************************************/
1203
1204/* (Driver->RIO,pre-emptive)
1205
1206 BOOT_RUP - UFOAD packets are sent from the Driver to an RTA to cause the RTA
1207 to ask it's neighbouring RTA to shut down and reboot.
1208 */
1209#if 0
1210#define PKT_Cmd (PKT_Data+0) /* Command code */
1211#define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */
1212#endif
1213#define PKT_UfoadId1 (PKT_Data+2) /* UFOAD Id 1 */
1214#define PKT_UfoadId2 (PKT_Data+3) /* UFOAD Id 2 */
1215
1216#define UFOADID1 0x1E
1217#define UFOADID2 0x0D
1218
1219/*****************************************************************************
1220**************************** ****************************
1221**************************** BOOT_RUP - IWAIT ****************************
1222**************************** ****************************
1223*****************************************************************************/
1224
1225/* (Driver->RIO,pre-emptive)
1226
1227 BOOT_RUP - IWAIT packets are sent from the Driver to an RTA to cause the RTA
1228 to pause booting on the specified link for 30 seconds.
1229 */
1230#if 0
1231#define PKT_Cmd (PKT_Data+0) /* Command code */
1232#define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */
1233#endif
1234#define PKT_IwaitId1 (PKT_Data+2) /* IWAIT Id 1 */
1235#define PKT_IwaitId2 (PKT_Data+3) /* IWAIT Id 2 */
1236
1237#define IWAITID1 0xDE
1238#define IWAITID2 0xB1
1239
1240/*****************************************************************************
1241************************ ***********************
1242************************ ROUTE_RUP - ROUTE_REQUEST ***********************
1243************************ ***********************
1244*****************************************************************************/
1245
1246/* (RIO->Driver,pre-emptive)
1247
1248 ROUTE_RUP - ROUTE_REQUEST packets are sent from a newly booted or connected
1249 RTA to a Driver to request an ID (RUP or unit number).
1250 */
1251#if 0
1252#define PKT_Cmd (PKT_Data+0) /* Command code */
1253#endif
1254#define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */
1255#define PKT_ModuleTypes (PKT_Data+6) /* RTA Module types */
1256
1257/* ModuleTypes definitions... */
1258#define MOD_BLANK 0x0F /* Blank plate attached */
1259#define MOD_RS232DB25 0x00 /* RS232 DB25 connector */
1260#define MOD_RS232RJ45 0x01 /* RS232 RJ45 connector */
1261#define MOD_RS422DB25 0x02 /* RS422 DB25 connector */
1262#define MOD_RS485DB25 0x03 /* RS485 DB25 connector */
1263#define MOD_PARALLEL 0x04 /* Centronics parallel */
1264
1265#define MOD2 0x08 /* Set to indicate Rev2 module */
1266
1267/*****************************************************************************
1268************************* *************************
1269************************* ROUTE_RUP - ROUTE_FOAD *************************
1270************************* *************************
1271*****************************************************************************/
1272
1273/* (Driver->RIO,pre-emptive)
1274
1275 ROUTE_RUP - ROUTE_FOAD packet is sent as a response to a ROUTE_RUP - ROUTE_REQUEST
1276 packet to cause the RTA to "Fall Over And Die"., i.e. shutdown and reboot.
1277 */
1278#if 0
1279#define PKT_Cmd (PKT_Data+0) /* Command code */
1280#endif
1281#define PKT_RouteCmdString (PKT_Data+2) /* Command string */
1282
1283/*****************************************************************************
1284*********************** ***********************
1285*********************** ROUTE_RUP - ROUTE_ALLOCATE ***********************
1286*********************** ***********************
1287*****************************************************************************/
1288
1289/* (Driver->RIO,pre-emptive)
1290
1291 ROUTE_RUP - ROUTE_ALLOCATE packet is sent as a response to a ROUTE_RUP - ROUTE_REQUEST
1292 packet to allocate the RTA's Id number (RUP number 1..16)
1293 */
1294#if 0
1295#define PKT_Cmd (PKT_Data+0) /* Command code */
1296#endif
1297#define PKT_IdNum (PKT_Data+1) /* RUP number for ports 1..8 */
1298#if 0
1299#define PKT_RouteCmdString (PKT_Data+2) /* Command string */
1300#endif
1301#define PKT_IdNum2 (PKT_Data+0x17) /* RUP number for ports 9..16 */
1302
1303/*****************************************************************************
1304*********************** ***********************
1305*********************** ROUTE_RUP - ROUTE_TOPOLOGY ***********************
1306*********************** ***********************
1307*****************************************************************************/
1308
1309/* (RIO->Driver,pre-emptive)
1310
1311 ROUTE_RUP - ROUTE_TOPOLOGY packet is sent to inform the driver of an RTA's
1312 current link status.
1313 */
1314#if 0
1315#define PKT_Cmd (PKT_Data+0) /* Command code */
1316#endif
1317#define PKT_Link1Rup (PKT_Data+2) /* Link 1 RUP number */
1318#define PKT_Link1Link (PKT_Data+3) /* Link 1 link number */
1319#define PKT_Link2Rup (PKT_Data+4) /* Link 2 RUP number */
1320#define PKT_Link2Link (PKT_Data+5) /* Link 2 link number */
1321#define PKT_Link3Rup (PKT_Data+6) /* Link 3 RUP number */
1322#define PKT_Link3Link (PKT_Data+7) /* Link 3 link number */
1323#define PKT_Link4Rup (PKT_Data+8) /* Link 4 RUP number */
1324#define PKT_Link4Link (PKT_Data+9) /* Link 4 link number */
1325#define PKT_RtaVpdProm (PKT_Data+10) /* 32 bytes of RTA VPD PROM Contents */
1326
1327#endif /* _sxwinif_h */
1328
1329/* End of RIOWINIF.H */
diff --git a/drivers/char/rio/riscos.h b/drivers/char/rio/riscos.h
deleted file mode 100644
index 60d66d0056ae..000000000000
--- a/drivers/char/rio/riscos.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : riscos.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:19
26** Retrieved : 11/6/98 11:34:22
27**
28** ident @(#)riscos.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_riscos_h__
34#define __rio_riscos_h__
35
36#ifdef SCCS_LABELS
37static char *_riscos_h_sccs_ = "@(#)riscos.h 1.2";
38#endif
39
40/*
41** This module used to define all those little itsy bits required for RISC/OS
42** now it's full of null macros.
43*/
44
45/*
46** RBYTE reads a byte from a location.
47** RWORD reads a word from a location.
48** WBYTE writes a byte to a location.
49** WWORD writes a word to a location.
50** RINDW reads a word through a pointer.
51** WINDW writes a word through a pointer.
52** RIOSWAB swaps the two bytes of a word, if needed.
53*/
54
55#define RIOSWAB(N) (N)
56#define WBYTE(A,V) (A)=(uchar)(V)
57#define WWORD(A,V) (A)=(ushort)(V)
58#define RBYTE(A) (uchar)(A)
59#define RWORD(A) (ushort)(A)
60#define RINDW(A) (*(ushort *)(A))
61#define WINDW(A,V) (*(ushort *)(A)=(ushort)(V))
62
63#endif /* __rio_riscos_h__ */
diff --git a/drivers/char/rio/rtahw.h b/drivers/char/rio/rtahw.h
deleted file mode 100644
index e6c2cdfd3a1f..000000000000
--- a/drivers/char/rio/rtahw.h
+++ /dev/null
@@ -1,75 +0,0 @@
1
2/****************************************************************************
3 ******* *******
4 ******* R T A H A R D W A R E
5 ******* *******
6 ****************************************************************************
7
8 Author : Ian Nandhra
9 Date :
10
11 *
12 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
28 Version : 0.01
29
30
31 Mods
32 ----------------------------------------------------------------------------
33 Date By Description
34 ----------------------------------------------------------------------------
35
36 ***************************************************************************/
37
38#ifndef lint
39#ifdef SCCS_LABELS
40static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5";
41#endif
42#endif
43
44#define WATCHDOG_ADDR ((unsigned short *)0x7a00)
45#define RTA_LED_ADDR ((unsigned short *)0x7c00)
46#define SERIALNUM_ADDR ((unsigned char *)0x7809)
47#define LATCH_ADDR ((unsigned char *)0x7800)
48
49/*
50** Here we define where the cd1400 chips are in memory.
51*/
52#define CD1400_ONE_ADDR (0x7300)
53#define CD1400_TWO_ADDR (0x7200)
54#define CD1400_THREE_ADDR (0x7100)
55#define CD1400_FOUR_ADDR (0x7000)
56
57/*
58** Define the different types of modules we can have
59*/
60enum module {
61 MOD_BLANK = 0x0f, /* Blank plate attached */
62 MOD_RS232DB25 = 0x00, /* RS232 DB25 connector */
63 MOD_RS232RJ45 = 0x01, /* RS232 RJ45 connector */
64 MOD_RS422DB25 = 0x02, /* RS422 DB25 connector */
65 MOD_RS485DB25 = 0x03, /* RS485 DB25 connector */
66 MOD_PARALLEL = 0x04 /* Centronics parallel */
67};
68
69#define TYPE_HOST 0
70#define TYPE_RTA8 1
71#define TYPE_RTA16 2
72
73#define WATCH_DOG WATCHDOG_ADDR
74
75/*********** end of file ***********/
diff --git a/drivers/char/rio/rupstat.h b/drivers/char/rio/rupstat.h
deleted file mode 100644
index 56d828c63d28..000000000000
--- a/drivers/char/rio/rupstat.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* RUPSTAT
4 ******* *******
5 ****************************************************************************
6
7 Author : Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef _rupstat_h
38#define _rupstat_h
39
40#ifndef lint
41#ifdef SCCS_LABELS
42static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1";
43#endif
44#endif
45
46#define STATUS_SYNC 0
47#define STATUS_REQ_TOP 1
48#define STATUS_TOPOLOGY 2
49
50#endif
diff --git a/drivers/char/rio/selftest.h b/drivers/char/rio/selftest.h
deleted file mode 100644
index 7a3dba352323..000000000000
--- a/drivers/char/rio/selftest.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2** File: selftest.h
3**
4** Author: David Dix
5**
6** Created: 15th March 1993
7**
8** Last modified: 94/06/14
9**
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26*/
27
28#ifndef _selftests_h_
29#define _selftests_h_
30
31/*
32** Selftest identifier...
33*/
34#define SELFTEST_MAGIC 0x5a5a
35
36/*
37** This is the structure of the packet that is sent back after each
38** selftest on a booting RTA.
39*/
40typedef struct {
41 short magic; /* Identifies packet type */
42 int test; /* Test number, see below */
43 unsigned int result; /* Result value */
44 unsigned int dataIn;
45 unsigned int dataOut;
46} selftestStruct;
47
48/*
49** The different tests are identified by the following data values.
50*/
51enum test {
52 TESTS_COMPLETE = 0x00,
53 MEMTEST_ADDR = 0x01,
54 MEMTEST_BIT = 0x02,
55 MEMTEST_FILL = 0x03,
56 MEMTEST_DATABUS = 0x04,
57 MEMTEST_ADDRBUS = 0x05,
58 CD1400_INIT = 0x10,
59 CD1400_LOOP = 0x11,
60 CD1400_INTERRUPT = 0x12
61};
62
63enum result {
64 E_PORT = 0x10,
65 E_TX = 0x11,
66 E_RX = 0x12,
67 E_EXCEPT = 0x13,
68 E_COMPARE = 0x14,
69 E_MODEM = 0x15,
70 E_TIMEOUT = 0x16,
71 E_INTERRUPT = 0x17
72};
73#endif /* _selftests_h_ */
diff --git a/drivers/char/rio/sysmap.h b/drivers/char/rio/sysmap.h
deleted file mode 100644
index e1c6f1160dff..000000000000
--- a/drivers/char/rio/sysmap.h
+++ /dev/null
@@ -1,62 +0,0 @@
1
2/****************************************************************************
3 ******* *******
4 ******* S Y S T E M M A P H E A D E R
5 ******* *******
6 ****************************************************************************
7
8 Author : Ian Nandhra
9 Date :
10
11 *
12 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
28 Version : 0.01
29
30
31 Mods
32 ----------------------------------------------------------------------------
33 Date By Description
34 ----------------------------------------------------------------------------
35
36 ***************************************************************************/
37
38#ifndef lint
39#ifdef SCCS_LABELS
40static char *_rio_sysmap_h_sccs = "@(#)sysmap.h 1.1";
41#endif
42#endif
43
44#define SYSTEM_MAP_LEN 64 /* Len of System Map array */
45
46
47typedef struct SYS_MAP SYS_MAP;
48typedef struct SYS_MAP_LINK SYS_MAP_LINK;
49
50struct SYS_MAP_LINK {
51 short id; /* Unit Id */
52 short link; /* Id's Link */
53 short been_here; /* Used by map_gen */
54};
55
56struct SYS_MAP {
57 char serial_num[4];
58 SYS_MAP_LINK link[4];
59};
60
61
62/*********** end of file ***********/
diff --git a/drivers/char/rio/timeouts.h b/drivers/char/rio/timeouts.h
deleted file mode 100644
index a8b5be3ca9bf..000000000000
--- a/drivers/char/rio/timeouts.h
+++ /dev/null
@@ -1,50 +0,0 @@
1
2/****************************************************************************
3 ******* *******
4 ******* T I M E O U T S
5 ******* *******
6 ****************************************************************************
7
8 Author : Ian Nandhra
9 Date :
10
11 *
12 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
28 Version : 0.01
29
30
31 Mods
32 ----------------------------------------------------------------------------
33 Date By Description
34 ----------------------------------------------------------------------------
35
36 ***************************************************************************/
37
38#ifndef lint
39#ifdef SCCS_LABELS
40static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3";
41#endif
42#endif
43
44#define MILLISECOND (int) (1000/64) /* 15.625 low ticks */
45#define SECOND (int) 15625 /* Low priority ticks */
46
47#define TX_TIMEOUT (int) (200 * MILLISECOND)
48
49
50/*********** end of file ***********/
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index 050e70ee5920..119e629656b7 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -82,7 +82,6 @@
82static struct riscom_board * IRQ_to_board[16]; 82static struct riscom_board * IRQ_to_board[16];
83static struct tty_driver *riscom_driver; 83static struct tty_driver *riscom_driver;
84static unsigned char * tmp_buf; 84static unsigned char * tmp_buf;
85static DECLARE_MUTEX(tmp_buf_sem);
86 85
87static unsigned long baud_table[] = { 86static unsigned long baud_table[] = {
88 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 87 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c
index f36342ae8e7e..037c940ac71b 100644
--- a/drivers/char/serial167.c
+++ b/drivers/char/serial167.c
@@ -129,7 +129,6 @@ struct cyclades_port cy_port[] = {
129 * memory if large numbers of serial ports are open. 129 * memory if large numbers of serial ports are open.
130 */ 130 */
131static unsigned char *tmp_buf = 0; 131static unsigned char *tmp_buf = 0;
132DECLARE_MUTEX(tmp_buf_sem);
133 132
134/* 133/*
135 * This is used to look up the divisor speeds and the timeouts 134 * This is used to look up the divisor speeds and the timeouts
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index 0a574bdbce36..5343e9fc6ab7 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -184,7 +184,6 @@ static int sx_poll = HZ;
184 184
185static struct tty_driver *specialix_driver; 185static struct tty_driver *specialix_driver;
186static unsigned char * tmp_buf; 186static unsigned char * tmp_buf;
187static DECLARE_MUTEX(tmp_buf_sem);
188 187
189static unsigned long baud_table[] = { 188static unsigned long baud_table[] = {
190 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 189 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
@@ -2556,8 +2555,6 @@ static int __init specialix_init_module(void)
2556 2555
2557 func_enter(); 2556 func_enter();
2558 2557
2559 init_MUTEX(&tmp_buf_sem); /* Init de the semaphore - pvdl */
2560
2561 if (iobase[0] || iobase[1] || iobase[2] || iobase[3]) { 2558 if (iobase[0] || iobase[1] || iobase[2] || iobase[3]) {
2562 for(i = 0; i < SX_NBOARD; i++) { 2559 for(i = 0; i < SX_NBOARD; i++) {
2563 sx_board[i].base = iobase[i]; 2560 sx_board[i].base = iobase[i];
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 0e20780d4a29..bdaab6992109 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -738,7 +738,7 @@ static int __init stallion_module_init(void)
738 stl_init(); 738 stl_init();
739 restore_flags(flags); 739 restore_flags(flags);
740 740
741 return(0); 741 return 0;
742} 742}
743 743
744/*****************************************************************************/ 744/*****************************************************************************/
@@ -889,7 +889,7 @@ static unsigned long stl_atol(char *str)
889 } 889 }
890 val = (val * base) + c; 890 val = (val * base) + c;
891 } 891 }
892 return(val); 892 return val;
893} 893}
894 894
895/*****************************************************************************/ 895/*****************************************************************************/
@@ -908,7 +908,7 @@ static int stl_parsebrd(stlconf_t *confp, char **argp)
908#endif 908#endif
909 909
910 if ((argp[0] == (char *) NULL) || (*argp[0] == 0)) 910 if ((argp[0] == (char *) NULL) || (*argp[0] == 0))
911 return(0); 911 return 0;
912 912
913 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) 913 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++)
914 *sp = TOLOWER(*sp); 914 *sp = TOLOWER(*sp);
@@ -935,7 +935,7 @@ static int stl_parsebrd(stlconf_t *confp, char **argp)
935 } 935 }
936 if ((argp[i] != (char *) NULL) && (*argp[i] != 0)) 936 if ((argp[i] != (char *) NULL) && (*argp[i] != 0))
937 confp->irq = stl_atol(argp[i]); 937 confp->irq = stl_atol(argp[i]);
938 return(1); 938 return 1;
939} 939}
940 940
941/*****************************************************************************/ 941/*****************************************************************************/
@@ -946,7 +946,7 @@ static int stl_parsebrd(stlconf_t *confp, char **argp)
946 946
947static void *stl_memalloc(int len) 947static void *stl_memalloc(int len)
948{ 948{
949 return((void *) kmalloc(len, GFP_KERNEL)); 949 return (void *) kmalloc(len, GFP_KERNEL);
950} 950}
951 951
952/*****************************************************************************/ 952/*****************************************************************************/
@@ -963,12 +963,12 @@ static stlbrd_t *stl_allocbrd(void)
963 if (brdp == (stlbrd_t *) NULL) { 963 if (brdp == (stlbrd_t *) NULL) {
964 printk("STALLION: failed to allocate memory (size=%d)\n", 964 printk("STALLION: failed to allocate memory (size=%d)\n",
965 sizeof(stlbrd_t)); 965 sizeof(stlbrd_t));
966 return((stlbrd_t *) NULL); 966 return (stlbrd_t *) NULL;
967 } 967 }
968 968
969 memset(brdp, 0, sizeof(stlbrd_t)); 969 memset(brdp, 0, sizeof(stlbrd_t));
970 brdp->magic = STL_BOARDMAGIC; 970 brdp->magic = STL_BOARDMAGIC;
971 return(brdp); 971 return brdp;
972} 972}
973 973
974/*****************************************************************************/ 974/*****************************************************************************/
@@ -988,10 +988,10 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
988 minordev = tty->index; 988 minordev = tty->index;
989 brdnr = MINOR2BRD(minordev); 989 brdnr = MINOR2BRD(minordev);
990 if (brdnr >= stl_nrbrds) 990 if (brdnr >= stl_nrbrds)
991 return(-ENODEV); 991 return -ENODEV;
992 brdp = stl_brds[brdnr]; 992 brdp = stl_brds[brdnr];
993 if (brdp == (stlbrd_t *) NULL) 993 if (brdp == (stlbrd_t *) NULL)
994 return(-ENODEV); 994 return -ENODEV;
995 minordev = MINOR2PORT(minordev); 995 minordev = MINOR2PORT(minordev);
996 for (portnr = -1, panelnr = 0; (panelnr < STL_MAXPANELS); panelnr++) { 996 for (portnr = -1, panelnr = 0; (panelnr < STL_MAXPANELS); panelnr++) {
997 if (brdp->panels[panelnr] == (stlpanel_t *) NULL) 997 if (brdp->panels[panelnr] == (stlpanel_t *) NULL)
@@ -1003,11 +1003,11 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
1003 minordev -= brdp->panels[panelnr]->nrports; 1003 minordev -= brdp->panels[panelnr]->nrports;
1004 } 1004 }
1005 if (portnr < 0) 1005 if (portnr < 0)
1006 return(-ENODEV); 1006 return -ENODEV;
1007 1007
1008 portp = brdp->panels[panelnr]->ports[portnr]; 1008 portp = brdp->panels[panelnr]->ports[portnr];
1009 if (portp == (stlport_t *) NULL) 1009 if (portp == (stlport_t *) NULL)
1010 return(-ENODEV); 1010 return -ENODEV;
1011 1011
1012/* 1012/*
1013 * On the first open of the device setup the port hardware, and 1013 * On the first open of the device setup the port hardware, and
@@ -1021,7 +1021,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
1021 if (portp->tx.buf == (char *) NULL) { 1021 if (portp->tx.buf == (char *) NULL) {
1022 portp->tx.buf = (char *) stl_memalloc(STL_TXBUFSIZE); 1022 portp->tx.buf = (char *) stl_memalloc(STL_TXBUFSIZE);
1023 if (portp->tx.buf == (char *) NULL) 1023 if (portp->tx.buf == (char *) NULL)
1024 return(-ENOMEM); 1024 return -ENOMEM;
1025 portp->tx.head = portp->tx.buf; 1025 portp->tx.head = portp->tx.buf;
1026 portp->tx.tail = portp->tx.buf; 1026 portp->tx.tail = portp->tx.buf;
1027 } 1027 }
@@ -1043,8 +1043,8 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
1043 if (portp->flags & ASYNC_CLOSING) { 1043 if (portp->flags & ASYNC_CLOSING) {
1044 interruptible_sleep_on(&portp->close_wait); 1044 interruptible_sleep_on(&portp->close_wait);
1045 if (portp->flags & ASYNC_HUP_NOTIFY) 1045 if (portp->flags & ASYNC_HUP_NOTIFY)
1046 return(-EAGAIN); 1046 return -EAGAIN;
1047 return(-ERESTARTSYS); 1047 return -ERESTARTSYS;
1048 } 1048 }
1049 1049
1050/* 1050/*
@@ -1054,11 +1054,11 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
1054 */ 1054 */
1055 if (!(filp->f_flags & O_NONBLOCK)) { 1055 if (!(filp->f_flags & O_NONBLOCK)) {
1056 if ((rc = stl_waitcarrier(portp, filp)) != 0) 1056 if ((rc = stl_waitcarrier(portp, filp)) != 0)
1057 return(rc); 1057 return rc;
1058 } 1058 }
1059 portp->flags |= ASYNC_NORMAL_ACTIVE; 1059 portp->flags |= ASYNC_NORMAL_ACTIVE;
1060 1060
1061 return(0); 1061 return 0;
1062} 1062}
1063 1063
1064/*****************************************************************************/ 1064/*****************************************************************************/
@@ -1115,7 +1115,7 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp)
1115 portp->openwaitcnt--; 1115 portp->openwaitcnt--;
1116 restore_flags(flags); 1116 restore_flags(flags);
1117 1117
1118 return(rc); 1118 return rc;
1119} 1119}
1120 1120
1121/*****************************************************************************/ 1121/*****************************************************************************/
@@ -1211,12 +1211,12 @@ static int stl_write(struct tty_struct *tty, const unsigned char *buf, int count
1211 1211
1212 if ((tty == (struct tty_struct *) NULL) || 1212 if ((tty == (struct tty_struct *) NULL) ||
1213 (stl_tmpwritebuf == (char *) NULL)) 1213 (stl_tmpwritebuf == (char *) NULL))
1214 return(0); 1214 return 0;
1215 portp = tty->driver_data; 1215 portp = tty->driver_data;
1216 if (portp == (stlport_t *) NULL) 1216 if (portp == (stlport_t *) NULL)
1217 return(0); 1217 return 0;
1218 if (portp->tx.buf == (char *) NULL) 1218 if (portp->tx.buf == (char *) NULL)
1219 return(0); 1219 return 0;
1220 1220
1221/* 1221/*
1222 * If copying direct from user space we must cater for page faults, 1222 * If copying direct from user space we must cater for page faults,
@@ -1255,7 +1255,7 @@ static int stl_write(struct tty_struct *tty, const unsigned char *buf, int count
1255 clear_bit(ASYI_TXLOW, &portp->istate); 1255 clear_bit(ASYI_TXLOW, &portp->istate);
1256 stl_startrxtx(portp, -1, 1); 1256 stl_startrxtx(portp, -1, 1);
1257 1257
1258 return(count); 1258 return count;
1259} 1259}
1260 1260
1261/*****************************************************************************/ 1261/*****************************************************************************/
@@ -1336,16 +1336,16 @@ static int stl_writeroom(struct tty_struct *tty)
1336#endif 1336#endif
1337 1337
1338 if (tty == (struct tty_struct *) NULL) 1338 if (tty == (struct tty_struct *) NULL)
1339 return(0); 1339 return 0;
1340 portp = tty->driver_data; 1340 portp = tty->driver_data;
1341 if (portp == (stlport_t *) NULL) 1341 if (portp == (stlport_t *) NULL)
1342 return(0); 1342 return 0;
1343 if (portp->tx.buf == (char *) NULL) 1343 if (portp->tx.buf == (char *) NULL)
1344 return(0); 1344 return 0;
1345 1345
1346 head = portp->tx.head; 1346 head = portp->tx.head;
1347 tail = portp->tx.tail; 1347 tail = portp->tx.tail;
1348 return((head >= tail) ? (STL_TXBUFSIZE - (head - tail) - 1) : (tail - head - 1)); 1348 return ((head >= tail) ? (STL_TXBUFSIZE - (head - tail) - 1) : (tail - head - 1));
1349} 1349}
1350 1350
1351/*****************************************************************************/ 1351/*****************************************************************************/
@@ -1370,19 +1370,19 @@ static int stl_charsinbuffer(struct tty_struct *tty)
1370#endif 1370#endif
1371 1371
1372 if (tty == (struct tty_struct *) NULL) 1372 if (tty == (struct tty_struct *) NULL)
1373 return(0); 1373 return 0;
1374 portp = tty->driver_data; 1374 portp = tty->driver_data;
1375 if (portp == (stlport_t *) NULL) 1375 if (portp == (stlport_t *) NULL)
1376 return(0); 1376 return 0;
1377 if (portp->tx.buf == (char *) NULL) 1377 if (portp->tx.buf == (char *) NULL)
1378 return(0); 1378 return 0;
1379 1379
1380 head = portp->tx.head; 1380 head = portp->tx.head;
1381 tail = portp->tx.tail; 1381 tail = portp->tx.tail;
1382 size = (head >= tail) ? (head - tail) : (STL_TXBUFSIZE - (tail - head)); 1382 size = (head >= tail) ? (head - tail) : (STL_TXBUFSIZE - (tail - head));
1383 if ((size == 0) && test_bit(ASYI_TXBUSY, &portp->istate)) 1383 if ((size == 0) && test_bit(ASYI_TXBUSY, &portp->istate))
1384 size = 1; 1384 size = 1;
1385 return(size); 1385 return size;
1386} 1386}
1387 1387
1388/*****************************************************************************/ 1388/*****************************************************************************/
@@ -1447,7 +1447,7 @@ static int stl_setserial(stlport_t *portp, struct serial_struct __user *sp)
1447 (sio.close_delay != portp->close_delay) || 1447 (sio.close_delay != portp->close_delay) ||
1448 ((sio.flags & ~ASYNC_USR_MASK) != 1448 ((sio.flags & ~ASYNC_USR_MASK) !=
1449 (portp->flags & ~ASYNC_USR_MASK))) 1449 (portp->flags & ~ASYNC_USR_MASK)))
1450 return(-EPERM); 1450 return -EPERM;
1451 } 1451 }
1452 1452
1453 portp->flags = (portp->flags & ~ASYNC_USR_MASK) | 1453 portp->flags = (portp->flags & ~ASYNC_USR_MASK) |
@@ -1457,7 +1457,7 @@ static int stl_setserial(stlport_t *portp, struct serial_struct __user *sp)
1457 portp->closing_wait = sio.closing_wait; 1457 portp->closing_wait = sio.closing_wait;
1458 portp->custom_divisor = sio.custom_divisor; 1458 portp->custom_divisor = sio.custom_divisor;
1459 stl_setport(portp, portp->tty->termios); 1459 stl_setport(portp, portp->tty->termios);
1460 return(0); 1460 return 0;
1461} 1461}
1462 1462
1463/*****************************************************************************/ 1463/*****************************************************************************/
@@ -1467,12 +1467,12 @@ static int stl_tiocmget(struct tty_struct *tty, struct file *file)
1467 stlport_t *portp; 1467 stlport_t *portp;
1468 1468
1469 if (tty == (struct tty_struct *) NULL) 1469 if (tty == (struct tty_struct *) NULL)
1470 return(-ENODEV); 1470 return -ENODEV;
1471 portp = tty->driver_data; 1471 portp = tty->driver_data;
1472 if (portp == (stlport_t *) NULL) 1472 if (portp == (stlport_t *) NULL)
1473 return(-ENODEV); 1473 return -ENODEV;
1474 if (tty->flags & (1 << TTY_IO_ERROR)) 1474 if (tty->flags & (1 << TTY_IO_ERROR))
1475 return(-EIO); 1475 return -EIO;
1476 1476
1477 return stl_getsignals(portp); 1477 return stl_getsignals(portp);
1478} 1478}
@@ -1484,12 +1484,12 @@ static int stl_tiocmset(struct tty_struct *tty, struct file *file,
1484 int rts = -1, dtr = -1; 1484 int rts = -1, dtr = -1;
1485 1485
1486 if (tty == (struct tty_struct *) NULL) 1486 if (tty == (struct tty_struct *) NULL)
1487 return(-ENODEV); 1487 return -ENODEV;
1488 portp = tty->driver_data; 1488 portp = tty->driver_data;
1489 if (portp == (stlport_t *) NULL) 1489 if (portp == (stlport_t *) NULL)
1490 return(-ENODEV); 1490 return -ENODEV;
1491 if (tty->flags & (1 << TTY_IO_ERROR)) 1491 if (tty->flags & (1 << TTY_IO_ERROR))
1492 return(-EIO); 1492 return -EIO;
1493 1493
1494 if (set & TIOCM_RTS) 1494 if (set & TIOCM_RTS)
1495 rts = 1; 1495 rts = 1;
@@ -1517,15 +1517,15 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd
1517#endif 1517#endif
1518 1518
1519 if (tty == (struct tty_struct *) NULL) 1519 if (tty == (struct tty_struct *) NULL)
1520 return(-ENODEV); 1520 return -ENODEV;
1521 portp = tty->driver_data; 1521 portp = tty->driver_data;
1522 if (portp == (stlport_t *) NULL) 1522 if (portp == (stlport_t *) NULL)
1523 return(-ENODEV); 1523 return -ENODEV;
1524 1524
1525 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && 1525 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
1526 (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { 1526 (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) {
1527 if (tty->flags & (1 << TTY_IO_ERROR)) 1527 if (tty->flags & (1 << TTY_IO_ERROR))
1528 return(-EIO); 1528 return -EIO;
1529 } 1529 }
1530 1530
1531 rc = 0; 1531 rc = 0;
@@ -1566,7 +1566,7 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd
1566 break; 1566 break;
1567 } 1567 }
1568 1568
1569 return(rc); 1569 return rc;
1570} 1570}
1571 1571
1572/*****************************************************************************/ 1572/*****************************************************************************/
@@ -1872,7 +1872,7 @@ static int stl_portinfo(stlport_t *portp, int portnr, char *pos)
1872 pos[(MAXLINE - 2)] = '+'; 1872 pos[(MAXLINE - 2)] = '+';
1873 pos[(MAXLINE - 1)] = '\n'; 1873 pos[(MAXLINE - 1)] = '\n';
1874 1874
1875 return(MAXLINE); 1875 return MAXLINE;
1876} 1876}
1877 1877
1878/*****************************************************************************/ 1878/*****************************************************************************/
@@ -1957,7 +1957,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof
1957 1957
1958stl_readdone: 1958stl_readdone:
1959 *start = page; 1959 *start = page;
1960 return(pos - page); 1960 return (pos - page);
1961} 1961}
1962 1962
1963/*****************************************************************************/ 1963/*****************************************************************************/
@@ -2349,7 +2349,7 @@ static inline int stl_initeio(stlbrd_t *brdp)
2349 } else { 2349 } else {
2350 rc = 0; 2350 rc = 0;
2351 } 2351 }
2352 return(rc); 2352 return rc;
2353} 2353}
2354 2354
2355/*****************************************************************************/ 2355/*****************************************************************************/
@@ -3116,7 +3116,7 @@ static int __init stl_init(void)
3116 return -1; 3116 return -1;
3117 } 3117 }
3118 3118
3119 return(0); 3119 return 0;
3120} 3120}
3121 3121
3122/*****************************************************************************/ 3122/*****************************************************************************/
@@ -3132,7 +3132,7 @@ static int __init stl_init(void)
3132static int stl_cd1400getreg(stlport_t *portp, int regnr) 3132static int stl_cd1400getreg(stlport_t *portp, int regnr)
3133{ 3133{
3134 outb((regnr + portp->uartaddr), portp->ioaddr); 3134 outb((regnr + portp->uartaddr), portp->ioaddr);
3135 return(inb(portp->ioaddr + EREG_DATA)); 3135 return inb(portp->ioaddr + EREG_DATA);
3136} 3136}
3137 3137
3138static void stl_cd1400setreg(stlport_t *portp, int regnr, int value) 3138static void stl_cd1400setreg(stlport_t *portp, int regnr, int value)
@@ -3146,9 +3146,9 @@ static int stl_cd1400updatereg(stlport_t *portp, int regnr, int value)
3146 outb((regnr + portp->uartaddr), portp->ioaddr); 3146 outb((regnr + portp->uartaddr), portp->ioaddr);
3147 if (inb(portp->ioaddr + EREG_DATA) != value) { 3147 if (inb(portp->ioaddr + EREG_DATA) != value) {
3148 outb(value, portp->ioaddr + EREG_DATA); 3148 outb(value, portp->ioaddr + EREG_DATA);
3149 return(1); 3149 return 1;
3150 } 3150 }
3151 return(0); 3151 return 0;
3152} 3152}
3153 3153
3154/*****************************************************************************/ 3154/*****************************************************************************/
@@ -3206,7 +3206,7 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp)
3206 } 3206 }
3207 3207
3208 BRDDISABLE(panelp->brdnr); 3208 BRDDISABLE(panelp->brdnr);
3209 return(chipmask); 3209 return chipmask;
3210} 3210}
3211 3211
3212/*****************************************************************************/ 3212/*****************************************************************************/
@@ -3557,7 +3557,7 @@ static int stl_cd1400getsignals(stlport_t *portp)
3557#else 3557#else
3558 sigs |= TIOCM_DSR; 3558 sigs |= TIOCM_DSR;
3559#endif 3559#endif
3560 return(sigs); 3560 return sigs;
3561} 3561}
3562 3562
3563/*****************************************************************************/ 3563/*****************************************************************************/
@@ -3830,9 +3830,9 @@ static int stl_cd1400datastate(stlport_t *portp)
3830#endif 3830#endif
3831 3831
3832 if (portp == (stlport_t *) NULL) 3832 if (portp == (stlport_t *) NULL)
3833 return(0); 3833 return 0;
3834 3834
3835 return(test_bit(ASYI_TXBUSY, &portp->istate) ? 1 : 0); 3835 return test_bit(ASYI_TXBUSY, &portp->istate) ? 1 : 0;
3836} 3836}
3837 3837
3838/*****************************************************************************/ 3838/*****************************************************************************/
@@ -3912,20 +3912,20 @@ static inline int stl_cd1400breakisr(stlport_t *portp, int ioaddr)
3912 outb((SRER + portp->uartaddr), ioaddr); 3912 outb((SRER + portp->uartaddr), ioaddr);
3913 outb((inb(ioaddr + EREG_DATA) & ~(SRER_TXDATA | SRER_TXEMPTY)), 3913 outb((inb(ioaddr + EREG_DATA) & ~(SRER_TXDATA | SRER_TXEMPTY)),
3914 (ioaddr + EREG_DATA)); 3914 (ioaddr + EREG_DATA));
3915 return(1); 3915 return 1;
3916 } else if (portp->brklen > 1) { 3916 } else if (portp->brklen > 1) {
3917 outb((TDR + portp->uartaddr), ioaddr); 3917 outb((TDR + portp->uartaddr), ioaddr);
3918 outb(ETC_CMD, (ioaddr + EREG_DATA)); 3918 outb(ETC_CMD, (ioaddr + EREG_DATA));
3919 outb(ETC_STOPBREAK, (ioaddr + EREG_DATA)); 3919 outb(ETC_STOPBREAK, (ioaddr + EREG_DATA));
3920 portp->brklen = -1; 3920 portp->brklen = -1;
3921 return(1); 3921 return 1;
3922 } else { 3922 } else {
3923 outb((COR2 + portp->uartaddr), ioaddr); 3923 outb((COR2 + portp->uartaddr), ioaddr);
3924 outb((inb(ioaddr + EREG_DATA) & ~COR2_ETC), 3924 outb((inb(ioaddr + EREG_DATA) & ~COR2_ETC),
3925 (ioaddr + EREG_DATA)); 3925 (ioaddr + EREG_DATA));
3926 portp->brklen = 0; 3926 portp->brklen = 0;
3927 } 3927 }
3928 return(0); 3928 return 0;
3929} 3929}
3930 3930
3931/*****************************************************************************/ 3931/*****************************************************************************/
@@ -4166,7 +4166,7 @@ static void stl_cd1400mdmisr(stlpanel_t *panelp, int ioaddr)
4166static int stl_sc26198getreg(stlport_t *portp, int regnr) 4166static int stl_sc26198getreg(stlport_t *portp, int regnr)
4167{ 4167{
4168 outb((regnr | portp->uartaddr), (portp->ioaddr + XP_ADDR)); 4168 outb((regnr | portp->uartaddr), (portp->ioaddr + XP_ADDR));
4169 return(inb(portp->ioaddr + XP_DATA)); 4169 return inb(portp->ioaddr + XP_DATA);
4170} 4170}
4171 4171
4172static void stl_sc26198setreg(stlport_t *portp, int regnr, int value) 4172static void stl_sc26198setreg(stlport_t *portp, int regnr, int value)
@@ -4180,9 +4180,9 @@ static int stl_sc26198updatereg(stlport_t *portp, int regnr, int value)
4180 outb((regnr | portp->uartaddr), (portp->ioaddr + XP_ADDR)); 4180 outb((regnr | portp->uartaddr), (portp->ioaddr + XP_ADDR));
4181 if (inb(portp->ioaddr + XP_DATA) != value) { 4181 if (inb(portp->ioaddr + XP_DATA) != value) {
4182 outb(value, (portp->ioaddr + XP_DATA)); 4182 outb(value, (portp->ioaddr + XP_DATA));
4183 return(1); 4183 return 1;
4184 } 4184 }
4185 return(0); 4185 return 0;
4186} 4186}
4187 4187
4188/*****************************************************************************/ 4188/*****************************************************************************/
@@ -4194,7 +4194,7 @@ static int stl_sc26198updatereg(stlport_t *portp, int regnr, int value)
4194static int stl_sc26198getglobreg(stlport_t *portp, int regnr) 4194static int stl_sc26198getglobreg(stlport_t *portp, int regnr)
4195{ 4195{
4196 outb(regnr, (portp->ioaddr + XP_ADDR)); 4196 outb(regnr, (portp->ioaddr + XP_ADDR));
4197 return(inb(portp->ioaddr + XP_DATA)); 4197 return inb(portp->ioaddr + XP_DATA);
4198} 4198}
4199 4199
4200#if 0 4200#if 0
@@ -4252,7 +4252,7 @@ static int stl_sc26198panelinit(stlbrd_t *brdp, stlpanel_t *panelp)
4252 } 4252 }
4253 4253
4254 BRDDISABLE(panelp->brdnr); 4254 BRDDISABLE(panelp->brdnr);
4255 return(chipmask); 4255 return chipmask;
4256} 4256}
4257 4257
4258/*****************************************************************************/ 4258/*****************************************************************************/
@@ -4546,7 +4546,7 @@ static int stl_sc26198getsignals(stlport_t *portp)
4546 sigs |= (ipr & IPR_DTR) ? 0: TIOCM_DTR; 4546 sigs |= (ipr & IPR_DTR) ? 0: TIOCM_DTR;
4547 sigs |= (ipr & IPR_RTS) ? 0: TIOCM_RTS; 4547 sigs |= (ipr & IPR_RTS) ? 0: TIOCM_RTS;
4548 sigs |= TIOCM_DSR; 4548 sigs |= TIOCM_DSR;
4549 return(sigs); 4549 return sigs;
4550} 4550}
4551 4551
4552/*****************************************************************************/ 4552/*****************************************************************************/
@@ -4828,9 +4828,9 @@ static int stl_sc26198datastate(stlport_t *portp)
4828#endif 4828#endif
4829 4829
4830 if (portp == (stlport_t *) NULL) 4830 if (portp == (stlport_t *) NULL)
4831 return(0); 4831 return 0;
4832 if (test_bit(ASYI_TXBUSY, &portp->istate)) 4832 if (test_bit(ASYI_TXBUSY, &portp->istate))
4833 return(1); 4833 return 1;
4834 4834
4835 save_flags(flags); 4835 save_flags(flags);
4836 cli(); 4836 cli();
@@ -4839,7 +4839,7 @@ static int stl_sc26198datastate(stlport_t *portp)
4839 BRDDISABLE(portp->brdnr); 4839 BRDDISABLE(portp->brdnr);
4840 restore_flags(flags); 4840 restore_flags(flags);
4841 4841
4842 return((sr & SR_TXEMPTY) ? 0 : 1); 4842 return (sr & SR_TXEMPTY) ? 0 : 1;
4843} 4843}
4844 4844
4845/*****************************************************************************/ 4845/*****************************************************************************/
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 9f1b466c4f84..ede688a4e141 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -951,7 +951,6 @@ static void* mgsl_get_text_ptr(void)
951 * memory if large numbers of serial ports are open. 951 * memory if large numbers of serial ports are open.
952 */ 952 */
953static unsigned char *tmp_buf; 953static unsigned char *tmp_buf;
954static DECLARE_MUTEX(tmp_buf_sem);
955 954
956static inline int mgsl_paranoia_check(struct mgsl_struct *info, 955static inline int mgsl_paranoia_check(struct mgsl_struct *info,
957 char *name, const char *routine) 956 char *name, const char *routine)
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 07c9be6a6bbf..a85a60a93deb 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -2630,7 +2630,7 @@ static int get_interface(struct slgt_info *info, int __user *if_mode)
2630static int set_interface(struct slgt_info *info, int if_mode) 2630static int set_interface(struct slgt_info *info, int if_mode)
2631{ 2631{
2632 unsigned long flags; 2632 unsigned long flags;
2633 unsigned char val; 2633 unsigned short val;
2634 2634
2635 DBGINFO(("%s set_interface=%x)\n", info->device_name, if_mode)); 2635 DBGINFO(("%s set_interface=%x)\n", info->device_name, if_mode));
2636 spin_lock_irqsave(&info->lock,flags); 2636 spin_lock_irqsave(&info->lock,flags);
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index bc56df8a3474..4c272189cd42 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -34,7 +34,6 @@
34#include <linux/kernel.h> /* printk() */ 34#include <linux/kernel.h> /* printk() */
35#include <linux/fs.h> /* everything... */ 35#include <linux/fs.h> /* everything... */
36#include <linux/errno.h> /* error codes */ 36#include <linux/errno.h> /* error codes */
37#include <linux/delay.h> /* udelay */
38#include <linux/slab.h> 37#include <linux/slab.h>
39#include <linux/ioport.h> 38#include <linux/ioport.h>
40#include <linux/interrupt.h> 39#include <linux/interrupt.h>
@@ -156,6 +155,8 @@ This directory exports the following interfaces. There operation is
156documented in the MCPBL0010 TPS under the Telecom Clock API section, 11.4. 155documented in the MCPBL0010 TPS under the Telecom Clock API section, 11.4.
157alarms : 156alarms :
158current_ref : 157current_ref :
158received_ref_clk3a :
159received_ref_clk3b :
159enable_clk3a_output : 160enable_clk3a_output :
160enable_clk3b_output : 161enable_clk3b_output :
161enable_clka0_output : 162enable_clka0_output :
@@ -165,7 +166,7 @@ enable_clkb1_output :
165filter_select : 166filter_select :
166hardware_switching : 167hardware_switching :
167hardware_switching_mode : 168hardware_switching_mode :
168interrupt_switch : 169telclock_version :
169mode_select : 170mode_select :
170refalign : 171refalign :
171reset : 172reset :
@@ -173,7 +174,6 @@ select_amcb1_transmit_clock :
173select_amcb2_transmit_clock : 174select_amcb2_transmit_clock :
174select_redundant_clock : 175select_redundant_clock :
175select_ref_frequency : 176select_ref_frequency :
176test_mode :
177 177
178All sysfs interfaces are integers in hex format, i.e echo 99 > refalign 178All sysfs interfaces are integers in hex format, i.e echo 99 > refalign
179has the same effect as echo 0x99 > refalign. 179has the same effect as echo 0x99 > refalign.
@@ -226,7 +226,7 @@ static int tlclk_release(struct inode *inode, struct file *filp)
226 return 0; 226 return 0;
227} 227}
228 228
229ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count, 229static ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count,
230 loff_t *f_pos) 230 loff_t *f_pos)
231{ 231{
232 if (count < sizeof(struct tlclk_alarms)) 232 if (count < sizeof(struct tlclk_alarms))
@@ -242,7 +242,7 @@ ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count,
242 return sizeof(struct tlclk_alarms); 242 return sizeof(struct tlclk_alarms);
243} 243}
244 244
245ssize_t tlclk_write(struct file *filp, const char __user *buf, size_t count, 245static ssize_t tlclk_write(struct file *filp, const char __user *buf, size_t count,
246 loff_t *f_pos) 246 loff_t *f_pos)
247{ 247{
248 return 0; 248 return 0;
@@ -278,21 +278,21 @@ static ssize_t show_current_ref(struct device *d,
278static DEVICE_ATTR(current_ref, S_IRUGO, show_current_ref, NULL); 278static DEVICE_ATTR(current_ref, S_IRUGO, show_current_ref, NULL);
279 279
280 280
281static ssize_t show_interrupt_switch(struct device *d, 281static ssize_t show_telclock_version(struct device *d,
282 struct device_attribute *attr, char *buf) 282 struct device_attribute *attr, char *buf)
283{ 283{
284 unsigned long ret_val; 284 unsigned long ret_val;
285 unsigned long flags; 285 unsigned long flags;
286 286
287 spin_lock_irqsave(&event_lock, flags); 287 spin_lock_irqsave(&event_lock, flags);
288 ret_val = inb(TLCLK_REG6); 288 ret_val = inb(TLCLK_REG5);
289 spin_unlock_irqrestore(&event_lock, flags); 289 spin_unlock_irqrestore(&event_lock, flags);
290 290
291 return sprintf(buf, "0x%lX\n", ret_val); 291 return sprintf(buf, "0x%lX\n", ret_val);
292} 292}
293 293
294static DEVICE_ATTR(interrupt_switch, S_IRUGO, 294static DEVICE_ATTR(telclock_version, S_IRUGO,
295 show_interrupt_switch, NULL); 295 show_telclock_version, NULL);
296 296
297static ssize_t show_alarms(struct device *d, 297static ssize_t show_alarms(struct device *d,
298 struct device_attribute *attr, char *buf) 298 struct device_attribute *attr, char *buf)
@@ -309,6 +309,50 @@ static ssize_t show_alarms(struct device *d,
309 309
310static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 310static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
311 311
312static ssize_t store_received_ref_clk3a(struct device *d,
313 struct device_attribute *attr, const char *buf, size_t count)
314{
315 unsigned long tmp;
316 unsigned char val;
317 unsigned long flags;
318
319 sscanf(buf, "%lX", &tmp);
320 dev_dbg(d, ": tmp = 0x%lX\n", tmp);
321
322 val = (unsigned char)tmp;
323 spin_lock_irqsave(&event_lock, flags);
324 SET_PORT_BITS(TLCLK_REG1, 0xef, val);
325 spin_unlock_irqrestore(&event_lock, flags);
326
327 return strnlen(buf, count);
328}
329
330static DEVICE_ATTR(received_ref_clk3a, S_IWUGO, NULL,
331 store_received_ref_clk3a);
332
333
334static ssize_t store_received_ref_clk3b(struct device *d,
335 struct device_attribute *attr, const char *buf, size_t count)
336{
337 unsigned long tmp;
338 unsigned char val;
339 unsigned long flags;
340
341 sscanf(buf, "%lX", &tmp);
342 dev_dbg(d, ": tmp = 0x%lX\n", tmp);
343
344 val = (unsigned char)tmp;
345 spin_lock_irqsave(&event_lock, flags);
346 SET_PORT_BITS(TLCLK_REG1, 0xef, val << 1);
347 spin_unlock_irqrestore(&event_lock, flags);
348
349 return strnlen(buf, count);
350}
351
352static DEVICE_ATTR(received_ref_clk3b, S_IWUGO, NULL,
353 store_received_ref_clk3b);
354
355
312static ssize_t store_enable_clk3b_output(struct device *d, 356static ssize_t store_enable_clk3b_output(struct device *d,
313 struct device_attribute *attr, const char *buf, size_t count) 357 struct device_attribute *attr, const char *buf, size_t count)
314{ 358{
@@ -436,26 +480,6 @@ static ssize_t store_enable_clka0_output(struct device *d,
436static DEVICE_ATTR(enable_clka0_output, S_IWUGO, NULL, 480static DEVICE_ATTR(enable_clka0_output, S_IWUGO, NULL,
437 store_enable_clka0_output); 481 store_enable_clka0_output);
438 482
439static ssize_t store_test_mode(struct device *d,
440 struct device_attribute *attr, const char *buf, size_t count)
441{
442 unsigned long flags;
443 unsigned long tmp;
444 unsigned char val;
445
446 sscanf(buf, "%lX", &tmp);
447 dev_dbg(d, "tmp = 0x%lX\n", tmp);
448
449 val = (unsigned char)tmp;
450 spin_lock_irqsave(&event_lock, flags);
451 SET_PORT_BITS(TLCLK_REG4, 0xfd, 2);
452 spin_unlock_irqrestore(&event_lock, flags);
453
454 return strnlen(buf, count);
455}
456
457static DEVICE_ATTR(test_mode, S_IWUGO, NULL, store_test_mode);
458
459static ssize_t store_select_amcb2_transmit_clock(struct device *d, 483static ssize_t store_select_amcb2_transmit_clock(struct device *d,
460 struct device_attribute *attr, const char *buf, size_t count) 484 struct device_attribute *attr, const char *buf, size_t count)
461{ 485{
@@ -475,7 +499,7 @@ static ssize_t store_select_amcb2_transmit_clock(struct device *d,
475 SET_PORT_BITS(TLCLK_REG3, 0xc7, 0x38); 499 SET_PORT_BITS(TLCLK_REG3, 0xc7, 0x38);
476 switch (val) { 500 switch (val) {
477 case CLK_8_592MHz: 501 case CLK_8_592MHz:
478 SET_PORT_BITS(TLCLK_REG0, 0xfc, 1); 502 SET_PORT_BITS(TLCLK_REG0, 0xfc, 2);
479 break; 503 break;
480 case CLK_11_184MHz: 504 case CLK_11_184MHz:
481 SET_PORT_BITS(TLCLK_REG0, 0xfc, 0); 505 SET_PORT_BITS(TLCLK_REG0, 0xfc, 0);
@@ -484,7 +508,7 @@ static ssize_t store_select_amcb2_transmit_clock(struct device *d,
484 SET_PORT_BITS(TLCLK_REG0, 0xfc, 3); 508 SET_PORT_BITS(TLCLK_REG0, 0xfc, 3);
485 break; 509 break;
486 case CLK_44_736MHz: 510 case CLK_44_736MHz:
487 SET_PORT_BITS(TLCLK_REG0, 0xfc, 2); 511 SET_PORT_BITS(TLCLK_REG0, 0xfc, 1);
488 break; 512 break;
489 } 513 }
490 } else 514 } else
@@ -653,9 +677,7 @@ static ssize_t store_refalign (struct device *d,
653 dev_dbg(d, "tmp = 0x%lX\n", tmp); 677 dev_dbg(d, "tmp = 0x%lX\n", tmp);
654 spin_lock_irqsave(&event_lock, flags); 678 spin_lock_irqsave(&event_lock, flags);
655 SET_PORT_BITS(TLCLK_REG0, 0xf7, 0); 679 SET_PORT_BITS(TLCLK_REG0, 0xf7, 0);
656 udelay(2);
657 SET_PORT_BITS(TLCLK_REG0, 0xf7, 0x08); 680 SET_PORT_BITS(TLCLK_REG0, 0xf7, 0x08);
658 udelay(2);
659 SET_PORT_BITS(TLCLK_REG0, 0xf7, 0); 681 SET_PORT_BITS(TLCLK_REG0, 0xf7, 0);
660 spin_unlock_irqrestore(&event_lock, flags); 682 spin_unlock_irqrestore(&event_lock, flags);
661 683
@@ -706,15 +728,16 @@ static DEVICE_ATTR(reset, S_IWUGO, NULL, store_reset);
706 728
707static struct attribute *tlclk_sysfs_entries[] = { 729static struct attribute *tlclk_sysfs_entries[] = {
708 &dev_attr_current_ref.attr, 730 &dev_attr_current_ref.attr,
709 &dev_attr_interrupt_switch.attr, 731 &dev_attr_telclock_version.attr,
710 &dev_attr_alarms.attr, 732 &dev_attr_alarms.attr,
733 &dev_attr_received_ref_clk3a.attr,
734 &dev_attr_received_ref_clk3b.attr,
711 &dev_attr_enable_clk3a_output.attr, 735 &dev_attr_enable_clk3a_output.attr,
712 &dev_attr_enable_clk3b_output.attr, 736 &dev_attr_enable_clk3b_output.attr,
713 &dev_attr_enable_clkb1_output.attr, 737 &dev_attr_enable_clkb1_output.attr,
714 &dev_attr_enable_clka1_output.attr, 738 &dev_attr_enable_clka1_output.attr,
715 &dev_attr_enable_clkb0_output.attr, 739 &dev_attr_enable_clkb0_output.attr,
716 &dev_attr_enable_clka0_output.attr, 740 &dev_attr_enable_clka0_output.attr,
717 &dev_attr_test_mode.attr,
718 &dev_attr_select_amcb1_transmit_clock.attr, 741 &dev_attr_select_amcb1_transmit_clock.attr,
719 &dev_attr_select_amcb2_transmit_clock.attr, 742 &dev_attr_select_amcb2_transmit_clock.attr,
720 &dev_attr_select_redundant_clock.attr, 743 &dev_attr_select_redundant_clock.attr,
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
index aedf7a8e6da7..537aa45d8c67 100644
--- a/drivers/char/tpm/tpm_bios.c
+++ b/drivers/char/tpm/tpm_bios.c
@@ -191,7 +191,7 @@ static int get_event_name(char *dest, struct tcpa_event *event,
191 const char *name = ""; 191 const char *name = "";
192 char data[40] = ""; 192 char data[40] = "";
193 int i, n_len = 0, d_len = 0; 193 int i, n_len = 0, d_len = 0;
194 u32 event_id, event_data_size; 194 u32 event_id;
195 195
196 switch(event->event_type) { 196 switch(event->event_type) {
197 case PREBOOT: 197 case PREBOOT:
@@ -220,8 +220,7 @@ static int get_event_name(char *dest, struct tcpa_event *event,
220 } 220 }
221 break; 221 break;
222 case EVENT_TAG: 222 case EVENT_TAG:
223 event_id = be32_to_cpu(event_entry); 223 event_id = be32_to_cpu(*((u32 *)event_entry));
224 event_data_size = be32_to_cpu(&event_entry[4]);
225 224
226 /* ToDo Row data -> Base64 */ 225 /* ToDo Row data -> Base64 */
227 226
@@ -376,7 +375,7 @@ static int read_log(struct tpm_bios_log *log)
376{ 375{
377 struct acpi_tcpa *buff; 376 struct acpi_tcpa *buff;
378 acpi_status status; 377 acpi_status status;
379 void *virt; 378 struct acpi_table_header *virt;
380 379
381 if (log->bios_event_log != NULL) { 380 if (log->bios_event_log != NULL) {
382 printk(KERN_ERR 381 printk(KERN_ERR
@@ -413,7 +412,7 @@ static int read_log(struct tpm_bios_log *log)
413 412
414 log->bios_event_log_end = log->bios_event_log + buff->log_max_len; 413 log->bios_event_log_end = log->bios_event_log + buff->log_max_len;
415 414
416 acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, &virt); 415 acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, (void *) &virt);
417 416
418 memcpy(log->bios_event_log, virt, buff->log_max_len); 417 memcpy(log->bios_event_log, virt, buff->log_max_len);
419 418
@@ -487,26 +486,35 @@ struct file_operations tpm_binary_bios_measurements_ops = {
487 .release = tpm_bios_measurements_release, 486 .release = tpm_bios_measurements_release,
488}; 487};
489 488
489static int is_bad(void *p)
490{
491 if (!p)
492 return 1;
493 if (IS_ERR(p) && (PTR_ERR(p) != -ENODEV))
494 return 1;
495 return 0;
496}
497
490struct dentry **tpm_bios_log_setup(char *name) 498struct dentry **tpm_bios_log_setup(char *name)
491{ 499{
492 struct dentry **ret = NULL, *tpm_dir, *bin_file, *ascii_file; 500 struct dentry **ret = NULL, *tpm_dir, *bin_file, *ascii_file;
493 501
494 tpm_dir = securityfs_create_dir(name, NULL); 502 tpm_dir = securityfs_create_dir(name, NULL);
495 if (!tpm_dir) 503 if (is_bad(tpm_dir))
496 goto out; 504 goto out;
497 505
498 bin_file = 506 bin_file =
499 securityfs_create_file("binary_bios_measurements", 507 securityfs_create_file("binary_bios_measurements",
500 S_IRUSR | S_IRGRP, tpm_dir, NULL, 508 S_IRUSR | S_IRGRP, tpm_dir, NULL,
501 &tpm_binary_bios_measurements_ops); 509 &tpm_binary_bios_measurements_ops);
502 if (!bin_file) 510 if (is_bad(bin_file))
503 goto out_tpm; 511 goto out_tpm;
504 512
505 ascii_file = 513 ascii_file =
506 securityfs_create_file("ascii_bios_measurements", 514 securityfs_create_file("ascii_bios_measurements",
507 S_IRUSR | S_IRGRP, tpm_dir, NULL, 515 S_IRUSR | S_IRGRP, tpm_dir, NULL,
508 &tpm_ascii_bios_measurements_ops); 516 &tpm_ascii_bios_measurements_ops);
509 if (!ascii_file) 517 if (is_bad(ascii_file))
510 goto out_bin; 518 goto out_bin;
511 519
512 ret = kmalloc(3 * sizeof(struct dentry *), GFP_KERNEL); 520 ret = kmalloc(3 * sizeof(struct dentry *), GFP_KERNEL);
@@ -538,3 +546,4 @@ void tpm_bios_log_teardown(struct dentry **lst)
538 securityfs_remove(lst[i]); 546 securityfs_remove(lst[i]);
539} 547}
540EXPORT_SYMBOL_GPL(tpm_bios_log_teardown); 548EXPORT_SYMBOL_GPL(tpm_bios_log_teardown);
549MODULE_LICENSE("GPL");
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
index 8198dbb7370f..ec7590951af5 100644
--- a/drivers/char/tpm/tpm_infineon.c
+++ b/drivers/char/tpm/tpm_infineon.c
@@ -441,7 +441,7 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
441 441
442 if ((ioh << 8 | iol) != tpm_inf.base) { 442 if ((ioh << 8 | iol) != tpm_inf.base) {
443 dev_err(&dev->dev, 443 dev_err(&dev->dev,
444 "Could not set IO-ports to %04x\n", 444 "Could not set IO-ports to 0x%lx\n",
445 tpm_inf.base); 445 tpm_inf.base);
446 release_region(tpm_inf.base, TPM_INF_PORT_LEN); 446 release_region(tpm_inf.base, TPM_INF_PORT_LEN);
447 return -EIO; 447 return -EIO;
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index f1d9cb7feae6..0900d1dbee59 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -3213,6 +3213,7 @@ void getconsxy(struct vc_data *vc, unsigned char *p)
3213 3213
3214void putconsxy(struct vc_data *vc, unsigned char *p) 3214void putconsxy(struct vc_data *vc, unsigned char *p)
3215{ 3215{
3216 hide_cursor(vc);
3216 gotoxy(vc, p[0], p[1]); 3217 gotoxy(vc, p[0], p[1]);
3217 set_cursor(vc); 3218 set_cursor(vc);
3218} 3219}
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
index a6544790af60..c0dfcf273f0a 100644
--- a/drivers/char/watchdog/Kconfig
+++ b/drivers/char/watchdog/Kconfig
@@ -395,12 +395,38 @@ config MACHZ_WDT
395 To compile this driver as a module, choose M here: the 395 To compile this driver as a module, choose M here: the
396 module will be called machzwd. 396 module will be called machzwd.
397 397
398config SBC_EPX_C3_WATCHDOG
399 tristate "Winsystems SBC EPX-C3 watchdog"
400 depends on WATCHDOG && X86
401 ---help---
402 This is the driver for the built-in watchdog timer on the EPX-C3
403 Single-board computer made by Winsystems, Inc.
404
405 *Note*: This hardware watchdog is not probeable and thus there
406 is no way to know if writing to its IO address will corrupt
407 your system or have any real effect. The only way to be sure
408 that this driver does what you want is to make sure you
409 are runnning it on an EPX-C3 from Winsystems with the watchdog
410 timer at IO address 0x1ee and 0x1ef. It will write to both those
411 IO ports. Basically, the assumption is made that if you compile
412 this driver into your kernel and/or load it as a module, that you
413 know what you are doing and that you are in fact running on an
414 EPX-C3 board!
415
416 To compile this driver as a module, choose M here: the
417 module will be called sbc_epx_c3.
418
419
398# PowerPC Architecture 420# PowerPC Architecture
399 421
400config 8xx_WDT 422config 8xx_WDT
401 tristate "MPC8xx Watchdog Timer" 423 tristate "MPC8xx Watchdog Timer"
402 depends on WATCHDOG && 8xx 424 depends on WATCHDOG && 8xx
403 425
426config 83xx_WDT
427 tristate "MPC83xx Watchdog Timer"
428 depends on WATCHDOG && PPC_83xx
429
404config MV64X60_WDT 430config MV64X60_WDT
405 tristate "MV64X60 (Marvell Discovery) Watchdog Timer" 431 tristate "MV64X60 (Marvell Discovery) Watchdog Timer"
406 depends on WATCHDOG && MV64X60 432 depends on WATCHDOG && MV64X60
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile
index cfd0a3987710..36c0b282b8ba 100644
--- a/drivers/char/watchdog/Makefile
+++ b/drivers/char/watchdog/Makefile
@@ -52,9 +52,11 @@ obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o
52obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o 52obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o
53obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o 53obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o
54obj-$(CONFIG_MACHZ_WDT) += machzwd.o 54obj-$(CONFIG_MACHZ_WDT) += machzwd.o
55obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
55 56
56# PowerPC Architecture 57# PowerPC Architecture
57obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o 58obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
59obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o
58obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o 60obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o
59obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o 61obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o
60 62
diff --git a/drivers/char/watchdog/mpc83xx_wdt.c b/drivers/char/watchdog/mpc83xx_wdt.c
new file mode 100644
index 000000000000..5d6f5061603a
--- /dev/null
+++ b/drivers/char/watchdog/mpc83xx_wdt.c
@@ -0,0 +1,229 @@
1/*
2 * mpc83xx_wdt.c - MPC83xx watchdog userspace interface
3 *
4 * Authors: Dave Updegraff <dave@cray.org>
5 * Kumar Gala <galak@kernel.crashing.org>
6 * Attribution: from 83xx_wst: Florian Schirmer <jolt@tuxbox.org>
7 * ..and from sc520_wdt
8 *
9 * Note: it appears that you can only actually ENABLE or DISABLE the thing
10 * once after POR. Once enabled, you cannot disable, and vice versa.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/config.h>
19#include <linux/fs.h>
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/miscdevice.h>
23#include <linux/platform_device.h>
24#include <linux/module.h>
25#include <linux/watchdog.h>
26#include <asm/io.h>
27#include <asm/uaccess.h>
28
29struct mpc83xx_wdt {
30 __be32 res0;
31 __be32 swcrr; /* System watchdog control register */
32#define SWCRR_SWTC 0xFFFF0000 /* Software Watchdog Time Count. */
33#define SWCRR_SWEN 0x00000004 /* Watchdog Enable bit. */
34#define SWCRR_SWRI 0x00000002 /* Software Watchdog Reset/Interrupt Select bit.*/
35#define SWCRR_SWPR 0x00000001 /* Software Watchdog Counter Prescale bit. */
36 __be32 swcnr; /* System watchdog count register */
37 u8 res1[2];
38 __be16 swsrr; /* System watchdog service register */
39 u8 res2[0xF0];
40};
41
42static struct mpc83xx_wdt __iomem *wd_base;
43
44static u16 timeout = 0xffff;
45module_param(timeout, ushort, 0);
46MODULE_PARM_DESC(timeout, "Watchdog timeout in ticks. (0<timeout<65536, default=65535");
47
48static int reset = 1;
49module_param(reset, bool, 0);
50MODULE_PARM_DESC(reset, "Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset");
51
52/*
53 * We always prescale, but if someone really doesn't want to they can set this
54 * to 0
55 */
56static int prescale = 1;
57static unsigned int timeout_sec;
58
59static unsigned long wdt_is_open;
60static spinlock_t wdt_spinlock;
61
62static void mpc83xx_wdt_keepalive(void)
63{
64 /* Ping the WDT */
65 spin_lock(&wdt_spinlock);
66 out_be16(&wd_base->swsrr, 0x556c);
67 out_be16(&wd_base->swsrr, 0xaa39);
68 spin_unlock(&wdt_spinlock);
69}
70
71static ssize_t mpc83xx_wdt_write(struct file *file, const char __user *buf,
72 size_t count, loff_t *ppos)
73{
74 if (count)
75 mpc83xx_wdt_keepalive();
76 return count;
77}
78
79static int mpc83xx_wdt_open(struct inode *inode, struct file *file)
80{
81 u32 tmp = SWCRR_SWEN;
82 if (test_and_set_bit(0, &wdt_is_open))
83 return -EBUSY;
84
85 /* Once we start the watchdog we can't stop it */
86 __module_get(THIS_MODULE);
87
88 /* Good, fire up the show */
89 if (prescale)
90 tmp |= SWCRR_SWPR;
91 if (reset)
92 tmp |= SWCRR_SWRI;
93
94 tmp |= timeout << 16;
95
96 out_be32(&wd_base->swcrr, tmp);
97
98 return nonseekable_open(inode, file);
99}
100
101static int mpc83xx_wdt_release(struct inode *inode, struct file *file)
102{
103 printk(KERN_CRIT "Unexpected close, not stopping watchdog!\n");
104 mpc83xx_wdt_keepalive();
105 clear_bit(0, &wdt_is_open);
106 return 0;
107}
108
109static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
110 unsigned int cmd, unsigned long arg)
111{
112 void __user *argp = (void __user *)arg;
113 int __user *p = argp;
114 static struct watchdog_info ident = {
115 .options = WDIOF_KEEPALIVEPING,
116 .firmware_version = 1,
117 .identity = "MPC83xx",
118 };
119
120 switch (cmd) {
121 case WDIOC_GETSUPPORT:
122 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
123 case WDIOC_KEEPALIVE:
124 mpc83xx_wdt_keepalive();
125 return 0;
126 case WDIOC_GETTIMEOUT:
127 return put_user(timeout_sec, p);
128 default:
129 return -ENOIOCTLCMD;
130 }
131}
132
133static struct file_operations mpc83xx_wdt_fops = {
134 .owner = THIS_MODULE,
135 .llseek = no_llseek,
136 .write = mpc83xx_wdt_write,
137 .ioctl = mpc83xx_wdt_ioctl,
138 .open = mpc83xx_wdt_open,
139 .release = mpc83xx_wdt_release,
140};
141
142static struct miscdevice mpc83xx_wdt_miscdev = {
143 .minor = WATCHDOG_MINOR,
144 .name = "watchdog",
145 .fops = &mpc83xx_wdt_fops,
146};
147
148static int __devinit mpc83xx_wdt_probe(struct platform_device *dev)
149{
150 struct resource *r;
151 int ret;
152 unsigned int *freq = dev->dev.platform_data;
153
154 /* get a pointer to the register memory */
155 r = platform_get_resource(dev, IORESOURCE_MEM, 0);
156
157 if (!r) {
158 ret = -ENODEV;
159 goto err_out;
160 }
161
162 wd_base = ioremap(r->start, sizeof (struct mpc83xx_wdt));
163
164 if (wd_base == NULL) {
165 ret = -ENOMEM;
166 goto err_out;
167 }
168
169 ret = misc_register(&mpc83xx_wdt_miscdev);
170 if (ret) {
171 printk(KERN_ERR "cannot register miscdev on minor=%d "
172 "(err=%d)\n",
173 WATCHDOG_MINOR, ret);
174 goto err_unmap;
175 }
176
177 /* Calculate the timeout in seconds */
178 if (prescale)
179 timeout_sec = (timeout * 0x10000) / (*freq);
180 else
181 timeout_sec = timeout / (*freq);
182
183 printk(KERN_INFO "WDT driver for MPC83xx initialized. "
184 "mode:%s timeout=%d (%d seconds)\n",
185 reset ? "reset":"interrupt", timeout, timeout_sec);
186
187 spin_lock_init(&wdt_spinlock);
188
189 return 0;
190
191err_unmap:
192 iounmap(wd_base);
193err_out:
194 return ret;
195}
196
197static int __devexit mpc83xx_wdt_remove(struct platform_device *dev)
198{
199 misc_deregister(&mpc83xx_wdt_miscdev);
200 iounmap(wd_base);
201
202 return 0;
203}
204
205static struct platform_driver mpc83xx_wdt_driver = {
206 .probe = mpc83xx_wdt_probe,
207 .remove = __devexit_p(mpc83xx_wdt_remove),
208 .driver = {
209 .name = "mpc83xx_wdt",
210 },
211};
212
213static int __init mpc83xx_wdt_init(void)
214{
215 return platform_driver_register(&mpc83xx_wdt_driver);
216}
217
218static void __exit mpc83xx_wdt_exit(void)
219{
220 platform_driver_unregister(&mpc83xx_wdt_driver);
221}
222
223module_init(mpc83xx_wdt_init);
224module_exit(mpc83xx_wdt_exit);
225
226MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
227MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx uProcessor");
228MODULE_LICENSE("GPL");
229MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c
index fb88b4041dca..b474ea52d6e8 100644
--- a/drivers/char/watchdog/sa1100_wdt.c
+++ b/drivers/char/watchdog/sa1100_wdt.c
@@ -74,7 +74,7 @@ static int sa1100dog_release(struct inode *inode, struct file *file)
74 return 0; 74 return 0;
75} 75}
76 76
77static ssize_t sa1100dog_write(struct file *file, const char *data, size_t len, loff_t *ppos) 77static ssize_t sa1100dog_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
78{ 78{
79 if (len) 79 if (len)
80 /* Refresh OSMR3 timer. */ 80 /* Refresh OSMR3 timer. */
@@ -96,20 +96,20 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file,
96 96
97 switch (cmd) { 97 switch (cmd) {
98 case WDIOC_GETSUPPORT: 98 case WDIOC_GETSUPPORT:
99 ret = copy_to_user((struct watchdog_info *)arg, &ident, 99 ret = copy_to_user((struct watchdog_info __user *)arg, &ident,
100 sizeof(ident)) ? -EFAULT : 0; 100 sizeof(ident)) ? -EFAULT : 0;
101 break; 101 break;
102 102
103 case WDIOC_GETSTATUS: 103 case WDIOC_GETSTATUS:
104 ret = put_user(0, (int *)arg); 104 ret = put_user(0, (int __user *)arg);
105 break; 105 break;
106 106
107 case WDIOC_GETBOOTSTATUS: 107 case WDIOC_GETBOOTSTATUS:
108 ret = put_user(boot_status, (int *)arg); 108 ret = put_user(boot_status, (int __user *)arg);
109 break; 109 break;
110 110
111 case WDIOC_SETTIMEOUT: 111 case WDIOC_SETTIMEOUT:
112 ret = get_user(time, (int *)arg); 112 ret = get_user(time, (int __user *)arg);
113 if (ret) 113 if (ret)
114 break; 114 break;
115 115
@@ -123,7 +123,7 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file,
123 /*fall through*/ 123 /*fall through*/
124 124
125 case WDIOC_GETTIMEOUT: 125 case WDIOC_GETTIMEOUT:
126 ret = put_user(pre_margin / OSCR_FREQ, (int *)arg); 126 ret = put_user(pre_margin / OSCR_FREQ, (int __user *)arg);
127 break; 127 break;
128 128
129 case WDIOC_KEEPALIVE: 129 case WDIOC_KEEPALIVE:
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c
new file mode 100644
index 000000000000..951764614ebf
--- /dev/null
+++ b/drivers/char/watchdog/sbc_epx_c3.c
@@ -0,0 +1,216 @@
1/*
2 * SBC EPX C3 0.1 A Hardware Watchdog Device for the Winsystems EPX-C3
3 * single board computer
4 *
5 * (c) Copyright 2006 Calin A. Culianu <calin@ajvar.org>, All Rights
6 * Reserved.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 *
13 * based on softdog.c by Alan Cox <alan@redhat.com>
14 */
15
16#include <linux/module.h>
17#include <linux/moduleparam.h>
18#include <linux/config.h>
19#include <linux/types.h>
20#include <linux/kernel.h>
21#include <linux/fs.h>
22#include <linux/mm.h>
23#include <linux/miscdevice.h>
24#include <linux/watchdog.h>
25#include <linux/notifier.h>
26#include <linux/reboot.h>
27#include <linux/init.h>
28#include <asm/uaccess.h>
29#include <asm/io.h>
30
31#define PFX "epx_c3: "
32static int epx_c3_alive;
33
34#define WATCHDOG_TIMEOUT 1 /* 1 sec default timeout */
35
36static int nowayout = WATCHDOG_NOWAYOUT;
37module_param(nowayout, int, 0);
38MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
39
40#define EPXC3_WATCHDOG_CTL_REG 0x1ee /* write 1 to enable, 0 to disable */
41#define EPXC3_WATCHDOG_PET_REG 0x1ef /* write anything to pet once enabled */
42
43static void epx_c3_start(void)
44{
45 outb(1, EPXC3_WATCHDOG_CTL_REG);
46}
47
48static void epx_c3_stop(void)
49{
50
51 outb(0, EPXC3_WATCHDOG_CTL_REG);
52
53 printk(KERN_INFO PFX "Stopped watchdog timer.\n");
54}
55
56static void epx_c3_pet(void)
57{
58 outb(1, EPXC3_WATCHDOG_PET_REG);
59}
60
61/*
62 * Allow only one person to hold it open
63 */
64static int epx_c3_open(struct inode *inode, struct file *file)
65{
66 if (epx_c3_alive)
67 return -EBUSY;
68
69 if (nowayout)
70 __module_get(THIS_MODULE);
71
72 /* Activate timer */
73 epx_c3_start();
74 epx_c3_pet();
75
76 epx_c3_alive = 1;
77 printk(KERN_INFO "Started watchdog timer.\n");
78
79 return nonseekable_open(inode, file);
80}
81
82static int epx_c3_release(struct inode *inode, struct file *file)
83{
84 /* Shut off the timer.
85 * Lock it in if it's a module and we defined ...NOWAYOUT */
86 if (!nowayout)
87 epx_c3_stop(); /* Turn the WDT off */
88
89 epx_c3_alive = 0;
90
91 return 0;
92}
93
94static ssize_t epx_c3_write(struct file *file, const char *data,
95 size_t len, loff_t *ppos)
96{
97 /* Refresh the timer. */
98 if (len)
99 epx_c3_pet();
100 return len;
101}
102
103static int epx_c3_ioctl(struct inode *inode, struct file *file,
104 unsigned int cmd, unsigned long arg)
105{
106 int options, retval = -EINVAL;
107 static struct watchdog_info ident = {
108 .options = WDIOF_KEEPALIVEPING |
109 WDIOF_MAGICCLOSE,
110 .firmware_version = 0,
111 .identity = "Winsystems EPX-C3 H/W Watchdog",
112 };
113
114 switch (cmd) {
115 case WDIOC_GETSUPPORT:
116 if (copy_to_user((struct watchdog_info *)arg,
117 &ident, sizeof(ident)))
118 return -EFAULT;
119 return 0;
120 case WDIOC_GETSTATUS:
121 case WDIOC_GETBOOTSTATUS:
122 return put_user(0,(int *)arg);
123 case WDIOC_KEEPALIVE:
124 epx_c3_pet();
125 return 0;
126 case WDIOC_GETTIMEOUT:
127 return put_user(WATCHDOG_TIMEOUT,(int *)arg);
128 case WDIOC_SETOPTIONS: {
129 if (get_user(options, (int *)arg))
130 return -EFAULT;
131
132 if (options & WDIOS_DISABLECARD) {
133 epx_c3_stop();
134 retval = 0;
135 }
136
137 if (options & WDIOS_ENABLECARD) {
138 epx_c3_start();
139 retval = 0;
140 }
141
142 return retval;
143 }
144 default:
145 return -ENOIOCTLCMD;
146 }
147}
148
149static int epx_c3_notify_sys(struct notifier_block *this, unsigned long code,
150 void *unused)
151{
152 if (code == SYS_DOWN || code == SYS_HALT)
153 epx_c3_stop(); /* Turn the WDT off */
154
155 return NOTIFY_DONE;
156}
157
158static struct file_operations epx_c3_fops = {
159 .owner = THIS_MODULE,
160 .llseek = no_llseek,
161 .write = epx_c3_write,
162 .ioctl = epx_c3_ioctl,
163 .open = epx_c3_open,
164 .release = epx_c3_release,
165};
166
167static struct miscdevice epx_c3_miscdev = {
168 .minor = WATCHDOG_MINOR,
169 .name = "watchdog",
170 .fops = &epx_c3_fops,
171};
172
173static struct notifier_block epx_c3_notifier = {
174 .notifier_call = epx_c3_notify_sys,
175};
176
177static const char banner[] __initdata =
178 KERN_INFO PFX "Hardware Watchdog Timer for Winsystems EPX-C3 SBC: 0.1\n";
179
180static int __init watchdog_init(void)
181{
182 int ret;
183
184 ret = register_reboot_notifier(&epx_c3_notifier);
185 if (ret) {
186 printk(KERN_ERR PFX "cannot register reboot notifier "
187 "(err=%d)\n", ret);
188 return ret;
189 }
190
191 ret = misc_register(&epx_c3_miscdev);
192 if (ret) {
193 printk(KERN_ERR PFX "cannot register miscdev on minor=%d "
194 "(err=%d)\n", WATCHDOG_MINOR, ret);
195 unregister_reboot_notifier(&epx_c3_notifier);
196 return ret;
197 }
198
199 printk(banner);
200
201 return 0;
202}
203
204static void __exit watchdog_exit(void)
205{
206 misc_deregister(&epx_c3_miscdev);
207 unregister_reboot_notifier(&epx_c3_notifier);
208}
209
210module_init(watchdog_init);
211module_exit(watchdog_exit);
212
213MODULE_AUTHOR("Calin A. Culianu <calin@ajvar.org>");
214MODULE_DESCRIPTION("Hardware Watchdog Device for Winsystems EPX-C3 SBC. Note that there is no way to probe for this device -- so only use it if you are *sure* you are runnning on this specific SBC system from Winsystems! It writes to IO ports 0x1ee and 0x1ef!");
215MODULE_LICENSE("GPL");
216MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);