Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branches 'sh/dwarf-unwinder', 'sh/g3-prep' and 'sh/stable-updates'

+173 -288
+7 -12
arch/sh/include/asm/dwarf.h
··· 243 243 244 244 unsigned long cie_pointer; 245 245 246 - struct list_head link; 247 - 248 246 unsigned long flags; 249 247 #define DWARF_CIE_Z_AUGMENTATION (1 << 0) 250 248 251 - /* 252 - * 'mod' will be non-NULL if this CIE came from a module's 253 - * .eh_frame section. 254 - */ 255 - struct module *mod; 249 + /* linked-list entry if this CIE is from a module */ 250 + struct list_head link; 251 + 252 + struct rb_node node; 256 253 }; 257 254 258 255 /** ··· 263 266 unsigned long address_range; 264 267 unsigned char *instructions; 265 268 unsigned char *end; 269 + 270 + /* linked-list entry if this FDE is from a module */ 266 271 struct list_head link; 267 272 268 - /* 269 - * 'mod' will be non-NULL if this FDE came from a module's 270 - * .eh_frame section. 271 - */ 272 - struct module *mod; 273 + struct rb_node node; 273 274 }; 274 275 275 276 /**
+16 -1
arch/sh/include/asm/module.h
··· 1 1 #ifndef _ASM_SH_MODULE_H 2 2 #define _ASM_SH_MODULE_H 3 3 4 - #include <asm-generic/module.h> 4 + struct mod_arch_specific { 5 + #ifdef CONFIG_DWARF_UNWINDER 6 + struct list_head fde_list; 7 + struct list_head cie_list; 8 + #endif 9 + }; 10 + 11 + #ifdef CONFIG_64BIT 12 + #define Elf_Shdr Elf64_Shdr 13 + #define Elf_Sym Elf64_Sym 14 + #define Elf_Ehdr Elf64_Ehdr 15 + #else 16 + #define Elf_Shdr Elf32_Shdr 17 + #define Elf_Sym Elf32_Sym 18 + #define Elf_Ehdr Elf32_Ehdr 19 + #endif 5 20 6 21 #ifdef CONFIG_CPU_LITTLE_ENDIAN 7 22 # ifdef CONFIG_CPU_SH2
+2 -1
arch/sh/kernel/cpu/sh3/entry.S
··· 132 132 mov #1, r5 133 133 134 134 call_handle_tlbmiss: 135 - setup_frame_reg 136 135 mov.l 1f, r0 137 136 mov r5, r8 138 137 mov.l @r0, r6 ··· 364 365 mov.l @k2, k2 ! read out vector and keep in k2 365 366 366 367 handle_exception_special: 368 + setup_frame_reg 369 + 367 370 ! Setup return address and jump to exception handler 368 371 mov.l 7f, r9 ! fetch return address 369 372 stc r2_bank, r0 ! k2 (vector)
+140 -54
arch/sh/kernel/dwarf.c
··· 39 39 static struct kmem_cache *dwarf_reg_cachep; 40 40 static mempool_t *dwarf_reg_pool; 41 41 42 - static LIST_HEAD(dwarf_cie_list); 42 + static struct rb_root cie_root; 43 43 static DEFINE_SPINLOCK(dwarf_cie_lock); 44 44 45 - static LIST_HEAD(dwarf_fde_list); 45 + static struct rb_root fde_root; 46 46 static DEFINE_SPINLOCK(dwarf_fde_lock); 47 47 48 48 static struct dwarf_cie *cached_cie; ··· 301 301 */ 302 302 static struct dwarf_cie *dwarf_lookup_cie(unsigned long cie_ptr) 303 303 { 304 - struct dwarf_cie *cie; 304 + struct rb_node **rb_node = &cie_root.rb_node; 305 + struct dwarf_cie *cie = NULL; 305 306 unsigned long flags; 306 307 307 308 spin_lock_irqsave(&dwarf_cie_lock, flags); ··· 316 315 goto out; 317 316 } 318 317 319 - list_for_each_entry(cie, &dwarf_cie_list, link) { 320 - if (cie->cie_pointer == cie_ptr) { 321 - cached_cie = cie; 322 - break; 318 + while (*rb_node) { 319 + struct dwarf_cie *cie_tmp; 320 + 321 + cie_tmp = rb_entry(*rb_node, struct dwarf_cie, node); 322 + BUG_ON(!cie_tmp); 323 + 324 + if (cie_ptr == cie_tmp->cie_pointer) { 325 + cie = cie_tmp; 326 + cached_cie = cie_tmp; 327 + goto out; 328 + } else { 329 + if (cie_ptr < cie_tmp->cie_pointer) 330 + rb_node = &(*rb_node)->rb_left; 331 + else 332 + rb_node = &(*rb_node)->rb_right; 323 333 } 324 334 } 325 335 326 - /* Couldn't find the entry in the list. */ 327 - if (&cie->link == &dwarf_cie_list) 328 - cie = NULL; 329 336 out: 330 337 spin_unlock_irqrestore(&dwarf_cie_lock, flags); 331 338 return cie; ··· 345 336 */ 346 337 struct dwarf_fde *dwarf_lookup_fde(unsigned long pc) 347 338 { 348 - struct dwarf_fde *fde; 339 + struct rb_node **rb_node = &fde_root.rb_node; 340 + struct dwarf_fde *fde = NULL; 349 341 unsigned long flags; 350 342 351 343 spin_lock_irqsave(&dwarf_fde_lock, flags); 352 344 353 - list_for_each_entry(fde, &dwarf_fde_list, link) { 354 - unsigned long start, end; 345 + while (*rb_node) { 346 + struct dwarf_fde *fde_tmp; 347 + unsigned long tmp_start, tmp_end; 355 348 356 - start = fde->initial_location; 357 - end = fde->initial_location + fde->address_range; 349 + fde_tmp = rb_entry(*rb_node, struct dwarf_fde, node); 350 + BUG_ON(!fde_tmp); 358 351 359 - if (pc >= start && pc < end) 360 - break; 352 + tmp_start = fde_tmp->initial_location; 353 + tmp_end = fde_tmp->initial_location + fde_tmp->address_range; 354 + 355 + if (pc < tmp_start) { 356 + rb_node = &(*rb_node)->rb_left; 357 + } else { 358 + if (pc < tmp_end) { 359 + fde = fde_tmp; 360 + goto out; 361 + } else 362 + rb_node = &(*rb_node)->rb_right; 363 + } 361 364 } 362 365 363 - /* Couldn't find the entry in the list. */ 364 - if (&fde->link == &dwarf_fde_list) 365 - fde = NULL; 366 - 366 + out: 367 367 spin_unlock_irqrestore(&dwarf_fde_lock, flags); 368 368 369 369 return fde; ··· 558 540 mempool_free(frame, dwarf_frame_pool); 559 541 } 560 542 543 + extern void ret_from_irq(void); 544 + 561 545 /** 562 546 * dwarf_unwind_stack - unwind the stack 563 547 * ··· 570 550 * on the callstack. Each of the lower (older) stack frames are 571 551 * linked via the "prev" member. 572 552 */ 573 - struct dwarf_frame * dwarf_unwind_stack(unsigned long pc, 574 - struct dwarf_frame *prev) 553 + struct dwarf_frame *dwarf_unwind_stack(unsigned long pc, 554 + struct dwarf_frame *prev) 575 555 { 576 556 struct dwarf_frame *frame; 577 557 struct dwarf_cie *cie; ··· 698 678 addr = frame->cfa + reg->addr; 699 679 frame->return_addr = __raw_readl(addr); 700 680 681 + /* 682 + * Ah, the joys of unwinding through interrupts. 683 + * 684 + * Interrupts are tricky - the DWARF info needs to be _really_ 685 + * accurate and unfortunately I'm seeing a lot of bogus DWARF 686 + * info. For example, I've seen interrupts occur in epilogues 687 + * just after the frame pointer (r14) had been restored. The 688 + * problem was that the DWARF info claimed that the CFA could be 689 + * reached by using the value of the frame pointer before it was 690 + * restored. 691 + * 692 + * So until the compiler can be trusted to produce reliable 693 + * DWARF info when it really matters, let's stop unwinding once 694 + * we've calculated the function that was interrupted. 695 + */ 696 + if (prev && prev->pc == (unsigned long)ret_from_irq) 697 + frame->return_addr = 0; 698 + 701 699 return frame; 702 700 703 701 bail: ··· 726 688 static int dwarf_parse_cie(void *entry, void *p, unsigned long len, 727 689 unsigned char *end, struct module *mod) 728 690 { 691 + struct rb_node **rb_node = &cie_root.rb_node; 692 + struct rb_node *parent; 729 693 struct dwarf_cie *cie; 730 694 unsigned long flags; 731 695 int count; ··· 822 782 cie->initial_instructions = p; 823 783 cie->instructions_end = end; 824 784 825 - cie->mod = mod; 826 - 827 785 /* Add to list */ 828 786 spin_lock_irqsave(&dwarf_cie_lock, flags); 829 - list_add_tail(&cie->link, &dwarf_cie_list); 787 + 788 + while (*rb_node) { 789 + struct dwarf_cie *cie_tmp; 790 + 791 + cie_tmp = rb_entry(*rb_node, struct dwarf_cie, node); 792 + 793 + parent = *rb_node; 794 + 795 + if (cie->cie_pointer < cie_tmp->cie_pointer) 796 + rb_node = &parent->rb_left; 797 + else if (cie->cie_pointer >= cie_tmp->cie_pointer) 798 + rb_node = &parent->rb_right; 799 + else 800 + WARN_ON(1); 801 + } 802 + 803 + rb_link_node(&cie->node, parent, rb_node); 804 + rb_insert_color(&cie->node, &cie_root); 805 + 806 + if (mod != NULL) 807 + list_add_tail(&cie->link, &mod->arch.cie_list); 808 + 830 809 spin_unlock_irqrestore(&dwarf_cie_lock, flags); 831 810 832 811 return 0; ··· 855 796 void *start, unsigned long len, 856 797 unsigned char *end, struct module *mod) 857 798 { 799 + struct rb_node **rb_node = &fde_root.rb_node; 800 + struct rb_node *parent; 858 801 struct dwarf_fde *fde; 859 802 struct dwarf_cie *cie; 860 803 unsigned long flags; ··· 904 843 fde->instructions = p; 905 844 fde->end = end; 906 845 907 - fde->mod = mod; 908 - 909 846 /* Add to list. */ 910 847 spin_lock_irqsave(&dwarf_fde_lock, flags); 911 - list_add_tail(&fde->link, &dwarf_fde_list); 848 + 849 + while (*rb_node) { 850 + struct dwarf_fde *fde_tmp; 851 + unsigned long tmp_start, tmp_end; 852 + unsigned long start, end; 853 + 854 + fde_tmp = rb_entry(*rb_node, struct dwarf_fde, node); 855 + 856 + start = fde->initial_location; 857 + end = fde->initial_location + fde->address_range; 858 + 859 + tmp_start = fde_tmp->initial_location; 860 + tmp_end = fde_tmp->initial_location + fde_tmp->address_range; 861 + 862 + parent = *rb_node; 863 + 864 + if (start < tmp_start) 865 + rb_node = &parent->rb_left; 866 + else if (start >= tmp_end) 867 + rb_node = &parent->rb_right; 868 + else 869 + WARN_ON(1); 870 + } 871 + 872 + rb_link_node(&fde->node, parent, rb_node); 873 + rb_insert_color(&fde->node, &fde_root); 874 + 875 + if (mod != NULL) 876 + list_add_tail(&fde->link, &mod->arch.fde_list); 877 + 912 878 spin_unlock_irqrestore(&dwarf_fde_lock, flags); 913 879 914 880 return 0; ··· 980 892 981 893 static void dwarf_unwinder_cleanup(void) 982 894 { 983 - struct dwarf_cie *cie, *cie_tmp; 984 - struct dwarf_fde *fde, *fde_tmp; 895 + struct rb_node **fde_rb_node = &fde_root.rb_node; 896 + struct rb_node **cie_rb_node = &cie_root.rb_node; 985 897 986 898 /* 987 899 * Deallocate all the memory allocated for the DWARF unwinder. 988 900 * Traverse all the FDE/CIE lists and remove and free all the 989 901 * memory associated with those data structures. 990 902 */ 991 - list_for_each_entry_safe(cie, cie_tmp, &dwarf_cie_list, link) 992 - kfree(cie); 903 + while (*fde_rb_node) { 904 + struct dwarf_fde *fde; 993 905 994 - list_for_each_entry_safe(fde, fde_tmp, &dwarf_fde_list, link) 906 + fde = rb_entry(*fde_rb_node, struct dwarf_fde, node); 907 + rb_erase(*fde_rb_node, &fde_root); 995 908 kfree(fde); 909 + } 910 + 911 + while (*cie_rb_node) { 912 + struct dwarf_cie *cie; 913 + 914 + cie = rb_entry(*cie_rb_node, struct dwarf_cie, node); 915 + rb_erase(*cie_rb_node, &cie_root); 916 + kfree(cie); 917 + } 996 918 997 919 kmem_cache_destroy(dwarf_reg_cachep); 998 920 kmem_cache_destroy(dwarf_frame_cachep); ··· 1102 1004 1103 1005 /* Did we find the .eh_frame section? */ 1104 1006 if (i != hdr->e_shnum) { 1007 + INIT_LIST_HEAD(&me->arch.cie_list); 1008 + INIT_LIST_HEAD(&me->arch.fde_list); 1105 1009 err = dwarf_parse_section((char *)start, (char *)end, me); 1106 1010 if (err) { 1107 1011 printk(KERN_WARNING "%s: failed to parse DWARF info\n", ··· 1124 1024 */ 1125 1025 void module_dwarf_cleanup(struct module *mod) 1126 1026 { 1127 - struct dwarf_fde *fde; 1128 - struct dwarf_cie *cie; 1027 + struct dwarf_fde *fde, *ftmp; 1028 + struct dwarf_cie *cie, *ctmp; 1129 1029 unsigned long flags; 1130 1030 1131 1031 spin_lock_irqsave(&dwarf_cie_lock, flags); 1132 1032 1133 - again_cie: 1134 - list_for_each_entry(cie, &dwarf_cie_list, link) { 1135 - if (cie->mod == mod) 1136 - break; 1137 - } 1138 - 1139 - if (&cie->link != &dwarf_cie_list) { 1033 + list_for_each_entry_safe(cie, ctmp, &mod->arch.cie_list, link) { 1140 1034 list_del(&cie->link); 1035 + rb_erase(&cie->node, &cie_root); 1141 1036 kfree(cie); 1142 - goto again_cie; 1143 1037 } 1144 1038 1145 1039 spin_unlock_irqrestore(&dwarf_cie_lock, flags); 1146 1040 1147 1041 spin_lock_irqsave(&dwarf_fde_lock, flags); 1148 1042 1149 - again_fde: 1150 - list_for_each_entry(fde, &dwarf_fde_list, link) { 1151 - if (fde->mod == mod) 1152 - break; 1153 - } 1154 - 1155 - if (&fde->link != &dwarf_fde_list) { 1043 + list_for_each_entry_safe(fde, ftmp, &mod->arch.fde_list, link) { 1156 1044 list_del(&fde->link); 1045 + rb_erase(&fde->node, &fde_root); 1157 1046 kfree(fde); 1158 - goto again_fde; 1159 1047 } 1160 1048 1161 1049 spin_unlock_irqrestore(&dwarf_fde_lock, flags); ··· 1162 1074 static int __init dwarf_unwinder_init(void) 1163 1075 { 1164 1076 int err; 1165 - INIT_LIST_HEAD(&dwarf_cie_list); 1166 - INIT_LIST_HEAD(&dwarf_fde_list); 1167 1077 1168 1078 dwarf_frame_cachep = kmem_cache_create("dwarf_frames", 1169 1079 sizeof(struct dwarf_frame), 0,
+7 -1
arch/sh/kernel/entry-common.S
··· 70 70 CFI_STARTPROC simple 71 71 CFI_DEF_CFA r14, 0 72 72 CFI_REL_OFFSET 17, 64 73 - CFI_REL_OFFSET 15, 0 73 + CFI_REL_OFFSET 15, 60 74 74 CFI_REL_OFFSET 14, 56 75 + CFI_REL_OFFSET 13, 52 76 + CFI_REL_OFFSET 12, 48 77 + CFI_REL_OFFSET 11, 44 78 + CFI_REL_OFFSET 10, 40 79 + CFI_REL_OFFSET 9, 36 80 + CFI_REL_OFFSET 8, 32 75 81 preempt_stop() 76 82 ENTRY(ret_from_irq) 77 83 !
+1 -219
drivers/serial/sh-sci.h
··· 518 518 { 519 519 if (port->mapbase == 0xfffffe80) 520 520 return __raw_readb(SCPDR)&0x01 ? 1 : 0; /* SCI */ 521 - if (port->mapbase == 0xa4000150) 522 - return __raw_readb(SCPDR)&0x10 ? 1 : 0; /* SCIF */ 523 - if (port->mapbase == 0xa4000140) 524 - return __raw_readb(SCPDR)&0x04 ? 1 : 0; /* IRDA */ 525 - return 1; 526 - } 527 - #elif defined(CONFIG_CPU_SUBTYPE_SH7705) 528 - static inline int sci_rxd_in(struct uart_port *port) 529 - { 530 - if (port->mapbase == SCIF0) 531 - return __raw_readb(SCPDR)&0x04 ? 1 : 0; /* IRDA */ 532 - if (port->mapbase == SCIF2) 533 - return __raw_readb(SCPDR)&0x10 ? 1 : 0; /* SCIF */ 534 - return 1; 535 - } 536 - #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) 537 - static inline int sci_rxd_in(struct uart_port *port) 538 - { 539 - return sci_in(port,SCxSR)&0x0010 ? 1 : 0; 540 - } 541 - #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 542 - defined(CONFIG_CPU_SUBTYPE_SH7721) 543 - static inline int sci_rxd_in(struct uart_port *port) 544 - { 545 - if (port->mapbase == 0xa4430000) 546 - return sci_in(port, SCxSR) & 0x0003 ? 1 : 0; 547 - else if (port->mapbase == 0xa4438000) 548 - return sci_in(port, SCxSR) & 0x0003 ? 1 : 0; 549 521 return 1; 550 522 } 551 523 #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ ··· 530 558 { 531 559 if (port->mapbase == 0xffe00000) 532 560 return __raw_readb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */ 533 - if (port->mapbase == 0xffe80000) 534 - return __raw_readw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */ 535 561 return 1; 536 - } 537 - #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) 538 - static inline int sci_rxd_in(struct uart_port *port) 539 - { 540 - if (port->mapbase == 0xffe80000) 541 - return __raw_readw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */ 542 - return 1; 543 - } 544 - #elif defined(CONFIG_CPU_SUBTYPE_SH7757) 545 - static inline int sci_rxd_in(struct uart_port *port) 546 - { 547 - if (port->mapbase == 0xfe4b0000) 548 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; 549 - if (port->mapbase == 0xfe4c0000) 550 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; 551 - if (port->mapbase == 0xfe4d0000) 552 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; 553 - } 554 - #elif defined(CONFIG_CPU_SUBTYPE_SH7760) 555 - static inline int sci_rxd_in(struct uart_port *port) 556 - { 557 - if (port->mapbase == 0xfe600000) 558 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 559 - if (port->mapbase == 0xfe610000) 560 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 561 - if (port->mapbase == 0xfe620000) 562 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 563 - return 1; 564 - } 565 - #elif defined(CONFIG_CPU_SUBTYPE_SH7343) 566 - static inline int sci_rxd_in(struct uart_port *port) 567 - { 568 - if (port->mapbase == 0xffe00000) 569 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 570 - if (port->mapbase == 0xffe10000) 571 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 572 - if (port->mapbase == 0xffe20000) 573 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 574 - if (port->mapbase == 0xffe30000) 575 - return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 576 - return 1; 577 - } 578 - #elif defined(CONFIG_CPU_SUBTYPE_SH7366) 579 - static inline int sci_rxd_in(struct uart_port *port) 580 - { 581 - if (port->mapbase == 0xffe00000) 582 - return __raw_readb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ 583 - return 1; 584 - } 585 - #elif defined(CONFIG_CPU_SUBTYPE_SH7722) 586 - static inline int sci_rxd_in(struct uart_port *port) 587 - { 588 - if (port->mapbase == 0xffe00000) 589 - return __raw_readb(PSDR) & 0x02 ? 1 : 0; /* SCIF0 */ 590 - if (port->mapbase == 0xffe10000) 591 - return __raw_readb(PADR) & 0x40 ? 1 : 0; /* SCIF1 */ 592 - if (port->mapbase == 0xffe20000) 593 - return __raw_readb(PWDR) & 0x04 ? 1 : 0; /* SCIF2 */ 594 - 595 - return 1; 596 - } 597 - #elif defined(CONFIG_CPU_SUBTYPE_SH7723) 598 - static inline int sci_rxd_in(struct uart_port *port) 599 - { 600 - if (port->mapbase == 0xffe00000) 601 - return __raw_readb(SCSPTR0) & 0x0008 ? 1 : 0; /* SCIF0 */ 602 - if (port->mapbase == 0xffe10000) 603 - return __raw_readb(SCSPTR1) & 0x0020 ? 1 : 0; /* SCIF1 */ 604 - if (port->mapbase == 0xffe20000) 605 - return __raw_readb(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF2 */ 606 - if (port->mapbase == 0xa4e30000) 607 - return __raw_readb(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF3 */ 608 - if (port->mapbase == 0xa4e40000) 609 - return __raw_readb(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF4 */ 610 - if (port->mapbase == 0xa4e50000) 611 - return __raw_readb(SCSPTR5) & 0x0008 ? 1 : 0; /* SCIF5 */ 612 - return 1; 613 - } 614 - #elif defined(CONFIG_CPU_SUBTYPE_SH7724) 615 - # define SCFSR 0x0010 616 - # define SCASSR 0x0014 617 - static inline int sci_rxd_in(struct uart_port *port) 618 - { 619 - if (port->type == PORT_SCIF) 620 - return __raw_readw((port->mapbase + SCFSR)) & SCIF_BRK ? 1 : 0; 621 - if (port->type == PORT_SCIFA) 622 - return __raw_readw((port->mapbase + SCASSR)) & SCIF_BRK ? 1 : 0; 623 - return 1; 624 - } 625 - #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) 626 - static inline int sci_rxd_in(struct uart_port *port) 627 - { 628 - return sci_in(port, SCSPTR)&0x0001 ? 1 : 0; /* SCIF */ 629 562 } 630 563 #elif defined(__H8300H__) || defined(__H8300S__) 631 564 static inline int sci_rxd_in(struct uart_port *port) ··· 538 661 int ch = (port->mapbase - SMR0) >> 3; 539 662 return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0; 540 663 } 541 - #elif defined(CONFIG_CPU_SUBTYPE_SH7763) 664 + #else /* default case for non-SCI processors */ 542 665 static inline int sci_rxd_in(struct uart_port *port) 543 666 { 544 - if (port->mapbase == 0xffe00000) 545 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 546 - if (port->mapbase == 0xffe08000) 547 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 548 - if (port->mapbase == 0xffe10000) 549 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF/IRDA */ 550 - 551 - return 1; 552 - } 553 - #elif defined(CONFIG_CPU_SUBTYPE_SH7770) 554 - static inline int sci_rxd_in(struct uart_port *port) 555 - { 556 - if (port->mapbase == 0xff923000) 557 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 558 - if (port->mapbase == 0xff924000) 559 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 560 - if (port->mapbase == 0xff925000) 561 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 562 - return 1; 563 - } 564 - #elif defined(CONFIG_CPU_SUBTYPE_SH7780) 565 - static inline int sci_rxd_in(struct uart_port *port) 566 - { 567 - if (port->mapbase == 0xffe00000) 568 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 569 - if (port->mapbase == 0xffe10000) 570 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 571 - return 1; 572 - } 573 - #elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \ 574 - defined(CONFIG_CPU_SUBTYPE_SH7786) 575 - static inline int sci_rxd_in(struct uart_port *port) 576 - { 577 - if (port->mapbase == 0xffea0000) 578 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 579 - if (port->mapbase == 0xffeb0000) 580 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 581 - if (port->mapbase == 0xffec0000) 582 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 583 - if (port->mapbase == 0xffed0000) 584 - return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 585 - if (port->mapbase == 0xffee0000) 586 - return __raw_readw(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF */ 587 - if (port->mapbase == 0xffef0000) 588 - return __raw_readw(SCSPTR5) & 0x0001 ? 1 : 0; /* SCIF */ 589 - return 1; 590 - } 591 - #elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \ 592 - defined(CONFIG_CPU_SUBTYPE_SH7203) || \ 593 - defined(CONFIG_CPU_SUBTYPE_SH7206) || \ 594 - defined(CONFIG_CPU_SUBTYPE_SH7263) 595 - static inline int sci_rxd_in(struct uart_port *port) 596 - { 597 - if (port->mapbase == 0xfffe8000) 598 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 599 - if (port->mapbase == 0xfffe8800) 600 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 601 - if (port->mapbase == 0xfffe9000) 602 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 603 - if (port->mapbase == 0xfffe9800) 604 - return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 605 - #if defined(CONFIG_CPU_SUBTYPE_SH7201) 606 - if (port->mapbase == 0xfffeA000) 607 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 608 - if (port->mapbase == 0xfffeA800) 609 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 610 - if (port->mapbase == 0xfffeB000) 611 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 612 - if (port->mapbase == 0xfffeB800) 613 - return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 614 - #endif 615 - return 1; 616 - } 617 - #elif defined(CONFIG_CPU_SUBTYPE_SH7619) 618 - static inline int sci_rxd_in(struct uart_port *port) 619 - { 620 - if (port->mapbase == 0xf8400000) 621 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 622 - if (port->mapbase == 0xf8410000) 623 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 624 - if (port->mapbase == 0xf8420000) 625 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 626 - return 1; 627 - } 628 - #elif defined(CONFIG_CPU_SUBTYPE_SHX3) 629 - static inline int sci_rxd_in(struct uart_port *port) 630 - { 631 - if (port->mapbase == 0xffc30000) 632 - return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 633 - if (port->mapbase == 0xffc40000) 634 - return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 635 - if (port->mapbase == 0xffc50000) 636 - return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 637 - if (port->mapbase == 0xffc60000) 638 - return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 639 667 return 1; 640 668 } 641 669 #endif