diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-21 18:39:41 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 06:50:05 -0400 |
commit | a9c1182fbd349882fe912245d6e03cd30943be2d (patch) | |
tree | 5f37f3c7f5ddafb7dcbe5dd6316090d4aed18b36 /arch/x86/kernel/setup_32.c | |
parent | 7a1fd9866cbb59a00006f1e0fd5726951b167c97 (diff) |
x86: seperate probe_roms into another file
it is only needed for 32bit
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/setup_32.c')
-rw-r--r-- | arch/x86/kernel/setup_32.c | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index e274ee6ff582..865838b11792 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c | |||
@@ -606,8 +606,6 @@ static void set_mca_bus(int x) | |||
606 | static void set_mca_bus(int x) { } | 606 | static void set_mca_bus(int x) { } |
607 | #endif | 607 | #endif |
608 | 608 | ||
609 | static void probe_roms(void); | ||
610 | |||
611 | /* | 609 | /* |
612 | * Determine if we were loaded by an EFI loader. If so, then we have also been | 610 | * Determine if we were loaded by an EFI loader. If so, then we have also been |
613 | * passed the efi memmap, systab, etc., so we should use these data structures | 611 | * passed the efi memmap, systab, etc., so we should use these data structures |
@@ -843,147 +841,3 @@ void __init setup_arch(char **cmdline_p) | |||
843 | #endif | 841 | #endif |
844 | } | 842 | } |
845 | 843 | ||
846 | static struct resource system_rom_resource = { | ||
847 | .name = "System ROM", | ||
848 | .start = 0xf0000, | ||
849 | .end = 0xfffff, | ||
850 | .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM | ||
851 | }; | ||
852 | |||
853 | static struct resource extension_rom_resource = { | ||
854 | .name = "Extension ROM", | ||
855 | .start = 0xe0000, | ||
856 | .end = 0xeffff, | ||
857 | .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM | ||
858 | }; | ||
859 | |||
860 | static struct resource adapter_rom_resources[] = { { | ||
861 | .name = "Adapter ROM", | ||
862 | .start = 0xc8000, | ||
863 | .end = 0, | ||
864 | .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM | ||
865 | }, { | ||
866 | .name = "Adapter ROM", | ||
867 | .start = 0, | ||
868 | .end = 0, | ||
869 | .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM | ||
870 | }, { | ||
871 | .name = "Adapter ROM", | ||
872 | .start = 0, | ||
873 | .end = 0, | ||
874 | .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM | ||
875 | }, { | ||
876 | .name = "Adapter ROM", | ||
877 | .start = 0, | ||
878 | .end = 0, | ||
879 | .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM | ||
880 | }, { | ||
881 | .name = "Adapter ROM", | ||
882 | .start = 0, | ||
883 | .end = 0, | ||
884 | .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM | ||
885 | }, { | ||
886 | .name = "Adapter ROM", | ||
887 | .start = 0, | ||
888 | .end = 0, | ||
889 | .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM | ||
890 | } }; | ||
891 | |||
892 | static struct resource video_rom_resource = { | ||
893 | .name = "Video ROM", | ||
894 | .start = 0xc0000, | ||
895 | .end = 0xc7fff, | ||
896 | .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM | ||
897 | }; | ||
898 | |||
899 | #define ROMSIGNATURE 0xaa55 | ||
900 | |||
901 | static int __init romsignature(const unsigned char *rom) | ||
902 | { | ||
903 | const unsigned short * const ptr = (const unsigned short *)rom; | ||
904 | unsigned short sig; | ||
905 | |||
906 | return probe_kernel_address(ptr, sig) == 0 && sig == ROMSIGNATURE; | ||
907 | } | ||
908 | |||
909 | static int __init romchecksum(const unsigned char *rom, unsigned long length) | ||
910 | { | ||
911 | unsigned char sum, c; | ||
912 | |||
913 | for (sum = 0; length && probe_kernel_address(rom++, c) == 0; length--) | ||
914 | sum += c; | ||
915 | return !length && !sum; | ||
916 | } | ||
917 | |||
918 | static void __init probe_roms(void) | ||
919 | { | ||
920 | const unsigned char *rom; | ||
921 | unsigned long start, length, upper; | ||
922 | unsigned char c; | ||
923 | int i; | ||
924 | |||
925 | /* video rom */ | ||
926 | upper = adapter_rom_resources[0].start; | ||
927 | for (start = video_rom_resource.start; start < upper; start += 2048) { | ||
928 | rom = isa_bus_to_virt(start); | ||
929 | if (!romsignature(rom)) | ||
930 | continue; | ||
931 | |||
932 | video_rom_resource.start = start; | ||
933 | |||
934 | if (probe_kernel_address(rom + 2, c) != 0) | ||
935 | continue; | ||
936 | |||
937 | /* 0 < length <= 0x7f * 512, historically */ | ||
938 | length = c * 512; | ||
939 | |||
940 | /* if checksum okay, trust length byte */ | ||
941 | if (length && romchecksum(rom, length)) | ||
942 | video_rom_resource.end = start + length - 1; | ||
943 | |||
944 | request_resource(&iomem_resource, &video_rom_resource); | ||
945 | break; | ||
946 | } | ||
947 | |||
948 | start = (video_rom_resource.end + 1 + 2047) & ~2047UL; | ||
949 | if (start < upper) | ||
950 | start = upper; | ||
951 | |||
952 | /* system rom */ | ||
953 | request_resource(&iomem_resource, &system_rom_resource); | ||
954 | upper = system_rom_resource.start; | ||
955 | |||
956 | /* check for extension rom (ignore length byte!) */ | ||
957 | rom = isa_bus_to_virt(extension_rom_resource.start); | ||
958 | if (romsignature(rom)) { | ||
959 | length = extension_rom_resource.end - extension_rom_resource.start + 1; | ||
960 | if (romchecksum(rom, length)) { | ||
961 | request_resource(&iomem_resource, &extension_rom_resource); | ||
962 | upper = extension_rom_resource.start; | ||
963 | } | ||
964 | } | ||
965 | |||
966 | /* check for adapter roms on 2k boundaries */ | ||
967 | for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) { | ||
968 | rom = isa_bus_to_virt(start); | ||
969 | if (!romsignature(rom)) | ||
970 | continue; | ||
971 | |||
972 | if (probe_kernel_address(rom + 2, c) != 0) | ||
973 | continue; | ||
974 | |||
975 | /* 0 < length <= 0x7f * 512, historically */ | ||
976 | length = c * 512; | ||
977 | |||
978 | /* but accept any length that fits if checksum okay */ | ||
979 | if (!length || start + length > upper || !romchecksum(rom, length)) | ||
980 | continue; | ||
981 | |||
982 | adapter_rom_resources[i].start = start; | ||
983 | adapter_rom_resources[i].end = start + length - 1; | ||
984 | request_resource(&iomem_resource, &adapter_rom_resources[i]); | ||
985 | |||
986 | start = adapter_rom_resources[i++].end & ~2047UL; | ||
987 | } | ||
988 | } | ||
989 | |||