===================================================================
RCS file: include/linux/RCS/pcmcia.h,v
retrieving revision 1.1
diff -c -r1.1 include/linux/pcmcia.h
*** 1.1	1994/04/08 03:33:26
--- include/linux/pcmcia.h	1994/04/14 01:56:47
***************
*** 21,30 ****
    int (*csc_poll)(unsigned int slot);
    void (*csc_ack)(unsigned int slot, int event);
    int (*ioctl)(unsigned int slot, unsigned int cmd, unsigned long arg);
!   };
  
  #endif /* KERNEL */
  
  /* Definitions for card status flags */
  #define PC_DETECT    0x01
  #define PC_BATDEAD   0x02
--- 21,58 ----
    int (*csc_poll)(unsigned int slot);
    void (*csc_ack)(unsigned int slot, int event);
    int (*ioctl)(unsigned int slot, unsigned int cmd, unsigned long arg);
! };
  
  #endif /* KERNEL */
  
+ /*
+  * Configuration Registers
+  *
+  * These are the registers required by Release 2.0 of the standard
+  * (Section 4.15)
+  */
+ 
+ /* Offsets for register ordering */
+ #define PCMCIA_COR	0x00	/* Configuration and Option Register */
+ #define PCMCIA_CCSR	0x02	/* Card Configuration and Status Register */
+ #define PCMCIA_PIR	0x04	/* Pin Replacement Register */
+ #define PCMCIA_SCR	0x06	/* Socket and Copy Register */
+ 
+ /* Now register bits, ordered by reg # */
+ 
+ /* For Configuration and Option Register (PCMCIA_COR) */
+ #define PCMCIA_MEMIO	0x01	/* Use I/O Space */
+ #define PCMCIA_CNFGIO	0x0e	/* I/O decoding configuration */
+ #define PCMCIA_LVLREQ	0x40	/* Generate level mode interrupts */
+ #define PCMCIA_SRESET	0x80	/* Reset Card */
+ 
+ /* For Card Configuration and Status Register (PCMCIA_CCSR) */
+ #define PCMCIA_INTR	0x02	/* Interrupt Pending */
+ 
+ /* For Socket and Copy Register (PCMCIA_SCR) */
+ #define PCMCIA_SOCKNUM	0x0f	/* Which socket I'm sitting in */
+ #define PCMCIA_COPNUM	0x70	/* Which instance I am. */
+ 
  /* Definitions for card status flags */
  #define PC_DETECT    0x01
  #define PC_BATDEAD   0x02
***************
*** 69,74 ****
--- 97,113 ----
    unsigned long card_start;
    };
  
+ /* XXX The PCMCIA Standars probably specify how large this can be */
+ struct pcmcia_attr_mem {
+      unsigned short buf[1024];
+ };
+ 
+ /* Definitions for PCMCIA register ioctl calls */
+ struct pcmcia_register {
+      unsigned char reg, val;
+      unsigned long ofs;
+ };
+ 
  /* ioctl definitions for PCMCIA devices */
  #define PCMCIA_GET_STATUS     _IOR ('p', 0, unsigned int)
  #define PCMCIA_GET_FLAGS      _IOR ('p', 1, unsigned int)
***************
*** 79,83 ****
--- 118,125 ----
  #define PCMCIA_SET_IO_MAP     _IOW ('p', 6, struct pcmcia_io_map)
  #define PCMCIA_GET_MEM_MAP    _IOWR('p', 7, struct pcmcia_mem_map)
  #define PCMCIA_SET_MEM_MAP    _IOW ('p', 8, struct pcmcia_mem_map)
+ #define PCMCIA_GET_ATTR_MEM   _IOR ('p', 9, struct pcmcia_attr_mem)
+ #define PCMCIA_GET_REG	      _IOR ('p', 10, struct pcmcia_register)
+ #define PCMCIA_SET_REG        _IOW ('p', 11, struct pcmcia_register)
  
  #endif /* _LINUX_PCMCIA_H */
===================================================================
RCS file: drivers/pcmcia/RCS/i82365.c,v
retrieving revision 1.1
diff -c -r1.1 drivers/pcmcia/i82365.c
*** 1.1	1994/04/08 03:28:22
--- drivers/pcmcia/i82365.c	1994/04/20 01:03:48
***************
*** 6,11 ****
--- 6,12 ----
      
  ======================================================================*/
  
+ #include <stdio.h>
  #include <linux/types.h>
  #include <linux/termios.h>
  #include <linux/errno.h>
***************
*** 16,28 ****
  #include <linux/tty.h>
  #include <linux/fcntl.h>
  #include <linux/string.h>
- #include <linux/pcmcia.h>
  
  #include <asm/io.h>
  #include <asm/bitops.h>
  #include <asm/segment.h>
  #include <asm/system.h>
  
  #include "i82365.h"
  
  /*====================================================================*/
--- 17,41 ----
  #include <linux/tty.h>
  #include <linux/fcntl.h>
  #include <linux/string.h>
  
  #include <asm/io.h>
  #include <asm/bitops.h>
  #include <asm/segment.h>
  #include <asm/system.h>
  
+ #define PHYS_ADDR 0xd0000
+ 
+ #ifdef USER_DRV
+ #define __KERNEL__
+ #define printk printf
+ int wp_works_ok = 1;
+ #endif
+ 
+ /* sigh */
+ static unsigned long phys_addr;
+ extern int pc_debug;
+ 
+ #include <linux/pcmcia.h>
  #include "i82365.h"
  
  /*====================================================================*/
***************
*** 61,66 ****
--- 74,86 ----
      ctrl->csc_poll = i365_csc_poll;
      ctrl->csc_ack = i365_csc_ack;
      ctrl->ioctl = i365_ioctl;
+ #ifndef USER_DRV
+     /* XXX allocate dynamically; note that the address has to be 4096 */
+     /* byte aligned */
+     phys_addr = PHYS_ADDR;
+ #else
+     phys_addr = PHYS_ADDR;
+ #endif
      return slot;
      }
    else {
***************
*** 122,128 ****
  /*====================================================================*/
  
  static void delay(int len)
!   {
    int start = jiffies;
    int boguscount = 150000;
    sti();
--- 142,149 ----
  /*====================================================================*/
  
  static void delay(int len)
! {
! #ifndef USER_DRV
    int start = jiffies;
    int boguscount = 150000;
    sti();
***************
*** 131,137 ****
        printk("jiffy failure (t=%ld)...", jiffies);
        break;
        }
!   } /* delay */
    
  /*====================================================================*/
  
--- 152,161 ----
        printk("jiffy failure (t=%ld)...", jiffies);
        break;
        }
! #else
!   sleep(len);
! #endif
! } /* delay */
    
  /*====================================================================*/
  
***************
*** 204,210 ****
    {
    unsigned char ctl = I365_GET(slot, I365_INTCTL);
    if (*value > 15) return -EINVAL;
!   ctl |= *value;
    I365_SET(slot, I365_INTCTL, ctl);
    return 0;
    } /* i365_set_irq */
--- 228,234 ----
    {
    unsigned char ctl = I365_GET(slot, I365_INTCTL);
    if (*value > 15) return -EINVAL;
!   ctl = (ctl & 0xf0) | *value;
    I365_SET(slot, I365_INTCTL, ctl);
    return 0;
    } /* i365_set_irq */
***************
*** 323,329 ****
    if (mem->flags & MAP_WRPROT) i |= I365_MEM_WRPROT;
    if (mem->flags & MAP_ATTRIB) i |= I365_MEM_REG;
    I365_SET_PAIR(slot, base+I365_W_OFF, i);
!   
    /* Turn on the window if necessary */
    if (mem->flags & MAP_ACTIVE) {
      addr |= I365_ENA_MEM(map);
--- 347,353 ----
    if (mem->flags & MAP_WRPROT) i |= I365_MEM_WRPROT;
    if (mem->flags & MAP_ATTRIB) i |= I365_MEM_REG;
    I365_SET_PAIR(slot, base+I365_W_OFF, i);
!                                              
    /* Turn on the window if necessary */
    if (mem->flags & MAP_ACTIVE) {
      addr |= I365_ENA_MEM(map);
***************
*** 334,354 ****
--- 358,509 ----
  
  /*====================================================================*/
  
+ int i365_map_attr(int slot, struct pcmcia_mem_map *old,
+ 		  struct pcmcia_mem_map *tmp)
+ {
+      int err;
+ 
+      old->map = 4;
+      if ((err = i365_get_mem_map(slot, old)) < 0)
+ 	  return err;
+      
+      tmp->map = 4;
+      tmp->sys_start = phys_addr;
+      tmp->sys_stop = phys_addr + sizeof(struct pcmcia_attr_mem);
+      tmp->card_start = 0;
+      tmp->extra_ws = 0;
+      tmp->flags = MAP_ACTIVE | MAP_ATTRIB;
+      if ((err = i365_set_mem_map(slot, tmp)) < 0)
+ 	  return err;
+ 
+      return 0;
+ }
+ 
+ int i365_get_attr_mem(unsigned int slot, struct pcmcia_attr_mem *attrmem)
+ {
+ #ifdef USER_DRV
+      extern int errno, mem_fd;
+ #endif
+      struct pcmcia_mem_map old, tmp;
+      int err;
+ 
+      if ((err = i365_map_attr(slot, &old, &tmp)) < 0)
+ 	  return err;
+ 
+ #ifdef USER_DRV
+      if (lseek(mem_fd, tmp.sys_start, SEEK_SET) < 0) {
+ 	  perror("seeking to attribute memory");
+ 	  return errno;
+      }
+      if (read(mem_fd, (char *) attrmem->buf, sizeof(attrmem->buf)) < 0) {
+ 	  perror("reading attribute memory");
+ 	  return errno;
+      }
+ #else
+      memcpy((char *) attrmem->buf, (char *) tmp.sys_start,
+ 	    sizeof(attrmem->buf)); 
+ #endif
+      
+      if ((err = i365_set_mem_map(slot, &old)) < 0)
+ 	  return err;
+      
+      return 0;
+ }
+    
+ /*====================================================================*/
+ 
+ int i365_getset_register(unsigned int slot, struct pcmcia_register *reg,
+ 			 int get)
+ {
+ #ifdef USER_DRV
+      extern int errno, mem_fd;
+ #endif
+      struct pcmcia_mem_map old, tmp;
+      int err;
+ 
+      /* Hack!  This function is intended to get and set PCMCIA */
+      /* registers.  However, if reg & 0x80, reg & 0x7f is a 365SL */
+      /* register number and reg->val is (should be) its value. */
+      if (reg->reg & 0x80) {
+ 	  reg->reg &= 0x7f;
+ 	  if (get) {
+ 	       reg->val = I365_GET(slot, reg->reg);
+ 	  } else {
+ 	       I365_SET(slot, reg->reg, reg->val);
+ 	  }
+ 	  if  (pc_debug)
+ 	       printk("i365_%s_register: i365 reg %#x = %#x\n", get ?
+ 		      "get" : "set", reg->reg, reg->val);
+ 	  return 0;
+      }
+ 
+      if ((err = i365_map_attr(slot, &old, &tmp)) < 0) {
+ 	  if (pc_debug)
+ 	       printk("i365_%s_register: map_attr = %d\n", get ? "get"
+ 		      : "set", err);
+ 	  return err;
+      }
+      
+ #ifdef USER_DRV
+      if (lseek(mem_fd, tmp.sys_start + reg->ofs + 2*reg->reg, SEEK_SET) < 0) {
+ 	  perror("seeking to register memory");
+ 	  return errno;
+      }
+      if (get) {
+ 	  if (read(mem_fd, (char *) &reg->val, sizeof(reg->val)) < 0) {
+ 	       perror("reading register memory");
+ 	       return errno;
+ 	  }
+      } else {
+ 	  if (write(mem_fd, (char *) &reg->val, sizeof(reg->val)) < 0) {
+ 	       perror("writing register memory");
+ 	       return errno;
+ 	  }
+      }
+ #else
+      if (get)
+ 	  memcpy((char *) &reg->val, tmp.sys_start + reg->ofs + 2*reg->reg,
+ 		 sizeof(reg->val));
+      else
+ 	  memcpy((char *) (tmp.sys_start + reg->ofs + 2*reg->reg),
+ 		 (char *) &reg->val, sizeof(reg->val));
+ #endif
+      
+      if ((err = i365_set_mem_map(slot, &old)) < 0) {
+ 	  if (pc_debug)
+ 	       printk("i365_%s_register: set_mem_map = %d\n", get ? "get"
+ 		      : "set", err);
+ 	  return err;
+      }
+      
+      return 0;
+ }
+ 
+ /*====================================================================*/
+ 
  int i365_ioctl(unsigned int slot, unsigned int cmd, unsigned long arg)
    {
    int err;
    unsigned int size, value;
    struct pcmcia_io_map iomap;
    struct pcmcia_mem_map memmap;
+   struct pcmcia_attr_mem attrmem;
+   struct pcmcia_register reg;
  
    err = 0;
    size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
    if (cmd & IOC_IN) {
      err = verify_area(VERIFY_READ, (char *)arg, size);
+     if (pc_debug)
+ 	 printk("i365_ioctl(%d, %x, %lx): verify_read = %d\n", slot, cmd,
+ 		arg, err);
      if (err) return err;
      }
    if (cmd & IOC_OUT) {
      err = verify_area(VERIFY_WRITE, (char *)arg, size);
+     if (pc_debug)
+ 	 printk("i365_ioctl(%d, %x, %lx): verify_write = %d\n", slot, cmd,
+ 		arg, err);
      if (err) return err;
      }
    
***************
*** 395,405 ****
        memcpy_fromfs(&memmap, (char *)arg, sizeof(struct pcmcia_mem_map));
        err = i365_set_mem_map(slot, &memmap);
        break;
      default:
        err = -EINVAL;
        break;
      }
    return err;
    } /* i365_ioctl */
-   
  
--- 550,587 ----
        memcpy_fromfs(&memmap, (char *)arg, sizeof(struct pcmcia_mem_map));
        err = i365_set_mem_map(slot, &memmap);
        break;
+     case PCMCIA_GET_ATTR_MEM:
+       err = i365_get_attr_mem(slot, &attrmem);
+       memcpy_tofs((char *)arg, &attrmem, sizeof(struct pcmcia_attr_mem));
+       break;
+     case PCMCIA_GET_REG:
+       memcpy_fromfs(&reg, (char *)arg, sizeof(struct pcmcia_register));
+       err = i365_getset_register(slot, &reg, 1);
+       memcpy_tofs((char *) arg, &reg, sizeof(struct pcmcia_register));
+       break;
+     case PCMCIA_SET_REG:
+       memcpy_fromfs(&reg, (char *)arg, sizeof(struct pcmcia_register));
+       err = i365_getset_register(slot, &reg, 0);
+       break;
      default:
        err = -EINVAL;
+       if (pc_debug)
+ 	   printk("i365_ioctl(%d, %x, %lx), cmd unknown\n", slot, cmd, arg);
        break;
      }
+   if (err && pc_debug) 
+        printk("i365_ioctl(%d, %x, %lx) = %d\n", slot, cmd, arg, err);
    return err;
    } /* i365_ioctl */
  
+ #ifdef USER_DRV
+ int __verify_write(unsigned long addr, unsigned long count)
+ {
+      return 0;
+ }
+ 
+ int suser()
+ {
+      return (getuid() == 0);
+ }
+ #endif
===================================================================
RCS file: drivers/pcmcia/RCS/i82365.h,v
retrieving revision 1.1
diff -c -r1.1 drivers/pcmcia/i82365.h
===================================================================
RCS file: drivers/pcmcia/RCS/pcmcia.c,v
retrieving revision 1.1
diff -c -r1.1 drivers/pcmcia/pcmcia.c
*** 1.1	1994/04/06 03:19:14
--- drivers/pcmcia/pcmcia.c	1994/04/20 00:59:28
***************
*** 1,6 ****
--- 1,8 ----
  /*======================================================================
  
      High-level PCMCIA driver interface
+ 
+     Written by David Hinds, dhinds@allegro.stanford.edu
      
  ======================================================================*/
  
***************
*** 14,28 ****
  #include <linux/tty.h>
  #include <linux/fcntl.h>
  #include <linux/string.h>
- #include <linux/pcmcia.h>
  
  #include <asm/io.h>
  #include <asm/bitops.h>
  #include <asm/segment.h>
  #include <asm/system.h>
  
  #include "i82365.h"
  
  /*====================================================================*/
  
  #define MAX_SLOTS 8
--- 16,43 ----
  #include <linux/tty.h>
  #include <linux/fcntl.h>
  #include <linux/string.h>
  
  #include <asm/io.h>
  #include <asm/bitops.h>
  #include <asm/segment.h>
  #include <asm/system.h>
  
+ #ifdef USER_DRV
+ #define __KERNEL__
+ #define printk printf
+ #define static
+ struct task_struct *current = NULL;
+ #endif
+ 
+ #include <linux/pcmcia.h>
  #include "i82365.h"
  
+ #ifdef PCMCIA_DEBUG
+ int pc_debug = PCMCIA_DEBUG;
+ #else
+ int pc_debug = 0;
+ #endif
+ 
  /*====================================================================*/
  
  #define MAX_SLOTS 8
***************
*** 69,78 ****
  
  /*====================================================================*/
  
! long pcmcia_init(long kmem_start)
    {
    unsigned int ret;
!   
  #ifdef CONFIG_I82365
    ret = i365_probe(&ctrl);
    if (ret > 0) slots_present = ret;
--- 84,112 ----
  
  /*====================================================================*/
  
! #ifdef USER_DRV
! int mem_fd;
! #endif
! 
! unsigned long pcmcia_init(unsigned long kmem_start,
!                           unsigned long kmem_end)
    {
    unsigned int ret;
! 
! #ifdef USER_DRV
!      /* 0x80 is for REALLY_SLOW_IO */
!      if (ioperm(0x3e0, 4, 1) || ioperm(0x80, 1, 1)) {
! 	  perror("ioperm");
! 	  exit(1);
!      }
! 
!      mem_fd = open("/dev/mem", O_RDWR, 0);
!      if (mem_fd < 0) {
! 	  perror("opening /dev/mem");
! 	  exit(1);
!      }
! #endif
! 
  #ifdef CONFIG_I82365
    ret = i365_probe(&ctrl);
    if (ret > 0) slots_present = ret;
***************
*** 83,88 ****
--- 117,123 ----
    if (ret > 0) slots_present = ret;
  #endif
  
+ #ifndef USER_DRV
    /* Grab an interrupt */
    if (slots_present > 0) {
      int irqlist[] = { 15, 14, 12, 11, 10, 9, 7, 5, 4, 3, 0 };
***************
*** 100,105 ****
--- 135,142 ----
      printk("unable to get major %d for PCMCIA controller\n",
             PCMCIA_MAJOR);
      }
+ #endif
+   
    return kmem_start;
    } /* pcmcia_init */
  
***************
*** 109,120 ****
    {
    int i, ret;
  
    
- /*  printk("pcmcia_interrupt()\n");*/
    for (i = 0; i < slots_present; i++) {
      ret = ctrl.csc_poll(i);
      if (ret == 0) continue;
- /*    printk("  csc_poll(slot %d) = %d\n", i, ret);*/
      if (slot_table[i].flags & PCMCIA_BUSY) {
        slot_table[i].flags |= PCMCIA_EVENT;
        slot_table[i].event |= ret;
--- 146,159 ----
    {
    int i, ret;
  
+   if (pc_debug)
+        printk("pcmcia_interrupt()\n");
    
    for (i = 0; i < slots_present; i++) {
      ret = ctrl.csc_poll(i);
+     if (pc_debug)
+ 	 printk("  csc_poll(slot %d) = %d\n", i, ret);
      if (ret == 0) continue;
      if (slot_table[i].flags & PCMCIA_BUSY) {
        slot_table[i].flags |= PCMCIA_EVENT;
        slot_table[i].event |= ret;
***************
*** 129,135 ****
                         char *buf, int count)
    {
    unsigned int slot = MINOR(inode->i_rdev);
! /*  printk("pcmcia_read(slot %d)\n", slot);*/
    if (slot >= slots_present)
      return -ENODEV;
    if (count < 4)
--- 168,176 ----
                         char *buf, int count)
    {
    unsigned int slot = MINOR(inode->i_rdev);
! 
!   if (pc_debug)
!        printk("pcmcia_read(slot %d)\n", slot);
    if (slot >= slots_present)
      return -ENODEV;
    if (count < 4)
***************
*** 153,159 ****
                           int sel_type, select_table *wait)
    {
    unsigned int slot = MINOR(inode->i_rdev);
! /*  printk("pcmcia_select(slot %d)\n", slot);*/
    if (sel_type != SEL_IN)
      return 0;
    if (slot_table[slot].flags & PCMCIA_EVENT)
--- 194,201 ----
                           int sel_type, select_table *wait)
    {
    unsigned int slot = MINOR(inode->i_rdev);
!   if (pc_debug)
!        printk("pcmcia_select(slot %d)\n", slot);
    if (sel_type != SEL_IN)
      return 0;
    if (slot_table[slot].flags & PCMCIA_EVENT)
***************
*** 161,171 ****
    select_wait(&slot_table[slot].queue, wait);
    return 0;
    } /* pcmcia_select */
!   
! static int pcmcia_ioctl(struct inode * inode, struct file * file,
                          unsigned int cmd, unsigned long arg)
    {
    unsigned int slot = MINOR(inode->i_rdev);
    if (slot >= slots_present) return -ENODEV;
    return ctrl.ioctl(slot, cmd, arg);
    } /* pcmcia_ioctl */
--- 203,218 ----
    select_wait(&slot_table[slot].queue, wait);
    return 0;
    } /* pcmcia_select */
! 
! #ifndef USER_DRV
! static
! #endif
! int pcmcia_ioctl(struct inode * inode, struct file * file,
                          unsigned int cmd, unsigned long arg)
    {
    unsigned int slot = MINOR(inode->i_rdev);
+   if (pc_debug)
+        printk("pcmcia_ioctl(%d, %x, %x)\n", slot, cmd, arg);
    if (slot >= slots_present) return -ENODEV;
    return ctrl.ioctl(slot, cmd, arg);
    } /* pcmcia_ioctl */
***************
*** 173,179 ****
  static int pcmcia_open(struct inode *inode, struct file *file)
    {
    unsigned int slot = MINOR(inode->i_rdev);
! /*  printk("pcmcia_open(slot %d)\n", slot);*/
    if (slot >= slots_present) return -ENODEV;
    if (slot_table[slot].flags & PCMCIA_BUSY) return -EBUSY;
    slot_table[slot].flags |= PCMCIA_BUSY;
--- 220,227 ----
  static int pcmcia_open(struct inode *inode, struct file *file)
    {
    unsigned int slot = MINOR(inode->i_rdev);
!   if (pc_debug)
!        printk("pcmcia_open(slot %d)\n", slot);
    if (slot >= slots_present) return -ENODEV;
    if (slot_table[slot].flags & PCMCIA_BUSY) return -EBUSY;
    slot_table[slot].flags |= PCMCIA_BUSY;
***************
*** 184,190 ****
  static void pcmcia_release(struct inode *inode, struct file *file)
    {
    unsigned int slot = MINOR(inode->i_rdev);
! /*  printk("pcmcia_release(slot %d)\n", slot);*/
    slot_table[slot].flags &= ~PCMCIA_BUSY;
    if (slot_table[slot].flags & PCMCIA_EVENT) {
      slot_table[slot].flags &= ~PCMCIA_EVENT;
--- 232,239 ----
  static void pcmcia_release(struct inode *inode, struct file *file)
    {
    unsigned int slot = MINOR(inode->i_rdev);
!   if (pc_debug)
!        printk("pcmcia_release(slot %d)\n", slot);
    slot_table[slot].flags &= ~PCMCIA_BUSY;
    if (slot_table[slot].flags & PCMCIA_EVENT) {
      slot_table[slot].flags &= ~PCMCIA_EVENT;
***************
*** 193,195 ****
--- 242,254 ----
      }
    ctrl.csc_off(slot);
    } /* pcmcia_release */
+ 
+ #ifdef USER_DRV
+ void wake_up_interruptible(struct wait_queue **queue)
+ {
+ }
+ 
+ void interruptible_sleep_on(struct wait_queue **queue)
+ {
+ }
+ #endif
rcsdiff error: drivers/pcmcia/RCS/Makefile,v: No such file or directory
