18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* NG2patch.S: Patch Ultra-I routines with Niagara-2 variant. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 2007 David S. Miller <davem@davemloft.net> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define BRANCH_ALWAYS 0x10680000 88c2ecf20Sopenharmony_ci#define NOP 0x01000000 98c2ecf20Sopenharmony_ci#define NG_DO_PATCH(OLD, NEW) \ 108c2ecf20Sopenharmony_ci sethi %hi(NEW), %g1; \ 118c2ecf20Sopenharmony_ci or %g1, %lo(NEW), %g1; \ 128c2ecf20Sopenharmony_ci sethi %hi(OLD), %g2; \ 138c2ecf20Sopenharmony_ci or %g2, %lo(OLD), %g2; \ 148c2ecf20Sopenharmony_ci sub %g1, %g2, %g1; \ 158c2ecf20Sopenharmony_ci sethi %hi(BRANCH_ALWAYS), %g3; \ 168c2ecf20Sopenharmony_ci sll %g1, 11, %g1; \ 178c2ecf20Sopenharmony_ci srl %g1, 11 + 2, %g1; \ 188c2ecf20Sopenharmony_ci or %g3, %lo(BRANCH_ALWAYS), %g3; \ 198c2ecf20Sopenharmony_ci or %g3, %g1, %g3; \ 208c2ecf20Sopenharmony_ci stw %g3, [%g2]; \ 218c2ecf20Sopenharmony_ci sethi %hi(NOP), %g3; \ 228c2ecf20Sopenharmony_ci or %g3, %lo(NOP), %g3; \ 238c2ecf20Sopenharmony_ci stw %g3, [%g2 + 0x4]; \ 248c2ecf20Sopenharmony_ci flush %g2; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci .globl niagara2_patch_copyops 278c2ecf20Sopenharmony_ci .type niagara2_patch_copyops,#function 288c2ecf20Sopenharmony_ciniagara2_patch_copyops: 298c2ecf20Sopenharmony_ci NG_DO_PATCH(memcpy, NG2memcpy) 308c2ecf20Sopenharmony_ci NG_DO_PATCH(raw_copy_from_user, NG2copy_from_user) 318c2ecf20Sopenharmony_ci NG_DO_PATCH(raw_copy_to_user, NG2copy_to_user) 328c2ecf20Sopenharmony_ci retl 338c2ecf20Sopenharmony_ci nop 348c2ecf20Sopenharmony_ci .size niagara2_patch_copyops,.-niagara2_patch_copyops 35