/* 2007-10-12: File added by Sony Corporation */
/*
 *  Sony NSC Boot time analysis
 *
 *  Copyright 2001-2003 Sony Corporation.
 *
 *  This program is free software; you can redistribute  it and/or modify it
 *  under  the terms of  the GNU General  Public License as published by the
 *  Free Software Foundation;  version 2 of the  License.
 *
 *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
 *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
 *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
 *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *  You should have received a copy of the  GNU General Public License along
 *  with this program; if not, write  to the Free Software Foundation, Inc.,
 *  675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef _SNSC_BOOT_TIME_H_
#define _SNSC_BOOT_TIME_H_

#include <linux/seq_file.h>

#ifdef CONFIG_SNSC_BOOT_TIME

#define MAX_COMMENT	        24

#define BOOT_TIME_BASE          CONFIG_SNSC_DEFAULT_BOOT_TIME_BASE
#define BOOT_TIME_SIZE          CONFIG_SNSC_DEFAULT_BOOT_TIME_SIZE

#define BOOT_TIME_MAGIC         0x4E554356

struct boot_time_entry {
	u32   count_lo;
	u32   count_hi;
	char  comment[MAX_COMMENT];
};

struct boot_time {
	u32    magic;
	u32    offHead;
	u32    offNext;
	u32    offMax;
	struct boot_time_entry first_entry;
};

/* machine/platform dependent routines */
struct boot_time_md {
	void  (*init)(struct boot_time *pBootTime, int rom_init);
	void  (*count_set)(struct boot_time_entry *pEntry);
	void  (*print)(struct seq_file *m, struct boot_time_entry *pEntry);
};


void mach_boot_time_init(void);
void boot_time_init(struct boot_time_md *pboot_time_md);
void boot_time_proc_init(void);
void boot_time_add(char *comment);

#define BOOT_TIME_ADD()         boot_time_add((char *)__FUNCTION__)
#define BOOT_TIME_ADD1(s)       boot_time_add(s)

/*
 * For platform with NBLArgs support
 */
#ifdef CONFIG_SNSC_BOOT_TIME_USE_NBLARGS
#  define SNSC_BOOT_TIME_KEY  "boottime"
#endif

#else /* ! CONFIG_SNSC_BOOT_TIME */
/*
 * if CONFIG_SNSC_BOOT_TIME is not defined, BOOT_TIME_ADD* do nothing
 */
#define BOOT_TIME_ADD()         do { } while(0)
#define BOOT_TIME_ADD1(s)       do { } while(0)

#endif /* CONFIG_SNSC_BOOT_TIME */

#endif /* _SNSC_BOOT_TIME_H_ */
