3 #define CARDTYPE_H_WANT_DATA 1
4 #define CARDTYPE_H_WANT_IDI_DATA 0
5 #define CARDTYPE_H_WANT_RESOURCE_DATA 0
6 #define CARDTYPE_H_WANT_FILE_DATA 0
21 #ifdef CONFIG_ISDN_DIVAS_PRIPCI
24 #ifdef CONFIG_ISDN_DIVAS_BRIPCI
34 #define DivaIdiReqFunc(N) \
35 static void DivaIdiRequest##N(ENTITY *e) \
36 { if (IoAdapters[N]) (*IoAdapters[N]->DIRequest)(IoAdapters[N], e); }
79 typedef
struct _diva_get_xlog {
92 #ifdef CONFIG_ISDN_DIVAS_PRIPCI
106 #ifdef CONFIG_ISDN_DIVAS_BRIPCI
135 static void diva_init_request_array(
void);
136 static void *divas_create_pci_card(
int handle,
void *pci_dev_handle);
140 static int diva_find_free_adapters(
int base,
int nr)
144 for (i = 0; i <
nr; i++) {
145 if (IoAdapters[base + i]) {
157 if (what && (what->
next != &adapter_queue))
172 for (i = 0; divas_supported_cards[
i].
CardOrdinal != -1; i++) {
173 if (divas_supported_cards[i].CardOrdinal == CardOrdinal) {
174 if (!(pdiva = divas_create_pci_card(i, pdev))) {
177 switch (CardOrdinal) {
191 diva_os_enter_spin_lock(&adapter_lock, &old_irql,
"add card");
193 for (i = 0; i <
max; i++) {
194 if (!diva_find_free_adapters(i, nr)) {
198 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"add card");
206 diva_os_enter_spin_lock(&adapter_lock, &old_irql,
"add card");
208 for (j = 1; j <
nr; j++) {
209 pa = diva_q_get_next(&pa->
link);
214 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"add card");
215 DBG_LOG((
"add slave adapter (%d)",
218 diva_os_enter_spin_lock(&adapter_lock, &old_irql,
"add card");
220 DBG_ERR((
"slave adapter problem"))
225 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"add card");
230 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"add card");
235 DBG_ERR((
"can not alloc request array"))
250 diva_os_initialize_spin_lock(&adapter_lock,
"adapter");
251 memset(&IoAdapters[0], 0x00,
sizeof(IoAdapters));
252 diva_init_request_array();
265 diva_os_enter_spin_lock(&adapter_lock, &old_irql,
"driver_unload");
267 if (!list_empty(&adapter_queue)) {
272 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"driver_unload");
287 a[1] = a[2] = a[3] =
NULL;
289 diva_os_enter_spin_lock(&adapter_lock, &old_irql,
"remode adapter");
291 for (i = 1; i < 4; i++) {
292 if ((pa = diva_q_get_next(&pa->
link))
300 for (i = 0; ((i < 4) && a[i]); i++) {
304 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"driver_unload");
308 for (i = 0; i < 4; i++) {
311 DBG_LOG((
"remove adapter (%d)",
315 diva_os_free(0, a[i]);
323 static void *divas_create_pci_card(
int handle,
void *pci_dev_handle)
332 DBG_ERR((
"A: can't alloc adapter"));
336 memset(a, 0x00,
sizeof(*a));
341 a->xdi_adapter.cardType = a->CardOrdinal;
344 a->resources.pci.hdev = pci_dev_handle;
350 diva_os_enter_spin_lock(&adapter_lock, &old_irql,
"found_pci_card");
352 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"found_pci_card");
355 diva_os_enter_spin_lock(&adapter_lock, &old_irql,
"found_pci_card");
357 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"found_pci_card");
359 DBG_ERR((
"A: can't get adapter resources"));
373 while ((a = get_and_remove_from_queue())) {
399 DBG_ERR((
"A: A(?) open, msg too small (%d < %d)",
403 if ((*cp_fn) (os_handle, &msg, src,
sizeof(msg)) <= 0) {
404 DBG_ERR((
"A: A(?) open, write error"))
407 diva_os_enter_spin_lock(&adapter_lock, &old_irql,
"open_adapter");
414 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"open_adapter");
450 DBG_ERR((
"A: A(%d) write, message too small (%d < %d)",
456 if (!(data = diva_os_malloc(0, length))) {
472 diva_os_free(0, data);
497 if (max_length < a->xdi_mbox.data_length) {
498 DBG_ERR((
"A: A(%d) rx buffer too short(%d < %d)",
525 (*clear_int_proc) (
a);
534 static void diva_init_request_array(
void)
573 if (!card || ((card - 1) >=
MAX_ADAPTER) || !IoAdapters[card - 1]) {
579 DBG_LOG((
"FEATURES FOR ADAPTER: %d", card + 1))
581 (features &
DI_FAX3) ?
"Y" :
"N"))
585 (features &
DI_POST) ?
"Y" :
"N"))
587 (features &
DI_V110) ?
"Y" :
"N"))
589 (features &
DI_V120) ?
"Y" :
"N"))
591 (features &
DI_POTS) ?
"Y" :
"N"))
597 (features &
DI_V_42) ?
"Y" :
"N"))
602 DBG_LOG((
" DI_VOICE_OVER_IP : %s",
610 diva_os_enter_spin_lock(&adapter_lock, &old_irql,
"add_slave");
612 diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"add_slave");
623 if (!(data = diva_os_malloc(0,
sizeof(
struct mi_pc_maint)))) {
628 if (!(req = diva_os_malloc(0,
sizeof(*req)))) {
629 diva_os_free(0, data);
632 req->command = 0x0400;
638 if (!req->rc || req->req) {
639 diva_os_free(0, data);
640 diva_os_free(0, req);
646 diva_os_free(0, req);