1 /*
2 * Copyright (C) Eicon Technology Corporation, 2000.
3 *
4 * Eicon File Revision : 1.10
5 *
6 * This software may be used and distributed according to the terms
7 * of the GNU General Public License, incorporated herein by reference.
8 *
9 */
10
11 #include <linux/sched.h>
12 #undef N_DATA
13 #include <linux/tqueue.h>
14
15 #include <linux/smp.h>
16 struct pt_regs;
17 #include <linux/interrupt.h>
18 #include <linux/ioport.h>
19
20 #include "sys.h"
21 #include "divas.h"
22 #include "adapter.h"
23 #include "divalog.h"
24
25 #include "uxio.h"
26
Divas4BRIInitPCI(card_t * card,dia_card_t * cfg)27 int Divas4BRIInitPCI(card_t *card, dia_card_t *cfg)
28 {
29 /* Use UxPciConfigWrite routines to initialise PCI config space */
30
31 /* wPCIcommand = 0x03;
32 cm_write_devconfig16(CMKey, PCI_COMMAND, &wPCIcommand);
33
34 wPCIcommand = 0x280;
35 cm_write_devconfig16(CMKey, PCI_STATUS, &wPCIcommand);
36
37 bPCIcommand = 0x30;
38 cm_write_devconfig16(CMKey, PCI_STATUS, &wPCIcommand);
39 */
40 return 0;
41 }
42
DivasPRIInitPCI(card_t * card,dia_card_t * cfg)43 int DivasPRIInitPCI(card_t *card, dia_card_t *cfg)
44 {
45 /* Use UxPciConfigWrite routines to initialise PCI config space */
46
47 /* wPCIcommand = 0x03;
48 cm_write_devconfig16(CMKey, PCI_COMMAND, &wPCIcommand);
49
50 wPCIcommand = 0x280;
51 cm_write_devconfig16(CMKey, PCI_STATUS, &wPCIcommand);
52
53 bPCIcommand = 0x30;
54 cm_write_devconfig8(CMKey, PCI_LATENCY, &bPCIcommand);*/
55
56 return 0;
57 }
58
DivasBRIInitPCI(card_t * card,dia_card_t * cfg)59 int DivasBRIInitPCI(card_t *card, dia_card_t *cfg)
60 {
61 /* Need to set these platform dependent values after patching */
62
63 card->hw->reset_base = card->cfg.reset_base;
64 card->hw->io_base = card->cfg.io_base;
65
66 request_region(card->hw->reset_base,0x80,"Divas");
67 request_region(card->hw->io_base,0x20,"Divas");
68
69
70 /* Same as for PRI */
71 return DivasPRIInitPCI(card, cfg);
72 }
73
74 /* ######################### Stubs of routines that are not done yet ################## */
75 /*void DivasLogIdi(card_t *card, ENTITY *e, int request)
76 {
77 }
78 */
79
DivasDpcSchedule(void)80 int DivasDpcSchedule(void)
81 {
82 static struct tq_struct DivasTask;
83
84 DivasTask.routine = DivasDoDpc;
85 DivasTask.data = (void *) 0;
86
87 queue_task(&DivasTask, &tq_immediate);
88 mark_bh(IMMEDIATE_BH);
89
90 return 0;
91 }
92
DivasScheduleRequestDpc(void)93 int DivasScheduleRequestDpc(void)
94 {
95 static struct tq_struct DivasTask;
96
97 DivasTask.routine = DivasDoRequestDpc;
98 DivasTask.data = (void *) 0;
99
100 queue_task(&DivasTask, &tq_immediate);
101 mark_bh(IMMEDIATE_BH);
102
103 return 0;
104 }
105
DivasLogAdd(void * buffer,int length)106 void DivasLogAdd(void *buffer, int length)
107 {
108 static
109 boolean_t overflow = FALSE;
110 static
111 boolean_t busy = FALSE;
112
113 /* make sure we're not interrupting ourselves */
114
115 if (busy)
116 {
117 printk(KERN_DEBUG "Divas: Logging interrupting self !\n");
118 return;
119 }
120 busy = TRUE;
121
122 /* ignore call if daemon isn't running and we've reached limit */
123
124 if (DivasLogFifoFull())
125 {
126 if (!overflow)
127 {
128 printk(KERN_DEBUG "Divas: Trace buffer full\n");
129 overflow = TRUE;
130 }
131 busy = FALSE;
132 return;
133 }
134
135 DivasLogFifoWrite(buffer, length);
136
137 busy = FALSE;
138 return;
139 }
140
141 /* #################################################################################### */
142