blob: 88e573544cdf98b18879ba486c939f5a4e07a235 [file] [log] [blame]
/*----------------------------------------------------------------------------*
* Copyright Statement: *
* *
* This software/firmware and related documentation ("MediaTek Software") *
* are protected under international and related jurisdictions'copyright laws *
* as unpublished works. The information contained herein is confidential and *
* proprietary to MediaTek Inc. Without the prior written permission of *
* MediaTek Inc., any reproduction, modification, use or disclosure of *
* MediaTek Software, and information contained herein, in whole or in part, *
* shall be strictly prohibited. *
* MediaTek Inc. Copyright (C) 2010. All rights reserved. *
* *
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND *
* AGREES TO THE FOLLOWING: *
* *
* 1)Any and all intellectual property rights (including without *
* limitation, patent, copyright, and trade secrets) in and to this *
* Software/firmware and related documentation ("MediaTek Software") shall *
* remain the exclusive property of MediaTek Inc. Any and all intellectual *
* property rights (including without limitation, patent, copyright, and *
* trade secrets) in and to any modifications and derivatives to MediaTek *
* Software, whoever made, shall also remain the exclusive property of *
* MediaTek Inc. Nothing herein shall be construed as any transfer of any *
* title to any intellectual property right in MediaTek Software to Receiver. *
* *
* 2)This MediaTek Software Receiver received from MediaTek Inc. and/or its *
* representatives is provided to Receiver on an "AS IS" basis only. *
* MediaTek Inc. expressly disclaims all warranties, expressed or implied, *
* including but not limited to any implied warranties of merchantability, *
* non-infringement and fitness for a particular purpose and any warranties *
* arising out of course of performance, course of dealing or usage of trade. *
* MediaTek Inc. does not provide any warranty whatsoever with respect to the *
* software of any third party which may be used by, incorporated in, or *
* supplied with the MediaTek Software, and Receiver agrees to look only to *
* such third parties for any warranty claim relating thereto. Receiver *
* expressly acknowledges that it is Receiver's sole responsibility to obtain *
* from any third party all proper licenses contained in or delivered with *
* MediaTek Software. MediaTek is not responsible for any MediaTek Software *
* releases made to Receiver's specifications or to conform to a particular *
* standard or open forum. *
* *
* 3)Receiver further acknowledge that Receiver may, either presently *
* and/or in the future, instruct MediaTek Inc. to assist it in the *
* development and the implementation, in accordance with Receiver's designs, *
* of certain softwares relating to Receiver's product(s) (the "Services"). *
* Except as may be otherwise agreed to in writing, no warranties of any *
* kind, whether express or implied, are given by MediaTek Inc. with respect *
* to the Services provided, and the Services are provided on an "AS IS" *
* basis. Receiver further acknowledges that the Services may contain errors *
* that testing is important and it is solely responsible for fully testing *
* the Services and/or derivatives thereof before they are used, sublicensed *
* or distributed. Should there be any third party action brought against *
* MediaTek Inc. arising out of or relating to the Services, Receiver agree *
* to fully indemnify and hold MediaTek Inc. harmless. If the parties *
* mutually agree to enter into or continue a business relationship or other *
* arrangement, the terms and conditions set forth herein shall remain *
* effective and, unless explicitly stated otherwise, shall prevail in the *
* event of a conflict in the terms in any agreements entered into between *
* the parties. *
* *
* 4)Receiver's sole and exclusive remedy and MediaTek Inc.'s entire and *
* cumulative liability with respect to MediaTek Software released hereunder *
* will be, at MediaTek Inc.'s sole discretion, to replace or revise the *
* MediaTek Software at issue. *
* *
* 5)The transaction contemplated hereunder shall be construed in *
* accordance with the laws of Singapore, excluding its conflict of laws *
* principles. Any disputes, controversies or claims arising thereof and *
* related thereto shall be settled via arbitration in Singapore, under the *
* then current rules of the International Chamber of Commerce (ICC). The *
* arbitration shall be conducted in English. The awards of the arbitration *
* shall be final and binding upon both parties and shall be entered and *
* enforceable in any court of competent jurisdiction. *
*---------------------------------------------------------------------------*/
#ifndef FAST_K_MISC_C
#define FAST_K_MISC_C
#include "fast_k_misc.h"
#define DRAM_BOOT_PARA "boot_para"
u64 get_part_addr(const char *name) {
// always return 0 for AUTO
return 0;
}
part_t *part_get(char *name) {
// always return 0 for AUTO
return NULL;
}
u32 storage_get_part_id(u32 id) {
// always return 0 for AUTO
return 0;
}
int blkdev_read(blkdev_t *bdev, u64 src, u32 size, u8 *dst, u32 part_id) {
if(NULL == bdev) {
printf("[FastK] bio read failed, NULL bdev\n");
return -1;
}
int rb = bio_read(bdev, (void*)dst, src, size);
if (rb <= 0) {
printf("[FastK] bio read failed, empty read\n");
return -1;
}
return 0;
}
int blkdev_write(blkdev_t *bdev, u64 dst, u32 size, u8 *src, u32 part_id) {
if(NULL == bdev) {
printf("[FastK] bio write failed, NULL bdev\n");
return -1;
}
int wb = bio_write(bdev, (void*)src, dst, size);
if (wb <= 0) {
printf("[FastK] bio write failed, empty write\n");
return -1;
}
return 0;
}
int blkdev_erase(blkdev_t *bdev, u64 src, u64 size, u32 part_id) {
if(NULL == bdev) {
printf("[FastK] bio erase failed, NULL bdev\n");
return -1;
}
int wb = bio_erase(bdev, src, size);
if (wb <= 0) {
printf("[FastK] bio erase failed, empty erase\n");
return -1;
}
return 0;
}
blkdev_t *blkdev_get(u32 type) {
bdev_t *bdev = bio_open_by_label(DRAM_BOOT_PARA);
if (NULL == bdev) {
printf("[FastK] bio open failed\n");
}
return bdev;
}
#endif /* FAST_K_MISC_C */