diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2015-11-17 13:23:46 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2015-11-25 22:08:32 -0500 |
commit | e2c22b45cb8feb00f2b8296e277d98485882ed92 (patch) | |
tree | 7eded504613fe1a3cfd22bb8ca18d10c06799fe0 /drivers/scsi/atp870u.c | |
parent | 2eabdf22ad667742258ef7c55a965e56366bf74d (diff) |
atp870u: Untangle tmport #8
Untangle the tmport crap so it becomes obvious what ports are accessed.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/atp870u.c')
-rw-r--r-- | drivers/scsi/atp870u.c | 478 |
1 files changed, 177 insertions, 301 deletions
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index f5a11f49bfad..993442d65a0e 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c | |||
@@ -2870,7 +2870,6 @@ static void tscam_885(void) | |||
2870 | 2870 | ||
2871 | static void is885(struct atp_unit *dev, unsigned int wkport,unsigned char c) | 2871 | static void is885(struct atp_unit *dev, unsigned int wkport,unsigned char c) |
2872 | { | 2872 | { |
2873 | unsigned int tmport; | ||
2874 | unsigned char i, j, k, rmb, n, lvdmode; | 2873 | unsigned char i, j, k, rmb, n, lvdmode; |
2875 | unsigned short int m; | 2874 | unsigned short int m; |
2876 | static unsigned char mbuf[512]; | 2875 | static unsigned char mbuf[512]; |
@@ -2895,123 +2894,93 @@ static void is885(struct atp_unit *dev, unsigned int wkport,unsigned char c) | |||
2895 | printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[c]); | 2894 | printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[c]); |
2896 | continue; | 2895 | continue; |
2897 | } | 2896 | } |
2898 | tmport = wkport + 0x1b; | 2897 | outb(0x01, wkport + 0x1b); |
2899 | outb(0x01, tmport); | 2898 | outb(0x08, wkport + 0x01); |
2900 | tmport = wkport + 0x01; | 2899 | outb(0x7f, wkport + 0x02); |
2901 | outb(0x08, tmport++); | 2900 | outb(satn[0], wkport + 0x03); |
2902 | outb(0x7f, tmport++); | 2901 | outb(satn[1], wkport + 0x04); |
2903 | outb(satn[0], tmport++); | 2902 | outb(satn[2], wkport + 0x05); |
2904 | outb(satn[1], tmport++); | 2903 | outb(satn[3], wkport + 0x06); |
2905 | outb(satn[2], tmport++); | 2904 | outb(satn[4], wkport + 0x07); |
2906 | outb(satn[3], tmport++); | 2905 | outb(satn[5], wkport + 0x08); |
2907 | outb(satn[4], tmport++); | 2906 | outb(0, wkport + 0x0f); |
2908 | outb(satn[5], tmport++); | 2907 | outb(dev->id[c][i].devsp, wkport + 0x11); |
2909 | tmport += 0x06; | ||
2910 | outb(0, tmport); | ||
2911 | tmport += 0x02; | ||
2912 | outb(dev->id[c][i].devsp, tmport++); | ||
2913 | 2908 | ||
2914 | outb(0, tmport++); | 2909 | outb(0, wkport + 0x12); |
2915 | outb(satn[6], tmport++); | 2910 | outb(satn[6], wkport + 0x13); |
2916 | outb(satn[7], tmport++); | 2911 | outb(satn[7], wkport + 0x14); |
2917 | j = i; | 2912 | j = i; |
2918 | if ((j & 0x08) != 0) { | 2913 | if ((j & 0x08) != 0) { |
2919 | j = (j & 0x07) | 0x40; | 2914 | j = (j & 0x07) | 0x40; |
2920 | } | 2915 | } |
2921 | outb(j, tmport); | 2916 | outb(j, wkport + 0x15); |
2922 | tmport += 0x03; | 2917 | outb(satn[8], wkport + 0x18); |
2923 | outb(satn[8], tmport); | ||
2924 | tmport += 0x07; | ||
2925 | 2918 | ||
2926 | while ((inb(tmport) & 0x80) == 0x00) | 2919 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
2927 | cpu_relax(); | 2920 | cpu_relax(); |
2928 | tmport -= 0x08; | 2921 | if ((inb(wkport + 0x17) != 0x11) && (inb(wkport + 0x17) != 0x8e)) { |
2929 | if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { | ||
2930 | continue; | 2922 | continue; |
2931 | } | 2923 | } |
2932 | while (inb(tmport) != 0x8e) | 2924 | while (inb(wkport + 0x17) != 0x8e) |
2933 | cpu_relax(); | 2925 | cpu_relax(); |
2934 | dev->active_id[c] |= m; | 2926 | dev->active_id[c] |= m; |
2935 | 2927 | ||
2936 | tmport = wkport + 0x10; | 2928 | outb(0x30, wkport + 0x10); |
2937 | outb(0x30, tmport); | 2929 | outb(0x00, wkport + 0x14); |
2938 | tmport = wkport + 0x14; | ||
2939 | outb(0x00, tmport); | ||
2940 | 2930 | ||
2941 | phase_cmd: | 2931 | phase_cmd: |
2942 | tmport = wkport + 0x18; | 2932 | outb(0x08, wkport + 0x18); |
2943 | outb(0x08, tmport); | 2933 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
2944 | tmport += 0x07; | ||
2945 | while ((inb(tmport) & 0x80) == 0x00) | ||
2946 | cpu_relax(); | 2934 | cpu_relax(); |
2947 | tmport -= 0x08; | 2935 | j = inb(wkport + 0x17); |
2948 | j = inb(tmport); | ||
2949 | if (j != 0x16) { | 2936 | if (j != 0x16) { |
2950 | tmport = wkport + 0x10; | 2937 | outb(0x41, wkport + 0x10); |
2951 | outb(0x41, tmport); | ||
2952 | goto phase_cmd; | 2938 | goto phase_cmd; |
2953 | } | 2939 | } |
2954 | sel_ok: | 2940 | sel_ok: |
2955 | tmport = wkport + 0x03; | 2941 | outb(inqd[0], wkport + 0x03); |
2956 | outb(inqd[0], tmport++); | 2942 | outb(inqd[1], wkport + 0x04); |
2957 | outb(inqd[1], tmport++); | 2943 | outb(inqd[2], wkport + 0x05); |
2958 | outb(inqd[2], tmport++); | 2944 | outb(inqd[3], wkport + 0x06); |
2959 | outb(inqd[3], tmport++); | 2945 | outb(inqd[4], wkport + 0x07); |
2960 | outb(inqd[4], tmport++); | 2946 | outb(inqd[5], wkport + 0x08); |
2961 | outb(inqd[5], tmport); | 2947 | outb(0, wkport + 0x0f); |
2962 | tmport += 0x07; | 2948 | outb(dev->id[c][i].devsp, wkport + 0x11); |
2963 | outb(0, tmport); | 2949 | outb(0, wkport + 0x12); |
2964 | tmport += 0x02; | 2950 | outb(inqd[6], wkport + 0x13); |
2965 | outb(dev->id[c][i].devsp, tmport++); | 2951 | outb(inqd[7], wkport + 0x14); |
2966 | outb(0, tmport++); | 2952 | outb(inqd[8], wkport + 0x18); |
2967 | outb(inqd[6], tmport++); | 2953 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
2968 | outb(inqd[7], tmport++); | ||
2969 | tmport += 0x03; | ||
2970 | outb(inqd[8], tmport); | ||
2971 | tmport += 0x07; | ||
2972 | while ((inb(tmport) & 0x80) == 0x00) | ||
2973 | cpu_relax(); | 2954 | cpu_relax(); |
2974 | tmport -= 0x08; | 2955 | if ((inb(wkport + 0x17) != 0x11) && (inb(wkport + 0x17) != 0x8e)) { |
2975 | if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { | ||
2976 | continue; | 2956 | continue; |
2977 | } | 2957 | } |
2978 | while (inb(tmport) != 0x8e) | 2958 | while (inb(wkport + 0x17) != 0x8e) |
2979 | cpu_relax(); | 2959 | cpu_relax(); |
2980 | tmport = wkport + 0x1b; | 2960 | outb(0x00, wkport + 0x1b); |
2981 | outb(0x00, tmport); | 2961 | outb(0x08, wkport + 0x18); |
2982 | tmport = wkport + 0x18; | ||
2983 | outb(0x08, tmport); | ||
2984 | tmport += 0x07; | ||
2985 | j = 0; | 2962 | j = 0; |
2986 | rd_inq_data: | 2963 | rd_inq_data: |
2987 | k = inb(tmport); | 2964 | k = inb(wkport + 0x1f); |
2988 | if ((k & 0x01) != 0) { | 2965 | if ((k & 0x01) != 0) { |
2989 | tmport -= 0x06; | 2966 | mbuf[j++] = inb(wkport + 0x19); |
2990 | mbuf[j++] = inb(tmport); | ||
2991 | tmport += 0x06; | ||
2992 | goto rd_inq_data; | 2967 | goto rd_inq_data; |
2993 | } | 2968 | } |
2994 | if ((k & 0x80) == 0) { | 2969 | if ((k & 0x80) == 0) { |
2995 | goto rd_inq_data; | 2970 | goto rd_inq_data; |
2996 | } | 2971 | } |
2997 | tmport -= 0x08; | 2972 | j = inb(wkport + 0x17); |
2998 | j = inb(tmport); | ||
2999 | if (j == 0x16) { | 2973 | if (j == 0x16) { |
3000 | goto inq_ok; | 2974 | goto inq_ok; |
3001 | } | 2975 | } |
3002 | tmport = wkport + 0x10; | 2976 | outb(0x46, wkport + 0x10); |
3003 | outb(0x46, tmport); | 2977 | outb(0, wkport + 0x12); |
3004 | tmport += 0x02; | 2978 | outb(0, wkport + 0x13); |
3005 | outb(0, tmport++); | 2979 | outb(0, wkport + 0x14); |
3006 | outb(0, tmport++); | 2980 | outb(0x08, wkport + 0x18); |
3007 | outb(0, tmport++); | 2981 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
3008 | tmport += 0x03; | ||
3009 | outb(0x08, tmport); | ||
3010 | tmport += 0x07; | ||
3011 | while ((inb(tmport) & 0x80) == 0x00) | ||
3012 | cpu_relax(); | 2982 | cpu_relax(); |
3013 | tmport -= 0x08; | 2983 | if (inb(wkport + 0x17) != 0x16) { |
3014 | if (inb(tmport) != 0x16) { | ||
3015 | goto sel_ok; | 2984 | goto sel_ok; |
3016 | } | 2985 | } |
3017 | inq_ok: | 2986 | inq_ok: |
@@ -3033,54 +3002,40 @@ inq_ok: | |||
3033 | goto chg_wide; | 3002 | goto chg_wide; |
3034 | } | 3003 | } |
3035 | 3004 | ||
3036 | tmport = wkport + 0x1b; | 3005 | outb(0x01, wkport + 0x1b); |
3037 | outb(0x01, tmport); | 3006 | outb(satn[0], wkport + 0x03); |
3038 | tmport = wkport + 0x03; | 3007 | outb(satn[1], wkport + 0x04); |
3039 | outb(satn[0], tmport++); | 3008 | outb(satn[2], wkport + 0x05); |
3040 | outb(satn[1], tmport++); | 3009 | outb(satn[3], wkport + 0x06); |
3041 | outb(satn[2], tmport++); | 3010 | outb(satn[4], wkport + 0x07); |
3042 | outb(satn[3], tmport++); | 3011 | outb(satn[5], wkport + 0x08); |
3043 | outb(satn[4], tmport++); | 3012 | outb(0, wkport + 0x0f); |
3044 | outb(satn[5], tmport++); | 3013 | outb(dev->id[c][i].devsp, wkport + 0x11); |
3045 | tmport += 0x06; | 3014 | outb(0, wkport + 0x12); |
3046 | outb(0, tmport); | 3015 | outb(satn[6], wkport + 0x13); |
3047 | tmport += 0x02; | 3016 | outb(satn[7], wkport + 0x14); |
3048 | outb(dev->id[c][i].devsp, tmport++); | 3017 | outb(satn[8], wkport + 0x18); |
3049 | outb(0, tmport++); | 3018 | |
3050 | outb(satn[6], tmport++); | 3019 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
3051 | outb(satn[7], tmport++); | ||
3052 | tmport += 0x03; | ||
3053 | outb(satn[8], tmport); | ||
3054 | tmport += 0x07; | ||
3055 | |||
3056 | while ((inb(tmport) & 0x80) == 0x00) | ||
3057 | cpu_relax(); | 3020 | cpu_relax(); |
3058 | tmport -= 0x08; | 3021 | if ((inb(wkport + 0x17) != 0x11) && (inb(wkport + 0x17) != 0x8e)) { |
3059 | if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { | ||
3060 | continue; | 3022 | continue; |
3061 | } | 3023 | } |
3062 | while (inb(tmport) != 0x8e) | 3024 | while (inb(wkport + 0x17) != 0x8e) |
3063 | cpu_relax(); | 3025 | cpu_relax(); |
3064 | try_u3: | 3026 | try_u3: |
3065 | j = 0; | 3027 | j = 0; |
3066 | tmport = wkport + 0x14; | 3028 | outb(0x09, wkport + 0x14); |
3067 | outb(0x09, tmport); | 3029 | outb(0x20, wkport + 0x18); |
3068 | tmport += 0x04; | 3030 | |
3069 | outb(0x20, tmport); | 3031 | while ((inb(wkport + 0x1f) & 0x80) == 0) { |
3070 | tmport += 0x07; | 3032 | if ((inb(wkport + 0x1f) & 0x01) != 0) |
3071 | 3033 | outb(u3[j++], wkport + 0x19); | |
3072 | while ((inb(tmport) & 0x80) == 0) { | ||
3073 | if ((inb(tmport) & 0x01) != 0) { | ||
3074 | tmport -= 0x06; | ||
3075 | outb(u3[j++], tmport); | ||
3076 | tmport += 0x06; | ||
3077 | } | ||
3078 | cpu_relax(); | 3034 | cpu_relax(); |
3079 | } | 3035 | } |
3080 | tmport -= 0x08; | 3036 | while ((inb(wkport + 0x17) & 0x80) == 0x00) |
3081 | while ((inb(tmport) & 0x80) == 0x00) | ||
3082 | cpu_relax(); | 3037 | cpu_relax(); |
3083 | j = inb(tmport) & 0x0f; | 3038 | j = inb(wkport + 0x17) & 0x0f; |
3084 | if (j == 0x0f) { | 3039 | if (j == 0x0f) { |
3085 | goto u3p_in; | 3040 | goto u3p_in; |
3086 | } | 3041 | } |
@@ -3092,19 +3047,13 @@ try_u3: | |||
3092 | } | 3047 | } |
3093 | continue; | 3048 | continue; |
3094 | u3p_out: | 3049 | u3p_out: |
3095 | tmport = wkport + 0x18; | 3050 | outb(0x20, wkport + 0x18); |
3096 | outb(0x20, tmport); | 3051 | while ((inb(wkport + 0x1f) & 0x80) == 0) { |
3097 | tmport += 0x07; | 3052 | if ((inb(wkport + 0x1f) & 0x01) != 0) |
3098 | while ((inb(tmport) & 0x80) == 0) { | 3053 | outb(0, wkport + 0x19); |
3099 | if ((inb(tmport) & 0x01) != 0) { | ||
3100 | tmport -= 0x06; | ||
3101 | outb(0, tmport); | ||
3102 | tmport += 0x06; | ||
3103 | } | ||
3104 | cpu_relax(); | 3054 | cpu_relax(); |
3105 | } | 3055 | } |
3106 | tmport -= 0x08; | 3056 | j = inb(wkport + 0x17) & 0x0f; |
3107 | j = inb(tmport) & 0x0f; | ||
3108 | if (j == 0x0f) { | 3057 | if (j == 0x0f) { |
3109 | goto u3p_in; | 3058 | goto u3p_in; |
3110 | } | 3059 | } |
@@ -3116,25 +3065,19 @@ u3p_out: | |||
3116 | } | 3065 | } |
3117 | continue; | 3066 | continue; |
3118 | u3p_in: | 3067 | u3p_in: |
3119 | tmport = wkport + 0x14; | 3068 | outb(0x09, wkport + 0x14); |
3120 | outb(0x09, tmport); | 3069 | outb(0x20, wkport + 0x18); |
3121 | tmport += 0x04; | ||
3122 | outb(0x20, tmport); | ||
3123 | tmport += 0x07; | ||
3124 | k = 0; | 3070 | k = 0; |
3125 | u3p_in1: | 3071 | u3p_in1: |
3126 | j = inb(tmport); | 3072 | j = inb(wkport + 0x1f); |
3127 | if ((j & 0x01) != 0) { | 3073 | if ((j & 0x01) != 0) { |
3128 | tmport -= 0x06; | 3074 | mbuf[k++] = inb(wkport + 0x19); |
3129 | mbuf[k++] = inb(tmport); | ||
3130 | tmport += 0x06; | ||
3131 | goto u3p_in1; | 3075 | goto u3p_in1; |
3132 | } | 3076 | } |
3133 | if ((j & 0x80) == 0x00) { | 3077 | if ((j & 0x80) == 0x00) { |
3134 | goto u3p_in1; | 3078 | goto u3p_in1; |
3135 | } | 3079 | } |
3136 | tmport -= 0x08; | 3080 | j = inb(wkport + 0x17) & 0x0f; |
3137 | j = inb(tmport) & 0x0f; | ||
3138 | if (j == 0x0f) { | 3081 | if (j == 0x0f) { |
3139 | goto u3p_in; | 3082 | goto u3p_in; |
3140 | } | 3083 | } |
@@ -3146,16 +3089,11 @@ u3p_in1: | |||
3146 | } | 3089 | } |
3147 | continue; | 3090 | continue; |
3148 | u3p_cmd: | 3091 | u3p_cmd: |
3149 | tmport = wkport + 0x10; | 3092 | outb(0x30, wkport + 0x10); |
3150 | outb(0x30, tmport); | 3093 | outb(0x00, wkport + 0x14); |
3151 | tmport = wkport + 0x14; | 3094 | outb(0x08, wkport + 0x18); |
3152 | outb(0x00, tmport); | 3095 | while ((inb(wkport + 0x1f) & 0x80) == 0x00); |
3153 | tmport += 0x04; | 3096 | j = inb(wkport + 0x17); |
3154 | outb(0x08, tmport); | ||
3155 | tmport += 0x07; | ||
3156 | while ((inb(tmport) & 0x80) == 0x00); | ||
3157 | tmport -= 0x08; | ||
3158 | j = inb(tmport); | ||
3159 | if (j != 0x16) { | 3097 | if (j != 0x16) { |
3160 | if (j == 0x4e) { | 3098 | if (j == 0x4e) { |
3161 | goto u3p_out; | 3099 | goto u3p_out; |
@@ -3182,54 +3120,40 @@ u3p_cmd: | |||
3182 | continue; | 3120 | continue; |
3183 | } | 3121 | } |
3184 | chg_wide: | 3122 | chg_wide: |
3185 | tmport = wkport + 0x1b; | 3123 | outb(0x01, wkport + 0x1b); |
3186 | outb(0x01, tmport); | 3124 | outb(satn[0], wkport + 0x03); |
3187 | tmport = wkport + 0x03; | 3125 | outb(satn[1], wkport + 0x04); |
3188 | outb(satn[0], tmport++); | 3126 | outb(satn[2], wkport + 0x05); |
3189 | outb(satn[1], tmport++); | 3127 | outb(satn[3], wkport + 0x06); |
3190 | outb(satn[2], tmport++); | 3128 | outb(satn[4], wkport + 0x07); |
3191 | outb(satn[3], tmport++); | 3129 | outb(satn[5], wkport + 0x08); |
3192 | outb(satn[4], tmport++); | 3130 | outb(0, wkport + 0x0f); |
3193 | outb(satn[5], tmport++); | 3131 | outb(dev->id[c][i].devsp, wkport + 0x11); |
3194 | tmport += 0x06; | 3132 | outb(0, wkport + 0x12); |
3195 | outb(0, tmport); | 3133 | outb(satn[6], wkport + 0x13); |
3196 | tmport += 0x02; | 3134 | outb(satn[7], wkport + 0x14); |
3197 | outb(dev->id[c][i].devsp, tmport++); | 3135 | outb(satn[8], wkport + 0x18); |
3198 | outb(0, tmport++); | 3136 | |
3199 | outb(satn[6], tmport++); | 3137 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
3200 | outb(satn[7], tmport++); | ||
3201 | tmport += 0x03; | ||
3202 | outb(satn[8], tmport); | ||
3203 | tmport += 0x07; | ||
3204 | |||
3205 | while ((inb(tmport) & 0x80) == 0x00) | ||
3206 | cpu_relax(); | 3138 | cpu_relax(); |
3207 | tmport -= 0x08; | 3139 | if ((inb(wkport + 0x17) != 0x11) && (inb(wkport + 0x17) != 0x8e)) { |
3208 | if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { | ||
3209 | continue; | 3140 | continue; |
3210 | } | 3141 | } |
3211 | while (inb(tmport) != 0x8e) | 3142 | while (inb(wkport + 0x17) != 0x8e) |
3212 | cpu_relax(); | 3143 | cpu_relax(); |
3213 | try_wide: | 3144 | try_wide: |
3214 | j = 0; | 3145 | j = 0; |
3215 | tmport = wkport + 0x14; | 3146 | outb(0x05, wkport + 0x14); |
3216 | outb(0x05, tmport); | 3147 | outb(0x20, wkport + 0x18); |
3217 | tmport += 0x04; | 3148 | |
3218 | outb(0x20, tmport); | 3149 | while ((inb(wkport + 0x1f) & 0x80) == 0) { |
3219 | tmport += 0x07; | 3150 | if ((inb(wkport + 0x1f) & 0x01) != 0) |
3220 | 3151 | outb(wide[j++], wkport + 0x19); | |
3221 | while ((inb(tmport) & 0x80) == 0) { | ||
3222 | if ((inb(tmport) & 0x01) != 0) { | ||
3223 | tmport -= 0x06; | ||
3224 | outb(wide[j++], tmport); | ||
3225 | tmport += 0x06; | ||
3226 | } | ||
3227 | cpu_relax(); | 3152 | cpu_relax(); |
3228 | } | 3153 | } |
3229 | tmport -= 0x08; | 3154 | while ((inb(wkport + 0x17) & 0x80) == 0x00) |
3230 | while ((inb(tmport) & 0x80) == 0x00) | ||
3231 | cpu_relax(); | 3155 | cpu_relax(); |
3232 | j = inb(tmport) & 0x0f; | 3156 | j = inb(wkport + 0x17) & 0x0f; |
3233 | if (j == 0x0f) { | 3157 | if (j == 0x0f) { |
3234 | goto widep_in; | 3158 | goto widep_in; |
3235 | } | 3159 | } |
@@ -3241,19 +3165,13 @@ try_wide: | |||
3241 | } | 3165 | } |
3242 | continue; | 3166 | continue; |
3243 | widep_out: | 3167 | widep_out: |
3244 | tmport = wkport + 0x18; | 3168 | outb(0x20, wkport + 0x18); |
3245 | outb(0x20, tmport); | 3169 | while ((inb(wkport + 0x1f) & 0x80) == 0) { |
3246 | tmport += 0x07; | 3170 | if ((inb(wkport + 0x1f) & 0x01) != 0) |
3247 | while ((inb(tmport) & 0x80) == 0) { | 3171 | outb(0, wkport + 0x19); |
3248 | if ((inb(tmport) & 0x01) != 0) { | ||
3249 | tmport -= 0x06; | ||
3250 | outb(0, tmport); | ||
3251 | tmport += 0x06; | ||
3252 | } | ||
3253 | cpu_relax(); | 3172 | cpu_relax(); |
3254 | } | 3173 | } |
3255 | tmport -= 0x08; | 3174 | j = inb(wkport + 0x17) & 0x0f; |
3256 | j = inb(tmport) & 0x0f; | ||
3257 | if (j == 0x0f) { | 3175 | if (j == 0x0f) { |
3258 | goto widep_in; | 3176 | goto widep_in; |
3259 | } | 3177 | } |
@@ -3265,25 +3183,19 @@ widep_out: | |||
3265 | } | 3183 | } |
3266 | continue; | 3184 | continue; |
3267 | widep_in: | 3185 | widep_in: |
3268 | tmport = wkport + 0x14; | 3186 | outb(0xff, wkport + 0x14); |
3269 | outb(0xff, tmport); | 3187 | outb(0x20, wkport + 0x18); |
3270 | tmport += 0x04; | ||
3271 | outb(0x20, tmport); | ||
3272 | tmport += 0x07; | ||
3273 | k = 0; | 3188 | k = 0; |
3274 | widep_in1: | 3189 | widep_in1: |
3275 | j = inb(tmport); | 3190 | j = inb(wkport + 0x1f); |
3276 | if ((j & 0x01) != 0) { | 3191 | if ((j & 0x01) != 0) { |
3277 | tmport -= 0x06; | 3192 | mbuf[k++] = inb(wkport + 0x19); |
3278 | mbuf[k++] = inb(tmport); | ||
3279 | tmport += 0x06; | ||
3280 | goto widep_in1; | 3193 | goto widep_in1; |
3281 | } | 3194 | } |
3282 | if ((j & 0x80) == 0x00) { | 3195 | if ((j & 0x80) == 0x00) { |
3283 | goto widep_in1; | 3196 | goto widep_in1; |
3284 | } | 3197 | } |
3285 | tmport -= 0x08; | 3198 | j = inb(wkport + 0x17) & 0x0f; |
3286 | j = inb(tmport) & 0x0f; | ||
3287 | if (j == 0x0f) { | 3199 | if (j == 0x0f) { |
3288 | goto widep_in; | 3200 | goto widep_in; |
3289 | } | 3201 | } |
@@ -3295,17 +3207,12 @@ widep_in1: | |||
3295 | } | 3207 | } |
3296 | continue; | 3208 | continue; |
3297 | widep_cmd: | 3209 | widep_cmd: |
3298 | tmport = wkport + 0x10; | 3210 | outb(0x30, wkport + 0x10); |
3299 | outb(0x30, tmport); | 3211 | outb(0x00, wkport + 0x14); |
3300 | tmport = wkport + 0x14; | 3212 | outb(0x08, wkport + 0x18); |
3301 | outb(0x00, tmport); | 3213 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
3302 | tmport += 0x04; | ||
3303 | outb(0x08, tmport); | ||
3304 | tmport += 0x07; | ||
3305 | while ((inb(tmport) & 0x80) == 0x00) | ||
3306 | cpu_relax(); | 3214 | cpu_relax(); |
3307 | tmport -= 0x08; | 3215 | j = inb(wkport + 0x17); |
3308 | j = inb(tmport); | ||
3309 | if (j != 0x16) { | 3216 | if (j != 0x16) { |
3310 | if (j == 0x4e) { | 3217 | if (j == 0x4e) { |
3311 | goto widep_out; | 3218 | goto widep_out; |
@@ -3347,69 +3254,56 @@ set_sync: | |||
3347 | synuw[4]=0x0a; | 3254 | synuw[4]=0x0a; |
3348 | } | 3255 | } |
3349 | } | 3256 | } |
3350 | tmport = wkport + 0x1b; | ||
3351 | j = 0; | 3257 | j = 0; |
3352 | if ((m & dev->wide_id[c]) != 0) { | 3258 | if ((m & dev->wide_id[c]) != 0) { |
3353 | j |= 0x01; | 3259 | j |= 0x01; |
3354 | } | 3260 | } |
3355 | outb(j, tmport); | 3261 | outb(j, wkport + 0x1b); |
3356 | tmport = wkport + 0x03; | 3262 | outb(satn[0], wkport + 0x03); |
3357 | outb(satn[0], tmport++); | 3263 | outb(satn[1], wkport + 0x04); |
3358 | outb(satn[1], tmport++); | 3264 | outb(satn[2], wkport + 0x05); |
3359 | outb(satn[2], tmport++); | 3265 | outb(satn[3], wkport + 0x06); |
3360 | outb(satn[3], tmport++); | 3266 | outb(satn[4], wkport + 0x07); |
3361 | outb(satn[4], tmport++); | 3267 | outb(satn[5], wkport + 0x08); |
3362 | outb(satn[5], tmport++); | 3268 | outb(0, wkport + 0x0f); |
3363 | tmport += 0x06; | 3269 | outb(dev->id[c][i].devsp, wkport + 0x11); |
3364 | outb(0, tmport); | 3270 | outb(0, wkport + 0x12); |
3365 | tmport += 0x02; | 3271 | outb(satn[6], wkport + 0x13); |
3366 | outb(dev->id[c][i].devsp, tmport++); | 3272 | outb(satn[7], wkport + 0x14); |
3367 | outb(0, tmport++); | 3273 | outb(satn[8], wkport + 0x18); |
3368 | outb(satn[6], tmport++); | 3274 | |
3369 | outb(satn[7], tmport++); | 3275 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
3370 | tmport += 0x03; | ||
3371 | outb(satn[8], tmport); | ||
3372 | tmport += 0x07; | ||
3373 | |||
3374 | while ((inb(tmport) & 0x80) == 0x00) | ||
3375 | cpu_relax(); | 3276 | cpu_relax(); |
3376 | tmport -= 0x08; | 3277 | if ((inb(wkport + 0x17) != 0x11) && (inb(wkport + 0x17) != 0x8e)) { |
3377 | if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { | ||
3378 | continue; | 3278 | continue; |
3379 | } | 3279 | } |
3380 | while (inb(tmport) != 0x8e) | 3280 | while (inb(wkport + 0x17) != 0x8e) |
3381 | cpu_relax(); | 3281 | cpu_relax(); |
3382 | try_sync: | 3282 | try_sync: |
3383 | j = 0; | 3283 | j = 0; |
3384 | tmport = wkport + 0x14; | 3284 | outb(0x06, wkport + 0x14); |
3385 | outb(0x06, tmport); | 3285 | outb(0x20, wkport + 0x18); |
3386 | tmport += 0x04; | 3286 | |
3387 | outb(0x20, tmport); | 3287 | while ((inb(wkport + 0x1f) & 0x80) == 0) { |
3388 | tmport += 0x07; | 3288 | if ((inb(wkport + 0x1f) & 0x01) != 0) { |
3389 | |||
3390 | while ((inb(tmport) & 0x80) == 0) { | ||
3391 | if ((inb(tmport) & 0x01) != 0) { | ||
3392 | tmport -= 0x06; | ||
3393 | if ((m & dev->wide_id[c]) != 0) { | 3289 | if ((m & dev->wide_id[c]) != 0) { |
3394 | if ((m & dev->ultra_map[c]) != 0) { | 3290 | if ((m & dev->ultra_map[c]) != 0) { |
3395 | outb(synuw[j++], tmport); | 3291 | outb(synuw[j++], wkport + 0x19); |
3396 | } else { | 3292 | } else { |
3397 | outb(synw[j++], tmport); | 3293 | outb(synw[j++], wkport + 0x19); |
3398 | } | 3294 | } |
3399 | } else { | 3295 | } else { |
3400 | if ((m & dev->ultra_map[c]) != 0) { | 3296 | if ((m & dev->ultra_map[c]) != 0) { |
3401 | outb(synu[j++], tmport); | 3297 | outb(synu[j++], wkport + 0x19); |
3402 | } else { | 3298 | } else { |
3403 | outb(synn[j++], tmport); | 3299 | outb(synn[j++], wkport + 0x19); |
3404 | } | 3300 | } |
3405 | } | 3301 | } |
3406 | tmport += 0x06; | ||
3407 | } | 3302 | } |
3408 | } | 3303 | } |
3409 | tmport -= 0x08; | 3304 | while ((inb(wkport + 0x17) & 0x80) == 0x00) |
3410 | while ((inb(tmport) & 0x80) == 0x00) | ||
3411 | cpu_relax(); | 3305 | cpu_relax(); |
3412 | j = inb(tmport) & 0x0f; | 3306 | j = inb(wkport + 0x17) & 0x0f; |
3413 | if (j == 0x0f) { | 3307 | if (j == 0x0f) { |
3414 | goto phase_ins; | 3308 | goto phase_ins; |
3415 | } | 3309 | } |
@@ -3421,19 +3315,13 @@ try_sync: | |||
3421 | } | 3315 | } |
3422 | continue; | 3316 | continue; |
3423 | phase_outs: | 3317 | phase_outs: |
3424 | tmport = wkport + 0x18; | 3318 | outb(0x20, wkport + 0x18); |
3425 | outb(0x20, tmport); | 3319 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) { |
3426 | tmport += 0x07; | 3320 | if ((inb(wkport + 0x1f) & 0x01) != 0x00) |
3427 | while ((inb(tmport) & 0x80) == 0x00) { | 3321 | outb(0x00, wkport + 0x19); |
3428 | if ((inb(tmport) & 0x01) != 0x00) { | ||
3429 | tmport -= 0x06; | ||
3430 | outb(0x00, tmport); | ||
3431 | tmport += 0x06; | ||
3432 | } | ||
3433 | cpu_relax(); | 3322 | cpu_relax(); |
3434 | } | 3323 | } |
3435 | tmport -= 0x08; | 3324 | j = inb(wkport + 0x17); |
3436 | j = inb(tmport); | ||
3437 | if (j == 0x85) { | 3325 | if (j == 0x85) { |
3438 | goto tar_dcons; | 3326 | goto tar_dcons; |
3439 | } | 3327 | } |
@@ -3449,26 +3337,20 @@ phase_outs: | |||
3449 | } | 3337 | } |
3450 | continue; | 3338 | continue; |
3451 | phase_ins: | 3339 | phase_ins: |
3452 | tmport = wkport + 0x14; | 3340 | outb(0x06, wkport + 0x14); |
3453 | outb(0x06, tmport); | 3341 | outb(0x20, wkport + 0x18); |
3454 | tmport += 0x04; | ||
3455 | outb(0x20, tmport); | ||
3456 | tmport += 0x07; | ||
3457 | k = 0; | 3342 | k = 0; |
3458 | phase_ins1: | 3343 | phase_ins1: |
3459 | j = inb(tmport); | 3344 | j = inb(wkport + 0x1f); |
3460 | if ((j & 0x01) != 0x00) { | 3345 | if ((j & 0x01) != 0x00) { |
3461 | tmport -= 0x06; | 3346 | mbuf[k++] = inb(wkport + 0x19); |
3462 | mbuf[k++] = inb(tmport); | ||
3463 | tmport += 0x06; | ||
3464 | goto phase_ins1; | 3347 | goto phase_ins1; |
3465 | } | 3348 | } |
3466 | if ((j & 0x80) == 0x00) { | 3349 | if ((j & 0x80) == 0x00) { |
3467 | goto phase_ins1; | 3350 | goto phase_ins1; |
3468 | } | 3351 | } |
3469 | tmport -= 0x08; | 3352 | while ((inb(wkport + 0x17) & 0x80) == 0x00); |
3470 | while ((inb(tmport) & 0x80) == 0x00); | 3353 | j = inb(wkport + 0x17); |
3471 | j = inb(tmport); | ||
3472 | if (j == 0x85) { | 3354 | if (j == 0x85) { |
3473 | goto tar_dcons; | 3355 | goto tar_dcons; |
3474 | } | 3356 | } |
@@ -3484,18 +3366,13 @@ phase_ins1: | |||
3484 | } | 3366 | } |
3485 | continue; | 3367 | continue; |
3486 | phase_cmds: | 3368 | phase_cmds: |
3487 | tmport = wkport + 0x10; | 3369 | outb(0x30, wkport + 0x10); |
3488 | outb(0x30, tmport); | ||
3489 | tar_dcons: | 3370 | tar_dcons: |
3490 | tmport = wkport + 0x14; | 3371 | outb(0x00, wkport + 0x14); |
3491 | outb(0x00, tmport); | 3372 | outb(0x08, wkport + 0x18); |
3492 | tmport += 0x04; | 3373 | while ((inb(wkport + 0x1f) & 0x80) == 0x00) |
3493 | outb(0x08, tmport); | ||
3494 | tmport += 0x07; | ||
3495 | while ((inb(tmport) & 0x80) == 0x00) | ||
3496 | cpu_relax(); | 3374 | cpu_relax(); |
3497 | tmport -= 0x08; | 3375 | j = inb(wkport + 0x17); |
3498 | j = inb(tmport); | ||
3499 | if (j != 0x16) { | 3376 | if (j != 0x16) { |
3500 | continue; | 3377 | continue; |
3501 | } | 3378 | } |
@@ -3542,8 +3419,7 @@ tar_dcons: | |||
3542 | printk("dev->id[%2d][%2d].devsp = %2x\n",c,i,dev->id[c][i].devsp); | 3419 | printk("dev->id[%2d][%2d].devsp = %2x\n",c,i,dev->id[c][i].devsp); |
3543 | #endif | 3420 | #endif |
3544 | } | 3421 | } |
3545 | tmport = wkport + 0x16; | 3422 | outb(0x80, wkport + 0x16); |
3546 | outb(0x80, tmport); | ||
3547 | } | 3423 | } |
3548 | 3424 | ||
3549 | module_init(atp870u_init); | 3425 | module_init(atp870u_init); |