hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/x86/kernel/io_delay.c
....@@ -13,7 +13,22 @@
1313 #include <linux/dmi.h>
1414 #include <linux/io.h>
1515
16
-int io_delay_type __read_mostly = CONFIG_DEFAULT_IO_DELAY_TYPE;
16
+#define IO_DELAY_TYPE_0X80 0
17
+#define IO_DELAY_TYPE_0XED 1
18
+#define IO_DELAY_TYPE_UDELAY 2
19
+#define IO_DELAY_TYPE_NONE 3
20
+
21
+#if defined(CONFIG_IO_DELAY_0X80)
22
+#define DEFAULT_IO_DELAY_TYPE IO_DELAY_TYPE_0X80
23
+#elif defined(CONFIG_IO_DELAY_0XED)
24
+#define DEFAULT_IO_DELAY_TYPE IO_DELAY_TYPE_0XED
25
+#elif defined(CONFIG_IO_DELAY_UDELAY)
26
+#define DEFAULT_IO_DELAY_TYPE IO_DELAY_TYPE_UDELAY
27
+#elif defined(CONFIG_IO_DELAY_NONE)
28
+#define DEFAULT_IO_DELAY_TYPE IO_DELAY_TYPE_NONE
29
+#endif
30
+
31
+int io_delay_type __read_mostly = DEFAULT_IO_DELAY_TYPE;
1732
1833 static int __initdata io_delay_override;
1934
....@@ -24,13 +39,13 @@
2439 {
2540 switch (io_delay_type) {
2641 default:
27
- case CONFIG_IO_DELAY_TYPE_0X80:
42
+ case IO_DELAY_TYPE_0X80:
2843 asm volatile ("outb %al, $0x80");
2944 break;
30
- case CONFIG_IO_DELAY_TYPE_0XED:
45
+ case IO_DELAY_TYPE_0XED:
3146 asm volatile ("outb %al, $0xed");
3247 break;
33
- case CONFIG_IO_DELAY_TYPE_UDELAY:
48
+ case IO_DELAY_TYPE_UDELAY:
3449 /*
3550 * 2 usecs is an upper-bound for the outb delay but
3651 * note that udelay doesn't have the bus-level
....@@ -39,7 +54,8 @@
3954 * are shorter until calibrated):
4055 */
4156 udelay(2);
42
- case CONFIG_IO_DELAY_TYPE_NONE:
57
+ break;
58
+ case IO_DELAY_TYPE_NONE:
4359 break;
4460 }
4561 }
....@@ -47,9 +63,9 @@
4763
4864 static int __init dmi_io_delay_0xed_port(const struct dmi_system_id *id)
4965 {
50
- if (io_delay_type == CONFIG_IO_DELAY_TYPE_0X80) {
66
+ if (io_delay_type == IO_DELAY_TYPE_0X80) {
5167 pr_notice("%s: using 0xed I/O delay port\n", id->ident);
52
- io_delay_type = CONFIG_IO_DELAY_TYPE_0XED;
68
+ io_delay_type = IO_DELAY_TYPE_0XED;
5369 }
5470
5571 return 0;
....@@ -115,13 +131,13 @@
115131 return -EINVAL;
116132
117133 if (!strcmp(s, "0x80"))
118
- io_delay_type = CONFIG_IO_DELAY_TYPE_0X80;
134
+ io_delay_type = IO_DELAY_TYPE_0X80;
119135 else if (!strcmp(s, "0xed"))
120
- io_delay_type = CONFIG_IO_DELAY_TYPE_0XED;
136
+ io_delay_type = IO_DELAY_TYPE_0XED;
121137 else if (!strcmp(s, "udelay"))
122
- io_delay_type = CONFIG_IO_DELAY_TYPE_UDELAY;
138
+ io_delay_type = IO_DELAY_TYPE_UDELAY;
123139 else if (!strcmp(s, "none"))
124
- io_delay_type = CONFIG_IO_DELAY_TYPE_NONE;
140
+ io_delay_type = IO_DELAY_TYPE_NONE;
125141 else
126142 return -EINVAL;
127143