diff options
-rw-r--r-- | arch/parisc/kernel/drivers.c | 171 |
1 files changed, 171 insertions, 0 deletions
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c index d4256145b74c..6afb595e0d86 100644 --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c | |||
@@ -895,6 +895,171 @@ void __init init_parisc_bus(void) | |||
895 | get_device(&root); | 895 | get_device(&root); |
896 | } | 896 | } |
897 | 897 | ||
898 | static __init void qemu_header(void) | ||
899 | { | ||
900 | int num; | ||
901 | unsigned long *p; | ||
902 | |||
903 | pr_info("--- cut here ---\n"); | ||
904 | pr_info("/* AUTO-GENERATED HEADER FILE FOR SEABIOS FIRMWARE */\n"); | ||
905 | pr_cont("/* generated with Linux kernel */\n"); | ||
906 | pr_cont("/* search for PARISC_QEMU_MACHINE_HEADER in Linux */\n\n"); | ||
907 | |||
908 | pr_info("#define PARISC_MODEL \"%s\"\n\n", | ||
909 | boot_cpu_data.pdc.sys_model_name); | ||
910 | |||
911 | pr_info("#define PARISC_PDC_MODEL 0x%lx, 0x%lx, 0x%lx, " | ||
912 | "0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx\n\n", | ||
913 | #define p ((unsigned long *)&boot_cpu_data.pdc.model) | ||
914 | p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); | ||
915 | #undef p | ||
916 | |||
917 | pr_info("#define PARISC_PDC_VERSION 0x%04lx\n\n", | ||
918 | boot_cpu_data.pdc.versions); | ||
919 | |||
920 | pr_info("#define PARISC_PDC_CPUID 0x%04lx\n\n", | ||
921 | boot_cpu_data.pdc.cpuid); | ||
922 | |||
923 | pr_info("#define PARISC_PDC_CAPABILITIES 0x%04lx\n\n", | ||
924 | boot_cpu_data.pdc.capabilities); | ||
925 | |||
926 | pr_info("#define PARISC_PDC_ENTRY_ORG 0x%04lx\n\n", | ||
927 | #ifdef CONFIG_64BIT | ||
928 | (unsigned long)(PAGE0->mem_pdc_hi) << 32 | | ||
929 | #endif | ||
930 | (unsigned long)PAGE0->mem_pdc); | ||
931 | |||
932 | pr_info("#define PARISC_PDC_CACHE_INFO"); | ||
933 | p = (unsigned long *) &cache_info; | ||
934 | for (num = 0; num < sizeof(cache_info); num += sizeof(unsigned long)) { | ||
935 | if (((num % 5) == 0)) { | ||
936 | pr_cont(" \\\n"); | ||
937 | pr_info("\t"); | ||
938 | } | ||
939 | pr_cont("%s0x%04lx", | ||
940 | num?", ":"", *p++); | ||
941 | } | ||
942 | pr_cont("\n\n"); | ||
943 | } | ||
944 | |||
945 | static __init int qemu_print_hpa(struct device *lin_dev, void *data) | ||
946 | { | ||
947 | struct parisc_device *dev = to_parisc_device(lin_dev); | ||
948 | unsigned long hpa = dev->hpa.start; | ||
949 | |||
950 | pr_cont("\t{\t.hpa = 0x%08lx,\\\n", hpa); | ||
951 | pr_cont("\t\t.iodc = &iodc_data_hpa_%08lx,\\\n", hpa); | ||
952 | pr_cont("\t\t.mod_info = &mod_info_hpa_%08lx,\\\n", hpa); | ||
953 | pr_cont("\t\t.mod_path = &mod_path_hpa_%08lx,\\\n", hpa); | ||
954 | pr_cont("\t\t.num_addr = HPA_%08lx_num_addr,\\\n", hpa); | ||
955 | pr_cont("\t\t.add_addr = { HPA_%08lx_add_addr } },\\\n", hpa); | ||
956 | return 0; | ||
957 | } | ||
958 | |||
959 | |||
960 | static __init void qemu_footer(void) | ||
961 | { | ||
962 | pr_info("\n\n#define PARISC_DEVICE_LIST \\\n"); | ||
963 | for_each_padev(qemu_print_hpa, NULL); | ||
964 | pr_cont("\t{ 0, }\n"); | ||
965 | pr_info("--- cut here ---\n"); | ||
966 | } | ||
967 | |||
968 | /* print iodc data of the various hpa modules for qemu inclusion */ | ||
969 | static __init int qemu_print_iodc_data(struct device *lin_dev, void *data) | ||
970 | { | ||
971 | struct parisc_device *dev = to_parisc_device(lin_dev); | ||
972 | unsigned long count; | ||
973 | unsigned long hpa = dev->hpa.start; | ||
974 | int status; | ||
975 | struct pdc_iodc iodc_data; | ||
976 | |||
977 | int mod_index; | ||
978 | struct pdc_system_map_mod_info pdc_mod_info; | ||
979 | struct pdc_module_path mod_path; | ||
980 | |||
981 | status = pdc_iodc_read(&count, hpa, 0, | ||
982 | &iodc_data, sizeof(iodc_data)); | ||
983 | if (status != PDC_OK) { | ||
984 | pr_info("No IODC data for hpa 0x%08lx\n", hpa); | ||
985 | return 0; | ||
986 | } | ||
987 | |||
988 | pr_info("\n"); | ||
989 | |||
990 | pr_info("#define HPA_%08lx_DESCRIPTION \"%s\"\n", | ||
991 | hpa, parisc_hardware_description(&dev->id)); | ||
992 | |||
993 | mod_index = 0; | ||
994 | do { | ||
995 | status = pdc_system_map_find_mods(&pdc_mod_info, | ||
996 | &mod_path, mod_index++); | ||
997 | } while (status == PDC_OK && pdc_mod_info.mod_addr != hpa); | ||
998 | |||
999 | pr_info("static struct pdc_system_map_mod_info" | ||
1000 | " mod_info_hpa_%08lx = {\n", hpa); | ||
1001 | #define DO(member) \ | ||
1002 | pr_cont("\t." #member " = 0x%x,\n", \ | ||
1003 | (unsigned int)pdc_mod_info.member) | ||
1004 | DO(mod_addr); | ||
1005 | DO(mod_pgs); | ||
1006 | DO(add_addrs); | ||
1007 | pr_cont("};\n"); | ||
1008 | #undef DO | ||
1009 | pr_info("static struct pdc_module_path " | ||
1010 | "mod_path_hpa_%08lx = {\n", hpa); | ||
1011 | pr_cont("\t.path = { "); | ||
1012 | pr_cont(".flags = 0x%x, ", mod_path.path.flags); | ||
1013 | pr_cont(".bc = { 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x }, ", | ||
1014 | (unsigned char)mod_path.path.bc[0], | ||
1015 | (unsigned char)mod_path.path.bc[1], | ||
1016 | (unsigned char)mod_path.path.bc[2], | ||
1017 | (unsigned char)mod_path.path.bc[3], | ||
1018 | (unsigned char)mod_path.path.bc[4], | ||
1019 | (unsigned char)mod_path.path.bc[5]); | ||
1020 | pr_cont(".mod = 0x%x ", mod_path.path.mod); | ||
1021 | pr_cont(" },\n"); | ||
1022 | pr_cont("\t.layers = { 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x }\n", | ||
1023 | mod_path.layers[0], mod_path.layers[1], mod_path.layers[2], | ||
1024 | mod_path.layers[3], mod_path.layers[4], mod_path.layers[5]); | ||
1025 | pr_cont("};\n"); | ||
1026 | |||
1027 | pr_info("static struct pdc_iodc iodc_data_hpa_%08lx = {\n", hpa); | ||
1028 | #define DO(member) \ | ||
1029 | pr_cont("\t." #member " = 0x%04lx,\n", \ | ||
1030 | (unsigned long)iodc_data.member) | ||
1031 | DO(hversion_model); | ||
1032 | DO(hversion); | ||
1033 | DO(spa); | ||
1034 | DO(type); | ||
1035 | DO(sversion_rev); | ||
1036 | DO(sversion_model); | ||
1037 | DO(sversion_opt); | ||
1038 | DO(rev); | ||
1039 | DO(dep); | ||
1040 | DO(features); | ||
1041 | DO(checksum); | ||
1042 | DO(length); | ||
1043 | #undef DO | ||
1044 | pr_cont("\t/* pad: 0x%04x, 0x%04x */\n", | ||
1045 | iodc_data.pad[0], iodc_data.pad[1]); | ||
1046 | pr_cont("};\n"); | ||
1047 | |||
1048 | pr_info("#define HPA_%08lx_num_addr %d\n", hpa, dev->num_addrs); | ||
1049 | pr_info("#define HPA_%08lx_add_addr ", hpa); | ||
1050 | count = 0; | ||
1051 | if (dev->num_addrs == 0) | ||
1052 | pr_cont("0"); | ||
1053 | while (count < dev->num_addrs) { | ||
1054 | pr_cont("0x%08lx, ", dev->addr[count]); | ||
1055 | count++; | ||
1056 | } | ||
1057 | pr_cont("\n\n"); | ||
1058 | |||
1059 | return 0; | ||
1060 | } | ||
1061 | |||
1062 | |||
898 | 1063 | ||
899 | static int print_one_device(struct device * dev, void * data) | 1064 | static int print_one_device(struct device * dev, void * data) |
900 | { | 1065 | { |
@@ -911,4 +1076,10 @@ static int print_one_device(struct device * dev, void * data) | |||
911 | void __init print_parisc_devices(void) | 1076 | void __init print_parisc_devices(void) |
912 | { | 1077 | { |
913 | for_each_padev(print_one_device, NULL); | 1078 | for_each_padev(print_one_device, NULL); |
1079 | #define PARISC_QEMU_MACHINE_HEADER 0 | ||
1080 | if (PARISC_QEMU_MACHINE_HEADER) { | ||
1081 | qemu_header(); | ||
1082 | for_each_padev(qemu_print_iodc_data, NULL); | ||
1083 | qemu_footer(); | ||
1084 | } | ||
914 | } | 1085 | } |