/* -*- linux-c -*- * Copyright (c) 2004-2006 Winbond Electronics Corp. All rights reserved. * * The contents of this file are subject to the Open * Software License version 1.1 that can be found at * http://www.opensource.org/licenses/osl-1.1.txt and is included herein * by reference. * * Alternatively, the contents of this file may be used under the terms * of the GNU General Public License version 2 (the "GPL") as distributed * in the kernel source COPYING file, in which case the provisions of * the GPL are applicable instead of the above. If you wish to allow * the use of your version of this file only under the terms of the * GPL and not to allow others to use your version of this file under * the OSL, indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the GPL. * If you do not delete the provisions above, a recipient may use your * version of this file under either the OSL or the GPL. * Maintained by: Weiming Shuai Jin Yuan Mu Dezheng Shen $Author: sjin $ $Id: wbtable.h,v 1.4.2.4 2006/06/22 06:06:13 sjin Exp $ --- don't modify lines above --- Description: Enviornments: (1) RedHat 9 on 32-bit Intel UP/32-bit Intel dual-core (2) Fedora Core 4 (2.6.11) on 32-bit Intel/32-bit Intel dual-core/64-bit AMD/64-bit Intel dual-core (3) RedHat Enterprise Workstatin Rel 4 UP2 (2.6.9) on 32-bit Intel 32-bit Intel dual-core/64-bit AMD/64-bit Intel dual-core */ #ifndef _WB_TABLE_H_ #define _WB_TABLE_H_ // those are special values, don't change them at will #define WB_TABLE_DEFECT (0xfffe) #define WB_TABLE_UNUSED (0xffff) #define WB_MAX_NUM_PHYSICAL (512) // for segment 0, only (496 - 2 = 494) logical blocks are mapped // those two blocks are reserved for book blocks #define WB_MAX_NUM_LOGICAL (496) #define WB_MAX_NUM_SEG (16) // block size: 16KB/10h, 8KB/08h, segment = total_physical_blk / WB_MAX_NUM_PHYSICAL int wbtable_init(unsigned int blk_size, unsigned int total_physical_blk); int wbtable_finit(void); int wbtable_add_link_logical_physical(unsigned int logical, unsigned int physical); int wbtable_add_link_physical_logical(unsigned int physical, unsigned int logical); // this link must exist; otherwise, an warning message is printed int wbtable_del_link(unsigned int physical, unsigned int logical); unsigned int wbtable_get_physical(unsigned int logical); unsigned int wbtable_get_logical(unsigned int physical); unsigned int wbtable_get_seg(unsigned int lba); unsigned int wbtable_get_unused_physical(unsigned int seg); unsigned int wbtable_add_link(unsigned int logical, unsigned int physical); int wbtable_dump(void); int wbtable_sanity_chk(void); static int wbtable_chk_limit(unsigned int seg, unsigned int physical, unsigned int logical); #endif /* _WB_TABLE_H_ */