diff options
Diffstat (limited to 'arch/x86_64')
-rw-r--r-- | arch/x86_64/kernel/pci-calgary.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c index 3215675ab128..87d90cb68a74 100644 --- a/arch/x86_64/kernel/pci-calgary.c +++ b/arch/x86_64/kernel/pci-calgary.c | |||
@@ -1052,7 +1052,7 @@ void __init detect_calgary(void) | |||
1052 | void *tbl; | 1052 | void *tbl; |
1053 | int calgary_found = 0; | 1053 | int calgary_found = 0; |
1054 | unsigned long ptr; | 1054 | unsigned long ptr; |
1055 | int offset; | 1055 | unsigned int offset, prev_offset; |
1056 | int ret; | 1056 | int ret; |
1057 | 1057 | ||
1058 | /* | 1058 | /* |
@@ -1071,15 +1071,20 @@ void __init detect_calgary(void) | |||
1071 | ptr = (unsigned long)phys_to_virt(get_bios_ebda()); | 1071 | ptr = (unsigned long)phys_to_virt(get_bios_ebda()); |
1072 | 1072 | ||
1073 | rio_table_hdr = NULL; | 1073 | rio_table_hdr = NULL; |
1074 | prev_offset = 0; | ||
1074 | offset = 0x180; | 1075 | offset = 0x180; |
1075 | while (offset) { | 1076 | /* |
1077 | * The next offset is stored in the 1st word. | ||
1078 | * Only parse up until the offset increases: | ||
1079 | */ | ||
1080 | while (offset > prev_offset) { | ||
1076 | /* The block id is stored in the 2nd word */ | 1081 | /* The block id is stored in the 2nd word */ |
1077 | if (*((unsigned short *)(ptr + offset + 2)) == 0x4752){ | 1082 | if (*((unsigned short *)(ptr + offset + 2)) == 0x4752){ |
1078 | /* set the pointer past the offset & block id */ | 1083 | /* set the pointer past the offset & block id */ |
1079 | rio_table_hdr = (struct rio_table_hdr *)(ptr + offset + 4); | 1084 | rio_table_hdr = (struct rio_table_hdr *)(ptr + offset + 4); |
1080 | break; | 1085 | break; |
1081 | } | 1086 | } |
1082 | /* The next offset is stored in the 1st word. 0 means no more */ | 1087 | prev_offset = offset; |
1083 | offset = *((unsigned short *)(ptr + offset)); | 1088 | offset = *((unsigned short *)(ptr + offset)); |
1084 | } | 1089 | } |
1085 | if (!rio_table_hdr) { | 1090 | if (!rio_table_hdr) { |