blob: e3b250b089f8b1377d6b4c243bda1c135cc0056a [file] [log] [blame]
Stephen Boyd6d67d252011-09-27 11:50:05 -07001/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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.
11 */
Stephen Boyde4174b22011-09-20 00:19:43 -070012#ifndef __MSM_PERIPHERAL_LOADER_H
13#define __MSM_PERIPHERAL_LOADER_H
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070014
Stephen Boyd3f4da322011-08-30 01:03:23 -070015struct device;
Stephen Boyd6d67d252011-09-27 11:50:05 -070016struct module;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017
Stephen Boyd36974ec2012-03-22 01:30:59 -070018/**
19 * struct pil_desc - PIL descriptor
20 * @name: string used for pil_get()
21 * @depends_on: booted before this peripheral
22 * @dev: parent device
23 * @ops: callback functions
24 * @owner: module the descriptor belongs to
25 * @proxy_timeout: delay in ms until proxy vote is removed
26 */
Stephen Boyd3f4da322011-08-30 01:03:23 -070027struct pil_desc {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028 const char *name;
29 const char *depends_on;
Stephen Boyd3f4da322011-08-30 01:03:23 -070030 struct device *dev;
31 const struct pil_reset_ops *ops;
Stephen Boyd6d67d252011-09-27 11:50:05 -070032 struct module *owner;
Stephen Boyd36974ec2012-03-22 01:30:59 -070033 unsigned long proxy_timeout;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034};
35
Stephen Boyd36974ec2012-03-22 01:30:59 -070036/**
37 * struct pil_reset_ops - PIL operations
38 * @init_image: prepare an image for authentication
39 * @verify_blob: authenticate a program segment, called once for each loadable
40 * program segment (optional)
41 * @proxy_vote: make proxy votes before auth_and_reset (optional)
42 * @auth_and_reset: boot the processor
43 * @proxy_unvote: remove any proxy votes (optional)
44 * @shutdown: shutdown the processor
45 */
Stephen Boyd5bd999a2011-08-02 18:50:57 -070046struct pil_reset_ops {
Stephen Boyd3f4da322011-08-30 01:03:23 -070047 int (*init_image)(struct pil_desc *pil, const u8 *metadata,
Stephen Boyd5bd999a2011-08-02 18:50:57 -070048 size_t size);
Stephen Boyd3f4da322011-08-30 01:03:23 -070049 int (*verify_blob)(struct pil_desc *pil, u32 phy_addr, size_t size);
Stephen Boyd36974ec2012-03-22 01:30:59 -070050 int (*proxy_vote)(struct pil_desc *pil);
Stephen Boyd3f4da322011-08-30 01:03:23 -070051 int (*auth_and_reset)(struct pil_desc *pil);
Stephen Boyd36974ec2012-03-22 01:30:59 -070052 void (*proxy_unvote)(struct pil_desc *pil);
Stephen Boyd3f4da322011-08-30 01:03:23 -070053 int (*shutdown)(struct pil_desc *pil);
Stephen Boyd5bd999a2011-08-02 18:50:57 -070054};
55
Stephen Boyd6d67d252011-09-27 11:50:05 -070056struct pil_device;
57
58extern struct pil_device *msm_pil_register(struct pil_desc *desc);
59extern void msm_pil_unregister(struct pil_device *pil);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070060
61#endif