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

Merge branch 'sh/for-2.6.29' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6

* 'sh/for-2.6.29' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
sh: Fix up T-bit error handling in SH-4A mutex fastpath.
sh: Fix up spurious syscall restarting.
sh: fcnvds fix with denormalized numbers on SH-4 FPU.
sh: Only reserve memory under CONFIG_ZERO_PAGE_OFFSET when it != 0.
sh: Handle calling csum_partial with misaligned data
sh: ap325rxa: Enable ov772x in defconfig.
sh: ap325rxa: Add ov772x support.
sh: ap325rxa: control camera power toggling.
sh: mach-migor: Enable ov772x and tw9910 in defconfig.

+184 -100
+59 -4
arch/sh/boards/board-ap325rxa.c
··· 22 22 #include <linux/gpio.h> 23 23 #include <linux/spi/spi.h> 24 24 #include <linux/spi/spi_gpio.h> 25 + #include <media/ov772x.h> 25 26 #include <media/soc_camera_platform.h> 26 27 #include <media/sh_mobile_ceu.h> 27 28 #include <video/sh_mobile_lcdc.h> ··· 217 216 }, 218 217 }; 219 218 219 + static void camera_power(int val) 220 + { 221 + gpio_set_value(GPIO_PTZ5, val); /* RST_CAM/RSTB */ 222 + mdelay(10); 223 + } 224 + 220 225 #ifdef CONFIG_I2C 226 + /* support for the old ncm03j camera */ 221 227 static unsigned char camera_ncm03j_magic[] = 222 228 { 223 229 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8, ··· 245 237 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F, 246 238 }; 247 239 240 + static int camera_probe(void) 241 + { 242 + struct i2c_adapter *a = i2c_get_adapter(0); 243 + struct i2c_msg msg; 244 + int ret; 245 + 246 + camera_power(1); 247 + msg.addr = 0x6e; 248 + msg.buf = camera_ncm03j_magic; 249 + msg.len = 2; 250 + msg.flags = 0; 251 + ret = i2c_transfer(a, &msg, 1); 252 + camera_power(0); 253 + 254 + return ret; 255 + } 256 + 248 257 static int camera_set_capture(struct soc_camera_platform_info *info, 249 258 int enable) 250 259 { ··· 270 245 int ret = 0; 271 246 int i; 272 247 248 + camera_power(0); 273 249 if (!enable) 274 250 return 0; /* no disable for now */ 275 251 252 + camera_power(1); 276 253 for (i = 0; i < ARRAY_SIZE(camera_ncm03j_magic); i += 2) { 277 254 u_int8_t buf[8]; 278 255 ··· 313 286 .platform_data = &camera_info, 314 287 }, 315 288 }; 289 + 290 + static int __init camera_setup(void) 291 + { 292 + if (camera_probe() > 0) 293 + platform_device_register(&camera_device); 294 + 295 + return 0; 296 + } 297 + late_initcall(camera_setup); 298 + 316 299 #endif /* CONFIG_I2C */ 300 + 301 + static int ov7725_power(struct device *dev, int mode) 302 + { 303 + camera_power(0); 304 + if (mode) 305 + camera_power(1); 306 + 307 + return 0; 308 + } 309 + 310 + static struct ov772x_camera_info ov7725_info = { 311 + .buswidth = SOCAM_DATAWIDTH_8, 312 + .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP, 313 + .link = { 314 + .power = ov7725_power, 315 + }, 316 + }; 317 317 318 318 static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 319 319 .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | ··· 392 338 &ap325rxa_nor_flash_device, 393 339 &lcdc_device, 394 340 &ceu_device, 395 - #ifdef CONFIG_I2C 396 - &camera_device, 397 - #endif 398 341 &nand_flash_device, 399 342 &sdcard_cn3_device, 400 343 }; ··· 399 348 static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = { 400 349 { 401 350 I2C_BOARD_INFO("pcf8563", 0x51), 351 + }, 352 + { 353 + I2C_BOARD_INFO("ov772x", 0x21), 354 + .platform_data = &ov7725_info, 402 355 }, 403 356 }; 404 357 ··· 481 426 gpio_request(GPIO_PTZ6, NULL); 482 427 gpio_direction_output(GPIO_PTZ6, 0); /* STBY_CAM */ 483 428 gpio_request(GPIO_PTZ5, NULL); 484 - gpio_direction_output(GPIO_PTZ5, 1); /* RST_CAM */ 429 + gpio_direction_output(GPIO_PTZ5, 0); /* RST_CAM */ 485 430 gpio_request(GPIO_PTZ4, NULL); 486 431 gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */ 487 432
+20 -7
arch/sh/configs/ap325rxa_defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 - # Linux kernel version: 2.6.28 4 - # Fri Jan 9 16:54:19 2009 3 + # Linux kernel version: 2.6.29-rc2 4 + # Tue Jan 27 11:45:08 2009 5 5 # 6 6 CONFIG_SUPERH=y 7 7 CONFIG_SUPERH32=y ··· 45 45 # CONFIG_AUDIT is not set 46 46 # CONFIG_IKCONFIG is not set 47 47 CONFIG_LOG_BUF_SHIFT=14 48 - # CONFIG_CGROUPS is not set 49 48 CONFIG_GROUP_SCHED=y 50 49 CONFIG_FAIR_GROUP_SCHED=y 51 50 # CONFIG_RT_GROUP_SCHED is not set 52 51 CONFIG_USER_SCHED=y 53 52 # CONFIG_CGROUP_SCHED is not set 53 + # CONFIG_CGROUPS is not set 54 54 CONFIG_SYSFS_DEPRECATED=y 55 55 CONFIG_SYSFS_DEPRECATED_V2=y 56 56 # CONFIG_RELAY is not set ··· 378 378 # CONFIG_WIRELESS_EXT is not set 379 379 # CONFIG_LIB80211 is not set 380 380 # CONFIG_MAC80211 is not set 381 + # CONFIG_WIMAX is not set 381 382 # CONFIG_RFKILL is not set 382 383 # CONFIG_NET_9P is not set 383 384 ··· 401 400 # CONFIG_MTD_DEBUG is not set 402 401 CONFIG_MTD_CONCAT=y 403 402 CONFIG_MTD_PARTITIONS=y 403 + # CONFIG_MTD_TESTS is not set 404 404 # CONFIG_MTD_REDBOOT_PARTS is not set 405 405 CONFIG_MTD_CMDLINE_PARTS=y 406 406 # CONFIG_MTD_AR7_PARTS is not set ··· 449 447 # 450 448 # CONFIG_MTD_COMPLEX_MAPPINGS is not set 451 449 CONFIG_MTD_PHYSMAP=y 452 - CONFIG_MTD_PHYSMAP_START=0xffffffff 453 - CONFIG_MTD_PHYSMAP_LEN=0 454 - CONFIG_MTD_PHYSMAP_BANKWIDTH=0 450 + # CONFIG_MTD_PHYSMAP_COMPAT is not set 455 451 # CONFIG_MTD_PLATRAM is not set 456 452 457 453 # ··· 478 478 # CONFIG_MTD_NAND_PLATFORM is not set 479 479 CONFIG_MTD_NAND_SH_FLCTL=y 480 480 # CONFIG_MTD_ONENAND is not set 481 + 482 + # 483 + # LPDDR flash memory drivers 484 + # 485 + # CONFIG_MTD_LPDDR is not set 486 + # CONFIG_MTD_QINFO_PROBE is not set 481 487 482 488 # 483 489 # UBI - Unsorted block images ··· 613 607 # CONFIG_WLAN_PRE80211 is not set 614 608 # CONFIG_WLAN_80211 is not set 615 609 # CONFIG_IWLWIFI_LEDS is not set 610 + 611 + # 612 + # Enable WiMAX (Networking options) to see the WiMAX drivers 613 + # 616 614 # CONFIG_WAN is not set 617 615 # CONFIG_PPP is not set 618 616 # CONFIG_SLIP is not set ··· 800 790 # CONFIG_PMIC_DA903X is not set 801 791 # CONFIG_MFD_WM8400 is not set 802 792 # CONFIG_MFD_WM8350_I2C is not set 793 + # CONFIG_MFD_PCF50633 is not set 803 794 # CONFIG_REGULATOR is not set 804 795 805 796 # ··· 848 837 # CONFIG_SOC_CAMERA_MT9V022 is not set 849 838 # CONFIG_SOC_CAMERA_TW9910 is not set 850 839 CONFIG_SOC_CAMERA_PLATFORM=y 851 - # CONFIG_SOC_CAMERA_OV772X is not set 840 + CONFIG_SOC_CAMERA_OV772X=y 852 841 CONFIG_VIDEO_SH_MOBILE_CEU=y 853 842 # CONFIG_RADIO_ADAPTERS is not set 854 843 # CONFIG_DAB is not set ··· 1023 1012 CONFIG_FILE_LOCKING=y 1024 1013 # CONFIG_XFS_FS is not set 1025 1014 # CONFIG_OCFS2_FS is not set 1015 + # CONFIG_BTRFS_FS is not set 1026 1016 CONFIG_DNOTIFY=y 1027 1017 CONFIG_INOTIFY=y 1028 1018 CONFIG_INOTIFY_USER=y ··· 1072 1060 # CONFIG_JFFS2_FS is not set 1073 1061 # CONFIG_UBIFS_FS is not set 1074 1062 # CONFIG_CRAMFS is not set 1063 + # CONFIG_SQUASHFS is not set 1075 1064 # CONFIG_VXFS_FS is not set 1076 1065 # CONFIG_MINIX_FS is not set 1077 1066 # CONFIG_OMFS_FS is not set
+33 -9
arch/sh/configs/migor_defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 - # Linux kernel version: 2.6.28 4 - # Fri Jan 9 17:09:35 2009 3 + # Linux kernel version: 2.6.29-rc1 4 + # Thu Jan 22 09:16:16 2009 5 5 # 6 6 CONFIG_SUPERH=y 7 7 CONFIG_SUPERH32=y ··· 45 45 CONFIG_IKCONFIG=y 46 46 CONFIG_IKCONFIG_PROC=y 47 47 CONFIG_LOG_BUF_SHIFT=14 48 - # CONFIG_CGROUPS is not set 49 48 # CONFIG_GROUP_SCHED is not set 49 + 50 + # 51 + # Control Group support 52 + # 53 + # CONFIG_CGROUPS is not set 50 54 CONFIG_SYSFS_DEPRECATED=y 51 55 CONFIG_SYSFS_DEPRECATED_V2=y 52 56 # CONFIG_RELAY is not set ··· 393 389 CONFIG_WIRELESS_EXT_SYSFS=y 394 390 # CONFIG_LIB80211 is not set 395 391 # CONFIG_MAC80211 is not set 392 + # CONFIG_WIMAX is not set 396 393 # CONFIG_RFKILL is not set 397 394 # CONFIG_NET_9P is not set 398 395 ··· 416 411 # CONFIG_MTD_DEBUG is not set 417 412 CONFIG_MTD_CONCAT=y 418 413 CONFIG_MTD_PARTITIONS=y 414 + # CONFIG_MTD_TESTS is not set 419 415 # CONFIG_MTD_REDBOOT_PARTS is not set 420 416 CONFIG_MTD_CMDLINE_PARTS=y 421 417 # CONFIG_MTD_AR7_PARTS is not set ··· 464 458 # 465 459 # CONFIG_MTD_COMPLEX_MAPPINGS is not set 466 460 CONFIG_MTD_PHYSMAP=y 467 - CONFIG_MTD_PHYSMAP_START=0xffffffff 468 - CONFIG_MTD_PHYSMAP_LEN=0 469 - CONFIG_MTD_PHYSMAP_BANKWIDTH=0 461 + # CONFIG_MTD_PHYSMAP_COMPAT is not set 470 462 # CONFIG_MTD_PLATRAM is not set 471 463 472 464 # ··· 490 486 # CONFIG_MTD_NAND_NANDSIM is not set 491 487 CONFIG_MTD_NAND_PLATFORM=y 492 488 # CONFIG_MTD_ONENAND is not set 489 + 490 + # 491 + # LPDDR flash memory drivers 492 + # 493 + # CONFIG_MTD_LPDDR is not set 494 + # CONFIG_MTD_QINFO_PROBE is not set 493 495 494 496 # 495 497 # UBI - Unsorted block images ··· 597 587 # CONFIG_WLAN_PRE80211 is not set 598 588 # CONFIG_WLAN_80211 is not set 599 589 # CONFIG_IWLWIFI_LEDS is not set 590 + 591 + # 592 + # Enable WiMAX (Networking options) to see the WiMAX drivers 593 + # 600 594 # CONFIG_WAN is not set 601 595 # CONFIG_PPP is not set 602 596 # CONFIG_SLIP is not set ··· 775 761 # CONFIG_PMIC_DA903X is not set 776 762 # CONFIG_MFD_WM8400 is not set 777 763 # CONFIG_MFD_WM8350_I2C is not set 764 + # CONFIG_MFD_PCF50633 is not set 778 765 # CONFIG_REGULATOR is not set 779 766 780 767 # ··· 821 806 # CONFIG_SOC_CAMERA_MT9M111 is not set 822 807 # CONFIG_SOC_CAMERA_MT9T031 is not set 823 808 # CONFIG_SOC_CAMERA_MT9V022 is not set 824 - # CONFIG_SOC_CAMERA_TW9910 is not set 825 - CONFIG_SOC_CAMERA_PLATFORM=y 826 - # CONFIG_SOC_CAMERA_OV772X is not set 809 + CONFIG_SOC_CAMERA_TW9910=y 810 + # CONFIG_SOC_CAMERA_PLATFORM is not set 811 + CONFIG_SOC_CAMERA_OV772X=y 827 812 CONFIG_VIDEO_SH_MOBILE_CEU=y 828 813 # CONFIG_RADIO_ADAPTERS is not set 829 814 # CONFIG_DAB is not set ··· 881 866 # CONFIG_USB_GADGET_PXA25X is not set 882 867 # CONFIG_USB_GADGET_PXA27X is not set 883 868 # CONFIG_USB_GADGET_S3C2410 is not set 869 + # CONFIG_USB_GADGET_IMX is not set 884 870 CONFIG_USB_GADGET_M66592=y 885 871 CONFIG_USB_M66592=y 886 872 CONFIG_SUPERH_BUILT_IN_M66592=y 887 873 # CONFIG_USB_GADGET_AMD5536UDC is not set 888 874 # CONFIG_USB_GADGET_FSL_QE is not set 875 + # CONFIG_USB_GADGET_CI13XXX is not set 889 876 # CONFIG_USB_GADGET_NET2280 is not set 890 877 # CONFIG_USB_GADGET_GOKU is not set 891 878 # CONFIG_USB_GADGET_DUMMY_HCD is not set ··· 900 883 # CONFIG_USB_MIDI_GADGET is not set 901 884 # CONFIG_USB_G_PRINTER is not set 902 885 # CONFIG_USB_CDC_COMPOSITE is not set 886 + 887 + # 888 + # OTG and related infrastructure 889 + # 890 + # CONFIG_USB_GPIO_VBUS is not set 903 891 # CONFIG_MMC is not set 904 892 # CONFIG_MEMSTICK is not set 905 893 # CONFIG_NEW_LEDS is not set ··· 983 961 CONFIG_FILE_LOCKING=y 984 962 # CONFIG_XFS_FS is not set 985 963 # CONFIG_OCFS2_FS is not set 964 + # CONFIG_BTRFS_FS is not set 986 965 # CONFIG_DNOTIFY is not set 987 966 # CONFIG_INOTIFY is not set 988 967 # CONFIG_QUOTA is not set ··· 1027 1004 # CONFIG_EFS_FS is not set 1028 1005 # CONFIG_JFFS2_FS is not set 1029 1006 # CONFIG_CRAMFS is not set 1007 + # CONFIG_SQUASHFS is not set 1030 1008 # CONFIG_VXFS_FS is not set 1031 1009 # CONFIG_MINIX_FS is not set 1032 1010 # CONFIG_OMFS_FS is not set
+9 -12
arch/sh/include/asm/mutex-llsc.h
··· 21 21 static inline void 22 22 __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) 23 23 { 24 - int __ex_flag, __res; 24 + int __done, __res; 25 25 26 26 __asm__ __volatile__ ( 27 27 "movli.l @%2, %0 \n" 28 28 "add #-1, %0 \n" 29 29 "movco.l %0, @%2 \n" 30 30 "movt %1 \n" 31 - : "=&z" (__res), "=&r" (__ex_flag) 31 + : "=&z" (__res), "=&r" (__done) 32 32 : "r" (&(count)->counter) 33 33 : "t"); 34 34 35 - __res |= !__ex_flag; 36 - if (unlikely(__res != 0)) 35 + if (unlikely(!__done || __res != 0)) 37 36 fail_fn(count); 38 37 } 39 38 40 39 static inline int 41 40 __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 42 41 { 43 - int __ex_flag, __res; 42 + int __done, __res; 44 43 45 44 __asm__ __volatile__ ( 46 45 "movli.l @%2, %0 \n" 47 46 "add #-1, %0 \n" 48 47 "movco.l %0, @%2 \n" 49 48 "movt %1 \n" 50 - : "=&z" (__res), "=&r" (__ex_flag) 49 + : "=&z" (__res), "=&r" (__done) 51 50 : "r" (&(count)->counter) 52 51 : "t"); 53 52 54 - __res |= !__ex_flag; 55 - if (unlikely(__res != 0)) 53 + if (unlikely(!__done || __res != 0)) 56 54 __res = fail_fn(count); 57 55 58 56 return __res; ··· 59 61 static inline void 60 62 __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *)) 61 63 { 62 - int __ex_flag, __res; 64 + int __done, __res; 63 65 64 66 __asm__ __volatile__ ( 65 67 "movli.l @%2, %0 \n\t" 66 68 "add #1, %0 \n\t" 67 69 "movco.l %0, @%2 \n\t" 68 70 "movt %1 \n\t" 69 - : "=&z" (__res), "=&r" (__ex_flag) 71 + : "=&z" (__res), "=&r" (__done) 70 72 : "r" (&(count)->counter) 71 73 : "t"); 72 74 73 - __res |= !__ex_flag; 74 - if (unlikely(__res <= 0)) 75 + if (unlikely(!__done || __res <= 0)) 75 76 fail_fn(count); 76 77 } 77 78
+3 -19
arch/sh/include/asm/syscall_32.h
··· 21 21 */ 22 22 } 23 23 24 - static inline bool syscall_has_error(struct pt_regs *regs) 25 - { 26 - return (regs->sr & 0x1) ? true : false; 27 - } 28 - static inline void syscall_set_error(struct pt_regs *regs) 29 - { 30 - regs->sr |= 0x1; 31 - } 32 - static inline void syscall_clear_error(struct pt_regs *regs) 33 - { 34 - regs->sr &= ~0x1; 35 - } 36 - 37 24 static inline long syscall_get_error(struct task_struct *task, 38 25 struct pt_regs *regs) 39 26 { 40 - return syscall_has_error(regs) ? regs->regs[0] : 0; 27 + return IS_ERR_VALUE(regs->regs[0]) ? regs->regs[0] : 0; 41 28 } 42 29 43 30 static inline long syscall_get_return_value(struct task_struct *task, ··· 37 50 struct pt_regs *regs, 38 51 int error, long val) 39 52 { 40 - if (error) { 41 - syscall_set_error(regs); 53 + if (error) 42 54 regs->regs[0] = -error; 43 - } else { 44 - syscall_clear_error(regs); 55 + else 45 56 regs->regs[0] = val; 46 - } 47 57 } 48 58 49 59 static inline void syscall_get_arguments(struct task_struct *task,
+3 -19
arch/sh/include/asm/syscall_64.h
··· 21 21 */ 22 22 } 23 23 24 - static inline bool syscall_has_error(struct pt_regs *regs) 25 - { 26 - return (regs->sr & 0x1) ? true : false; 27 - } 28 - static inline void syscall_set_error(struct pt_regs *regs) 29 - { 30 - regs->sr |= 0x1; 31 - } 32 - static inline void syscall_clear_error(struct pt_regs *regs) 33 - { 34 - regs->sr &= ~0x1; 35 - } 36 - 37 24 static inline long syscall_get_error(struct task_struct *task, 38 25 struct pt_regs *regs) 39 26 { 40 - return syscall_has_error(regs) ? regs->regs[9] : 0; 27 + return IS_ERR_VALUE(regs->regs[9]) ? regs->regs[9] : 0; 41 28 } 42 29 43 30 static inline long syscall_get_return_value(struct task_struct *task, ··· 37 50 struct pt_regs *regs, 38 51 int error, long val) 39 52 { 40 - if (error) { 41 - syscall_set_error(regs); 53 + if (error) 42 54 regs->regs[9] = -error; 43 - } else { 44 - syscall_clear_error(regs); 55 + else 45 56 regs->regs[9] = val; 46 - } 47 57 } 48 58 49 59 static inline void syscall_get_arguments(struct task_struct *task,
+1 -1
arch/sh/kernel/cpu/sh4/fpu.c
··· 423 423 int m; 424 424 unsigned int hx; 425 425 426 - m = (finsn >> 9) & 0x7; 426 + m = (finsn >> 8) & 0x7; 427 427 hx = tsk->thread.fpu.hard.fp_regs[m]; 428 428 429 429 if ((tsk->thread.fpu.hard.fpscr & FPSCR_CAUSE_ERROR)
+4 -4
arch/sh/kernel/setup.c
··· 262 262 BOOTMEM_DEFAULT); 263 263 264 264 /* 265 - * reserve physical page 0 - it's a special BIOS page on many boxes, 266 - * enabling clean reboots, SMP operation, laptop functions. 265 + * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET. 267 266 */ 268 - reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET, 269 - BOOTMEM_DEFAULT); 267 + if (CONFIG_ZERO_PAGE_OFFSET != 0) 268 + reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET, 269 + BOOTMEM_DEFAULT); 270 270 271 271 sparse_memory_present_with_active_regions(0); 272 272
+1 -3
arch/sh/kernel/signal_32.c
··· 510 510 case -ERESTARTNOHAND: 511 511 no_system_call_restart: 512 512 regs->regs[0] = -EINTR; 513 - regs->sr |= 1; 514 513 break; 515 514 516 515 case -ERESTARTSYS: ··· 588 589 589 590 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 590 591 if (signr > 0) { 591 - if (regs->sr & 1) 592 - handle_syscall_restart(save_r0, regs, &ka.sa); 592 + handle_syscall_restart(save_r0, regs, &ka.sa); 593 593 594 594 /* Whee! Actually deliver the signal. */ 595 595 if (handle_signal(signr, &ka, &info, oldset,
+1 -3
arch/sh/kernel/signal_64.c
··· 60 60 case -ERESTARTNOHAND: 61 61 no_system_call_restart: 62 62 regs->regs[REG_RET] = -EINTR; 63 - regs->sr |= 1; 64 63 break; 65 64 66 65 case -ERESTARTSYS: ··· 108 109 109 110 signr = get_signal_to_deliver(&info, &ka, regs, 0); 110 111 if (signr > 0) { 111 - if (regs->sr & 1) 112 - handle_syscall_restart(regs, &ka.sa); 112 + handle_syscall_restart(regs, &ka.sa); 113 113 114 114 /* Whee! Actually deliver the signal. */ 115 115 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
+50 -19
arch/sh/lib/checksum.S
··· 36 36 */ 37 37 38 38 /* 39 - * unsigned int csum_partial(const unsigned char *buf, int len, 40 - * unsigned int sum); 39 + * asmlinkage __wsum csum_partial(const void *buf, int len, __wsum sum); 41 40 */ 42 41 43 42 .text ··· 48 49 * Fortunately, it is easy to convert 2-byte alignment to 4-byte 49 50 * alignment for the unrolled loop. 50 51 */ 51 - mov r5, r1 52 52 mov r4, r0 53 - tst #2, r0 ! Check alignment. 54 - bt 2f ! Jump if alignment is ok. 53 + tst #3, r0 ! Check alignment. 54 + bt/s 2f ! Jump if alignment is ok. 55 + mov r4, r7 ! Keep a copy to check for alignment 55 56 ! 57 + tst #1, r0 ! Check alignment. 58 + bt 21f ! Jump if alignment is boundary of 2bytes. 59 + 60 + ! buf is odd 61 + tst r5, r5 62 + add #-1, r5 63 + bt 9f 64 + mov.b @r4+, r0 65 + extu.b r0, r0 66 + addc r0, r6 ! t=0 from previous tst 67 + mov r6, r0 68 + shll8 r6 69 + shlr16 r0 70 + shlr8 r0 71 + or r0, r6 72 + mov r4, r0 73 + tst #2, r0 74 + bt 2f 75 + 21: 76 + ! buf is 2 byte aligned (len could be 0) 56 77 add #-2, r5 ! Alignment uses up two bytes. 57 78 cmp/pz r5 ! 58 79 bt/s 1f ! Jump if we had at least two bytes. ··· 80 61 bra 6f 81 62 add #2, r5 ! r5 was < 2. Deal with it. 82 63 1: 83 - mov r5, r1 ! Save new len for later use. 84 64 mov.w @r4+, r0 85 65 extu.w r0, r0 86 66 addc r0, r6 87 67 bf 2f 88 68 add #1, r6 89 69 2: 70 + ! buf is 4 byte aligned (len could be 0) 71 + mov r5, r1 90 72 mov #-5, r0 91 - shld r0, r5 92 - tst r5, r5 73 + shld r0, r1 74 + tst r1, r1 93 75 bt/s 4f ! if it's =0, go to 4f 94 76 clrt 95 77 .align 2 ··· 112 92 addc r0, r6 113 93 addc r2, r6 114 94 movt r0 115 - dt r5 95 + dt r1 116 96 bf/s 3b 117 97 cmp/eq #1, r0 118 - ! here, we know r5==0 119 - addc r5, r6 ! add carry to r6 98 + ! here, we know r1==0 99 + addc r1, r6 ! add carry to r6 120 100 4: 121 - mov r1, r0 101 + mov r5, r0 122 102 and #0x1c, r0 123 103 tst r0, r0 124 - bt/s 6f 125 - mov r0, r5 126 - shlr2 r5 104 + bt 6f 105 + ! 4 bytes or more remaining 106 + mov r0, r1 107 + shlr2 r1 127 108 mov #0, r2 128 109 5: 129 110 addc r2, r6 130 111 mov.l @r4+, r2 131 112 movt r0 132 - dt r5 113 + dt r1 133 114 bf/s 5b 134 115 cmp/eq #1, r0 135 116 addc r2, r6 136 - addc r5, r6 ! r5==0 here, so it means add carry-bit 117 + addc r1, r6 ! r1==0 here, so it means add carry-bit 137 118 6: 138 - mov r1, r5 119 + ! 3 bytes or less remaining 139 120 mov #3, r0 140 121 and r0, r5 141 122 tst r5, r5 ··· 160 139 8: 161 140 addc r0, r6 162 141 mov #0, r0 163 - addc r0, r6 142 + addc r0, r6 164 143 9: 144 + ! Check if the buffer was misaligned, if so realign sum 145 + mov r7, r0 146 + tst #1, r0 147 + bt 10f 148 + mov r6, r0 149 + shll8 r6 150 + shlr16 r0 151 + shlr8 r0 152 + or r0, r6 153 + 10: 165 154 rts 166 155 mov r6, r0 167 156