1 #include <linux/types.h>
2 #include <linux/kernel.h>
3 #include <linux/sched.h>
4 #include <linux/kernel_stat.h>
5 
6 #include <asm/system.h>
7 #include <asm/irq.h>
8 #include <asm/traps.h>
9 #include <asm/page.h>
10 #include <asm/machdep.h>
11 #include <asm/apollohw.h>
12 
13 static irq_handler_t dn_irqs[16];
14 
dn_process_int(int irq,struct pt_regs * fp)15 void dn_process_int(int irq, struct pt_regs *fp) {
16 
17 
18   if(dn_irqs[irq-160].handler) {
19     dn_irqs[irq-160].handler(irq,dn_irqs[irq-160].dev_id,fp);
20   }
21   else {
22     printk("spurious irq %d occurred\n",irq);
23   }
24 
25   *(volatile unsigned char *)(pica)=0x20;
26   *(volatile unsigned char *)(picb)=0x20;
27 
28 }
29 
dn_init_IRQ(void)30 void dn_init_IRQ(void) {
31 
32   int i;
33 
34   for(i=0;i<16;i++) {
35     dn_irqs[i].handler=NULL;
36     dn_irqs[i].flags=IRQ_FLG_STD;
37     dn_irqs[i].dev_id=NULL;
38     dn_irqs[i].devname=NULL;
39   }
40 
41 }
42 
dn_request_irq(unsigned int irq,void (* handler)(int,void *,struct pt_regs *),unsigned long flags,const char * devname,void * dev_id)43 int dn_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) {
44 
45   if((irq<0) || (irq>15)) {
46     printk("Trying to request invalid IRQ\n");
47     return -ENXIO;
48   }
49 
50   if(!dn_irqs[irq].handler) {
51     dn_irqs[irq].handler=handler;
52     dn_irqs[irq].flags=IRQ_FLG_STD;
53     dn_irqs[irq].dev_id=dev_id;
54     dn_irqs[irq].devname=devname;
55     if(irq<8)
56       *(volatile unsigned char *)(pica+1)&=~(1<<irq);
57     else
58       *(volatile unsigned char *)(picb+1)&=~(1<<(irq-8));
59 
60     return 0;
61   }
62   else {
63     printk("Trying to request already assigned irq %d\n",irq);
64     return -ENXIO;
65   }
66 
67 }
68 
dn_free_irq(unsigned int irq,void * dev_id)69 void dn_free_irq(unsigned int irq, void *dev_id) {
70 
71   if((irq<0) || (irq>15)) {
72     printk("Trying to free invalid IRQ\n");
73     return ;
74   }
75 
76   if(irq<8)
77     *(volatile unsigned char *)(pica+1)|=(1<<irq);
78   else
79     *(volatile unsigned char *)(picb+1)|=(1<<(irq-8));
80 
81   dn_irqs[irq].handler=NULL;
82   dn_irqs[irq].flags=IRQ_FLG_STD;
83   dn_irqs[irq].dev_id=NULL;
84   dn_irqs[irq].devname=NULL;
85 
86   return ;
87 
88 }
89 
dn_enable_irq(unsigned int irq)90 void dn_enable_irq(unsigned int irq) {
91 
92   printk("dn enable irq\n");
93 
94 }
95 
dn_disable_irq(unsigned int irq)96 void dn_disable_irq(unsigned int irq) {
97 
98   printk("dn disable irq\n");
99 
100 }
101 
dn_get_irq_list(char * buf)102 int dn_get_irq_list(char *buf) {
103 
104   printk("dn get irq list\n");
105 
106   return 0;
107 
108 }
109 
dn_dummy_fb_init(long * mem_start)110 struct fb_info *dn_dummy_fb_init(long *mem_start) {
111 
112   printk("fb init\n");
113 
114   return NULL;
115 
116 }
117 
118 #ifdef CONFIG_VT
119 extern void write_keyb_cmd(u_short length, u_char *cmd);
120 static char BellOnCommand[] =  { 0xFF, 0x21, 0x81 },
121 		    BellOffCommand[] = { 0xFF, 0x21, 0x82 };
122 
dn_nosound(unsigned long ignored)123 static void dn_nosound (unsigned long ignored) {
124 
125 	write_keyb_cmd(sizeof(BellOffCommand),BellOffCommand);
126 
127 }
128 
dn_mksound(unsigned int count,unsigned int ticks)129 void dn_mksound( unsigned int count, unsigned int ticks ) {
130 
131 	static struct timer_list sound_timer = { function: dn_nosound };
132 
133 	del_timer( &sound_timer );
134 	if(count) {
135 		write_keyb_cmd(sizeof(BellOnCommand),BellOnCommand);
136 		if (ticks) {
137        		sound_timer.expires = jiffies + ticks;
138 			add_timer( &sound_timer );
139 		}
140 	}
141 	else
142 		write_keyb_cmd(sizeof(BellOffCommand),BellOffCommand);
143 }
144 #endif /* CONFIG_VT */
145 
146 
dn_dummy_video_setup(char * options,int * ints)147 void dn_dummy_video_setup(char *options,int *ints) {
148 
149   printk("no video yet\n");
150 
151 }
152