[go: up one dir, main page]

File: classify.c

package info (click to toggle)
irqbalance 0.12-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 160 kB
  • ctags: 54
  • sloc: ansic: 491; sh: 94; xml: 31; makefile: 10
file content (115 lines) | stat: -rw-r--r-- 2,331 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include <stdlib.h>
#include <string.h>


#include "prototypes.h"

/*
   Copyright (C) 2003 Red Hat, Inc. All rights reserved.
                                                                                                             
   Usage and distribution of this file are subject to the Open Software License version 2.1
   that can be found at http://www.opensource.org/licenses/osl-2.1.txt and the COPYING file as
   distributed together with this file is included herein by reference. Alternatively you can use 
   and distribute this file under version 1.1 of the same license.
                                                                                                                      
   Author: Arjan van de Ven   <arjanv@redhat.com>

*/

/*
 Code to classify the type of irq source based on the strings modules register.
 Evil. Yuck. Ugly. Separated out to a separate file for that reason. Needs rewriting.
 Should probably read a file from disk instead of hardcoded arrays.
 /boot/module-info ?
 */
 

char *legacy_modules[] = {
 	"PS/2",
 	"serial",
 	"i8042",
 	"acpi",
 	"keyboard",
 	"usb-ohci",
	"usb-uhci",
	"uhci_hcd",
	"ohci_hcd",
	"ehci_hcd",
	"EMU10K1",
	0
};

char *timer_modules[] = {
 	"rtc",
 	"timer",
	0
};

char *storage_modules[] = {
	"aic7xxx",
	"ide",
	"cciss",
	"cpqarray",
	"qla2",
	"megaraid",
	"fusion",
	"oic",
	"libata",
	"ohci1394",
	"sym53c8xx",
	0
};

char *ethernet_modules[] = {
	"eth",
	"e100",
	"eepro100",
	"orinico_cs",
	"wvlan_cs",
	"3c5",	
	"HiSax",
	0
};

char *gige_modules[] = {
	"e1000",
	"tg3",
	0
};

unsigned int class_policy[16];


void classify_type(int irqnumber, char *moduletext)
{
	int guess = IRQ_OTHER;
	int i;
	
	if (moduletext == NULL)
		return;
		
	for (i=0; legacy_modules[i]; i++)
		if (strstr(moduletext, legacy_modules[i]))
			guess = IRQ_LEGACY;

	for (i=0; storage_modules[i]; i++)
		if (strstr(moduletext, storage_modules[i]))
			guess = IRQ_SCSI;

	for (i=0; timer_modules[i]; i++)
		if (strstr(moduletext, timer_modules[i]))
			guess = IRQ_TIMER;
			
	for (i=0; ethernet_modules[i]; i++)
		if (strstr(moduletext, ethernet_modules[i]))
			guess = IRQ_ETH;


	for (i=0; gige_modules[i]; i++)
		if (strstr(moduletext, gige_modules[i]))
			guess = IRQ_GIGE;
	
	if (guess >  interrupts[irqnumber].type)	
		interrupts[irqnumber].type = guess;

}