z90hardware.c
来自「优龙2410linux2.6.8内核源代码」· C语言 代码 · 共 2,185 行 · 第 1/4 页
C
2,185 行
static struct function_and_rules_block static_pkd_function_and_rulesX = { {0x50,0x44}, {0x00,0x0A}, {'P','K','C','S','-','1','.','2'}};static struct function_and_rules_block static_pke_function_and_rulesX = { {0x50,0x4B}, {0x00,0x0A}, {'Z','E','R','O','-','P','A','D'}};struct T6_keyBlock_hdrX { unsigned short blen; unsigned short ulen; unsigned char flags[2];};static unsigned char static_pad[256] = {0x1B,0x7B,0x5D,0xB5,0x75,0x01,0x3D,0xFD,0x8D,0xD1,0xC7,0x03,0x2D,0x09,0x23,0x57,0x89,0x49,0xB9,0x3F,0xBB,0x99,0x41,0x5B,0x75,0x21,0x7B,0x9D,0x3B,0x6B,0x51,0x39,0xBB,0x0D,0x35,0xB9,0x89,0x0F,0x93,0xA5,0x0B,0x47,0xF1,0xD3,0xBB,0xCB,0xF1,0x9D,0x23,0x73,0x71,0xFF,0xF3,0xF5,0x45,0xFB,0x61,0x29,0x23,0xFD,0xF1,0x29,0x3F,0x7F,0x17,0xB7,0x1B,0xA9,0x19,0xBD,0x57,0xA9,0xD7,0x95,0xA3,0xCB,0xED,0x1D,0xDB,0x45,0x7D,0x11,0xD1,0x51,0x1B,0xED,0x71,0xE9,0xB1,0xD1,0xAB,0xAB,0x21,0x2B,0x1B,0x9F,0x3B,0x9F,0xF7,0xF7,0xBD,0x63,0xEB,0xAD,0xDF,0xB3,0x6F,0x5B,0xDB,0x8D,0xA9,0x5D,0xE3,0x7D,0x77,0x49,0x47,0xF5,0xA7,0xFD,0xAB,0x2F,0x27,0x35,0x77,0xD3,0x49,0xC9,0x09,0xEB,0xB1,0xF9,0xBF,0x4B,0xCB,0x2B,0xEB,0xEB,0x05,0xFF,0x7D,0xC7,0x91,0x8B,0x09,0x83,0xB9,0xB9,0x69,0x33,0x39,0x6B,0x79,0x75,0x19,0xBF,0xBB,0x07,0x1D,0xBD,0x29,0xBF,0x39,0x95,0x93,0x1D,0x35,0xC7,0xC9,0x4D,0xE5,0x97,0x0B,0x43,0x9B,0xF1,0x16,0x93,0x03,0x1F,0xA5,0xFB,0xDB,0xF3,0x27,0x4F,0x27,0x61,0x05,0x1F,0xB9,0x23,0x2F,0xC3,0x81,0xA9,0x23,0x71,0x55,0x55,0xEB,0xED,0x41,0xE5,0xF3,0x11,0xF1,0x43,0x69,0x03,0xBD,0x0B,0x37,0x0F,0x51,0x8F,0x0B,0xB5,0x89,0x5B,0x67,0xA9,0xD9,0x4F,0x01,0xF9,0x21,0x77,0x37,0x73,0x79,0xC5,0x7F,0x51,0xC1,0xCF,0x97,0xA1,0x75,0xAD,0x35,0x9D,0xD3,0xD3,0xA7,0x9D,0x5D,0x41,0x6F,0x65,0x1B,0xCF,0xA9,0x87,0x91,0x09};static struct cca_private_ext_ME static_pvt_me_key = { { 0x1E, 0x00, 0x0183, {0x00,0x00,0x00,0x00} }, { 0x02, 0x00, 0x016C, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00}, 0x00, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00}, {0x80,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }, { 0x04, 0x00, 0x000F, {0x00,0x00}, 0x0003, 0x0000, 0x0000, {0x01,0x00,0x01} }};static struct cca_public_key static_public_key = { { 0x1E, 0x00, 0x0000, {0x00,0x00,0x00,0x00} }, { 0x04, 0x00, 0x0000, {0x00,0x00}, 0x0000, 0x0000, 0x0000, {0x01,0x00,0x01} }};#define FIXED_TYPE6_ME_LEN 0x0000025F#define FIXED_TYPE6_ME_EN_LEN 0x000000F0#define FIXED_TYPE6_ME_LENX 0x000002CB#define FIXED_TYPE6_ME_EN_LENX 0x0000015Cstatic struct cca_public_sec static_cca_pub_sec = { 0x04, 0x00, 0x000f, {0x00,0x00}, 0x0003, 0x0000, 0x0000, {0x01,0x00,0x01}};#define FIXED_TYPE6_CR_LEN 0x00000177#define FIXED_TYPE6_CR_LENX 0x000001E3#ifndef MAX_RESPONSE_SIZE#define MAX_RESPONSE_SIZE 0x00000710#define MAX_RESPONSEX_SIZE 0x0000077C#endif#define RESPONSE_CPRB_SIZE 0x000006B8#define RESPONSE_CPRBX_SIZE 0x00000724#define CALLER_HEADER 12static unsigned char static_PKE_function_code[2] = {0x50, 0x4B};static inline inttestq(int q_nr, int *q_depth, int *dev_type, struct ap_status_word *stat){ int ccode; asm volatile#ifdef __s390x__ (" llgfr 0,%4 \n" " slgr 1,1 \n" " lgr 2,1 \n" "0: .long 0xb2af0000 \n" "1: ipm %0 \n" " srl %0,28 \n" " iihh %0,0 \n" " iihl %0,0 \n" " lgr %1,1 \n" " lgr %3,2 \n" " srl %3,24 \n" " sll 2,24 \n" " srl 2,24 \n" " lgr %2,2 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h5 \n" " jg 2b \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 8 \n" " .quad 0b,3b \n" " .quad 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat),"=d" (*q_depth), "=d" (*dev_type) :"d" (q_nr), "K" (DEV_TSQ_EXCEPTION) :"cc","0","1","2","memory");#else (" lr 0,%4 \n" " slr 1,1 \n" " lr 2,1 \n" "0: .long 0xb2af0000 \n" "1: ipm %0 \n" " srl %0,28 \n" " lr %1,1 \n" " lr %3,2 \n" " srl %3,24 \n" " sll 2,24 \n" " srl 2,24 \n" " lr %2,2 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h5 \n" " bras 1,4f \n" " .long 2b \n" "4: \n" " l 1,0(1) \n" " br 1 \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 4 \n" " .long 0b,3b \n" " .long 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat),"=d" (*q_depth), "=d" (*dev_type) :"d" (q_nr), "K" (DEV_TSQ_EXCEPTION) :"cc","0","1","2","memory");#endif return ccode;}static inline intresetq(int q_nr, struct ap_status_word *stat_p){ int ccode; asm volatile#ifdef __s390x__ (" llgfr 0,%2 \n" " lghi 1,1 \n" " sll 1,24 \n" " or 0,1 \n" " slgr 1,1 \n" " lgr 2,1 \n" "0: .long 0xb2af0000 \n" "1: ipm %0 \n" " srl %0,28 \n" " iihh %0,0 \n" " iihl %0,0 \n" " lgr %1,1 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h3 \n" " jg 2b \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 8 \n" " .quad 0b,3b \n" " .quad 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat_p) :"d" (q_nr), "K" (DEV_RSQ_EXCEPTION) :"cc","0","1","2","memory");#else (" lr 0,%2 \n" " lhi 1,1 \n" " sll 1,24 \n" " or 0,1 \n" " slr 1,1 \n" " lr 2,1 \n" "0: .long 0xb2af0000 \n" "1: ipm %0 \n" " srl %0,28 \n" " lr %1,1 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h3 \n" " bras 1,4f \n" " .long 2b \n" "4: \n" " l 1,0(1) \n" " br 1 \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 4 \n" " .long 0b,3b \n" " .long 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat_p) :"d" (q_nr), "K" (DEV_RSQ_EXCEPTION) :"cc","0","1","2","memory");#endif return ccode;}static inline intsen(int msg_len, unsigned char *msg_ext, struct ap_status_word *stat){ int ccode; asm volatile#ifdef __s390x__ (" lgr 6,%3 \n" " llgfr 7,%2 \n" " llgt 0,0(6) \n" " lghi 1,64 \n" " sll 1,24 \n" " or 0,1 \n" " la 6,4(6) \n" " llgt 2,0(6) \n" " llgt 3,4(6) \n" " la 6,8(6) \n" " slr 1,1 \n" "0: .long 0xb2ad0026 \n" "1: brc 2,0b \n" " ipm %0 \n" " srl %0,28 \n" " iihh %0,0 \n" " iihl %0,0 \n" " lgr %1,1 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h4 \n" " jg 2b \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 8 \n" " .quad 0b,3b \n" " .quad 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat) :"d" (msg_len),"a" (msg_ext), "K" (DEV_SEN_EXCEPTION) :"cc","0","1","2","3","6","7","memory");#else (" lr 6,%3 \n" " lr 7,%2 \n" " l 0,0(6) \n" " lhi 1,64 \n" " sll 1,24 \n" " or 0,1 \n" " la 6,4(6) \n" " l 2,0(6) \n" " l 3,4(6) \n" " la 6,8(6) \n" " slr 1,1 \n" "0: .long 0xb2ad0026 \n" "1: brc 2,0b \n" " ipm %0 \n" " srl %0,28 \n" " lr %1,1 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h4 \n" " bras 1,4f \n" " .long 2b \n" "4: \n" " l 1,0(1) \n" " br 1 \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 4 \n" " .long 0b,3b \n" " .long 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat) :"d" (msg_len),"a" (msg_ext), "K" (DEV_SEN_EXCEPTION) :"cc","0","1","2","3","6","7","memory");#endif return ccode;}static inline intrec(int q_nr, int buff_l, unsigned char *rsp, unsigned char *id, struct ap_status_word *st){ int ccode; asm volatile#ifdef __s390x__ (" llgfr 0,%2 \n" " lgr 3,%4 \n" " lgr 6,%3 \n" " llgfr 7,%5 \n" " lghi 1,128 \n" " sll 1,24 \n" " or 0,1 \n" " slgr 1,1 \n" " lgr 2,1 \n" " lgr 4,1 \n" " lgr 5,1 \n" "0: .long 0xb2ae0046 \n" "1: brc 2,0b \n" " brc 4,0b \n" " ipm %0 \n" " srl %0,28 \n" " iihh %0,0 \n" " iihl %0,0 \n" " lgr %1,1 \n" " st 4,0(3) \n" " st 5,4(3) \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h6 \n" " jg 2b \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 8 \n" " .quad 0b,3b \n" " .quad 1b,3b \n" ".previous" :"=d"(ccode),"=d"(*st) :"d" (q_nr), "d" (rsp), "d" (id), "d" (buff_l), "K" (DEV_REC_EXCEPTION) :"cc","0","1","2","3","4","5","6","7","memory");#else (" lr 0,%2 \n" " lr 3,%4 \n" " lr 6,%3 \n" " lr 7,%5 \n" " lhi 1,128 \n" " sll 1,24 \n" " or 0,1 \n" " slr 1,1 \n" " lr 2,1 \n" " lr 4,1 \n" " lr 5,1 \n" "0: .long 0xb2ae0046 \n" "1: brc 2,0b \n" " brc 4,0b \n" " ipm %0 \n" " srl %0,28 \n" " lr %1,1 \n" " st 4,0(3) \n" " st 5,4(3) \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h6 \n" " bras 1,4f \n" " .long 2b \n" "4: \n" " l 1,0(1) \n" " br 1 \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 4 \n" " .long 0b,3b \n" " .long 1b,3b \n" ".previous" :"=d"(ccode),"=d"(*st) :"d" (q_nr), "d" (rsp), "d" (id), "d" (buff_l), "K" (DEV_REC_EXCEPTION) :"cc","0","1","2","3","4","5","6","7","memory");#endif return ccode;}static inline voiditoLe2(int *i_p, unsigned char *lechars){ *lechars = *((unsigned char *) i_p + sizeof(int) - 1); *(lechars + 1) = *((unsigned char *) i_p + sizeof(int) - 2);}static inline voidle2toI(unsigned char *lechars, int *i_p){ unsigned char *ic_p; *i_p = 0; ic_p = (unsigned char *) i_p; *(ic_p + 2) = *(lechars + 1); *(ic_p + 3) = *(lechars);}static inline intis_empty(unsigned char *ptr, int len){ return !memcmp(ptr, (unsigned char *) &static_pvt_me_key+60, len);}enum hdstatquery_online(int deviceNr, int cdx, int resetNr, int *q_depth, int *dev_type){ int q_nr, i, t_depth, t_dev_type; enum devstat ccode; struct ap_status_word stat_word; enum hdstat stat; int break_out; q_nr = (deviceNr << SKIP_BITL) + cdx; stat = HD_BUSY; ccode = testq(q_nr, &t_depth, &t_dev_type, &stat_word); PDEBUG("ccode %d response_code %02X\n", ccode, stat_word.response_code); break_out = 0; for (i = 0; i < resetNr; i++) { if (ccode > 3) { PRINTKC("Exception testing device %d\n", i); return HD_TSQ_EXCEPTION; } switch (ccode) { case 0: PDEBUG("t_dev_type %d\n", t_dev_type); break_out = 1; stat = HD_ONLINE; *q_depth = t_depth + 1; switch (t_dev_type) { case OTHER_HW: case OTHER2_HW: stat = HD_NOT_THERE; *dev_type = NILDEV; break; case PCICA_HW: *dev_type = PCICA; break; case PCICC_HW: *dev_type = PCICC; break; case PCIXCC_HW: *dev_type = PCIXCC; break; default: *dev_type = NILDEV; break; } PDEBUG("available device %d: Q depth = %d, dev " "type = %d, stat = %02X%02X%02X%02X\n", deviceNr, *q_depth, *dev_type, stat_word.q_stat_flags, stat_word.response_code, stat_word.reserved[0], stat_word.reserved[1]); break; case 3: switch (stat_word.response_code) { case AP_RESPONSE_NORMAL: stat = HD_ONLINE;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?