Stephen Boyd | cb053de | 2011-12-15 13:32:43 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #include <linux/slab.h> |
| 14 | #include <linux/io.h> |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/mutex.h> |
| 17 | #include <linux/errno.h> |
| 18 | #include <linux/err.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 19 | #include <linux/init.h> |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 20 | |
| 21 | #include <asm/cacheflush.h> |
| 22 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 23 | #include <mach/scm.h> |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 24 | |
| 25 | #define SCM_ENOMEM -5 |
| 26 | #define SCM_EOPNOTSUPP -4 |
| 27 | #define SCM_EINVAL_ADDR -3 |
| 28 | #define SCM_EINVAL_ARG -2 |
| 29 | #define SCM_ERROR -1 |
| 30 | #define SCM_INTERRUPTED 1 |
| 31 | |
| 32 | static DEFINE_MUTEX(scm_lock); |
| 33 | |
| 34 | /** |
| 35 | * struct scm_command - one SCM command buffer |
| 36 | * @len: total available memory for command and response |
| 37 | * @buf_offset: start of command buffer |
| 38 | * @resp_hdr_offset: start of response buffer |
| 39 | * @id: command to be executed |
| 40 | * @buf: buffer returned from scm_get_command_buffer() |
| 41 | * |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 42 | * An SCM command is laid out in memory as follows: |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 43 | * |
| 44 | * ------------------- <--- struct scm_command |
| 45 | * | command header | |
| 46 | * ------------------- <--- scm_get_command_buffer() |
| 47 | * | command buffer | |
| 48 | * ------------------- <--- struct scm_response and |
| 49 | * | response header | scm_command_to_response() |
| 50 | * ------------------- <--- scm_get_response_buffer() |
| 51 | * | response buffer | |
| 52 | * ------------------- |
| 53 | * |
| 54 | * There can be arbitrary padding between the headers and buffers so |
| 55 | * you should always use the appropriate scm_get_*_buffer() routines |
| 56 | * to access the buffers in a safe manner. |
| 57 | */ |
| 58 | struct scm_command { |
| 59 | u32 len; |
| 60 | u32 buf_offset; |
| 61 | u32 resp_hdr_offset; |
| 62 | u32 id; |
| 63 | u32 buf[0]; |
| 64 | }; |
| 65 | |
| 66 | /** |
| 67 | * struct scm_response - one SCM response buffer |
| 68 | * @len: total available memory for response |
| 69 | * @buf_offset: start of response data relative to start of scm_response |
| 70 | * @is_complete: indicates if the command has finished processing |
| 71 | */ |
| 72 | struct scm_response { |
| 73 | u32 len; |
| 74 | u32 buf_offset; |
| 75 | u32 is_complete; |
| 76 | }; |
| 77 | |
| 78 | /** |
| 79 | * alloc_scm_command() - Allocate an SCM command |
| 80 | * @cmd_size: size of the command buffer |
| 81 | * @resp_size: size of the response buffer |
| 82 | * |
| 83 | * Allocate an SCM command, including enough room for the command |
| 84 | * and response headers as well as the command and response buffers. |
| 85 | * |
| 86 | * Returns a valid &scm_command on success or %NULL if the allocation fails. |
| 87 | */ |
| 88 | static struct scm_command *alloc_scm_command(size_t cmd_size, size_t resp_size) |
| 89 | { |
| 90 | struct scm_command *cmd; |
| 91 | size_t len = sizeof(*cmd) + sizeof(struct scm_response) + cmd_size + |
| 92 | resp_size; |
| 93 | |
| 94 | cmd = kzalloc(PAGE_ALIGN(len), GFP_KERNEL); |
| 95 | if (cmd) { |
| 96 | cmd->len = len; |
| 97 | cmd->buf_offset = offsetof(struct scm_command, buf); |
| 98 | cmd->resp_hdr_offset = cmd->buf_offset + cmd_size; |
| 99 | } |
| 100 | return cmd; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * free_scm_command() - Free an SCM command |
| 105 | * @cmd: command to free |
| 106 | * |
| 107 | * Free an SCM command. |
| 108 | */ |
| 109 | static inline void free_scm_command(struct scm_command *cmd) |
| 110 | { |
| 111 | kfree(cmd); |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * scm_command_to_response() - Get a pointer to a scm_response |
| 116 | * @cmd: command |
| 117 | * |
| 118 | * Returns a pointer to a response for a command. |
| 119 | */ |
| 120 | static inline struct scm_response *scm_command_to_response( |
| 121 | const struct scm_command *cmd) |
| 122 | { |
| 123 | return (void *)cmd + cmd->resp_hdr_offset; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * scm_get_command_buffer() - Get a pointer to a command buffer |
| 128 | * @cmd: command |
| 129 | * |
| 130 | * Returns a pointer to the command buffer of a command. |
| 131 | */ |
| 132 | static inline void *scm_get_command_buffer(const struct scm_command *cmd) |
| 133 | { |
| 134 | return (void *)cmd->buf; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * scm_get_response_buffer() - Get a pointer to a response buffer |
| 139 | * @rsp: response |
| 140 | * |
| 141 | * Returns a pointer to a response buffer of a response. |
| 142 | */ |
| 143 | static inline void *scm_get_response_buffer(const struct scm_response *rsp) |
| 144 | { |
| 145 | return (void *)rsp + rsp->buf_offset; |
| 146 | } |
| 147 | |
| 148 | static int scm_remap_error(int err) |
| 149 | { |
| 150 | switch (err) { |
| 151 | case SCM_ERROR: |
| 152 | return -EIO; |
| 153 | case SCM_EINVAL_ADDR: |
| 154 | case SCM_EINVAL_ARG: |
| 155 | return -EINVAL; |
| 156 | case SCM_EOPNOTSUPP: |
| 157 | return -EOPNOTSUPP; |
| 158 | case SCM_ENOMEM: |
| 159 | return -ENOMEM; |
| 160 | } |
| 161 | return -EINVAL; |
| 162 | } |
| 163 | |
| 164 | static u32 smc(u32 cmd_addr) |
| 165 | { |
| 166 | int context_id; |
| 167 | register u32 r0 asm("r0") = 1; |
| 168 | register u32 r1 asm("r1") = (u32)&context_id; |
| 169 | register u32 r2 asm("r2") = cmd_addr; |
Stephen Boyd | 8e76a80 | 2011-02-24 10:44:44 -0800 | [diff] [blame] | 170 | do { |
| 171 | asm volatile( |
| 172 | __asmeq("%0", "r0") |
| 173 | __asmeq("%1", "r0") |
| 174 | __asmeq("%2", "r1") |
| 175 | __asmeq("%3", "r2") |
Marc Zyngier | eca55f4 | 2011-11-08 13:07:36 +0000 | [diff] [blame] | 176 | #ifdef REQUIRES_SEC |
| 177 | ".arch_extension sec\n" |
| 178 | #endif |
Stephen Boyd | 8e76a80 | 2011-02-24 10:44:44 -0800 | [diff] [blame] | 179 | "smc #0 @ switch to secure world\n" |
| 180 | : "=r" (r0) |
| 181 | : "r" (r0), "r" (r1), "r" (r2) |
| 182 | : "r3"); |
| 183 | } while (r0 == SCM_INTERRUPTED); |
| 184 | |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 185 | return r0; |
| 186 | } |
| 187 | |
| 188 | static int __scm_call(const struct scm_command *cmd) |
| 189 | { |
| 190 | int ret; |
| 191 | u32 cmd_addr = virt_to_phys(cmd); |
| 192 | |
| 193 | /* |
| 194 | * Flush the entire cache here so callers don't have to remember |
| 195 | * to flush the cache when passing physical addresses to the secure |
| 196 | * side in the buffer. |
| 197 | */ |
| 198 | flush_cache_all(); |
Stephen Boyd | 8e76a80 | 2011-02-24 10:44:44 -0800 | [diff] [blame] | 199 | ret = smc(cmd_addr); |
| 200 | if (ret < 0) |
| 201 | ret = scm_remap_error(ret); |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 202 | |
| 203 | return ret; |
| 204 | } |
| 205 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 206 | static u32 cacheline_size; |
| 207 | |
| 208 | static void scm_inv_range(unsigned long start, unsigned long end) |
| 209 | { |
| 210 | start = round_down(start, cacheline_size); |
| 211 | end = round_up(end, cacheline_size); |
| 212 | while (start < end) { |
| 213 | asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start) |
| 214 | : "memory"); |
| 215 | start += cacheline_size; |
| 216 | } |
| 217 | dsb(); |
| 218 | isb(); |
| 219 | } |
| 220 | |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 221 | /** |
| 222 | * scm_call() - Send an SCM command |
| 223 | * @svc_id: service identifier |
| 224 | * @cmd_id: command identifier |
| 225 | * @cmd_buf: command buffer |
| 226 | * @cmd_len: length of the command buffer |
| 227 | * @resp_buf: response buffer |
| 228 | * @resp_len: length of the response buffer |
| 229 | * |
| 230 | * Sends a command to the SCM and waits for the command to finish processing. |
| 231 | */ |
| 232 | int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len, |
| 233 | void *resp_buf, size_t resp_len) |
| 234 | { |
| 235 | int ret; |
| 236 | struct scm_command *cmd; |
| 237 | struct scm_response *rsp; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 238 | unsigned long start, end; |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 239 | |
| 240 | cmd = alloc_scm_command(cmd_len, resp_len); |
| 241 | if (!cmd) |
| 242 | return -ENOMEM; |
| 243 | |
| 244 | cmd->id = (svc_id << 10) | cmd_id; |
| 245 | if (cmd_buf) |
| 246 | memcpy(scm_get_command_buffer(cmd), cmd_buf, cmd_len); |
| 247 | |
| 248 | mutex_lock(&scm_lock); |
| 249 | ret = __scm_call(cmd); |
| 250 | mutex_unlock(&scm_lock); |
| 251 | if (ret) |
| 252 | goto out; |
| 253 | |
| 254 | rsp = scm_command_to_response(cmd); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 255 | start = (unsigned long)rsp; |
| 256 | |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 257 | do { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 258 | scm_inv_range(start, start + sizeof(*rsp)); |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 259 | } while (!rsp->is_complete); |
| 260 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 261 | end = (unsigned long)scm_get_response_buffer(rsp) + resp_len; |
| 262 | scm_inv_range(start, end); |
| 263 | |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 264 | if (resp_buf) |
| 265 | memcpy(resp_buf, scm_get_response_buffer(rsp), resp_len); |
| 266 | out: |
| 267 | free_scm_command(cmd); |
| 268 | return ret; |
| 269 | } |
| 270 | EXPORT_SYMBOL(scm_call); |
| 271 | |
Stephen Boyd | 551cd96 | 2011-07-18 10:33:45 -0700 | [diff] [blame] | 272 | #define SCM_CLASS_REGISTER (0x2 << 8) |
| 273 | #define SCM_MASK_IRQS BIT(5) |
| 274 | #define SCM_ATOMIC(svc, cmd, n) (((((svc) << 10)|((cmd) & 0x3ff)) << 12) | \ |
| 275 | SCM_CLASS_REGISTER | \ |
| 276 | SCM_MASK_IRQS | \ |
| 277 | (n & 0xf)) |
| 278 | |
| 279 | /** |
| 280 | * scm_call_atomic1() - Send an atomic SCM command with one argument |
| 281 | * @svc_id: service identifier |
| 282 | * @cmd_id: command identifier |
| 283 | * @arg1: first argument |
| 284 | * |
| 285 | * This shall only be used with commands that are guaranteed to be |
| 286 | * uninterruptable, atomic and SMP safe. |
| 287 | */ |
Stephen Boyd | c2a7718 | 2011-12-12 13:52:17 -0800 | [diff] [blame] | 288 | s32 scm_call_atomic1(u32 svc, u32 cmd, u32 arg1) |
Stephen Boyd | 551cd96 | 2011-07-18 10:33:45 -0700 | [diff] [blame] | 289 | { |
| 290 | int context_id; |
| 291 | register u32 r0 asm("r0") = SCM_ATOMIC(svc, cmd, 1); |
| 292 | register u32 r1 asm("r1") = (u32)&context_id; |
| 293 | register u32 r2 asm("r2") = arg1; |
| 294 | |
| 295 | asm volatile( |
| 296 | __asmeq("%0", "r0") |
| 297 | __asmeq("%1", "r0") |
| 298 | __asmeq("%2", "r1") |
| 299 | __asmeq("%3", "r2") |
Steve Muckle | 6dff957 | 2012-06-25 17:37:50 -0700 | [diff] [blame^] | 300 | #ifdef REQUIRES_SEC |
| 301 | ".arch_extension sec\n" |
| 302 | #endif |
Stephen Boyd | 551cd96 | 2011-07-18 10:33:45 -0700 | [diff] [blame] | 303 | "smc #0 @ switch to secure world\n" |
| 304 | : "=r" (r0) |
| 305 | : "r" (r0), "r" (r1), "r" (r2) |
| 306 | : "r3"); |
| 307 | return r0; |
| 308 | } |
| 309 | EXPORT_SYMBOL(scm_call_atomic1); |
| 310 | |
| 311 | /** |
| 312 | * scm_call_atomic2() - Send an atomic SCM command with two arguments |
| 313 | * @svc_id: service identifier |
| 314 | * @cmd_id: command identifier |
| 315 | * @arg1: first argument |
| 316 | * @arg2: second argument |
| 317 | * |
| 318 | * This shall only be used with commands that are guaranteed to be |
| 319 | * uninterruptable, atomic and SMP safe. |
| 320 | */ |
Stephen Boyd | c2a7718 | 2011-12-12 13:52:17 -0800 | [diff] [blame] | 321 | s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2) |
Stephen Boyd | 551cd96 | 2011-07-18 10:33:45 -0700 | [diff] [blame] | 322 | { |
| 323 | int context_id; |
| 324 | register u32 r0 asm("r0") = SCM_ATOMIC(svc, cmd, 2); |
| 325 | register u32 r1 asm("r1") = (u32)&context_id; |
| 326 | register u32 r2 asm("r2") = arg1; |
| 327 | register u32 r3 asm("r3") = arg2; |
| 328 | |
| 329 | asm volatile( |
| 330 | __asmeq("%0", "r0") |
| 331 | __asmeq("%1", "r0") |
| 332 | __asmeq("%2", "r1") |
| 333 | __asmeq("%3", "r2") |
| 334 | __asmeq("%4", "r3") |
Steve Muckle | 6dff957 | 2012-06-25 17:37:50 -0700 | [diff] [blame^] | 335 | #ifdef REQUIRES_SEC |
| 336 | ".arch_extension sec\n" |
| 337 | #endif |
Stephen Boyd | 551cd96 | 2011-07-18 10:33:45 -0700 | [diff] [blame] | 338 | "smc #0 @ switch to secure world\n" |
| 339 | : "=r" (r0) |
| 340 | : "r" (r0), "r" (r1), "r" (r2), "r" (r3)); |
| 341 | return r0; |
| 342 | } |
| 343 | EXPORT_SYMBOL(scm_call_atomic2); |
| 344 | |
Stephen Boyd | cb053de | 2011-12-15 13:32:43 -0800 | [diff] [blame] | 345 | s32 scm_call_atomic4_3(u32 svc, u32 cmd, u32 arg1, u32 arg2, |
| 346 | u32 arg3, u32 arg4, u32 *ret1, u32 *ret2) |
| 347 | { |
| 348 | int ret; |
| 349 | int context_id; |
| 350 | register u32 r0 asm("r0") = SCM_ATOMIC(svc, cmd, 4); |
| 351 | register u32 r1 asm("r1") = (u32)&context_id; |
| 352 | register u32 r2 asm("r2") = arg1; |
| 353 | register u32 r3 asm("r3") = arg2; |
| 354 | register u32 r4 asm("r4") = arg3; |
| 355 | register u32 r5 asm("r5") = arg4; |
| 356 | |
| 357 | asm volatile( |
| 358 | __asmeq("%0", "r0") |
| 359 | __asmeq("%1", "r1") |
| 360 | __asmeq("%2", "r2") |
| 361 | __asmeq("%3", "r0") |
| 362 | __asmeq("%4", "r1") |
| 363 | __asmeq("%5", "r2") |
| 364 | __asmeq("%6", "r3") |
Steve Muckle | 6dff957 | 2012-06-25 17:37:50 -0700 | [diff] [blame^] | 365 | #ifdef REQUIRES_SEC |
| 366 | ".arch_extension sec\n" |
| 367 | #endif |
Stephen Boyd | cb053de | 2011-12-15 13:32:43 -0800 | [diff] [blame] | 368 | "smc #0 @ switch to secure world\n" |
| 369 | : "=r" (r0), "=r" (r1), "=r" (r2) |
| 370 | : "r" (r0), "r" (r1), "r" (r2), "r" (r3), "r" (r4), "r" (r5)); |
| 371 | ret = r0; |
| 372 | if (ret1) |
| 373 | *ret1 = r1; |
| 374 | if (ret2) |
| 375 | *ret2 = r2; |
| 376 | return r0; |
| 377 | } |
| 378 | EXPORT_SYMBOL(scm_call_atomic4_3); |
| 379 | |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 380 | u32 scm_get_version(void) |
| 381 | { |
| 382 | int context_id; |
| 383 | static u32 version = -1; |
Stephen Boyd | 98d4ded | 2011-02-24 10:44:43 -0800 | [diff] [blame] | 384 | register u32 r0 asm("r0"); |
| 385 | register u32 r1 asm("r1"); |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 386 | |
| 387 | if (version != -1) |
| 388 | return version; |
| 389 | |
| 390 | mutex_lock(&scm_lock); |
Stephen Boyd | 98d4ded | 2011-02-24 10:44:43 -0800 | [diff] [blame] | 391 | |
| 392 | r0 = 0x1 << 8; |
| 393 | r1 = (u32)&context_id; |
Stephen Boyd | 8e76a80 | 2011-02-24 10:44:44 -0800 | [diff] [blame] | 394 | do { |
| 395 | asm volatile( |
| 396 | __asmeq("%0", "r0") |
| 397 | __asmeq("%1", "r1") |
| 398 | __asmeq("%2", "r0") |
| 399 | __asmeq("%3", "r1") |
Steve Muckle | 6dff957 | 2012-06-25 17:37:50 -0700 | [diff] [blame^] | 400 | #ifdef REQUIRES_SEC |
| 401 | ".arch_extension sec\n" |
| 402 | #endif |
Stephen Boyd | 8e76a80 | 2011-02-24 10:44:44 -0800 | [diff] [blame] | 403 | "smc #0 @ switch to secure world\n" |
| 404 | : "=r" (r0), "=r" (r1) |
| 405 | : "r" (r0), "r" (r1) |
| 406 | : "r2", "r3"); |
| 407 | } while (r0 == SCM_INTERRUPTED); |
| 408 | |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 409 | version = r1; |
| 410 | mutex_unlock(&scm_lock); |
| 411 | |
| 412 | return version; |
| 413 | } |
| 414 | EXPORT_SYMBOL(scm_get_version); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 415 | |
Saravana Kannan | 988feaf | 2011-09-07 19:57:06 -0700 | [diff] [blame] | 416 | #define IS_CALL_AVAIL_CMD 1 |
| 417 | int scm_is_call_available(u32 svc_id, u32 cmd_id) |
| 418 | { |
| 419 | int ret; |
| 420 | u32 svc_cmd = (svc_id << 10) | cmd_id; |
| 421 | u32 ret_val = 0; |
| 422 | |
| 423 | ret = scm_call(SCM_SVC_INFO, IS_CALL_AVAIL_CMD, &svc_cmd, |
| 424 | sizeof(svc_cmd), &ret_val, sizeof(ret_val)); |
| 425 | if (ret) |
| 426 | return ret; |
| 427 | |
| 428 | return ret_val; |
| 429 | } |
| 430 | EXPORT_SYMBOL(scm_is_call_available); |
| 431 | |
Stephen Boyd | c085f9b | 2012-02-29 17:52:52 -0800 | [diff] [blame] | 432 | #define GET_FEAT_VERSION_CMD 3 |
| 433 | int scm_get_feat_version(u32 feat) |
| 434 | { |
| 435 | if (scm_is_call_available(SCM_SVC_INFO, GET_FEAT_VERSION_CMD)) { |
| 436 | u32 version; |
| 437 | if (!scm_call(SCM_SVC_INFO, GET_FEAT_VERSION_CMD, &feat, |
| 438 | sizeof(feat), &version, sizeof(version))) |
| 439 | return version; |
| 440 | } |
| 441 | return 0; |
| 442 | } |
| 443 | EXPORT_SYMBOL(scm_get_feat_version); |
| 444 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 445 | static int scm_init(void) |
| 446 | { |
| 447 | u32 ctr; |
| 448 | |
| 449 | asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr)); |
| 450 | cacheline_size = 4 << ((ctr >> 16) & 0xf); |
| 451 | |
| 452 | return 0; |
| 453 | } |
| 454 | early_initcall(scm_init); |