]> git.ipfire.org Git - ipfire-2.x.git/blob - src/hwinfo/src/hd/isa.c
Zwischencommit Installer...
[ipfire-2.x.git] / src / hwinfo / src / hd / isa.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #include "hd.h"
6 #include "hd_int.h"
7 #include "isa.h"
8
9 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10 * isa cards
11 *
12 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13 */
14
15 #if defined(__i386__)
16
17 static void scan_isa_isdn(hd_data_t *hd_data);
18 static isa_isdn_t *free_isa_isdn(isa_isdn_t *ii);
19
20 static void dump_isa_isdn_data(hd_data_t *hd_data, isa_isdn_t *ii);
21
22 void hd_scan_isa(hd_data_t *hd_data)
23 {
24 if(!hd_probe_feature(hd_data, pr_isa)) return;
25
26 hd_data->module = mod_isa;
27
28 /* some clean-up */
29 remove_hd_entries(hd_data);
30 // hd_data->isa = NULL;
31
32 if(hd_probe_feature(hd_data, pr_isa_isdn)) {
33 scan_isa_isdn(hd_data);
34 }
35
36 }
37
38 void scan_isa_isdn(hd_data_t *hd_data)
39 {
40 isa_isdn_t *ii0, *ii;
41 hd_t *hd;
42 hd_res_t *res;
43
44 PROGRESS(1, 0, "isdn");
45
46 ii0 = isdn_detect();
47
48 dump_isa_isdn_data(hd_data, ii0);
49
50 PROGRESS(1, 1, "isdn");
51
52 for(ii = ii0; ii; ii = ii->next) {
53 hd = add_hd_entry(hd_data, __LINE__, 0);
54 hd->bus.id = bus_isa;
55 hd->base_class.id = bc_isdn;
56 hd->vendor.id = MAKE_ID(TAG_SPECIAL, 0x3000 + ii->type);
57 hd->device.id = MAKE_ID(TAG_SPECIAL, ((ii->type << 8) + (ii->subtype & 0xff)) & 0xffff);
58
59 if(ii->has_io) {
60 res = add_res_entry(&hd->res, new_mem(sizeof *res));
61 res->io.type = res_io;
62 res->io.enabled = 1;
63 res->io.base = ii->io;
64 res->io.access = acc_rw;
65 }
66
67 if(ii->has_irq) {
68 res = add_res_entry(&hd->res, new_mem(sizeof *res));
69 res->irq.type = res_irq;
70 res->irq.enabled = 1;
71 res->irq.base = ii->irq;
72 }
73
74 // #### ask libihw? -> isdn.c
75
76 }
77
78 free_isa_isdn(ii0);
79 }
80
81 isa_isdn_t *new_isa_isdn(isa_isdn_t **ii)
82 {
83 while(*ii) ii = &(*ii)->next;
84
85 return *ii = new_mem(sizeof **ii);
86 }
87
88 isa_isdn_t *free_isa_isdn(isa_isdn_t *ii)
89 {
90 isa_isdn_t *l;
91
92 for(; ii; ii = (l = ii)->next, free_mem(l));
93
94 return NULL;
95 }
96
97 void dump_isa_isdn_data(hd_data_t *hd_data, isa_isdn_t *ii)
98 {
99 ADD2LOG("---------- ISA ISDN raw data ----------\n");
100
101 for(; ii; ii = ii->next) {
102 ADD2LOG(" type %d, subtype %d", ii->type, ii->subtype);
103 if(ii->has_mem) ADD2LOG(", mem 0x%04x", ii->mem);
104 if(ii->has_io) ADD2LOG(", io 0x%04x", ii->io);
105 if(ii->has_irq) ADD2LOG(", irq %d", ii->irq);
106 ADD2LOG("\n");
107 }
108
109 ADD2LOG("---------- ISA ISDN raw data end ----------\n");
110 }
111
112
113 #endif /* defined(__i386__) */
114