first and last commit
This commit is contained in:
commit
1bf4efd552
2612 files changed
+636500
No files matched your search
@@ -0,0 +1,12 @@
|
||||
_WMR_Open
|
||||
_WMR_PPN_GetFTL
|
||||
_WMR_PPN_GetFPart
|
||||
_WMR_Start
|
||||
_WMR_PPN_CtrlIO
|
||||
_ppn_init
|
||||
_ppnMiscSingleOperation
|
||||
_ppnMiscFillDevStruct
|
||||
_ppnMiscGetCEFromBank
|
||||
_ppnMiscSingleLbaRead
|
||||
_ppnMiscConvertToPPNPageAddress
|
||||
_ppnMiscConvertPhysicalAddressToCauBlockPage
|
||||
@@ -0,0 +1,77 @@
|
||||
# Copyright (C) 2009 Apple Inc. All rights reserved.
|
||||
#
|
||||
# This document is the property of Apple Inc.
|
||||
# It is considered confidential and proprietary.
|
||||
#
|
||||
# This document may not be reproduced or transmitted in any form,
|
||||
# in whole or in part, without the express written permission of
|
||||
# Apple Inc.
|
||||
#
|
||||
|
||||
SWISSPPN_DIR := $(GET_LOCAL_DIR)
|
||||
SWISSPPN_BUILD := $(call TOLIBDIR,$(SWISSPPN_DIR)/SWISSPPN.a)
|
||||
COMMONLIBS += SWISSPPN
|
||||
|
||||
# Only process the remainder of the makefile if we are building libraries
|
||||
#
|
||||
ifeq ($(MAKEPHASE),libraries)
|
||||
|
||||
NAND_DIR := $(patsubst %/,%,$(dir $(GET_LOCAL_DIR)))
|
||||
|
||||
MODULES += \
|
||||
drivers/flash_nand/OAM \
|
||||
lib/blockdev
|
||||
|
||||
GLOBAL_INCLUDES += \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SVFL \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/Misc \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/FPart \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Boot \
|
||||
$(NAND_DIR)/raw/Whimory/Inc \
|
||||
$(NAND_DIR)/OAM \
|
||||
$(NAND_DIR)/OAM/iBoot
|
||||
|
||||
# base library files
|
||||
SWISSPPN_SUBOBJS += \
|
||||
$(SWISSPPN_DIR)/ppn.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/FPart/PPNFPart.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/Misc/PPNMisc.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/Misc/VFLBuffer.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SVFL/s_vfl.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_boot.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_btoc.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_cxt.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_cxt_diff.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_cxt_load.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_external.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_gc.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_geom.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_init.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_internal.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_meta.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_read.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/s_sb.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/L2V/L2V_Free.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/L2V/L2V_Init.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/L2V/L2V_Mem.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/L2V/L2V_Repack.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/L2V/L2V_Search.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/L2V/L2V_Types.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/SFTL/L2V/L2V_Update.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Boot/WhimoryBoot.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Boot/RegSwiss.o
|
||||
|
||||
SWISSPPN_SUBOBJS := $(call TOLIBOBJDIR,$(SWISSPPN_SUBOBJS))
|
||||
ALL_DEPS += $(SWISSPPN_SUBOBJS:%o=%d)
|
||||
|
||||
SWISSPPN_OBJS := $(call TOLIBOBJDIR,$(SWISSPPN_DIR)/SWISSPPN.o)
|
||||
|
||||
|
||||
$(SWISSPPN_OBJS): $(SWISSPPN_SUBOBJS)
|
||||
@echo LIB_LD $@
|
||||
$(_v)$(_LD) $(LIBRARY_LDFLAGS) $(SWISSPPN_SUBOBJS) -o $@ -exported_symbols_list $(SWISSPPN_DIR)/export.txt
|
||||
|
||||
$(SWISSPPN_BUILD): $(SWISSPPN_OBJS)
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2009 Apple Inc. All rights reserved.
|
||||
* Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* This document is the property of Apple Inc.
|
||||
* It is considered confidential and proprietary.
|
||||
*
|
||||
* This document may not be reproduced or transmitted in any form,
|
||||
* in whole or in part, without the express written permission of
|
||||
* Apple Inc.
|
||||
*/
|
||||
#include <debug.h>
|
||||
#include <lib/heap.h>
|
||||
#include <lib/blockdev.h>
|
||||
#include <lib/partition.h>
|
||||
#include <platform/clocks.h>
|
||||
#include <sys/menu.h>
|
||||
|
||||
#include "WMRConfig.h"
|
||||
#include "ANDTypes.h"
|
||||
#include "FIL.h"
|
||||
#include "VFLBuffer.h"
|
||||
#include "VFL.h"
|
||||
#include "FTL.h"
|
||||
#include "WhimoryBoot.h"
|
||||
#include "WMROAM.h"
|
||||
|
||||
|
||||
|
||||
extern uint32_t nand_fsys_block_offset;
|
||||
|
||||
static int nand_filesys_init(uint32_t block_size, uint32_t block_count);
|
||||
static FTLFunctions *TLFuncPtr=NULL;
|
||||
static int nand_read_block_hook(struct blockdev *_dev, void *ptr, block_addr block, uint32_t count)
|
||||
{
|
||||
Int32 err;
|
||||
|
||||
if (count > 0) {
|
||||
err = TLFuncPtr->Read(block, count, ptr);
|
||||
//err = FTL_Read(block, count, ptr);
|
||||
|
||||
if (err != FIL_SUCCESS) {
|
||||
printf("nand_read_block_hook: failure %d reading block %u, count %zd\n", err, block, count);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
int ppn_init(void)
|
||||
{
|
||||
uint32_t block_size, block_count;
|
||||
uint32_t index_cache = 0;
|
||||
WhimoryBootCode boot_code;
|
||||
|
||||
dprintf(DEBUG_INFO, "swiss_ppn_init()\n");
|
||||
|
||||
// Find a signature
|
||||
boot_code = WMR_Start(0, 0, gWhimoryInitParameters);
|
||||
if (kWhimoryOk == boot_code) {
|
||||
// Open the FTL
|
||||
boot_code = WMR_Open(&block_count, &block_size, &index_cache, gWhimoryInitParameters);
|
||||
if (kWhimoryOk == boot_code) {
|
||||
// Publish a block device
|
||||
if (0 != nand_filesys_init(block_size, block_count)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else if (kWhimoryWarningUnformatted == boot_code) {
|
||||
printf("***NAND driver is not formatted. Run restore process.***\n");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int nand_filesys_init(uint32_t block_size, uint32_t block_count)
|
||||
{
|
||||
struct blockdev *nand;
|
||||
|
||||
TLFuncPtr = WMR_PPN_GetFTL();
|
||||
// build a block device around this NAND
|
||||
nand = malloc(sizeof(struct blockdev));
|
||||
|
||||
construct_blockdev(nand, "nand0", (off_t)block_count * block_size, block_size);
|
||||
|
||||
nand->read_block_hook = &nand_read_block_hook;
|
||||
|
||||
register_blockdev(nand);
|
||||
|
||||
/* scan ourselves for partitions and publish subdevices */
|
||||
partition_scan_and_publish_subdevices("nand0");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2009 Apple Inc. All rights reserved.
|
||||
* Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* This document is the property of Apple Inc.
|
||||
* It is considered confidential and proprietary.
|
||||
*
|
||||
* This document may not be reproduced or transmitted in any form,
|
||||
* in whole or in part, without the express written permission of
|
||||
* Apple Inc.
|
||||
*/
|
||||
|
||||
#if WITH_SYSCFG
|
||||
|
||||
#include <debug.h>
|
||||
#include <lib/blockdev.h>
|
||||
#include <lib/syscfg.h>
|
||||
|
||||
#include "FPart.h"
|
||||
#include "VFLBuffer.h"
|
||||
#include "WMRConfig.h"
|
||||
#include "WhimoryBoot.h"
|
||||
|
||||
extern uint32_t nand_fsys_block_offset;
|
||||
|
||||
// The syscfg library assumes that syscfg will be 0x4000 bytes into
|
||||
// the device regardles of whether it's NAND or NOR. nand1 will ONLY
|
||||
// expose syscfg, so this doesn't make any sense, but we'll say we're
|
||||
// big enough to read that far in anyway.
|
||||
#define kSysCfgActualSize ( 0x4000 )
|
||||
#define kFakeBdevBlockSize (kSysCfgBdevOffset)
|
||||
#define kFakeBdevCapacity (kSysCfgBdevOffset + kSysCfgActualSize)
|
||||
|
||||
|
||||
|
||||
static FPartFunctions *_fpart = NULL;
|
||||
|
||||
int ppn_syscfg_init(void)
|
||||
{
|
||||
WhimoryBootCode boot_code;
|
||||
|
||||
boot_code = WMR_Start(0, 0, 0);
|
||||
if (kWhimoryOk == boot_code) {
|
||||
_fpart = WMR_PPN_GetFPart();
|
||||
if (NULL != _fpart->ReadSpecialBlock) {
|
||||
return 0;
|
||||
} else {
|
||||
dprintf(DEBUG_CRITICAL, "ppn syscfg is not supported!\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ppn_read_syscfg_hook(struct blockdev *_dev, void *ptr, block_addr block, size_t count)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
// Only allow reading the "second" block
|
||||
if ((block != 1) || (count != 1)) {
|
||||
dprintf(DEBUG_CRITICAL, "attempted to read ppn syscfg at non-zero offset\n");
|
||||
ok = false;
|
||||
|
||||
} else if (count > 0) {
|
||||
if (!_fpart->ReadSpecialBlock(ptr, kFakeBdevBlockSize, AND_SB_TYPE_UNIQUE_INFO)) {
|
||||
dprintf(DEBUG_CRITICAL, "ppn_read_syscfg_hook: failure reading syscfg\n");
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
return -1;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#endif /* WITH_SYSCFG */
|
||||
@@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2007-2009 Apple Inc. All rights reserved.
|
||||
# Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
|
||||
#
|
||||
# This document is the property of Apple Inc.
|
||||
# It is considered confidential and proprietary.
|
||||
#
|
||||
# This document may not be reproduced or transmitted in any form,
|
||||
# in whole or in part, without the express written permission of
|
||||
# Apple Inc.
|
||||
#
|
||||
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
NAND_DIR := $(patsubst %/,%,$(dir $(GET_LOCAL_DIR)))
|
||||
|
||||
OPTIONS += \
|
||||
WITH_PPN=1 \
|
||||
WITH_PPN_SYSCFG=1
|
||||
|
||||
GLOBAL_INCLUDES += \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/FPart \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/Misc \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Boot
|
||||
|
||||
ALL_OBJS += \
|
||||
$(LOCAL_DIR)/ppn_syscfg.o
|
||||
|
||||
#
|
||||
# If a NAND FTL has not been configured, we need some of the raw NAND bits.
|
||||
#
|
||||
ifeq ($(WITH_NAND_FTL),)
|
||||
ALL_OBJS += \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/FPart/PPNFPart.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Core/Misc/PPNMisc.o \
|
||||
$(NAND_DIR)/ppn/WhimoryPPN/Boot/WhimoryBoot.o
|
||||
else
|
||||
LIBRARY_MODULES += $(LOCAL_DIR)
|
||||
endif
|
||||
Reference in new issue
Block a user