Index: stable/10/sys/arm/arm/disassem.c =================================================================== --- stable/10/sys/arm/arm/disassem.c (revision 279466) +++ stable/10/sys/arm/arm/disassem.c (revision 279467) @@ -1,693 +1,693 @@ /* $NetBSD: disassem.c,v 1.14 2003/03/27 16:58:36 mycroft Exp $ */ /*- * Copyright (c) 1996 Mark Brinicombe. * Copyright (c) 1996 Brini. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Brini. * 4. The name of the company nor the name of the author may be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * RiscBSD kernel project * * db_disasm.c * * Kernel disassembler * * Created : 10/02/96 * * Structured after the sparc/sparc/db_disasm.c by David S. Miller & * Paul Kranenburg * * This code is not complete. Not all instructions are disassembled. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include /* * General instruction format * * insn[cc][mod] [operands] * * Those fields with an uppercase format code indicate that the field * follows directly after the instruction before the separator i.e. * they modify the instruction rather than just being an operand to * the instruction. The only exception is the writeback flag which * follows a operand. * * * 2 - print Operand 2 of a data processing instruction * d - destination register (bits 12-15) * n - n register (bits 16-19) * s - s register (bits 8-11) * o - indirect register rn (bits 16-19) (used by swap) * m - m register (bits 0-3) * a - address operand of ldr/str instruction * l - register list for ldm/stm instruction * f - 1st fp operand (register) (bits 12-14) * g - 2nd fp operand (register) (bits 16-18) * h - 3rd fp operand (register/immediate) (bits 0-4) * b - branch address * t - thumb branch address (bits 24, 0-23) * k - breakpoint comment (bits 0-3, 8-19) * X - block transfer type * Y - block transfer type (r13 base) * c - comment field bits(0-23) * p - saved or current status register * F - PSR transfer fields * D - destination-is-r15 (P) flag on TST, TEQ, CMP, CMN * L - co-processor transfer size * S - set status flag * P - fp precision * Q - fp precision (for ldf/stf) * R - fp rounding * v - co-processor data transfer registers + addressing mode * W - writeback flag * x - instruction in hex * # - co-processor number * y - co-processor data processing registers * z - co-processor register transfer registers */ struct arm32_insn { u_int mask; u_int pattern; char* name; char* format; }; static const struct arm32_insn arm32_i[] = { { 0x0fffffff, 0x0ff00000, "imb", "c" }, /* Before swi */ { 0x0fffffff, 0x0ff00001, "imbrange", "c" }, /* Before swi */ { 0x0f000000, 0x0f000000, "swi", "c" }, { 0xfe000000, 0xfa000000, "blx", "t" }, /* Before b and bl */ { 0x0f000000, 0x0a000000, "b", "b" }, { 0x0f000000, 0x0b000000, "bl", "b" }, { 0x0fe000f0, 0x00000090, "mul", "Snms" }, { 0x0fe000f0, 0x00200090, "mla", "Snmsd" }, { 0x0fe000f0, 0x00800090, "umull", "Sdnms" }, { 0x0fe000f0, 0x00c00090, "smull", "Sdnms" }, { 0x0fe000f0, 0x00a00090, "umlal", "Sdnms" }, { 0x0fe000f0, 0x00e00090, "smlal", "Sdnms" }, { 0x0d700000, 0x04200000, "strt", "daW" }, { 0x0d700000, 0x04300000, "ldrt", "daW" }, { 0x0d700000, 0x04600000, "strbt", "daW" }, { 0x0d700000, 0x04700000, "ldrbt", "daW" }, { 0x0c500000, 0x04000000, "str", "daW" }, { 0x0c500000, 0x04100000, "ldr", "daW" }, { 0x0c500000, 0x04400000, "strb", "daW" }, { 0x0c500000, 0x04500000, "ldrb", "daW" }, #if __ARM_ARCH >= 6 { 0xffffffff, 0xf57ff01f, "clrex", "c" }, { 0x0ff00ff0, 0x01800f90, "strex", "dmo" }, { 0x0ff00fff, 0x01900f9f, "ldrex", "do" }, { 0x0ff00ff0, 0x01a00f90, "strexd", "dmo" }, { 0x0ff00fff, 0x01b00f9f, "ldrexd", "do" }, { 0x0ff00ff0, 0x01c00f90, "strexb", "dmo" }, { 0x0ff00fff, 0x01d00f9f, "ldrexb", "do" }, { 0x0ff00ff0, 0x01e00f90, "strexh", "dmo" }, { 0x0ff00fff, 0x01f00f9f, "ldrexh", "do" }, #endif { 0x0e1f0000, 0x080d0000, "stm", "YnWl" },/* separate out r13 base */ { 0x0e1f0000, 0x081d0000, "ldm", "YnWl" },/* separate out r13 base */ { 0x0e100000, 0x08000000, "stm", "XnWl" }, { 0x0e100000, 0x08100000, "ldm", "XnWl" }, { 0x0e1000f0, 0x00100090, "ldrb", "de" }, { 0x0e1000f0, 0x00000090, "strb", "de" }, { 0x0e1000f0, 0x001000d0, "ldrsb", "de" }, { 0x0e1000f0, 0x001000b0, "ldrh", "de" }, { 0x0e1000f0, 0x000000b0, "strh", "de" }, { 0x0e1000f0, 0x001000f0, "ldrsh", "de" }, { 0x0f200090, 0x00200090, "und", "x" }, /* Before data processing */ { 0x0e1000d0, 0x000000d0, "und", "x" }, /* Before data processing */ { 0x0ff00ff0, 0x01000090, "swp", "dmo" }, { 0x0ff00ff0, 0x01400090, "swpb", "dmo" }, { 0x0fbf0fff, 0x010f0000, "mrs", "dp" }, /* Before data processing */ { 0x0fb0fff0, 0x0120f000, "msr", "pFm" },/* Before data processing */ { 0x0fb0f000, 0x0320f000, "msr", "pF2" },/* Before data processing */ { 0x0ffffff0, 0x012fff10, "bx", "m" }, { 0x0fff0ff0, 0x016f0f10, "clz", "dm" }, { 0x0ffffff0, 0x012fff30, "blx", "m" }, { 0xfff000f0, 0xe1200070, "bkpt", "k" }, { 0x0de00000, 0x00000000, "and", "Sdn2" }, { 0x0de00000, 0x00200000, "eor", "Sdn2" }, { 0x0de00000, 0x00400000, "sub", "Sdn2" }, { 0x0de00000, 0x00600000, "rsb", "Sdn2" }, { 0x0de00000, 0x00800000, "add", "Sdn2" }, { 0x0de00000, 0x00a00000, "adc", "Sdn2" }, { 0x0de00000, 0x00c00000, "sbc", "Sdn2" }, { 0x0de00000, 0x00e00000, "rsc", "Sdn2" }, { 0x0df00000, 0x01100000, "tst", "Dn2" }, { 0x0df00000, 0x01300000, "teq", "Dn2" }, { 0x0de00000, 0x01400000, "cmp", "Dn2" }, { 0x0de00000, 0x01600000, "cmn", "Dn2" }, { 0x0de00000, 0x01800000, "orr", "Sdn2" }, { 0x0de00000, 0x01a00000, "mov", "Sd2" }, { 0x0de00000, 0x01c00000, "bic", "Sdn2" }, { 0x0de00000, 0x01e00000, "mvn", "Sd2" }, { 0x0ff08f10, 0x0e000100, "adf", "PRfgh" }, { 0x0ff08f10, 0x0e100100, "muf", "PRfgh" }, { 0x0ff08f10, 0x0e200100, "suf", "PRfgh" }, { 0x0ff08f10, 0x0e300100, "rsf", "PRfgh" }, { 0x0ff08f10, 0x0e400100, "dvf", "PRfgh" }, { 0x0ff08f10, 0x0e500100, "rdf", "PRfgh" }, { 0x0ff08f10, 0x0e600100, "pow", "PRfgh" }, { 0x0ff08f10, 0x0e700100, "rpw", "PRfgh" }, { 0x0ff08f10, 0x0e800100, "rmf", "PRfgh" }, { 0x0ff08f10, 0x0e900100, "fml", "PRfgh" }, { 0x0ff08f10, 0x0ea00100, "fdv", "PRfgh" }, { 0x0ff08f10, 0x0eb00100, "frd", "PRfgh" }, { 0x0ff08f10, 0x0ec00100, "pol", "PRfgh" }, { 0x0f008f10, 0x0e000100, "fpbop", "PRfgh" }, { 0x0ff08f10, 0x0e008100, "mvf", "PRfh" }, { 0x0ff08f10, 0x0e108100, "mnf", "PRfh" }, { 0x0ff08f10, 0x0e208100, "abs", "PRfh" }, { 0x0ff08f10, 0x0e308100, "rnd", "PRfh" }, { 0x0ff08f10, 0x0e408100, "sqt", "PRfh" }, { 0x0ff08f10, 0x0e508100, "log", "PRfh" }, { 0x0ff08f10, 0x0e608100, "lgn", "PRfh" }, { 0x0ff08f10, 0x0e708100, "exp", "PRfh" }, { 0x0ff08f10, 0x0e808100, "sin", "PRfh" }, { 0x0ff08f10, 0x0e908100, "cos", "PRfh" }, { 0x0ff08f10, 0x0ea08100, "tan", "PRfh" }, { 0x0ff08f10, 0x0eb08100, "asn", "PRfh" }, { 0x0ff08f10, 0x0ec08100, "acs", "PRfh" }, { 0x0ff08f10, 0x0ed08100, "atn", "PRfh" }, { 0x0f008f10, 0x0e008100, "fpuop", "PRfh" }, { 0x0e100f00, 0x0c000100, "stf", "QLv" }, { 0x0e100f00, 0x0c100100, "ldf", "QLv" }, { 0x0ff00f10, 0x0e000110, "flt", "PRgd" }, { 0x0ff00f10, 0x0e100110, "fix", "PRdh" }, { 0x0ff00f10, 0x0e200110, "wfs", "d" }, { 0x0ff00f10, 0x0e300110, "rfs", "d" }, { 0x0ff00f10, 0x0e400110, "wfc", "d" }, { 0x0ff00f10, 0x0e500110, "rfc", "d" }, { 0x0ff0ff10, 0x0e90f110, "cmf", "PRgh" }, { 0x0ff0ff10, 0x0eb0f110, "cnf", "PRgh" }, { 0x0ff0ff10, 0x0ed0f110, "cmfe", "PRgh" }, { 0x0ff0ff10, 0x0ef0f110, "cnfe", "PRgh" }, { 0xff100010, 0xfe000010, "mcr2", "#z" }, { 0x0f100010, 0x0e000010, "mcr", "#z" }, { 0xff100010, 0xfe100010, "mrc2", "#z" }, { 0x0f100010, 0x0e100010, "mrc", "#z" }, { 0xff000010, 0xfe000000, "cdp2", "#y" }, { 0x0f000010, 0x0e000000, "cdp", "#y" }, { 0xfe100090, 0xfc100000, "ldc2", "L#v" }, { 0x0e100090, 0x0c100000, "ldc", "L#v" }, { 0xfe100090, 0xfc000000, "stc2", "L#v" }, { 0x0e100090, 0x0c000000, "stc", "L#v" }, { 0x00000000, 0x00000000, NULL, NULL } }; static char const arm32_insn_conditions[][4] = { "eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", "hi", "ls", "ge", "lt", "gt", "le", "", "nv" }; static char const insn_block_transfers[][4] = { "da", "ia", "db", "ib" }; static char const insn_stack_block_transfers[][4] = { "ed", "ea", "fd", "fa" }; static char const op_shifts[][4] = { "lsl", "lsr", "asr", "ror" }; static char const insn_fpa_rounding[][2] = { "", "p", "m", "z" }; static char const insn_fpa_precision[][2] = { "s", "d", "e", "p" }; static char const insn_fpaconstants[][8] = { "0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "0.5", "10.0" }; #define insn_condition(x) arm32_insn_conditions[(x >> 28) & 0x0f] #define insn_blktrans(x) insn_block_transfers[(x >> 23) & 3] #define insn_stkblktrans(x) insn_stack_block_transfers[(x >> 23) & 3] #define op2_shift(x) op_shifts[(x >> 5) & 3] #define insn_fparnd(x) insn_fpa_rounding[(x >> 5) & 0x03] #define insn_fpaprec(x) insn_fpa_precision[(((x >> 18) & 2)|(x >> 7)) & 1] #define insn_fpaprect(x) insn_fpa_precision[(((x >> 21) & 2)|(x >> 15)) & 1] #define insn_fpaimm(x) insn_fpaconstants[x & 0x07] /* Local prototypes */ static void disasm_register_shift(const disasm_interface_t *di, u_int insn); static void disasm_print_reglist(const disasm_interface_t *di, u_int insn); static void disasm_insn_ldrstr(const disasm_interface_t *di, u_int insn, u_int loc); static void disasm_insn_ldrhstrh(const disasm_interface_t *di, u_int insn, u_int loc); static void disasm_insn_ldcstc(const disasm_interface_t *di, u_int insn, u_int loc); static u_int disassemble_readword(u_int address); static void disassemble_printaddr(u_int address); vm_offset_t disasm(const disasm_interface_t *di, vm_offset_t loc, int altfmt) { - struct arm32_insn *i_ptr = (struct arm32_insn *)&arm32_i; + const struct arm32_insn *i_ptr = arm32_i; u_int insn; int matchp; int branch; char* f_ptr; int fmt; fmt = 0; matchp = 0; insn = di->di_readword(loc); /* di->di_printf("loc=%08x insn=%08x : ", loc, insn);*/ while (i_ptr->name) { if ((insn & i_ptr->mask) == i_ptr->pattern) { matchp = 1; break; } i_ptr++; } if (!matchp) { di->di_printf("und%s\t%08x\n", insn_condition(insn), insn); return(loc + INSN_SIZE); } /* If instruction forces condition code, don't print it. */ if ((i_ptr->mask & 0xf0000000) == 0xf0000000) di->di_printf("%s", i_ptr->name); else di->di_printf("%s%s", i_ptr->name, insn_condition(insn)); f_ptr = i_ptr->format; /* Insert tab if there are no instruction modifiers */ if (*(f_ptr) < 'A' || *(f_ptr) > 'Z') { ++fmt; di->di_printf("\t"); } while (*f_ptr) { switch (*f_ptr) { /* 2 - print Operand 2 of a data processing instruction */ case '2': if (insn & 0x02000000) { int rotate= ((insn >> 7) & 0x1e); di->di_printf("#0x%08x", (insn & 0xff) << (32 - rotate) | (insn & 0xff) >> rotate); } else { disasm_register_shift(di, insn); } break; /* d - destination register (bits 12-15) */ case 'd': di->di_printf("r%d", ((insn >> 12) & 0x0f)); break; /* D - insert 'p' if Rd is R15 */ case 'D': if (((insn >> 12) & 0x0f) == 15) di->di_printf("p"); break; /* n - n register (bits 16-19) */ case 'n': di->di_printf("r%d", ((insn >> 16) & 0x0f)); break; /* s - s register (bits 8-11) */ case 's': di->di_printf("r%d", ((insn >> 8) & 0x0f)); break; /* o - indirect register rn (bits 16-19) (used by swap) */ case 'o': di->di_printf("[r%d]", ((insn >> 16) & 0x0f)); break; /* m - m register (bits 0-4) */ case 'm': di->di_printf("r%d", ((insn >> 0) & 0x0f)); break; /* a - address operand of ldr/str instruction */ case 'a': disasm_insn_ldrstr(di, insn, loc); break; /* e - address operand of ldrh/strh instruction */ case 'e': disasm_insn_ldrhstrh(di, insn, loc); break; /* l - register list for ldm/stm instruction */ case 'l': disasm_print_reglist(di, insn); break; /* f - 1st fp operand (register) (bits 12-14) */ case 'f': di->di_printf("f%d", (insn >> 12) & 7); break; /* g - 2nd fp operand (register) (bits 16-18) */ case 'g': di->di_printf("f%d", (insn >> 16) & 7); break; /* h - 3rd fp operand (register/immediate) (bits 0-4) */ case 'h': if (insn & (1 << 3)) di->di_printf("#%s", insn_fpaimm(insn)); else di->di_printf("f%d", insn & 7); break; /* b - branch address */ case 'b': branch = ((insn << 2) & 0x03ffffff); if (branch & 0x02000000) branch |= 0xfc000000; di->di_printaddr(loc + 8 + branch); break; /* t - blx address */ case 't': branch = ((insn << 2) & 0x03ffffff) | (insn >> 23 & 0x00000002); if (branch & 0x02000000) branch |= 0xfc000000; di->di_printaddr(loc + 8 + branch); break; /* X - block transfer type */ case 'X': di->di_printf("%s", insn_blktrans(insn)); break; /* Y - block transfer type (r13 base) */ case 'Y': di->di_printf("%s", insn_stkblktrans(insn)); break; /* c - comment field bits(0-23) */ case 'c': di->di_printf("0x%08x", (insn & 0x00ffffff)); break; /* k - breakpoint comment (bits 0-3, 8-19) */ case 'k': di->di_printf("0x%04x", (insn & 0x000fff00) >> 4 | (insn & 0x0000000f)); break; /* p - saved or current status register */ case 'p': if (insn & 0x00400000) di->di_printf("spsr"); else di->di_printf("cpsr"); break; /* F - PSR transfer fields */ case 'F': di->di_printf("_"); if (insn & (1 << 16)) di->di_printf("c"); if (insn & (1 << 17)) di->di_printf("x"); if (insn & (1 << 18)) di->di_printf("s"); if (insn & (1 << 19)) di->di_printf("f"); break; /* B - byte transfer flag */ case 'B': if (insn & 0x00400000) di->di_printf("b"); break; /* L - co-processor transfer size */ case 'L': if (insn & (1 << 22)) di->di_printf("l"); break; /* S - set status flag */ case 'S': if (insn & 0x00100000) di->di_printf("s"); break; /* P - fp precision */ case 'P': di->di_printf("%s", insn_fpaprec(insn)); break; /* Q - fp precision (for ldf/stf) */ case 'Q': break; /* R - fp rounding */ case 'R': di->di_printf("%s", insn_fparnd(insn)); break; /* W - writeback flag */ case 'W': if (insn & (1 << 21)) di->di_printf("!"); break; /* # - co-processor number */ case '#': di->di_printf("p%d", (insn >> 8) & 0x0f); break; /* v - co-processor data transfer registers+addressing mode */ case 'v': disasm_insn_ldcstc(di, insn, loc); break; /* x - instruction in hex */ case 'x': di->di_printf("0x%08x", insn); break; /* y - co-processor data processing registers */ case 'y': di->di_printf("%d, ", (insn >> 20) & 0x0f); di->di_printf("c%d, c%d, c%d", (insn >> 12) & 0x0f, (insn >> 16) & 0x0f, insn & 0x0f); di->di_printf(", %d", (insn >> 5) & 0x07); break; /* z - co-processor register transfer registers */ case 'z': di->di_printf("%d, ", (insn >> 21) & 0x07); di->di_printf("r%d, c%d, c%d, %d", (insn >> 12) & 0x0f, (insn >> 16) & 0x0f, insn & 0x0f, (insn >> 5) & 0x07); /* if (((insn >> 5) & 0x07) != 0) di->di_printf(", %d", (insn >> 5) & 0x07);*/ break; default: di->di_printf("[%c - unknown]", *f_ptr); break; } if (*(f_ptr+1) >= 'A' && *(f_ptr+1) <= 'Z') ++f_ptr; else if (*(++f_ptr)) { ++fmt; if (fmt == 1) di->di_printf("\t"); else di->di_printf(", "); } }; di->di_printf("\n"); return(loc + INSN_SIZE); } static void disasm_register_shift(const disasm_interface_t *di, u_int insn) { di->di_printf("r%d", (insn & 0x0f)); if ((insn & 0x00000ff0) == 0) ; else if ((insn & 0x00000ff0) == 0x00000060) di->di_printf(", rrx"); else { if (insn & 0x10) di->di_printf(", %s r%d", op2_shift(insn), (insn >> 8) & 0x0f); else di->di_printf(", %s #%d", op2_shift(insn), (insn >> 7) & 0x1f); } } static void disasm_print_reglist(const disasm_interface_t *di, u_int insn) { int loop; int start; int comma; di->di_printf("{"); start = -1; comma = 0; for (loop = 0; loop < 17; ++loop) { if (start != -1) { if (loop == 16 || !(insn & (1 << loop))) { if (comma) di->di_printf(", "); else comma = 1; if (start == loop - 1) di->di_printf("r%d", start); else di->di_printf("r%d-r%d", start, loop - 1); start = -1; } } else { if (insn & (1 << loop)) start = loop; } } di->di_printf("}"); if (insn & (1 << 22)) di->di_printf("^"); } static void disasm_insn_ldrstr(const disasm_interface_t *di, u_int insn, u_int loc) { int offset; offset = insn & 0xfff; if ((insn & 0x032f0000) == 0x010f0000) { /* rA = pc, immediate index */ if (insn & 0x00800000) loc += offset; else loc -= offset; di->di_printaddr(loc + 8); } else { di->di_printf("[r%d", (insn >> 16) & 0x0f); if ((insn & 0x03000fff) != 0x01000000) { di->di_printf("%s, ", (insn & (1 << 24)) ? "" : "]"); if (!(insn & 0x00800000)) di->di_printf("-"); if (insn & (1 << 25)) disasm_register_shift(di, insn); else di->di_printf("#0x%03x", offset); } if (insn & (1 << 24)) di->di_printf("]"); } } static void disasm_insn_ldrhstrh(const disasm_interface_t *di, u_int insn, u_int loc) { int offset; offset = ((insn & 0xf00) >> 4) | (insn & 0xf); if ((insn & 0x004f0000) == 0x004f0000) { /* rA = pc, immediate index */ if (insn & 0x00800000) loc += offset; else loc -= offset; di->di_printaddr(loc + 8); } else { di->di_printf("[r%d", (insn >> 16) & 0x0f); if ((insn & 0x01400f0f) != 0x01400000) { di->di_printf("%s, ", (insn & (1 << 24)) ? "" : "]"); if (!(insn & 0x00800000)) di->di_printf("-"); if (insn & (1 << 22)) di->di_printf("#0x%02x", offset); else di->di_printf("r%d", (insn & 0x0f)); } if (insn & (1 << 24)) di->di_printf("]"); } } static void disasm_insn_ldcstc(const disasm_interface_t *di, u_int insn, u_int loc) { if (((insn >> 8) & 0xf) == 1) di->di_printf("f%d, ", (insn >> 12) & 0x07); else di->di_printf("c%d, ", (insn >> 12) & 0x0f); di->di_printf("[r%d", (insn >> 16) & 0x0f); di->di_printf("%s, ", (insn & (1 << 24)) ? "" : "]"); if (!(insn & (1 << 23))) di->di_printf("-"); di->di_printf("#0x%03x", (insn & 0xff) << 2); if (insn & (1 << 24)) di->di_printf("]"); if (insn & (1 << 21)) di->di_printf("!"); } static u_int disassemble_readword(u_int address) { return(*((u_int *)address)); } static void disassemble_printaddr(u_int address) { printf("0x%08x", address); } static const disasm_interface_t disassemble_di = { disassemble_readword, disassemble_printaddr, db_printf }; void disassemble(u_int address) { (void)disasm(&disassemble_di, address, 0); } /* End of disassem.c */ Index: stable/10/sys/arm/ti/am335x/am335x_scm_padconf.c =================================================================== --- stable/10/sys/arm/ti/am335x/am335x_scm_padconf.c (revision 279466) +++ stable/10/sys/arm/ti/am335x/am335x_scm_padconf.c (revision 279467) @@ -1,364 +1,364 @@ /*- * Copyright (c) 2012 Damjan Marion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define _PIN(r, b, gp, gm, m0, m1, m2, m3, m4, m5, m6, m7) \ { .reg_off = r, \ .gpio_pin = gp, \ .gpio_mode = gm, \ .ballname = b, \ .muxmodes[0] = m0, \ .muxmodes[1] = m1, \ .muxmodes[2] = m2, \ .muxmodes[3] = m3, \ .muxmodes[4] = m4, \ .muxmodes[5] = m5, \ .muxmodes[6] = m6, \ .muxmodes[7] = m7, \ } #define SLEWCTRL (0x01 << 6) /* faster(0) or slower(1) slew rate. */ #define RXACTIVE (0x01 << 5) /* Input enable value for the Pad */ #define PULLTYPESEL (0x01 << 4) /* Pad pullup/pulldown type selection */ #define PULLUDEN (0x01 << 3) /* Pullup/pulldown disabled */ #define PADCONF_OUTPUT (0) #define PADCONF_OUTPUT_PULLUP (PULLTYPESEL) #define PADCONF_INPUT (RXACTIVE | PULLUDEN) #define PADCONF_INPUT_PULLUP (RXACTIVE | PULLTYPESEL) #define PADCONF_INPUT_PULLDOWN (RXACTIVE) #define PADCONF_INPUT_PULLUP_SLOW (PADCONF_INPUT_PULLUP | SLEWCTRL) const struct ti_scm_padstate ti_padstate_devmap[] = { {"output", PADCONF_OUTPUT }, {"output_pullup", PADCONF_OUTPUT_PULLUP }, {"input", PADCONF_INPUT }, {"input_pulldown", PADCONF_INPUT_PULLDOWN }, {"input_pullup", PADCONF_INPUT_PULLUP }, {"i2c", PADCONF_INPUT_PULLUP_SLOW }, { .state = NULL } }; const struct ti_scm_padconf ti_padconf_devmap[] = { _PIN(0x800, "GPMC_AD0", 32, 7,"gpmc_ad0", "mmc1_dat0", NULL, NULL, NULL, NULL, NULL, "gpio1_0"), _PIN(0x804, "GPMC_AD1", 33, 7,"gpmc_ad1", "mmc1_dat1", NULL, NULL, NULL, NULL, NULL, "gpio1_1"), _PIN(0x808, "GPMC_AD2", 34, 7,"gpmc_ad2", "mmc1_dat2", NULL, NULL, NULL, NULL, NULL, "gpio1_2"), _PIN(0x80C, "GPMC_AD3", 35, 7,"gpmc_ad3", "mmc1_dat3", NULL, NULL, NULL, NULL, NULL, "gpio1_3"), _PIN(0x810, "GPMC_AD4", 36, 7,"gpmc_ad4", "mmc1_dat4", NULL, NULL, NULL, NULL, NULL, "gpio1_4"), _PIN(0x814, "GPMC_AD5", 37, 7,"gpmc_ad5", "mmc1_dat5", NULL, NULL, NULL, NULL, NULL, "gpio1_5"), _PIN(0x818, "GPMC_AD6", 38, 7,"gpmc_ad6", "mmc1_dat6", NULL, NULL, NULL, NULL, NULL, "gpio1_6"), _PIN(0x81C, "GPMC_AD7", 39, 7,"gpmc_ad7", "mmc1_dat7", NULL, NULL, NULL, NULL, NULL, "gpio1_7"), _PIN(0x820, "GPMC_AD8", 22, 7, "gpmc_ad8", "lcd_data23", "mmc1_dat0", "mmc2_dat4", "ehrpwm2A", NULL, NULL, "gpio0_22"), _PIN(0x824, "GPMC_AD9", 23, 7, "gpmc_ad9", "lcd_data22", "mmc1_dat1", "mmc2_dat5", "ehrpwm2B", NULL, NULL, "gpio0_23"), _PIN(0x828, "GPMC_AD10", 26, 7, "gpmc_ad10", "lcd_data21", "mmc1_dat2", "mmc2_dat6", "ehrpwm2_tripzone_in", NULL, NULL, "gpio0_26"), _PIN(0x82C, "GPMC_AD11", 27, 7, "gpmc_ad11", "lcd_data20", "mmc1_dat3", "mmc2_dat7", "ehrpwm0_synco", NULL, NULL, "gpio0_27"), _PIN(0x830, "GPMC_AD12", 44, 7, "gpmc_ad12", "lcd_data19", "mmc1_dat4", "mmc2_dat0", "eQEP2A_in", "pr1_mii0_txd2", "pr1_pru0_pru_r30_14", "gpio1_12"), _PIN(0x834, "GPMC_AD13", 45, 7, "gpmc_ad13", "lcd_data18", "mmc1_dat5", "mmc2_dat1", "eQEP2B_in", "pr1_mii0_txd1", "pr1_pru0_pru_r30_15", "gpio1_13"), _PIN(0x838, "GPMC_AD14", 46, 7, "gpmc_ad14", "lcd_data17", "mmc1_dat6", "mmc2_dat2", "eQEP2_index", "pr1_mii0_txd0", "pr1_pru0_pru_r31_14", "gpio1_14"), _PIN(0x83C, "GPMC_AD15", 47, 7, "gpmc_ad15", "lcd_data16", "mmc1_dat7", "mmc2_dat3", "eQEP2_strobe", "pr1_ecap0_ecap_capin_apwm_o", "pr1_pru0_pru_r31_15", "gpio1_15"), _PIN(0x840, "GPMC_A0", 48, 7, "gpmc_a0", "gmii2_txen", "rgmii2_tctl", "rmii2_txen", "gpmc_a16", "pr1_mii_mt1_clk", "ehrpwm1_tripzone_input", "gpio1_16"), _PIN(0x844, "GPMC_A1", 49, 7, "gpmc_a1", "gmii2_rxdv", "rgmii2_rctl", "mmc2_dat0", "gpmc_a17", "pr1_mii1_txd3", "ehrpwm0_synco", "gpio1_17"), _PIN(0x848, "GPMC_A2", 50, 7, "gpmc_a2", "gmii2_txd3", "rgmii2_td3", "mmc2_dat1", "gpmc_a18", "pr1_mii1_txd2", "ehrpwm1A", "gpio1_18"), _PIN(0x84C, "GPMC_A3", 51, 7, "gpmc_a3", "gmii2_txd2", "rgmii2_td2", "mmc2_dat2", "gpmc_a19", "pr1_mii1_txd1", "ehrpwm1B", "gpio1_19"), _PIN(0x850, "GPMC_A4", 52, 7, "gpmc_a4", "gmii2_txd1", "rgmii2_td1", "rmii2_tdx1", "gpmc_a20", "pr1_mii1_txd0", "eQEP1A_in", "gpio1_20"), _PIN(0x854, "GPMC_A5", 53, 7, "gpmc_a5", "gmii2_txd0", "rgmii2_td0", "rmii2_txd0", "gpmc_a21", "pr1_mii1_rxd3", "eQEP1B_in", "gpio1_21"), _PIN(0x858, "GPMC_A6", 54, 7, "gpmc_a6", "gmii2_txclk", "rgmii2_tclk", "mmc2_dat4", "gpmc_a22", "pr1_mii1_rxd2", "eQEP1_index", "gpio1_22"), _PIN(0x85C, "GPMC_A7", 55, 7, "gpmc_a7", "gmii2_rxclk", "rgmii2_rclk", "mmc2_dat5", "gpmc_a23", "pr1_mii1_rxd1", "eQEP1_strobe", "gpio1_23"), _PIN(0x860, "GPMC_A8", 56, 7, "gpmc_a8", "gmii2_rxd3", "rgmii2_rd3", "mmc2_dat6", "gpmc_a24", "pr1_mii1_rxd0", "mcasp0_aclkx", "gpio1_24"), _PIN(0x864, "GPMC_A9", 57, 7, "gmpc_a9", "gmii2_rxd2", "rgmii2_rd2", "mmc2_dat7 / rmii2_crs_dv", "gpmc_a25", "pr1_mii_mr1_clk", "mcasp0_fsx", "gpio1_25"), _PIN(0x868, "GPMC_A10", 58, 7, "gmpc_a10", "gmii2_rxd1", "rgmii2_rd1", "rmii2_rxd1", "gpmc_a26", "pr1_mii1_rxdv", "mcasp0_arx0", "gpio1_26"), _PIN(0x86C, "GPMC_A11", 59, 7, "gmpc_a11", "gmii2_rxd0", "rgmii2_rd0", "rmii2_rxd0", "gpmc_a27", "pr1_mii1_rxer", "mcasp0_axr1", "gpio1_27"), _PIN(0x870, "GPMC_WAIT0", 30, 7, "gpmc_wait0", "gmii2_crs", "gpmc_csn4", "rmii2_crs_dv", "mmc1_sdcd", "pr1_mii1_col", "uart4_rxd", "gpio0_30"), _PIN(0x874, "GPMC_WPn", 31, 7, "gpmc_wpn", "gmii2_rxerr", "gpmc_csn5", "rmii2_rxerr", "mmc2_sdcd", "pr1_mii1_txen", "uart4_txd", "gpio0_31"), _PIN(0x878, "GPMC_BEn1", 60, 7, "gpmc_be1n", "gmii2_col", "gmpc_csn6","mmc2_dat3", "gpmc_dir", "pr1_mii1_rxlink", "mcasp0_aclkr", "gpio1_28"), _PIN(0x87c, "GPMC_CSn0", 61, 7, "gpmc_csn0", NULL, NULL, NULL, NULL, NULL, NULL, "gpio1_29"), _PIN(0x880, "GPMC_CSn1", 62, 7, "gpmc_csn1", "gpmc_clk", "mmc1_clk", "pr1_edio_data_in6", "pr1_edio_data_out6", "pr1_pru1_pru_r30_12", "pr1_pru1_pru_r31_12", "gpio1_30"), _PIN(0x884, "GPMC_CSn2", 63, 7, "gpmc_csn2", "gpmc_be1n", "mmc1_cmd", "pr1_edio_data_in7", "pr1_edio_data_out7", "pr1_pru1_pru_r30_13", "pr1_pru1_pru_r31_13", "gpio1_31"), _PIN(0x888, "GPMC_CSn3", 64, 7, "gpmc_csn3", "gpmc_a3", "rmii2_crs_dv", "mmc2_cmd", "pr1_mii0_crs", "pr1_mdio_data", "EMU4", "gpio2_0"), _PIN(0x88c, "GPMC_CLK", 65, 7, "gpmc_clk", "lcd_memory_clk", "gpmc_wait1", "mmc2_clk", "pr1_mii1_crs", "pr1_mdio_mdclk", "mcasp0_fsr", "gpio2_1"), _PIN(0x890, "GPMC_ADVn_ALE", 66, 7, "gpmc_advn_ale", NULL, "timer4", NULL, NULL, NULL, NULL, "gpio2_2"), _PIN(0x894, "GPMC_OEn_REn", 67, 7, "gpmc_oen_ren", NULL, "timer7", NULL, NULL, NULL, NULL, "gpio2_3"), _PIN(0x898, "GPMC_WEn", 68, 7, "gpmc_wen", NULL, "timer6", NULL, NULL, NULL, NULL, "gpio2_4"), _PIN(0x89c, "GPMC_BEn0_CLE", 67, 7, "gpmc_ben0_cle", NULL, "timer5", NULL, NULL, NULL, NULL, "gpio2_5"), _PIN(0x8a0, "LCD_DATA0", 68, 7, "lcd_data0", "gpmc_a0", "pr1_mii_mt0_clk", "ehrpwm2A", NULL, "pr1_pru1_pru_r30_0", "pr1_pru1_pru_r31_0", "gpio2_6"), _PIN(0x8a4, "LCD_DATA1", 69, 7, "lcd_data1", "gpmc_a1", "pr1_mii0_txen", "ehrpwm2B", NULL, "pr1_pru1_pru_r30_1", "pr1_pru1_pru_r31_1", "gpio2_7"), _PIN(0x8a8, "LCD_DATA2", 70, 7, "lcd_data2", "gpmc_a2", "pr1_mii0_txd3", "ehrpwm2_tripzone_input", NULL, "pr1_pru1_pru_r30_2", "pr1_pru1_pru_r31_2", "gpio2_8"), _PIN(0x8ac, "LCD_DATA3", 71, 7, "lcd_data3", "gpmc_a3", "pr1_mii0_txd2", "ehrpwm0_synco", NULL, "pr1_pru1_pru_r30_3", "pr1_pru1_pru_r31_3", "gpio2_9"), _PIN(0x8b0, "LCD_DATA4", 72, 7, "lcd_data4", "gpmc_a4", "pr1_mii0_txd1", "eQEP2A_in", NULL, "pr1_pru1_pru_r30_4", "pr1_pru1_pru_r31_4", "gpio2_10"), _PIN(0x8b4, "LCD_DATA5", 73, 7, "lcd_data5", "gpmc_a5", "pr1_mii0_txd0", "eQEP2B_in", NULL, "pr1_pru1_pru_r30_5", "pr1_pru1_pru_r31_5", "gpio2_11"), _PIN(0x8b8, "LCD_DATA6", 74, 7, "lcd_data6", "gpmc_a6", "pr1_edio_data_in6", "eQEP2_index", "pr1_edio_data_out6", "pr1_pru1_pru_r30_6", "pr1_pru1_pru_r31_6", "gpio2_12"), _PIN(0x8bc, "LCD_DATA7", 75, 7, "lcd_data7", "gpmc_a7", "pr1_edio_data_in7", "eQEP2_strobe", "pr1_edio_data_out7", "pr1_pru1_pru_r30_7", "pr1_pru1_pru_r31_7", "gpio2_13"), _PIN(0x8c0, "LCD_DATA8", 76, 7, "lcd_data8", "gpmc_a12", "ehrpwm1_tripzone_input", "mcasp0_aclkx", "uart5_txd", "pr1_mii0_rxd3", "uart2_ctsn", "gpio2_14"), _PIN(0x8c4, "LCD_DATA9", 76, 7, "lcd_data9", "gpmc_a13", "ehrpwm0_synco", "mcasp0_fsx", "uart5_rxd", "pr1_mii0_rxd2", "uart2_rtsn", "gpio2_15"), _PIN(0x8c8, "LCD_DATA10", 77, 7, "lcd_data10", "gpmc_a14", "ehrpwm1A", "mcasp0_axr0", NULL, "pr1_mii0_rxd1", "uart3_ctsn", "gpio2_16"), _PIN(0x8cc, "LCD_DATA11", 78, 7, "lcd_data11", "gpmc_a15", "ehrpwm1B", "mcasp0_ahclkr", "mcasp0_axr2", "pr1_mii0_rxd0", "uart3_rtsn", "gpio2_17"), _PIN(0x8d0, "LCD_DATA12", 8, 7, "lcd_data12", "gpmc_a16", "eQEP1A_in", "mcasp0_aclkr", "mcasp0_axr2", "pr1_mii0_rxlink", "uart4_ctsn", "gpio0_8"), _PIN(0x8d4, "LCD_DATA13", 9, 7, "lcd_data13", "gpmc_a17", "eQEP1B_in", "mcasp0_fsr", "mcasp0_axr3", "pr1_mii0_rxer", "uart4_rtsn", "gpio0_9"), _PIN(0x8d8, "LCD_DATA14", 10, 7, "lcd_data14", "gpmc_a18", "eQEP1_index", "mcasp0_axr1", "uart5_rxd", "pr1_mii_mr0_clk", "uart5_ctsn", "gpio0_10"), _PIN(0x8dc, "LCD_DATA15", 11, 7, "lcd_data15", "gpmc_a19", "eQEP1_strobe", "mcasp0_ahclkx", "mcasp0_axr3", "pr1_mii0_rxdv", "uart5_rtsn", "gpio0_11"), _PIN(0x8e0, "LCD_VSYNC", 86, 7, "lcd_vsync", "gpmc_a8", "gpmc_a1", "pr1_edio_data_in2", "pr1_edio_data_out2", "pr1_pru1_pru_r30_8", "pr1_pru1_pru_r31_8", "gpio2_22"), _PIN(0x8e4, "LCD_HSYNC", 87, 7, "lcd_hsync", "gmpc_a9", "gpmc_a2", "pr1_edio_data_in3", "pr1_edio_data_out3", "pr1_pru1_pru_r30_9", "pr1_pru1_pru_r31_9", "gpio2_23"), _PIN(0x8e8, "LCD_PCLK", 88, 7, "lcd_pclk", "gpmc_a10", "pr1_mii0_crs", "pr1_edio_data_in4", "pr1_edio_data_out4", "pr1_pru1_pru_r30_10", "pr1_pru1_pru_r31_10", "gpio2_24"), _PIN(0x8ec, "LCD_AC_BIAS_EN", 89, 7, "lcd_ac_bias_en", "gpmc_a11", "pr1_mii1_crs", "pr1_edio_data_in5", "pr1_edio_data_out5", "pr1_pru1_pru_r30_11", "pr1_pru1_pru_r31_11", "gpio2_25"), _PIN(0x8f0, "MMC0_DAT3", 90, 7, "mmc0_dat3", "gpmc_a20", "uart4_ctsn", "timer5", "uart1_dcdn", "pr1_pru0_pru_r30_8", "pr1_pru0_pru_r31_8", "gpio2_26"), _PIN(0x8f4, "MMC0_DAT2", 91, 7, "mmc0_dat2", "gpmc_a21", "uart4_rtsn", "timer6", "uart1_dsrn", "pr1_pru0_pru_r30_9", "pr1_pru0_pru_r31_9", "gpio2_27"), _PIN(0x8f8, "MMC0_DAT1", 92, 7, "mmc0_dat1", "gpmc_a22", "uart5_ctsn", "uart3_rxd", "uart1_dtrn", "pr1_pru0_pru_r30_10", "pr1_pru0_pru_r31_10", "gpio2_28"), _PIN(0x8fc, "MMC0_DAT0", 93, 7, "mmc0_dat0", "gpmc_a23", "uart5_rtsn", "uart3_txd", "uart1_rin", "pr1_pru0_pru_r30_11", "pr1_pru0_pru_r31_11", "gpio2_29"), _PIN(0x900, "MMC0_CLK", 94, 7, "mmc0_clk", "gpmc_a24", "uart3_ctsn", "uart2_rxd", "dcan1_tx", "pr1_pru0_pru_r30_12", "pr1_pru0_pru_r31_12", "gpio2_30"), _PIN(0x904, "MMC0_CMD", 95, 7, "mmc0_cmd", "gpmc_a25", "uart3_rtsn", "uart2_txd", "dcan1_rx", "pr1_pru0_pru_r30_13", "pr1_pru0_pru_r31_13", "gpio2_31"), _PIN(0x908, "MII1_COL", 96, 7, "gmii1_col", "rmii2_refclk", "spi1_sclk", "uart5_rxd", "mcasp1_axr2", "mmc2_dat3", "mcasp0_axr2", "gpio3_0"), _PIN(0x90c, "MII1_CRS", 97, 7, "gmii1_crs", "rmii1_crs_dv", "spi1_d0", "I2C1_SDA", "mcasp1_aclkx", "uart5_ctsn", "uart2_rxd", "gpio3_1"), _PIN(0x910, "MII1_RX_ER", 98, 7, "gmii1_rxerr", "rmii1_rxerr", "spi1_d1", "I2C1_SCL", "mcasp1_fsx", "uart5_rtsn", "uart2_txd", "gpio3_2"), _PIN(0x914, "MII1_TX_EN", 99, 7, "gmii1_txen", "rmii1_txen", "rgmii1_tctl", "timer4", "mcasp1_axr0", "eQEP0_index", "mmc2_cmd", "gpio3_3"), _PIN(0x918, "MII1_RX_DV", 100, 7, "gmii1_rxdv", "cd_memory_clk", "rgmii1_rctl", "uart5_txd", "mcasp1_aclkx", "mmc2_dat0", "mcasp0_aclkr", "gpio3_4"), _PIN(0x91c, "MII1_TXD3", 16, 7, "gmii1_txd3", "dcan0_tx", "rgmii1_td3", "uart4_rxd", "mcasp1_fsx", "mmc2_dat1", "mcasp0_fsr", "gpio0_16"), _PIN(0x920, "MII1_TXD2", 17, 7, "gmii1_txd2", "dcan0_rx", "rgmii1_td2", "uart4_txd", "mcasp1_axr0", "mmc2_dat2", "mcasp0_ahclkx", "gpio0_17"), _PIN(0x924, "MII1_TXD1", 21, 7, "gmii1_txd1", "rmii1_txd1", "rgmii1_td1", "mcasp1_fsr", "mcasp1_axr1", "eQEP0A_in", "mmc1_cmd", "gpio0_21"), _PIN(0x928, "MII1_TXD0", 28, 7, "gmii1_txd0", "rmii1_txd0", "rgmii1_td0", "mcasp1_axr2", "mcasp1_aclkr", "eQEP0B_in", "mmc1_clk", "gpio0_28"), _PIN(0x92c, "MII1_TX_CLK", 105, 7, "gmii1_txclk", "uart2_rxd", "rgmii1_tclk", "mmc0_dat7", "mmc1_dat0", "uart1_dcdn", "mcasp0_aclkx", "gpio3_9"), _PIN(0x930, "MII1_RX_CLK", 106, 7, "gmii1_rxclk", "uart2_txd", "rgmii1_rclk", "mmc0_dat6", "mmc1_dat1", "uart1_dsrn", "mcasp0_fsx", "gpio3_10"), _PIN(0x934, "MII1_RXD3", 82, 7, "gmii1_rxd3", "uart3_rxd", "rgmii1_rd3", "mmc0_dat5", "mmc1_dat2", "uart1_dtrn", "mcasp0_axr0", "gpio2_18"), _PIN(0x938, "MII1_RXD2", 83, 7, "gmii1_rxd2", "uart3_txd", "rgmii1_rd2", "mmc0_dat4", "mmc1_dat3", "uart1_rin", "mcasp0_axr1", "gpio2_19"), _PIN(0x93c, "MII1_RXD1", 84, 7, "gmii1_rxd1", "rmii1_rxd1", "rgmii1_rd1", "mcasp1_axr3", "mcasp1_fsr", "eQEP0_strobe", "mmc2_clk", "gpio2_20"), _PIN(0x940, "MII1_RXD0", 85, 7, "gmii1_rxd0", "rmii1_rxd0", "rgmii1_rd0", "mcasp1_ahclkx", "mcasp1_ahclkr", "mcasp1_aclkr", "mcasp0_axr3", "gpio2_21"), _PIN(0x944, "RMII1_REF_CLK", 29, 7, "rmii1_refclk", "xdma_event_intr2", "spi1_cs0", "uart5_txd", "mcasp1_axr3", "mmc0_pow", "mcasp1_ahclkx", "gpio0_29"), _PIN(0x948, "MDIO", 0, 7, "mdio_data", "timer6", "uart5_rxd", "uart3_ctsn", "mmc0_sdcd","mmc1_cmd", "mmc2_cmd","gpio0_0"), _PIN(0x94c, "MDC", 1, 7, "mdio_clk", "timer5", "uart5_txd", "uart3_rtsn", "mmc0_sdwp", "mmc1_clk", "mmc2_clk", "gpio0_1"), _PIN(0x950, "SPI0_SCLK", 2, 7, "spi0_sclk", "uart2_rxd", "I2C2_SDA", "ehrpwm0A", "pr1_uart0_cts_n", "pr1_edio_sof", "EMU2", "gpio0_2"), _PIN(0x954, "SPI0_D0", 3, 7, "spi0_d0", "uart2_txd", "I2C2_SCL", "ehrpwm0B", "pr1_uart0_rts_n", "pr1_edio_latch_in", "EMU3", "gpio0_3"), _PIN(0x958, "SPI0_D1", 4, 7, "spi0_d1", "mmc1_sdwp", "I2C1_SDA", "ehrpwm0_tripzone_input", "pr1_uart0_rxd", "pr1_edio_data_in0", "pr1_edio_data_out0", "gpio0_4"), _PIN(0x95c, "SPI0_CS0", 5, 7, "spi0_cs0", "mmc2_sdwp", "I2C1_SCL", "ehrpwm0_synci", "pr1_uart0_txd", "pr1_edio_data_in1", "pr1_edio_data_out1", "gpio0_5"), _PIN(0x960, "SPI0_CS1", 6, 7, "spi0_cs1", "uart3_rxd", "eCAP1_in_PWM1_out", "mcc0_pow", "xdm_event_intr2", "mmc0_sdcd", "EMU4", "gpio0_6"), _PIN(0x964, "ECAP0_IN_PWM0_OUT",7, 7, "eCAP0_in_PWM0_out", "uart3_txd", "spi1_cs1", "pr1_ecap0_ecap_capin_apwm_o", "spi1_sclk", "mmc0_sdwp", "xdma_event_intr2", "gpio0_7"), _PIN(0x968, "UART0_CTSn", 40, 7, "uart0_ctsn", "uart4_rxd", "dcan1_tx", "I2C1_SDA", "spi1_d0", "timer7", "pr1_edc_sync0_out", "gpio1_8"), _PIN(0x96c, "UART0_RTSn", 41, 7, "uart0_rtsn", "uart4_txd", "dcan1_rx", "I2C1_SCL", "spi1_d1", "spi1_cs0", "pr1_edc_sync1_out", "gpio1_9"), _PIN(0x970, "UART0_rxd", 42, 7, "uart0_rxd", "spi1_cs0", "dcan0_tx", "I2C2_SDA", "eCAP2_in_PWM2_out", "pr1_pru1_pru_r30_14", "pr1_pru1_pru_r31_14", "gpio1_10"), _PIN(0x974, "UART0_txd", 43, 7, "uart0_txd", "spi1_cs1", "dcan0_rx", "I2C2_SCL", "eCAP1_in_PWM1_out", "pr1_pru1_pru_r30_15", "pr1_pru1_pru_r31_15", "gpio1_11"), _PIN(0x978, "UART1_CTSn", 12, 7, "uart1_ctsn", "timer6_mux1", "dcan0_tx", "I2C2_SDA", "spi1_cs0", "pr1_uart0_cts_n", "pr1_edc_latch0_in", "gpio0_12"), _PIN(0x97c, "UART1_RTSn", 13, 7, "uart1_rtsn", "timer5_mux1", "dcan0_rx", "I2C2_SCL", "spi1_cs1", "pr1_uart0_rts_n", "pr1_edc_latch1_in", "gpio0_13"), _PIN(0x980, "UART1_RXD", 14, 7, "uart1_rxd", "mmc1_sdwp", "dcan1_tx", "I2C1_SDA", NULL, "pr1_uart0_rxd", "pr1_pru1_pru_r31_16", "gpio0_14"), _PIN(0x984, "UART1_TXD", 15, 7, "uart1_txd", "mmc2_sdwp", "dcan1_rx", "I2C1_SCL", NULL, "pr1_uart0_txd", "pr1_pru0_pru_r31_16", "gpio0_15"), _PIN(0x988, "I2C0_SDA", 101, 7, "I2C0_SDA", "timer4", "uart2_ctsn", "eCAP2_in_PWM2_out", NULL, NULL, NULL, "gpio3_5"), _PIN(0x98c, "I2C0_SCL", 102, 7, "I2C0_SCL", "timer7", "uart2_rtsn", "eCAP1_in_PWM1_out", NULL, NULL, NULL, "gpio3_6"), _PIN(0x990, "MCASP0_ACLKX", 110, 7, "mcasp0_aclkx", "ehrpwm0A", NULL, "spi1_sclk", "mmc0_sdcd", "pr1_pru0_pru_r30_0", "pr1_pru0_pru_r31_0", "gpio3_14"), _PIN(0x994, "MCASP0_FSX", 111, 7, "mcasp0_fsx", "ehrpwm0B", NULL, "spi1_d0", "mmc1_sdcd", "pr1_pru0_pru_r30_1", "pr1_pru0_pru_r31_1", "gpio3_15"), _PIN(0x998, "MCASP0_AXR0", 112, 7, "mcasp0_axr0", "ehrpwm0_tripzone_input", NULL, "spi1_d1", "mmc2_sdcd", "pr1_pru0_pru_r30_2", "pr1_pru0_pru_r31_2", "gpio3_16"), _PIN(0x99c, "MCASP0_AHCLKR", 113, 7, "mcasp0_ahclkr", "ehrpwm0_synci", "mcasp0_axr2", "spi1_cs0", "eCAP2_in_PWM2_out", "pr1_pru0_pru_r30_3", "pr1_pru0_pru_r31_3", "gpio3_17"), _PIN(0x9a0, "MCASP0_ACLKR", 114, 7, "mcasp0_aclkr", "eQEP0A_in", "mcasp0_axr2", "mcasp1_aclkx", "mmc0_sdwp", "pr1_pru0_pru_r30_4", "pr1_pru0_pru_r31_4", "gpio3_18"), _PIN(0x9a4, "MCASP0_FSR", 115, 7, "mcasp0_fsr", "eQEP0B_in", "mcasp0_axr3", "mcasp1_fsx", "EMU2", "pr1_pru0_pru_r30_5", "pr1_pru0_pru_r31_5", "gpio3_19"), _PIN(0x9a8, "MCASP0_AXR1", 116, 7, "mcasp0_axr1", "eQEP0_index", NULL, "mcasp1_axr0", "EMU3", "pr1_pru0_pru_r30_6", "pr1_pru0_pru_r31_6", "gpio3_20"), _PIN(0x9ac, "MCASP0_AHCLKX", 117, 7, "mcasp0_ahclkx", "eQEP0_strobe", "mcasp0_axr3", "mcasp1_axr1", "EMU4", "pr1_pru0_pru_r30_7", "pr1_pru0_pru_r31_7", "gpio3_21"), _PIN(0x9b0, "XDMA_EVENT_INTR0", 19, 7, "xdma_event_intr0", NULL, "timer4", "clkout1", "spi1_cs1", "pr1_pru1_pru_r31_16", "EMU2", "gpio0_19"), _PIN(0x9b4, "XDMA_EVENT_INTR1", 20, 7, "xdma_event_intr1", NULL, "tclkin", "clkout2", "timer7", "pr1_pru0_pru_r31_16", "EMU3", "gpio0_20"), #if 0 _PIN(0x9b8, "nresetin_out", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9bc, "porz", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9c0, "nnmi", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9c4, "osc0_in", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9c8, "osc0_out", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9cc, "osc0_vss", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9d0, "tms", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9d4, "tdi", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9d8, "tdo", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9dc, "tck", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9e0, "ntrst", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), #endif _PIN(0x9e4, "EMU0", 103, 7, "EMU0", NULL, NULL, NULL, NULL, NULL, NULL, "gpio3_7"), _PIN(0x9e8, "EMU1", 104, 0, "EMU1", NULL, NULL, NULL, NULL, NULL, NULL, "gpio3_8"), #if 0 _PIN(0x9ec, "osc1_in", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9f0, "osc1_out", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9f4, "osc1_vss", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9f8, "rtc_porz", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x9fc, "pmic_power_en", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa00, "ext_wakeup", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa04, "enz_kaldo_1p8v", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), #endif _PIN(0xa08, "USB0_DM", 0, 0, "USB0_DM", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa0c, "USB0_DP", 0, 0, "USB0_DP", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa10, "USB0_CE", 0, 0, "USB0_CE", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa14, "USB0_ID", 0, 0, "USB0_ID", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa18, "USB0_VBUS", 0, 0, "USB0_VBUS", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa1c, "USB0_DRVVBUS", 18, 7, "USB0_DRVVBUS", NULL, NULL, NULL, NULL, NULL, NULL, "gpio0_18"), _PIN(0xa20, "USB1_DM", 0, 0, "USB1_DM", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa24, "USB1_DP", 0, 0, "USB1_DP", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa28, "USB1_CE", 0, 0, "USB1_CE", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa2c, "USB1_ID", 0, 0, "USB1_ID", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa30, "USB1_VBUS", 0, 0, "USB1_VBUS", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa34, "USB1_DRVVBUS", 109, 7, "USB1_DRVVBUS", NULL, NULL, NULL, NULL, NULL, NULL, "gpio3_13"), #if 0 _PIN(0xa38, "ddr_resetn", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa3c, "ddr_csn0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa40, "ddr_cke", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa44, "ddr_ck", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa48, "ddr_nck", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa4c, "ddr_casn", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa50, "ddr_rasn", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa54, "ddr_wen", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa58, "ddr_ba0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa5c, "ddr_ba1", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa60, "ddr_ba2", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa64, "ddr_a0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa68, "ddr_a1", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa6c, "ddr_a2", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa70, "ddr_a3", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa74, "ddr_a4", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa78, "ddr_a5", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa7c, "ddr_a6", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa80, "ddr_a7", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa84, "ddr_a8", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa88, "ddr_a9", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa8c, "ddr_a10", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa90, "ddr_a11", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa94, "ddr_a12", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa98, "ddr_a13", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa9c, "ddr_a14", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xaa0, "ddr_a15", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xaa4, "ddr_odt", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xaa8, "ddr_d0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xaac, "ddr_d1", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xab0, "ddr_d2", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xab4, "ddr_d3", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xab8, "ddr_d4", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xabc, "ddr_d5", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xac0, "ddr_d6", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xac4, "ddr_d7", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xac8, "ddr_d8", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xacc, "ddr_d9", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xad0, "ddr_d10", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xad4, "ddr_d11", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xad8, "ddr_d12", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xadc, "ddr_d13", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xae0, "ddr_d14", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xae4, "ddr_d15", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xae8, "ddr_dqm0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xaec, "ddr_dqm1", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xaf0, "ddr_dqs0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xaf4, "ddr_dqsn0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xaf8, "ddr_dqs1", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xafc, "ddr_dqsn1", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb00, "ddr_vref", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb04, "ddr_vtp", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb08, "ddr_strben0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb0c, "ddr_strben1", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb2c, "ain0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb28, "ain1", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb24, "ain2", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb20, "ain3", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb1c, "ain4", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb18, "ain5", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb14, "ain6", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb10, "ain7", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb30, "vrefp", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb34, "vrefn", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb38, "avdd", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb3c, "avss", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb40, "iforce", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb44, "vsense", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xb48, "testout", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), #endif { .ballname = NULL }, }; const struct ti_scm_device ti_scm_dev = { .padconf_muxmode_mask = 0x7, .padconf_sate_mask = 0x78, - .padstate = (struct ti_scm_padstate *) &ti_padstate_devmap, - .padconf = (struct ti_scm_padconf *) &ti_padconf_devmap, + .padstate = ti_padstate_devmap, + .padconf = ti_padconf_devmap, }; int ti_scm_padconf_set_gpioflags(uint32_t gpio, uint32_t flags) { unsigned int state = 0; if (flags & GPIO_PIN_OUTPUT) { if (flags & GPIO_PIN_PULLUP) state = PADCONF_OUTPUT_PULLUP; else state = PADCONF_OUTPUT; } else if (flags & GPIO_PIN_INPUT) { if (flags & GPIO_PIN_PULLUP) state = PADCONF_INPUT_PULLUP; else if (flags & GPIO_PIN_PULLDOWN) state = PADCONF_INPUT_PULLDOWN; else state = PADCONF_INPUT; } return ti_scm_padconf_set_gpiomode(gpio, state); } void ti_scm_padconf_get_gpioflags(uint32_t gpio, uint32_t *flags) { unsigned int state; if (ti_scm_padconf_get_gpiomode(gpio, &state) != 0) *flags = 0; else { switch (state) { case PADCONF_OUTPUT: *flags = GPIO_PIN_OUTPUT; break; case PADCONF_OUTPUT_PULLUP: *flags = GPIO_PIN_OUTPUT | GPIO_PIN_PULLUP; break; case PADCONF_INPUT: *flags = GPIO_PIN_INPUT; break; case PADCONF_INPUT_PULLUP: *flags = GPIO_PIN_INPUT | GPIO_PIN_PULLUP; break; case PADCONF_INPUT_PULLDOWN: *flags = GPIO_PIN_INPUT | GPIO_PIN_PULLDOWN; break; default: *flags = 0; break; } } } Index: stable/10/sys/arm/ti/omap4/omap4_scm_padconf.c =================================================================== --- stable/10/sys/arm/ti/omap4/omap4_scm_padconf.c (revision 279466) +++ stable/10/sys/arm/ti/omap4/omap4_scm_padconf.c (revision 279467) @@ -1,404 +1,404 @@ /*- * Copyright (c) 2011 * Ben Gray . * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the company nor the name of the author may be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* * This file defines the pin mux configuration for the OMAP4xxx series of * devices. * * How This is Suppose to Work * =========================== * - There is a top level ti_scm module (System Control Module) that is * the interface for all omap drivers, which can use it to change the mux * settings for individual pins. (That said, typically the pin mux settings * are set to defaults by the 'hints' and then not altered by the driver). * * - For this to work the top level driver needs all the pin info, and hence * this is where this file comes in. Here we define all the pin information * that is supplied to the top level driver. * */ #define CONTROL_PADCONF_WAKEUP_EVENT (1UL << 15) #define CONTROL_PADCONF_WAKEUP_ENABLE (1UL << 14) #define CONTROL_PADCONF_OFF_PULL_UP (1UL << 13) #define CONTROL_PADCONF_OFF_PULL_ENABLE (1UL << 12) #define CONTROL_PADCONF_OFF_OUT_HIGH (1UL << 11) #define CONTROL_PADCONF_OFF_OUT_ENABLE (1UL << 10) #define CONTROL_PADCONF_OFF_ENABLE (1UL << 9) #define CONTROL_PADCONF_INPUT_ENABLE (1UL << 8) #define CONTROL_PADCONF_PULL_UP (1UL << 4) #define CONTROL_PADCONF_PULL_ENABLE (1UL << 3) #define CONTROL_PADCONF_MUXMODE_MASK (0x7) #define CONTROL_PADCONF_SATE_MASK ( CONTROL_PADCONF_WAKEUP_EVENT \ | CONTROL_PADCONF_WAKEUP_ENABLE \ | CONTROL_PADCONF_OFF_PULL_UP \ | CONTROL_PADCONF_OFF_PULL_ENABLE \ | CONTROL_PADCONF_OFF_OUT_HIGH \ | CONTROL_PADCONF_OFF_OUT_ENABLE \ | CONTROL_PADCONF_OFF_ENABLE \ | CONTROL_PADCONF_INPUT_ENABLE \ | CONTROL_PADCONF_PULL_UP \ | CONTROL_PADCONF_PULL_ENABLE ) /* Active pin states */ #define PADCONF_PIN_OUTPUT 0 #define PADCONF_PIN_INPUT CONTROL_PADCONF_INPUT_ENABLE #define PADCONF_PIN_INPUT_PULLUP ( CONTROL_PADCONF_INPUT_ENABLE \ | CONTROL_PADCONF_PULL_ENABLE \ | CONTROL_PADCONF_PULL_UP) #define PADCONF_PIN_INPUT_PULLDOWN ( CONTROL_PADCONF_INPUT_ENABLE \ | CONTROL_PADCONF_PULL_ENABLE ) /* Off mode states */ #define PADCONF_PIN_OFF_NONE 0 #define PADCONF_PIN_OFF_OUTPUT_HIGH ( CONTROL_PADCONF_OFF_ENABLE \ | CONTROL_PADCONF_OFF_OUT_ENABLE \ | CONTROL_PADCONF_OFF_OUT_HIGH) #define PADCONF_PIN_OFF_OUTPUT_LOW ( CONTROL_PADCONF_OFF_ENABLE \ | CONTROL_PADCONF_OFF_OUT_ENABLE) #define PADCONF_PIN_OFF_INPUT_PULLUP ( CONTROL_PADCONF_OFF_ENABLE \ | CONTROL_PADCONF_OFF_PULL_ENABLE \ | CONTROL_PADCONF_OFF_PULL_UP) #define PADCONF_PIN_OFF_INPUT_PULLDOWN ( CONTROL_PADCONF_OFF_ENABLE \ | CONTROL_PADCONF_OFF_PULL_ENABLE) #define PADCONF_PIN_OFF_WAKEUPENABLE CONTROL_PADCONF_WAKEUP_ENABLE #define _PINDEF(r, b, gp, gm, m0, m1, m2, m3, m4, m5, m6, m7) \ { .reg_off = r, \ .gpio_pin = gp, \ .gpio_mode = gm, \ .ballname = b, \ .muxmodes[0] = m0, \ .muxmodes[1] = m1, \ .muxmodes[2] = m2, \ .muxmodes[3] = m3, \ .muxmodes[4] = m4, \ .muxmodes[5] = m5, \ .muxmodes[6] = m6, \ .muxmodes[7] = m7, \ } const struct ti_scm_padstate ti_padstate_devmap[] = { {"output", PADCONF_PIN_OUTPUT}, {"input", PADCONF_PIN_INPUT}, {"input_pullup", PADCONF_PIN_INPUT_PULLUP}, {"input_pulldown", PADCONF_PIN_INPUT_PULLDOWN}, { .state = NULL } }; /* * Table 18-10, p. 3470 */ const struct ti_scm_padconf ti_padconf_devmap[] = { _PINDEF(0x0040, "c12", 0, 0, "gpmc_ad0", "sdmmc2_dat0", NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0042, "d12", 0, 0, "gpmc_ad1", "sdmmc2_dat1", NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0044, "c13", 0, 0, "gpmc_ad2", "sdmmc2_dat2", NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0046, "d13", 0, 0, "gpmc_ad3", "sdmmc2_dat3", NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0048, "c15", 0, 0, "gpmc_ad4", "sdmmc2_dat4", "sdmmc2_dir_dat0", NULL, NULL, NULL, NULL, NULL), _PINDEF(0x004a, "d15", 0, 0, "gpmc_ad5", "sdmmc2_dat5", "sdmmc2_dir_dat1", NULL, NULL, NULL, NULL, NULL), _PINDEF(0x004c, "a16", 0, 0, "gpmc_ad6", "sdmmc2_dat6", "sdmmc2_dir_cmd", NULL, NULL, NULL, NULL, NULL), _PINDEF(0x004e, "b16", 0, 0, "gpmc_ad7", "sdmmc2_dat7", "sdmmc2_clk_fdbk", NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0050, "c16", 32, 3, "gpmc_ad8", "kpd_row0", "c2c_data15", "gpio_32", NULL, "sdmmc1_dat0", NULL, NULL), _PINDEF(0x0052, "d16", 33, 3, "gpmc_ad9", "kpd_row1", "c2c_data14", "gpio_33", NULL, "sdmmc1_dat1", NULL, NULL), _PINDEF(0x0054, "c17", 34, 3, "gpmc_ad10", "kpd_row2", "c2c_data13", "gpio_34", NULL, "sdmmc1_dat2", NULL, NULL), _PINDEF(0x0056, "d17", 35, 3, "gpmc_ad11", "kpd_row3", "c2c_data12", "gpio_35", NULL, "sdmmc1_dat3", NULL, NULL), _PINDEF(0x0058, "c18", 36, 3, "gpmc_ad12", "kpd_col0", "c2c_data11", "gpio_36", NULL, "sdmmc1_dat4", NULL, NULL), _PINDEF(0x005a, "d18", 37, 3, "gpmc_ad13", "kpd_col1", "c2c_data10", "gpio_37", NULL, "sdmmc1_dat5", NULL, NULL), _PINDEF(0x005c, "c19", 38, 3, "gpmc_ad14", "kpd_col2", "c2c_data9", "gpio_38", NULL, "sdmmc1_dat6", NULL, NULL), _PINDEF(0x005e, "d19", 39, 3, "gpmc_ad15", "kpd_col3", "c2c_data8", "gpio_39", NULL, "sdmmc1_dat7", NULL, NULL), _PINDEF(0x0060, "b17", 40, 3, "gpmc_a16", "kpd_row4", "c2c_datain0", "gpio_40", "venc_656_data0", NULL, NULL, "safe_mode"), _PINDEF(0x0062, "a18", 41, 3, "gpmc_a17", "kpd_row5", "c2c_datain1", "gpio_41", "venc_656_data1", NULL, NULL, "safe_mode"), _PINDEF(0x0064, "b18", 42, 3, "gpmc_a18", "kpd_row6", "c2c_datain2", "gpio_42", "venc_656_data2", NULL, NULL, "safe_mode"), _PINDEF(0x0066, "a19", 43, 3, "gpmc_a19", "kpd_row7", "c2c_datain3", "gpio_43", "venc_656_data3", NULL, NULL, "safe_mode"), _PINDEF(0x0068, "b19", 44, 3, "gpmc_a20", "kpd_col4", "c2c_datain4", "gpio_44", "venc_656_data4", NULL, NULL, "safe_mode"), _PINDEF(0x006a, "b20", 45, 3, "gpmc_a21", "kpd_col5", "c2c_datain5", "gpio_45", "venc_656_data5", NULL, NULL, "safe_mode"), _PINDEF(0x006c, "a21", 46, 3, "gpmc_a22", "kpd_col6", "c2c_datain6", "gpio_46", "venc_656_data6", NULL, NULL, "safe_mode"), _PINDEF(0x006e, "b21", 47, 3, "gpmc_a23", "kpd_col7", "c2c_datain7", "gpio_47", "venc_656_data7", NULL, NULL, "safe_mode"), _PINDEF(0x0070, "c20", 48, 3, "gpmc_a24", "kpd_col8", "c2c_clkout0", "gpio_48", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0072, "d20", 49, 3, "gpmc_a25", NULL, "c2c_clkout1", "gpio_49", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0074, "b25", 50, 3, "gpmc_ncs0", NULL, NULL, "gpio_50", "sys_ndmareq0", NULL, NULL, NULL), _PINDEF(0x0076, "c21", 51, 3, "gpmc_ncs1", NULL, "c2c_dataout6", "gpio_51", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0078, "d21", 52, 3, "gpmc_ncs2", "kpd_row8", "c2c_dataout7", "gpio_52", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x007a, "c22", 53, 3, "gpmc_ncs3", "gpmc_dir", "c2c_dataout4", "gpio_53", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x007c, "c25", 54, 3, "gpmc_nwp", "dsi1_te0", NULL, "gpio_54", "sys_ndmareq1", NULL, NULL, NULL), _PINDEF(0x007e, "b22", 55, 3, "gpmc_clk", NULL, NULL, "gpio_55", "sys_ndmareq2", "sdmmc1_cmd", NULL, NULL), _PINDEF(0x0080, "d25", 56, 3, "gpmc_nadv_ale", "dsi1_te1", NULL, "gpio_56", "sys_ndmareq3", "sdmmc1_clk", NULL, NULL), _PINDEF(0x0082, "b11", 0, 0, "gpmc_noe", "sdmmc2_clk", NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0084, "b12", 0, 0, "gpmc_nwe", "sdmmc2_cmd", NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0086, "c23", 59, 3, "gpmc_nbe0_cle", "dsi2_te0", NULL, "gpio_59", NULL, NULL, NULL, NULL), _PINDEF(0x0088, "d22", 60, 3, "gpmc_nbe1", NULL, "c2c_dataout5", "gpio_60", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x008a, "b26", 61, 3, "gpmc_wait0", "dsi2_te1", NULL, "gpio_61", NULL, NULL, NULL, NULL), _PINDEF(0x008c, "b23", 62, 3, "gpmc_wait1", NULL, "c2c_dataout2", "gpio_62", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x008e, "d23", 100, 3, "gpmc_wait2", "usbc1_icusb_txen", "c2c_dataout3", "gpio_100", "sys_ndmareq0", NULL, NULL, "safe_mode"), _PINDEF(0x0090, "a24", 101, 3, "gpmc_ncs4", "dsi1_te0", "c2c_clkin0", "gpio_101", "sys_ndmareq1", NULL, NULL, "safe_mode"), _PINDEF(0x0092, "b24", 102, 3, "gpmc_ncs5", "dsi1_te1", "c2c_clkin1", "gpio_102", "sys_ndmareq2", NULL, NULL, "safe_mode"), _PINDEF(0x0094, "c24", 103, 3, "gpmc_ncs6", "dsi2_te0", "c2c_dataout0", "gpio_103", "sys_ndmareq3", NULL, NULL, "safe_mode"), _PINDEF(0x0096, "d24", 104, 3, "gpmc_ncs7", "dsi2_te1", "c2c_dataout1", "gpio_104", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0098, "b9", 63, 3, "hdmi_hpd", NULL, NULL, "gpio_63", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x009a, "b10", 64, 3, "hdmi_cec", NULL, NULL, "gpio_64", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x009c, "a8", 65, 3, "hdmi_ddc_scl", NULL, NULL, "gpio_65", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x009e, "b8", 66, 3, "hdmi_ddc_sda", NULL, NULL, "gpio_66", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00a0, "r26", 0, 0, "csi21_dx0", NULL, NULL, "gpi_67", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00a2, "r25", 0, 0, "csi21_dy0", NULL, NULL, "gpi_68", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00a4, "t26", 0, 0, "csi21_dx1", NULL, NULL, "gpi_69", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00a6, "t25", 0, 0, "csi21_dy1", NULL, NULL, "gpi_70", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00a8, "u26", 0, 0, "csi21_dx2", NULL, NULL, "gpi_71", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00aa, "u25", 0, 0, "csi21_dy2", NULL, NULL, "gpi_72", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00ac, "v26", 0, 0, "csi21_dx3", NULL, NULL, "gpi_73", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00ae, "v25", 0, 0, "csi21_dy3", NULL, NULL, "gpi_74", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00b0, "w26", 0, 0, "csi21_dx4", NULL, NULL, "gpi_75", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00b2, "w25", 0, 0, "csi21_dy4", NULL, NULL, "gpi_76", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00b4, "m26", 0, 0, "csi22_dx0", NULL, NULL, "gpi_77", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00b6, "m25", 0, 0, "csi22_dy0", NULL, NULL, "gpi_78", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00b8, "n26", 0, 0, "csi22_dx1", NULL, NULL, "gpi_79", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00ba, "n25", 0, 0, "csi22_dy1", NULL, NULL, "gpi_80", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00bc, "t27", 81, 3, "cam_shutter", NULL, NULL, "gpio_81", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00be, "u27", 82, 3, "cam_strobe", NULL, NULL, "gpio_82", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00c0, "v27", 83, 3, "cam_globalreset", NULL, NULL, "gpio_83", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00c2, "ae18", 84, 3, "usbb1_ulpitll_clk", "hsi1_cawake", NULL, "gpio_84", "usbb1_ulpiphy_clk", NULL, "hw_dbg20", "safe_mode"), _PINDEF(0x00c4, "ag19", 85, 3, "usbb1_ulpitll_stp", "hsi1_cadata", "mcbsp4_clkr", "gpio_85", "usbb1_ulpiphy_stp", "usbb1_mm_rxdp", "hw_dbg21", "safe_mode"), _PINDEF(0x00c6, "af19", 86, 3, "usbb1_ulpitll_dir", "hsi1_caflag", "mcbsp4_fsr", "gpio_86", "usbb1_ulpiphy_dir", NULL, "hw_dbg22", "safe_mode"), _PINDEF(0x00c8, "ae19", 87, 3, "usbb1_ulpitll_nxt", "hsi1_acready", "mcbsp4_fsx", "gpio_87", "usbb1_ulpiphy_nxt", "usbb1_mm_rxdm", "hw_dbg23", "safe_mode"), _PINDEF(0x00ca, "af18", 88, 3, "usbb1_ulpitll_dat0", "hsi1_acwake", "mcbsp4_clkx", "gpio_88", "usbb1_ulpiphy_dat0", "usbb1_mm_txen", "hw_dbg24", "safe_mode"), _PINDEF(0x00cc, "ag18", 89, 3, "usbb1_ulpitll_dat1", "hsi1_acdata", "mcbsp4_dx", "gpio_89", "usbb1_ulpiphy_dat1", "usbb1_mm_txdat", "hw_dbg25", "safe_mode"), _PINDEF(0x00ce, "ae17", 90, 3, "usbb1_ulpitll_dat2", "hsi1_acflag", "mcbsp4_dr", "gpio_90", "usbb1_ulpiphy_dat2", "usbb1_mm_txse0", "hw_dbg26", "safe_mode"), _PINDEF(0x00d0, "af17", 91, 3, "usbb1_ulpitll_dat3", "hsi1_caready", NULL, "gpio_91", "usbb1_ulpiphy_dat3", "usbb1_mm_rxrcv", "hw_dbg27", "safe_mode"), _PINDEF(0x00d2, "ah17", 92, 3, "usbb1_ulpitll_dat4", "dmtimer8_pwm_evt", "abe_mcbsp3_dr", "gpio_92", "usbb1_ulpiphy_dat4", NULL, "hw_dbg28", "safe_mode"), _PINDEF(0x00d4, "ae16", 93, 3, "usbb1_ulpitll_dat5", "dmtimer9_pwm_evt", "abe_mcbsp3_dx", "gpio_93", "usbb1_ulpiphy_dat5", NULL, "hw_dbg29", "safe_mode"), _PINDEF(0x00d6, "af16", 94, 3, "usbb1_ulpitll_dat6", "dmtimer10_pwm_evt", "abe_mcbsp3_clkx", "gpio_94", "usbb1_ulpiphy_dat6", "abe_dmic_din3", "hw_dbg30", "safe_mode"), _PINDEF(0x00d8, "ag16", 95, 3, "usbb1_ulpitll_dat7", "dmtimer11_pwm_evt", "abe_mcbsp3_fsx", "gpio_95", "usbb1_ulpiphy_dat7", "abe_dmic_clk3", "hw_dbg31", "safe_mode"), _PINDEF(0x00da, "af14", 96, 3, "usbb1_hsic_data", NULL, NULL, "gpio_96", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00dc, "ae14", 97, 3, "usbb1_hsic_strobe", NULL, NULL, "gpio_97", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00de, "h2", 98, 3, "usbc1_icusb_dp", NULL, NULL, "gpio_98", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00e0, "h3", 99, 3, "usbc1_icusb_dm", NULL, NULL, "gpio_99", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00e2, "d2", 100, 3, "sdmmc1_clk", NULL, "dpm_emu19", "gpio_100", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00e4, "e3", 101, 3, "sdmmc1_cmd", NULL, "uart1_rx", "gpio_101", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00e6, "e4", 102, 3, "sdmmc1_dat0", NULL, "dpm_emu18", "gpio_102", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00e8, "e2", 103, 3, "sdmmc1_dat1", NULL, "dpm_emu17", "gpio_103", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00ea, "e1", 104, 3, "sdmmc1_dat2", NULL, "dpm_emu16", "gpio_104", "jtag_tms_tmsc", NULL, NULL, "safe_mode"), _PINDEF(0x00ec, "f4", 105, 3, "sdmmc1_dat3", NULL, "dpm_emu15", "gpio_105", "jtag_tck", NULL, NULL, "safe_mode"), _PINDEF(0x00ee, "f3", 106, 3, "sdmmc1_dat4", NULL, NULL, "gpio_106", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00f0, "f1", 107, 3, "sdmmc1_dat5", NULL, NULL, "gpio_107", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00f2, "g4", 108, 3, "sdmmc1_dat6", NULL, NULL, "gpio_108", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00f4, "g3", 109, 3, "sdmmc1_dat7", NULL, NULL, "gpio_109", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x00f6, "ad27", 110, 3, "abe_mcbsp2_clkx", "mcspi2_clk", "abe_mcasp_ahclkx", "gpio_110", "usbb2_mm_rxdm", NULL, NULL, "safe_mode"), _PINDEF(0x00f8, "ad26", 111, 3, "abe_mcbsp2_dr", "mcspi2_somi", "abe_mcasp_axr", "gpio_111", "usbb2_mm_rxdp", NULL, NULL, "safe_mode"), _PINDEF(0x00fa, "ad25", 112, 3, "abe_mcbsp2_dx", "mcspi2_simo", "abe_mcasp_amute", "gpio_112", "usbb2_mm_rxrcv", NULL, NULL, "safe_mode"), _PINDEF(0x00fc, "ac28", 113, 3, "abe_mcbsp2_fsx", "mcspi2_cs0", "abe_mcasp_afsx", "gpio_113", "usbb2_mm_txen", NULL, NULL, "safe_mode"), _PINDEF(0x00fe, "ac26", 114, 3, "abe_mcbsp1_clkx", "abe_slimbus1_clock", NULL, "gpio_114", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0100, "ac25", 115, 3, "abe_mcbsp1_dr", "abe_slimbus1_data", NULL, "gpio_115", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0102, "ab25", 116, 3, "abe_mcbsp1_dx", "sdmmc3_dat2", "abe_mcasp_aclkx", "gpio_116", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0104, "ac27", 117, 3, "abe_mcbsp1_fsx", "sdmmc3_dat3", "abe_mcasp_amutein", "gpio_117", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0106, "ag25", 0, 0, "abe_pdm_ul_data", "abe_mcbsp3_dr", NULL, NULL, NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0108, "af25", 0, 0, "abe_pdm_dl_data", "abe_mcbsp3_dx", NULL, NULL, NULL, NULL, NULL, "safe_mode"), _PINDEF(0x010a, "ae25", 0, 0, "abe_pdm_frame", "abe_mcbsp3_clkx", NULL, NULL, NULL, NULL, NULL, "safe_mode"), _PINDEF(0x010c, "af26", 0, 0, "abe_pdm_lb_clk", "abe_mcbsp3_fsx", NULL, NULL, NULL, NULL, NULL, "safe_mode"), _PINDEF(0x010e, "ah26", 118, 3, "abe_clks", NULL, NULL, "gpio_118", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0110, "ae24", 119, 3, "abe_dmic_clk1", NULL, NULL, "gpio_119", "usbb2_mm_txse0", "uart4_cts", NULL, "safe_mode"), _PINDEF(0x0112, "af24", 120, 3, "abe_dmic_din1", NULL, NULL, "gpio_120", "usbb2_mm_txdat", "uart4_rts", NULL, "safe_mode"), _PINDEF(0x0114, "ag24", 121, 3, "abe_dmic_din2", "slimbus2_clock", "abe_mcasp_axr", "gpio_121", NULL, "dmtimer11_pwm_evt", NULL, "safe_mode"), _PINDEF(0x0116, "ah24", 122, 3, "abe_dmic_din3", "slimbus2_data", "abe_dmic_clk2", "gpio_122", NULL, "dmtimer9_pwm_evt", NULL, "safe_mode"), _PINDEF(0x0118, "ab26", 123, 3, "uart2_cts", "sdmmc3_clk", NULL, "gpio_123", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x011a, "ab27", 124, 3, "uart2_rts", "sdmmc3_cmd", NULL, "gpio_124", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x011c, "aa25", 125, 3, "uart2_rx", "sdmmc3_dat0", NULL, "gpio_125", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x011e, "aa26", 126, 3, "uart2_tx", "sdmmc3_dat1", NULL, "gpio_126", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0120, "aa27", 127, 3, "hdq_sio", "i2c3_sccb", "i2c2_sccb", "gpio_127", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0122, "ae28", 0, 0, "i2c1_scl", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0124, "ae26", 0, 0, "i2c1_sda", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0126, "c26", 128, 3, "i2c2_scl", "uart1_rx", NULL, "gpio_128", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0128, "d26", 129, 3, "i2c2_sda", "uart1_tx", NULL, "gpio_129", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x012a, "w27", 130, 3, "i2c3_scl", NULL, NULL, "gpio_130", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x012c, "y27", 131, 3, "i2c3_sda", NULL, NULL, "gpio_131", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x012e, "ag21", 132, 3, "i2c4_scl", NULL, NULL, "gpio_132", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0130, "ah22", 133, 3, "i2c4_sda", NULL, NULL, "gpio_133", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0132, "af22", 134, 3, "mcspi1_clk", NULL, NULL, "gpio_134", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0134, "ae22", 135, 3, "mcspi1_somi", NULL, NULL, "gpio_135", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0136, "ag22", 136, 3, "mcspi1_simo", NULL, NULL, "gpio_136", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0138, "ae23", 137, 3, "mcspi1_cs0", NULL, NULL, "gpio_137", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x013a, "af23", 138, 3, "mcspi1_cs1", "uart1_rx", NULL, "gpio_138", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x013c, "ag23", 139, 3, "mcspi1_cs2", "uart1_cts", "slimbus2_clock", "gpio_139", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x013e, "ah23", 140, 3, "mcspi1_cs3", "uart1_rts", "slimbus2_data", "gpio_140", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0140, "f27", 141, 3, "uart3_cts_rctx", "uart1_tx", NULL, "gpio_141", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0142, "f28", 142, 3, "uart3_rts_sd", NULL, NULL, "gpio_142", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0144, "g27", 143, 3, "uart3_rx_irrx", "dmtimer8_pwm_evt", NULL, "gpio_143", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0146, "g28", 144, 3, "uart3_tx_irtx", "dmtimer9_pwm_evt", NULL, "gpio_144", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0148, "ae5", 145, 3, "sdmmc5_clk", "mcspi2_clk", "usbc1_icusb_dp", "gpio_145", NULL, "sdmmc2_clk", NULL, "safe_mode"), _PINDEF(0x014a, "af5", 146, 3, "sdmmc5_cmd", "mcspi2_simo", "usbc1_icusb_dm", "gpio_146", NULL, "sdmmc2_cmd", NULL, "safe_mode"), _PINDEF(0x014c, "ae4", 147, 3, "sdmmc5_dat0", "mcspi2_somi", "usbc1_icusb_rcv", "gpio_147", NULL, "sdmmc2_dat0", NULL, "safe_mode"), _PINDEF(0x014e, "af4", 148, 3, "sdmmc5_dat1", NULL, "usbc1_icusb_txen", "gpio_148", NULL, "sdmmc2_dat1", NULL, "safe_mode"), _PINDEF(0x0150, "ag3", 149, 3, "sdmmc5_dat2", "mcspi2_cs1", NULL, "gpio_149", NULL, "sdmmc2_dat2", NULL, "safe_mode"), _PINDEF(0x0152, "af3", 150, 3, "sdmmc5_dat3", "mcspi2_cs0", NULL, "gpio_150", NULL, "sdmmc2_dat3", NULL, "safe_mode"), _PINDEF(0x0154, "ae21", 151, 3, "mcspi4_clk", "sdmmc4_clk", "kpd_col6", "gpio_151", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0156, "af20", 152, 3, "mcspi4_simo", "sdmmc4_cmd", "kpd_col7", "gpio_152", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0158, "af21", 153, 3, "mcspi4_somi", "sdmmc4_dat0", "kpd_row6", "gpio_153", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x015a, "ae20", 154, 3, "mcspi4_cs0", "sdmmc4_dat3", "kpd_row7", "gpio_154", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x015c, "ag20", 155, 3, "uart4_rx", "sdmmc4_dat2", "kpd_row8", "gpio_155", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x015e, "ah19", 156, 3, "uart4_tx", "sdmmc4_dat1", "kpd_col8", "gpio_156", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0160, "ag12", 157, 3, "usbb2_ulpitll_clk", "usbb2_ulpiphy_clk", "sdmmc4_cmd", "gpio_157", "hsi2_cawake", NULL, NULL, "safe_mode"), _PINDEF(0x0162, "af12", 158, 3, "usbb2_ulpitll_stp", "usbb2_ulpiphy_stp", "sdmmc4_clk", "gpio_158", "hsi2_cadata", "dispc2_data23", NULL, "safe_mode"), _PINDEF(0x0164, "ae12", 159, 3, "usbb2_ulpitll_dir", "usbb2_ulpiphy_dir", "sdmmc4_dat0", "gpio_159", "hsi2_caflag", "dispc2_data22", NULL, "safe_mode"), _PINDEF(0x0166, "ag13", 160, 3, "usbb2_ulpitll_nxt", "usbb2_ulpiphy_nxt", "sdmmc4_dat1", "gpio_160", "hsi2_acready", "dispc2_data21", NULL, "safe_mode"), _PINDEF(0x0168, "ae11", 161, 3, "usbb2_ulpitll_dat0", "usbb2_ulpiphy_dat0", "sdmmc4_dat2", "gpio_161", "hsi2_acwake", "dispc2_data20", "usbb2_mm_txen", "safe_mode"), _PINDEF(0x016a, "af11", 162, 3, "usbb2_ulpitll_dat1", "usbb2_ulpiphy_dat1", "sdmmc4_dat3", "gpio_162", "hsi2_acdata", "dispc2_data19", "usbb2_mm_txdat", "safe_mode"), _PINDEF(0x016c, "ag11", 163, 3, "usbb2_ulpitll_dat2", "usbb2_ulpiphy_dat2", "sdmmc3_dat2", "gpio_163", "hsi2_acflag", "dispc2_data18", "usbb2_mm_txse0", "safe_mode"), _PINDEF(0x016e, "ah11", 164, 3, "usbb2_ulpitll_dat3", "usbb2_ulpiphy_dat3", "sdmmc3_dat1", "gpio_164", "hsi2_caready", "dispc2_data15", "rfbi_data15", "safe_mode"), _PINDEF(0x0170, "ae10", 165, 3, "usbb2_ulpitll_dat4", "usbb2_ulpiphy_dat4", "sdmmc3_dat0", "gpio_165", "mcspi3_somi", "dispc2_data14", "rfbi_data14", "safe_mode"), _PINDEF(0x0172, "af10", 166, 3, "usbb2_ulpitll_dat5", "usbb2_ulpiphy_dat5", "sdmmc3_dat3", "gpio_166", "mcspi3_cs0", "dispc2_data13", "rfbi_data13", "safe_mode"), _PINDEF(0x0174, "ag10", 167, 3, "usbb2_ulpitll_dat6", "usbb2_ulpiphy_dat6", "sdmmc3_cmd", "gpio_167", "mcspi3_simo", "dispc2_data12", "rfbi_data12", "safe_mode"), _PINDEF(0x0176, "ae9", 168, 3, "usbb2_ulpitll_dat7", "usbb2_ulpiphy_dat7", "sdmmc3_clk", "gpio_168", "mcspi3_clk", "dispc2_data11", "rfbi_data11", "safe_mode"), _PINDEF(0x0178, "af13", 169, 3, "usbb2_hsic_data", NULL, NULL, "gpio_169", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x017a, "ae13", 170, 3, "usbb2_hsic_strobe", NULL, NULL, "gpio_170", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x017c, "g26", 171, 3, "kpd_col3", "kpd_col0", NULL, "gpio_171", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x017e, "g25", 172, 3, "kpd_col4", "kpd_col1", NULL, "gpio_172", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0180, "h26", 173, 3, "kpd_col5", "kpd_col2", NULL, "gpio_173", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0182, "h25", 174, 3, "kpd_col0", "kpd_col3", NULL, "gpio_174", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0184, "j27", 0, 0, "kpd_col1", "kpd_col4", NULL, "gpio_0", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0186, "h27", 1, 3, "kpd_col2", "kpd_col5", NULL, "gpio_1", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0188, "j26", 175, 3, "kpd_row3", "kpd_row0", NULL, "gpio_175", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x018a, "j25", 176, 3, "kpd_row4", "kpd_row1", NULL, "gpio_176", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x018c, "k26", 177, 3, "kpd_row5", "kpd_row2", NULL, "gpio_177", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x018e, "k25", 178, 3, "kpd_row0", "kpd_row3", NULL, "gpio_178", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0190, "l27", 2, 3, "kpd_row1", "kpd_row4", NULL, "gpio_2", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0192, "k27", 3, 3, "kpd_row2", "kpd_row5", NULL, "gpio_3", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0194, "c3", 0, 0, "usba0_otg_ce", NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0196, "b5", 0, 0, "usba0_otg_dp", "uart3_rx_irrx", "uart2_rx", NULL, NULL, NULL, NULL, "safe_mode"), _PINDEF(0x0198, "b4", 0, 0, "usba0_otg_dm", "uart3_tx_irtx", "uart2_tx", NULL, NULL, NULL, NULL, "safe_mode"), _PINDEF(0x019a, "aa28", 181, 3, "fref_clk1_out", NULL, NULL, "gpio_181", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x019c, "y28", 182, 3, "fref_clk2_out", NULL, NULL, "gpio_182", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x019e, "ae6", 0, 0, "sys_nirq1", NULL, NULL, NULL, NULL, NULL, NULL, "safe_mode"), _PINDEF(0x01a0, "af6", 183, 3, "sys_nirq2", NULL, NULL, "gpio_183", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x01a2, "f26", 184, 3, "sys_boot0", NULL, NULL, "gpio_184", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x01a4, "e27", 185, 3, "sys_boot1", NULL, NULL, "gpio_185", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x01a6, "e26", 186, 3, "sys_boot2", NULL, NULL, "gpio_186", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x01a8, "e25", 187, 3, "sys_boot3", NULL, NULL, "gpio_187", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x01aa, "d28", 188, 3, "sys_boot4", NULL, NULL, "gpio_188", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x01ac, "d27", 189, 3, "sys_boot5", NULL, NULL, "gpio_189", NULL, NULL, NULL, "safe_mode"), _PINDEF(0x01ae, "m2", 11, 3, "dpm_emu0", NULL, NULL, "gpio_11", NULL, NULL, "hw_dbg0", "safe_mode"), _PINDEF(0x01b0, "n2", 12, 3, "dpm_emu1", NULL, NULL, "gpio_12", NULL, NULL, "hw_dbg1", "safe_mode"), _PINDEF(0x01b2, "p2", 13, 3, "dpm_emu2", "usba0_ulpiphy_clk", NULL, "gpio_13", NULL, "dispc2_fid", "hw_dbg2", "safe_mode"), _PINDEF(0x01b4, "v1", 14, 3, "dpm_emu3", "usba0_ulpiphy_stp", NULL, "gpio_14", "rfbi_data10", "dispc2_data10", "hw_dbg3", "safe_mode"), _PINDEF(0x01b6, "v2", 15, 3, "dpm_emu4", "usba0_ulpiphy_dir", NULL, "gpio_15", "rfbi_data9", "dispc2_data9", "hw_dbg4", "safe_mode"), _PINDEF(0x01b8, "w1", 16, 3, "dpm_emu5", "usba0_ulpiphy_nxt", NULL, "gpio_16", "rfbi_te_vsync0", "dispc2_data16", "hw_dbg5", "safe_mode"), _PINDEF(0x01ba, "w2", 17, 3, "dpm_emu6", "usba0_ulpiphy_dat0", "uart3_tx_irtx", "gpio_17", "rfbi_hsync0", "dispc2_data17", "hw_dbg6", "safe_mode"), _PINDEF(0x01bc, "w3", 18, 3, "dpm_emu7", "usba0_ulpiphy_dat1", "uart3_rx_irrx", "gpio_18", "rfbi_cs0", "dispc2_hsync", "hw_dbg7", "safe_mode"), _PINDEF(0x01be, "w4", 19, 3, "dpm_emu8", "usba0_ulpiphy_dat2", "uart3_rts_sd", "gpio_19", "rfbi_re", "dispc2_pclk", "hw_dbg8", "safe_mode"), _PINDEF(0x01c0, "y2", 20, 3, "dpm_emu9", "usba0_ulpiphy_dat3", "uart3_cts_rctx", "gpio_20", "rfbi_we", "dispc2_vsync", "hw_dbg9", "safe_mode"), _PINDEF(0x01c2, "y3", 21, 3, "dpm_emu10", "usba0_ulpiphy_dat4", NULL, "gpio_21", "rfbi_a0", "dispc2_de", "hw_dbg10", "safe_mode"), _PINDEF(0x01c4, "y4", 22, 3, "dpm_emu11", "usba0_ulpiphy_dat5", NULL, "gpio_22", "rfbi_data8", "dispc2_data8", "hw_dbg11", "safe_mode"), _PINDEF(0x01c6, "aa1", 23, 3, "dpm_emu12", "usba0_ulpiphy_dat6", NULL, "gpio_23", "rfbi_data7", "dispc2_data7", "hw_dbg12", "safe_mode"), _PINDEF(0x01c8, "aa2", 24, 3, "dpm_emu13", "usba0_ulpiphy_dat7", NULL, "gpio_24", "rfbi_data6", "dispc2_data6", "hw_dbg13", "safe_mode"), _PINDEF(0x01ca, "aa3", 25, 3, "dpm_emu14", "sys_drm_msecure", "uart1_rx", "gpio_25", "rfbi_data5", "dispc2_data5", "hw_dbg14", "safe_mode"), _PINDEF(0x01cc, "aa4", 26, 3, "dpm_emu15", "sys_secure_indicator", NULL, "gpio_26", "rfbi_data4", "dispc2_data4", "hw_dbg15", "safe_mode"), _PINDEF(0x01ce, "ab2", 27, 3, "dpm_emu16", "dmtimer8_pwm_evt", "dsi1_te0", "gpio_27", "rfbi_data3", "dispc2_data3", "hw_dbg16", "safe_mode"), _PINDEF(0x01d0, "ab3", 28, 3, "dpm_emu17", "dmtimer9_pwm_evt", "dsi1_te1", "gpio_28", "rfbi_data2", "dispc2_data2", "hw_dbg17", "safe_mode"), _PINDEF(0x01d2, "ab4", 190, 3, "dpm_emu18", "dmtimer10_pwm_evt", "dsi2_te0", "gpio_190", "rfbi_data1", "dispc2_data1", "hw_dbg18", "safe_mode"), _PINDEF(0x01d4, "ac4", 191, 3, "dpm_emu19", "dmtimer11_pwm_evt", "dsi2_te1", "gpio_191", "rfbi_data0", "dispc2_data0", "hw_dbg19", "safe_mode"), { .ballname = NULL }, }; const struct ti_scm_device ti_scm_dev = { .padconf_muxmode_mask = CONTROL_PADCONF_MUXMODE_MASK, .padconf_sate_mask = CONTROL_PADCONF_SATE_MASK, - .padstate = (struct ti_scm_padstate *) &ti_padstate_devmap, - .padconf = (struct ti_scm_padconf *) &ti_padconf_devmap, + .padstate = ti_padstate_devmap, + .padconf = ti_padconf_devmap, }; int ti_scm_padconf_set_gpioflags(uint32_t gpio, uint32_t flags) { unsigned int state = 0; /* First the SCM driver needs to be told to put the pad into GPIO mode */ if (flags & GPIO_PIN_OUTPUT) state = PADCONF_PIN_OUTPUT; else if (flags & GPIO_PIN_INPUT) { if (flags & GPIO_PIN_PULLUP) state = PADCONF_PIN_INPUT_PULLUP; else if (flags & GPIO_PIN_PULLDOWN) state = PADCONF_PIN_INPUT_PULLDOWN; else state = PADCONF_PIN_INPUT; } return ti_scm_padconf_set_gpiomode(gpio, state); } void ti_scm_padconf_get_gpioflags(uint32_t gpio, uint32_t *flags) { unsigned int state; /* Get the current pin state */ if (ti_scm_padconf_get_gpiomode(gpio, &state) != 0) *flags = 0; else { switch (state) { case PADCONF_PIN_OUTPUT: *flags = GPIO_PIN_OUTPUT; break; case PADCONF_PIN_INPUT: *flags = GPIO_PIN_INPUT; break; case PADCONF_PIN_INPUT_PULLUP: *flags = GPIO_PIN_INPUT | GPIO_PIN_PULLUP; break; case PADCONF_PIN_INPUT_PULLDOWN: *flags = GPIO_PIN_INPUT | GPIO_PIN_PULLDOWN; break; default: *flags = 0; break; } } } Index: stable/10/sys/arm/ti/ti_scm.h =================================================================== --- stable/10/sys/arm/ti/ti_scm.h (revision 279466) +++ stable/10/sys/arm/ti/ti_scm.h (revision 279467) @@ -1,84 +1,84 @@ /* * Copyright (c) 2010 * Ben Gray . * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Ben Gray. * 4. The name of the company nor the name of the author may be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ /** * Functions to configure the PIN multiplexing on the chip. * * This is different from the GPIO module in that it is used to configure the * pins between modules not just GPIO input output. * */ #ifndef _TI_SCM_H_ #define _TI_SCM_H_ struct ti_scm_padconf { uint16_t reg_off; uint16_t gpio_pin; uint16_t gpio_mode; const char *ballname; const char *muxmodes[8]; }; struct ti_scm_padstate { const char *state; uint16_t reg; }; struct ti_scm_device { uint16_t padconf_muxmode_mask; uint16_t padconf_sate_mask; - struct ti_scm_padstate *padstate; - struct ti_scm_padconf *padconf; + const struct ti_scm_padstate *padstate; + const struct ti_scm_padconf *padconf; }; struct ti_scm_softc { device_t sc_dev; struct resource * sc_res[4]; bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; }; int ti_scm_padconf_set(const char *padname, const char *muxmode, unsigned int state); int ti_scm_padconf_get(const char *padname, const char **muxmode, unsigned int *state); int ti_scm_padconf_set_gpiomode(uint32_t gpio, unsigned int state); int ti_scm_padconf_get_gpiomode(uint32_t gpio, unsigned int *state); int ti_scm_padconf_set_gpioflags(uint32_t gpio, uint32_t flags); void ti_scm_padconf_get_gpioflags(uint32_t gpio, uint32_t *flags); int ti_scm_reg_read_4(uint32_t reg, uint32_t *val); int ti_scm_reg_write_4(uint32_t reg, uint32_t val); #endif /* _TI_SCM_H_ */ Index: stable/10 =================================================================== --- stable/10 (revision 279466) +++ stable/10 (revision 279467) Property changes on: stable/10 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r279312 Index: stable/9/sys/arm/arm/disassem.c =================================================================== --- stable/9/sys/arm/arm/disassem.c (revision 279466) +++ stable/9/sys/arm/arm/disassem.c (revision 279467) @@ -1,681 +1,681 @@ /* $NetBSD: disassem.c,v 1.14 2003/03/27 16:58:36 mycroft Exp $ */ /*- * Copyright (c) 1996 Mark Brinicombe. * Copyright (c) 1996 Brini. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Brini. * 4. The name of the company nor the name of the author may be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * RiscBSD kernel project * * db_disasm.c * * Kernel disassembler * * Created : 10/02/96 * * Structured after the sparc/sparc/db_disasm.c by David S. Miller & * Paul Kranenburg * * This code is not complete. Not all instructions are disassembled. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include /* * General instruction format * * insn[cc][mod] [operands] * * Those fields with an uppercase format code indicate that the field * follows directly after the instruction before the separator i.e. * they modify the instruction rather than just being an operand to * the instruction. The only exception is the writeback flag which * follows a operand. * * * 2 - print Operand 2 of a data processing instruction * d - destination register (bits 12-15) * n - n register (bits 16-19) * s - s register (bits 8-11) * o - indirect register rn (bits 16-19) (used by swap) * m - m register (bits 0-3) * a - address operand of ldr/str instruction * l - register list for ldm/stm instruction * f - 1st fp operand (register) (bits 12-14) * g - 2nd fp operand (register) (bits 16-18) * h - 3rd fp operand (register/immediate) (bits 0-4) * b - branch address * t - thumb branch address (bits 24, 0-23) * k - breakpoint comment (bits 0-3, 8-19) * X - block transfer type * Y - block transfer type (r13 base) * c - comment field bits(0-23) * p - saved or current status register * F - PSR transfer fields * D - destination-is-r15 (P) flag on TST, TEQ, CMP, CMN * L - co-processor transfer size * S - set status flag * P - fp precision * Q - fp precision (for ldf/stf) * R - fp rounding * v - co-processor data transfer registers + addressing mode * W - writeback flag * x - instruction in hex * # - co-processor number * y - co-processor data processing registers * z - co-processor register transfer registers */ struct arm32_insn { u_int mask; u_int pattern; char* name; char* format; }; static const struct arm32_insn arm32_i[] = { { 0x0fffffff, 0x0ff00000, "imb", "c" }, /* Before swi */ { 0x0fffffff, 0x0ff00001, "imbrange", "c" }, /* Before swi */ { 0x0f000000, 0x0f000000, "swi", "c" }, { 0xfe000000, 0xfa000000, "blx", "t" }, /* Before b and bl */ { 0x0f000000, 0x0a000000, "b", "b" }, { 0x0f000000, 0x0b000000, "bl", "b" }, { 0x0fe000f0, 0x00000090, "mul", "Snms" }, { 0x0fe000f0, 0x00200090, "mla", "Snmsd" }, { 0x0fe000f0, 0x00800090, "umull", "Sdnms" }, { 0x0fe000f0, 0x00c00090, "smull", "Sdnms" }, { 0x0fe000f0, 0x00a00090, "umlal", "Sdnms" }, { 0x0fe000f0, 0x00e00090, "smlal", "Sdnms" }, { 0x0d700000, 0x04200000, "strt", "daW" }, { 0x0d700000, 0x04300000, "ldrt", "daW" }, { 0x0d700000, 0x04600000, "strbt", "daW" }, { 0x0d700000, 0x04700000, "ldrbt", "daW" }, { 0x0c500000, 0x04000000, "str", "daW" }, { 0x0c500000, 0x04100000, "ldr", "daW" }, { 0x0c500000, 0x04400000, "strb", "daW" }, { 0x0c500000, 0x04500000, "ldrb", "daW" }, { 0x0e1f0000, 0x080d0000, "stm", "YnWl" },/* separate out r13 base */ { 0x0e1f0000, 0x081d0000, "ldm", "YnWl" },/* separate out r13 base */ { 0x0e100000, 0x08000000, "stm", "XnWl" }, { 0x0e100000, 0x08100000, "ldm", "XnWl" }, { 0x0e1000f0, 0x00100090, "ldrb", "de" }, { 0x0e1000f0, 0x00000090, "strb", "de" }, { 0x0e1000f0, 0x001000d0, "ldrsb", "de" }, { 0x0e1000f0, 0x001000b0, "ldrh", "de" }, { 0x0e1000f0, 0x000000b0, "strh", "de" }, { 0x0e1000f0, 0x001000f0, "ldrsh", "de" }, { 0x0f200090, 0x00200090, "und", "x" }, /* Before data processing */ { 0x0e1000d0, 0x000000d0, "und", "x" }, /* Before data processing */ { 0x0ff00ff0, 0x01000090, "swp", "dmo" }, { 0x0ff00ff0, 0x01400090, "swpb", "dmo" }, { 0x0fbf0fff, 0x010f0000, "mrs", "dp" }, /* Before data processing */ { 0x0fb0fff0, 0x0120f000, "msr", "pFm" },/* Before data processing */ { 0x0fb0f000, 0x0320f000, "msr", "pF2" },/* Before data processing */ { 0x0ffffff0, 0x012fff10, "bx", "m" }, { 0x0fff0ff0, 0x016f0f10, "clz", "dm" }, { 0x0ffffff0, 0x012fff30, "blx", "m" }, { 0xfff000f0, 0xe1200070, "bkpt", "k" }, { 0x0de00000, 0x00000000, "and", "Sdn2" }, { 0x0de00000, 0x00200000, "eor", "Sdn2" }, { 0x0de00000, 0x00400000, "sub", "Sdn2" }, { 0x0de00000, 0x00600000, "rsb", "Sdn2" }, { 0x0de00000, 0x00800000, "add", "Sdn2" }, { 0x0de00000, 0x00a00000, "adc", "Sdn2" }, { 0x0de00000, 0x00c00000, "sbc", "Sdn2" }, { 0x0de00000, 0x00e00000, "rsc", "Sdn2" }, { 0x0df00000, 0x01100000, "tst", "Dn2" }, { 0x0df00000, 0x01300000, "teq", "Dn2" }, { 0x0de00000, 0x01400000, "cmp", "Dn2" }, { 0x0de00000, 0x01600000, "cmn", "Dn2" }, { 0x0de00000, 0x01800000, "orr", "Sdn2" }, { 0x0de00000, 0x01a00000, "mov", "Sd2" }, { 0x0de00000, 0x01c00000, "bic", "Sdn2" }, { 0x0de00000, 0x01e00000, "mvn", "Sd2" }, { 0x0ff08f10, 0x0e000100, "adf", "PRfgh" }, { 0x0ff08f10, 0x0e100100, "muf", "PRfgh" }, { 0x0ff08f10, 0x0e200100, "suf", "PRfgh" }, { 0x0ff08f10, 0x0e300100, "rsf", "PRfgh" }, { 0x0ff08f10, 0x0e400100, "dvf", "PRfgh" }, { 0x0ff08f10, 0x0e500100, "rdf", "PRfgh" }, { 0x0ff08f10, 0x0e600100, "pow", "PRfgh" }, { 0x0ff08f10, 0x0e700100, "rpw", "PRfgh" }, { 0x0ff08f10, 0x0e800100, "rmf", "PRfgh" }, { 0x0ff08f10, 0x0e900100, "fml", "PRfgh" }, { 0x0ff08f10, 0x0ea00100, "fdv", "PRfgh" }, { 0x0ff08f10, 0x0eb00100, "frd", "PRfgh" }, { 0x0ff08f10, 0x0ec00100, "pol", "PRfgh" }, { 0x0f008f10, 0x0e000100, "fpbop", "PRfgh" }, { 0x0ff08f10, 0x0e008100, "mvf", "PRfh" }, { 0x0ff08f10, 0x0e108100, "mnf", "PRfh" }, { 0x0ff08f10, 0x0e208100, "abs", "PRfh" }, { 0x0ff08f10, 0x0e308100, "rnd", "PRfh" }, { 0x0ff08f10, 0x0e408100, "sqt", "PRfh" }, { 0x0ff08f10, 0x0e508100, "log", "PRfh" }, { 0x0ff08f10, 0x0e608100, "lgn", "PRfh" }, { 0x0ff08f10, 0x0e708100, "exp", "PRfh" }, { 0x0ff08f10, 0x0e808100, "sin", "PRfh" }, { 0x0ff08f10, 0x0e908100, "cos", "PRfh" }, { 0x0ff08f10, 0x0ea08100, "tan", "PRfh" }, { 0x0ff08f10, 0x0eb08100, "asn", "PRfh" }, { 0x0ff08f10, 0x0ec08100, "acs", "PRfh" }, { 0x0ff08f10, 0x0ed08100, "atn", "PRfh" }, { 0x0f008f10, 0x0e008100, "fpuop", "PRfh" }, { 0x0e100f00, 0x0c000100, "stf", "QLv" }, { 0x0e100f00, 0x0c100100, "ldf", "QLv" }, { 0x0ff00f10, 0x0e000110, "flt", "PRgd" }, { 0x0ff00f10, 0x0e100110, "fix", "PRdh" }, { 0x0ff00f10, 0x0e200110, "wfs", "d" }, { 0x0ff00f10, 0x0e300110, "rfs", "d" }, { 0x0ff00f10, 0x0e400110, "wfc", "d" }, { 0x0ff00f10, 0x0e500110, "rfc", "d" }, { 0x0ff0ff10, 0x0e90f110, "cmf", "PRgh" }, { 0x0ff0ff10, 0x0eb0f110, "cnf", "PRgh" }, { 0x0ff0ff10, 0x0ed0f110, "cmfe", "PRgh" }, { 0x0ff0ff10, 0x0ef0f110, "cnfe", "PRgh" }, { 0xff100010, 0xfe000010, "mcr2", "#z" }, { 0x0f100010, 0x0e000010, "mcr", "#z" }, { 0xff100010, 0xfe100010, "mrc2", "#z" }, { 0x0f100010, 0x0e100010, "mrc", "#z" }, { 0xff000010, 0xfe000000, "cdp2", "#y" }, { 0x0f000010, 0x0e000000, "cdp", "#y" }, { 0xfe100090, 0xfc100000, "ldc2", "L#v" }, { 0x0e100090, 0x0c100000, "ldc", "L#v" }, { 0xfe100090, 0xfc000000, "stc2", "L#v" }, { 0x0e100090, 0x0c000000, "stc", "L#v" }, { 0x00000000, 0x00000000, NULL, NULL } }; static char const arm32_insn_conditions[][4] = { "eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", "hi", "ls", "ge", "lt", "gt", "le", "", "nv" }; static char const insn_block_transfers[][4] = { "da", "ia", "db", "ib" }; static char const insn_stack_block_transfers[][4] = { "ed", "ea", "fd", "fa" }; static char const op_shifts[][4] = { "lsl", "lsr", "asr", "ror" }; static char const insn_fpa_rounding[][2] = { "", "p", "m", "z" }; static char const insn_fpa_precision[][2] = { "s", "d", "e", "p" }; static char const insn_fpaconstants[][8] = { "0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "0.5", "10.0" }; #define insn_condition(x) arm32_insn_conditions[(x >> 28) & 0x0f] #define insn_blktrans(x) insn_block_transfers[(x >> 23) & 3] #define insn_stkblktrans(x) insn_stack_block_transfers[(x >> 23) & 3] #define op2_shift(x) op_shifts[(x >> 5) & 3] #define insn_fparnd(x) insn_fpa_rounding[(x >> 5) & 0x03] #define insn_fpaprec(x) insn_fpa_precision[(((x >> 18) & 2)|(x >> 7)) & 1] #define insn_fpaprect(x) insn_fpa_precision[(((x >> 21) & 2)|(x >> 15)) & 1] #define insn_fpaimm(x) insn_fpaconstants[x & 0x07] /* Local prototypes */ static void disasm_register_shift(const disasm_interface_t *di, u_int insn); static void disasm_print_reglist(const disasm_interface_t *di, u_int insn); static void disasm_insn_ldrstr(const disasm_interface_t *di, u_int insn, u_int loc); static void disasm_insn_ldrhstrh(const disasm_interface_t *di, u_int insn, u_int loc); static void disasm_insn_ldcstc(const disasm_interface_t *di, u_int insn, u_int loc); static u_int disassemble_readword(u_int address); static void disassemble_printaddr(u_int address); vm_offset_t disasm(const disasm_interface_t *di, vm_offset_t loc, int altfmt) { - struct arm32_insn *i_ptr = (struct arm32_insn *)&arm32_i; + const struct arm32_insn *i_ptr = arm32_i; u_int insn; int matchp; int branch; char* f_ptr; int fmt; fmt = 0; matchp = 0; insn = di->di_readword(loc); /* di->di_printf("loc=%08x insn=%08x : ", loc, insn);*/ while (i_ptr->name) { if ((insn & i_ptr->mask) == i_ptr->pattern) { matchp = 1; break; } i_ptr++; } if (!matchp) { di->di_printf("und%s\t%08x\n", insn_condition(insn), insn); return(loc + INSN_SIZE); } /* If instruction forces condition code, don't print it. */ if ((i_ptr->mask & 0xf0000000) == 0xf0000000) di->di_printf("%s", i_ptr->name); else di->di_printf("%s%s", i_ptr->name, insn_condition(insn)); f_ptr = i_ptr->format; /* Insert tab if there are no instruction modifiers */ if (*(f_ptr) < 'A' || *(f_ptr) > 'Z') { ++fmt; di->di_printf("\t"); } while (*f_ptr) { switch (*f_ptr) { /* 2 - print Operand 2 of a data processing instruction */ case '2': if (insn & 0x02000000) { int rotate= ((insn >> 7) & 0x1e); di->di_printf("#0x%08x", (insn & 0xff) << (32 - rotate) | (insn & 0xff) >> rotate); } else { disasm_register_shift(di, insn); } break; /* d - destination register (bits 12-15) */ case 'd': di->di_printf("r%d", ((insn >> 12) & 0x0f)); break; /* D - insert 'p' if Rd is R15 */ case 'D': if (((insn >> 12) & 0x0f) == 15) di->di_printf("p"); break; /* n - n register (bits 16-19) */ case 'n': di->di_printf("r%d", ((insn >> 16) & 0x0f)); break; /* s - s register (bits 8-11) */ case 's': di->di_printf("r%d", ((insn >> 8) & 0x0f)); break; /* o - indirect register rn (bits 16-19) (used by swap) */ case 'o': di->di_printf("[r%d]", ((insn >> 16) & 0x0f)); break; /* m - m register (bits 0-4) */ case 'm': di->di_printf("r%d", ((insn >> 0) & 0x0f)); break; /* a - address operand of ldr/str instruction */ case 'a': disasm_insn_ldrstr(di, insn, loc); break; /* e - address operand of ldrh/strh instruction */ case 'e': disasm_insn_ldrhstrh(di, insn, loc); break; /* l - register list for ldm/stm instruction */ case 'l': disasm_print_reglist(di, insn); break; /* f - 1st fp operand (register) (bits 12-14) */ case 'f': di->di_printf("f%d", (insn >> 12) & 7); break; /* g - 2nd fp operand (register) (bits 16-18) */ case 'g': di->di_printf("f%d", (insn >> 16) & 7); break; /* h - 3rd fp operand (register/immediate) (bits 0-4) */ case 'h': if (insn & (1 << 3)) di->di_printf("#%s", insn_fpaimm(insn)); else di->di_printf("f%d", insn & 7); break; /* b - branch address */ case 'b': branch = ((insn << 2) & 0x03ffffff); if (branch & 0x02000000) branch |= 0xfc000000; di->di_printaddr(loc + 8 + branch); break; /* t - blx address */ case 't': branch = ((insn << 2) & 0x03ffffff) | (insn >> 23 & 0x00000002); if (branch & 0x02000000) branch |= 0xfc000000; di->di_printaddr(loc + 8 + branch); break; /* X - block transfer type */ case 'X': di->di_printf("%s", insn_blktrans(insn)); break; /* Y - block transfer type (r13 base) */ case 'Y': di->di_printf("%s", insn_stkblktrans(insn)); break; /* c - comment field bits(0-23) */ case 'c': di->di_printf("0x%08x", (insn & 0x00ffffff)); break; /* k - breakpoint comment (bits 0-3, 8-19) */ case 'k': di->di_printf("0x%04x", (insn & 0x000fff00) >> 4 | (insn & 0x0000000f)); break; /* p - saved or current status register */ case 'p': if (insn & 0x00400000) di->di_printf("spsr"); else di->di_printf("cpsr"); break; /* F - PSR transfer fields */ case 'F': di->di_printf("_"); if (insn & (1 << 16)) di->di_printf("c"); if (insn & (1 << 17)) di->di_printf("x"); if (insn & (1 << 18)) di->di_printf("s"); if (insn & (1 << 19)) di->di_printf("f"); break; /* B - byte transfer flag */ case 'B': if (insn & 0x00400000) di->di_printf("b"); break; /* L - co-processor transfer size */ case 'L': if (insn & (1 << 22)) di->di_printf("l"); break; /* S - set status flag */ case 'S': if (insn & 0x00100000) di->di_printf("s"); break; /* P - fp precision */ case 'P': di->di_printf("%s", insn_fpaprec(insn)); break; /* Q - fp precision (for ldf/stf) */ case 'Q': break; /* R - fp rounding */ case 'R': di->di_printf("%s", insn_fparnd(insn)); break; /* W - writeback flag */ case 'W': if (insn & (1 << 21)) di->di_printf("!"); break; /* # - co-processor number */ case '#': di->di_printf("p%d", (insn >> 8) & 0x0f); break; /* v - co-processor data transfer registers+addressing mode */ case 'v': disasm_insn_ldcstc(di, insn, loc); break; /* x - instruction in hex */ case 'x': di->di_printf("0x%08x", insn); break; /* y - co-processor data processing registers */ case 'y': di->di_printf("%d, ", (insn >> 20) & 0x0f); di->di_printf("c%d, c%d, c%d", (insn >> 12) & 0x0f, (insn >> 16) & 0x0f, insn & 0x0f); di->di_printf(", %d", (insn >> 5) & 0x07); break; /* z - co-processor register transfer registers */ case 'z': di->di_printf("%d, ", (insn >> 21) & 0x07); di->di_printf("r%d, c%d, c%d, %d", (insn >> 12) & 0x0f, (insn >> 16) & 0x0f, insn & 0x0f, (insn >> 5) & 0x07); /* if (((insn >> 5) & 0x07) != 0) di->di_printf(", %d", (insn >> 5) & 0x07);*/ break; default: di->di_printf("[%c - unknown]", *f_ptr); break; } if (*(f_ptr+1) >= 'A' && *(f_ptr+1) <= 'Z') ++f_ptr; else if (*(++f_ptr)) { ++fmt; if (fmt == 1) di->di_printf("\t"); else di->di_printf(", "); } }; di->di_printf("\n"); return(loc + INSN_SIZE); } static void disasm_register_shift(const disasm_interface_t *di, u_int insn) { di->di_printf("r%d", (insn & 0x0f)); if ((insn & 0x00000ff0) == 0) ; else if ((insn & 0x00000ff0) == 0x00000060) di->di_printf(", rrx"); else { if (insn & 0x10) di->di_printf(", %s r%d", op2_shift(insn), (insn >> 8) & 0x0f); else di->di_printf(", %s #%d", op2_shift(insn), (insn >> 7) & 0x1f); } } static void disasm_print_reglist(const disasm_interface_t *di, u_int insn) { int loop; int start; int comma; di->di_printf("{"); start = -1; comma = 0; for (loop = 0; loop < 17; ++loop) { if (start != -1) { if (loop == 16 || !(insn & (1 << loop))) { if (comma) di->di_printf(", "); else comma = 1; if (start == loop - 1) di->di_printf("r%d", start); else di->di_printf("r%d-r%d", start, loop - 1); start = -1; } } else { if (insn & (1 << loop)) start = loop; } } di->di_printf("}"); if (insn & (1 << 22)) di->di_printf("^"); } static void disasm_insn_ldrstr(const disasm_interface_t *di, u_int insn, u_int loc) { int offset; offset = insn & 0xfff; if ((insn & 0x032f0000) == 0x010f0000) { /* rA = pc, immediate index */ if (insn & 0x00800000) loc += offset; else loc -= offset; di->di_printaddr(loc + 8); } else { di->di_printf("[r%d", (insn >> 16) & 0x0f); if ((insn & 0x03000fff) != 0x01000000) { di->di_printf("%s, ", (insn & (1 << 24)) ? "" : "]"); if (!(insn & 0x00800000)) di->di_printf("-"); if (insn & (1 << 25)) disasm_register_shift(di, insn); else di->di_printf("#0x%03x", offset); } if (insn & (1 << 24)) di->di_printf("]"); } } static void disasm_insn_ldrhstrh(const disasm_interface_t *di, u_int insn, u_int loc) { int offset; offset = ((insn & 0xf00) >> 4) | (insn & 0xf); if ((insn & 0x004f0000) == 0x004f0000) { /* rA = pc, immediate index */ if (insn & 0x00800000) loc += offset; else loc -= offset; di->di_printaddr(loc + 8); } else { di->di_printf("[r%d", (insn >> 16) & 0x0f); if ((insn & 0x01400f0f) != 0x01400000) { di->di_printf("%s, ", (insn & (1 << 24)) ? "" : "]"); if (!(insn & 0x00800000)) di->di_printf("-"); if (insn & (1 << 22)) di->di_printf("#0x%02x", offset); else di->di_printf("r%d", (insn & 0x0f)); } if (insn & (1 << 24)) di->di_printf("]"); } } static void disasm_insn_ldcstc(const disasm_interface_t *di, u_int insn, u_int loc) { if (((insn >> 8) & 0xf) == 1) di->di_printf("f%d, ", (insn >> 12) & 0x07); else di->di_printf("c%d, ", (insn >> 12) & 0x0f); di->di_printf("[r%d", (insn >> 16) & 0x0f); di->di_printf("%s, ", (insn & (1 << 24)) ? "" : "]"); if (!(insn & (1 << 23))) di->di_printf("-"); di->di_printf("#0x%03x", (insn & 0xff) << 2); if (insn & (1 << 24)) di->di_printf("]"); if (insn & (1 << 21)) di->di_printf("!"); } static u_int disassemble_readword(u_int address) { return(*((u_int *)address)); } static void disassemble_printaddr(u_int address) { printf("0x%08x", address); } static const disasm_interface_t disassemble_di = { disassemble_readword, disassemble_printaddr, db_printf }; void disassemble(u_int address) { (void)disasm(&disassemble_di, address, 0); } /* End of disassem.c */ Index: stable/9/sys =================================================================== --- stable/9/sys (revision 279466) +++ stable/9/sys (revision 279467) Property changes on: stable/9/sys ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/sys:r279312