Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'chromeos-2.6.38' of https://github.com/astarasikov/icon…

…ia-gnu-kernel into chromeos-2.6.38
  • Loading branch information...
commit a2070264476f713959fa7b0e95f0fefe8e600391 2 parents b9881a6 + b90735e
@muromec authored
View
11 arch/arm/configs/iconiaa500_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux/arm 2.6.38.3 Kernel Configuration
-# Sun Jul 24 00:43:33 2011
+# Mon Aug 15 02:30:35 2011
#
CONFIG_ARM=y
CONFIG_HAVE_PWM=y
@@ -291,6 +291,7 @@ CONFIG_ARCH_TEGRA_2x_SOC=y
# CONFIG_MACH_HARMONY is not set
# CONFIG_MACH_VENTANA is not set
CONFIG_MACH_PICASSO=y
+# CONFIG_MACH_TF101 is not set
# CONFIG_MACH_KAEN is not set
# CONFIG_MACH_PAZ00 is not set
# CONFIG_MACH_SEABOARD is not set
@@ -616,7 +617,7 @@ CONFIG_WEXT_PROC=y
CONFIG_WEXT_PRIV=y
CONFIG_CFG80211=y
# CONFIG_NL80211_TESTMODE is not set
-CONFIG_CFG80211_DEVELOPER_WARNINGS=y
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
# CONFIG_CFG80211_REG_DEBUG is not set
CONFIG_CFG80211_DEFAULT_PS=y
# CONFIG_CFG80211_DEBUGFS is not set
@@ -1890,6 +1891,7 @@ CONFIG_MACH_NO_WESTBRIDGE=y
# CONFIG_SPEAKUP is not set
# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set
# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set
+# CONFIG_ASUSEC is not set
# CONFIG_ARM_PLATFORM_DEVICES is not set
CONFIG_CLKDEV_LOOKUP=y
@@ -1928,7 +1930,8 @@ CONFIG_INOTIFY_USER=y
# CONFIG_QUOTA is not set
# CONFIG_QUOTACTL is not set
# CONFIG_AUTOFS4_FS is not set
-# CONFIG_FUSE_FS is not set
+CONFIG_FUSE_FS=y
+CONFIG_CUSE=y
#
# Caches
@@ -2018,6 +2021,8 @@ CONFIG_MSDOS_PARTITION=y
# CONFIG_KARMA_PARTITION is not set
CONFIG_EFI_PARTITION=y
# CONFIG_SYSV68_PARTITION is not set
+CONFIG_NVTEGRA_PARTITION=y
+CONFIG_NVTEGRA_HIDE_PARTS="BCT,PT,EBT,GP1,AKB,GPT"
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="utf8"
CONFIG_NLS_CODEPAGE_437=y
View
1  arch/arm/mach-tegra/board-picasso.c
@@ -585,6 +585,7 @@ static struct tegra_sdhci_platform_data tegra_sdhci_platform_data4 = {
.cd_gpio = -1,
.wp_gpio = -1,
.power_gpio = -1,
+ .is_8bit = 1,
};
/******************************************************************************
View
20 fs/partitions/Kconfig
@@ -249,3 +249,23 @@ config SYSV68_PARTITION
partition table format used by Motorola Delta machines (using
sysv68).
Otherwise, say N.
+
+config NVTEGRA_PARTITION
+ bool "Nvidia Tegra partition table support" if PARTITION_ADVANCED
+ default n
+ help
+ Add support for undocummented partition table format used by Tegra2
+ systems.
+
+config NVTEGRA_HIDE_PARTS
+ string "Hidden NVidia Tegra partitions"
+ depends on NVTEGRA_PARTITION
+ default ""
+ help
+ Fill here the list of partitions you want to hide to the kennel.
+ This is likely used to hide boot configuration partition,
+ bootloader, and others which does not contain valid filesystem.
+ List each partition name (the 3,4 letters identifier) separated
+ by commas.
+
+
View
1  fs/partitions/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_IBM_PARTITION) += ibm.o
obj-$(CONFIG_EFI_PARTITION) += efi.o
obj-$(CONFIG_KARMA_PARTITION) += karma.o
obj-$(CONFIG_SYSV68_PARTITION) += sysv68.o
+obj-$(CONFIG_NVTEGRA_PARTITION) += nvtegra.o
View
4 fs/partitions/check.c
@@ -38,6 +38,7 @@
#include "efi.h"
#include "karma.h"
#include "sysv68.h"
+#include "nvtegra.h"
#ifdef CONFIG_BLK_DEV_MD
extern void md_autodetect_dev(dev_t dev);
@@ -112,6 +113,9 @@ static int (*check_part[])(struct parsed_partitions *) = {
#ifdef CONFIG_SYSV68_PARTITION
sysv68_partition,
#endif
+#ifdef CONFIG_NVTEGRA_PARTITION
+ nvtegra_partition,
+#endif
NULL
};
View
281 fs/partitions/nvtegra.c
@@ -0,0 +1,281 @@
+/*
+ * fs/partitions/nvtegria.c
+ * Copyright (c) 2010 Gilles Grandou
+ *
+ * Nvidia uses for its Tegra2 SOCs a proprietary partition system which is
+ * unfortunately undocumented.
+ *
+ * Typically a Tegra2 system embedds an internal Flash memory (MTD or MMC).
+ * The bottom of this memory contains the initial bootstrap code which
+ * implements a communication protocol (typically over usb) which allows a
+ * host system (through a tool called nvflash) to access, read, write and
+ * partition the internal flash.
+ *
+ * The partition table format is not publicaly documented, and usually
+ * partition description is passed to kernel through the command line
+ * (with tegrapart= argument whose support is available in nv-tegra tree,
+ * see http://nv-tegra.nvidia.com/ )
+ *
+ * Rewriting partition table or even switching to a standard msdos is
+ * theorically possible, but it would mean loosing support from nvflash
+ * and from bootloader, while no real alternative exists yet.
+ *
+ * Partition table format has been reverse-engineered from analysis of
+ * an existing partition table as found on Toshiba AC100/Dynabook AZ. All
+ * fields have been guessed and there is no guarantee that it will work
+ * in all situation nor in all other Tegra2 based products.
+ *
+ *
+ * The standard partitions which can be found on an AC100 are the next
+ * ones:
+ *
+ * sector size = 2048 bytes
+ *
+ * Id Name Start Size Comment
+ * sector sectors
+ *
+ * 1 0 1024 unreachable (bootstrap ?)
+ * 2 BCT 1024 512 Boot Configuration Table
+ * 3 PT 1536 256 Partition Table
+ * 4 EBT 1792 1024 Boot Loader
+ * 5 SOS 2816 2560 Recovery Kernel
+ * 6 LNX 5376 4096 System Kernel
+ * 7 MBR 9472 512 MBR - msdos partition table
+ * for the rest of the disk
+ * 8 APP 9984 153600 OS root filesystem
+ * ...
+ *
+ * the 1024 first sectors are hidden to the hardware one booted
+ * (so 1024 should be removed from numbers found in the partition
+ * table)
+ *
+ */
+
+#include "check.h"
+#include "nvtegra.h"
+
+#include <linux/types.h>
+
+#define NVPART_NAME_LEN 4
+#define NVTEGRA_PT_MAGIC 0xffffffff8f9e8d8bLLU
+#define NVTEGRA_PT_OFFSET 0x100000
+
+typedef struct {
+ u32 id;
+ char name[NVPART_NAME_LEN];
+ u32 dev_type;
+ u32 dev_id;
+ u32 unknown1;
+ char name2[NVPART_NAME_LEN];
+ u32 fstype;
+ u32 fsattr;
+
+ u32 part_attr;
+ u64 start_sector;
+ u64 num_sectors;
+ u32 unknown2[4];
+ u32 parttype;
+} nvtegra_partinfo;
+
+typedef struct {
+ u64 magic;
+ u32 version;
+ u32 length;
+ char hash[16];
+} nvtegra_hdr_short;
+
+typedef struct {
+ u8 trash[16];
+ u64 magic;
+ u32 version;
+ u32 length;
+ u32 num_parts;
+ char unknown[4];
+} nvtegra_hdr_long;
+
+typedef struct {
+ nvtegra_hdr_short hdr_s;
+ nvtegra_hdr_long hdr_l;
+ nvtegra_partinfo parts[];
+} nvtegra_ptable;
+
+typedef struct {
+ u32 valid;
+ char name[4];
+ u64 start;
+ u64 size;
+} temp_partinfo;
+
+char *hidden_parts_str = CONFIG_NVTEGRA_HIDE_PARTS;
+
+static size_t
+read_dev_bytes(struct block_device *bdev, unsigned sector, char *buffer,
+ size_t count)
+{
+ size_t totalreadcount = 0;
+
+ if (!bdev || !buffer)
+ return 0;
+
+ while (count) {
+ int copied = 512;
+ Sector sect;
+ unsigned char *data = read_dev_sector(bdev, sector++, &sect);
+ if (!data)
+ break;
+ if (copied > count)
+ copied = count;
+ memcpy(buffer, data, copied);
+ put_dev_sector(sect);
+ buffer += copied;
+ totalreadcount += copied;
+ count -= copied;
+ }
+ return totalreadcount;
+}
+
+int nvtegra_partition(struct parsed_partitions *state)
+{
+ nvtegra_ptable *pt;
+ nvtegra_partinfo *p;
+ temp_partinfo *parts;
+ temp_partinfo *part;
+
+ int count;
+ int i;
+ unsigned n_parts;
+ u64 pt_offset = 0, offset;
+ char *s;
+
+ pt = kzalloc(2048, GFP_KERNEL);
+ if (!pt)
+ return -1;
+
+ if (read_dev_bytes(state->bdev, 2048, (char *)pt, 2048) != 2048) {
+ printk(KERN_INFO "%s: failed to read partition table\n", __func__);
+ kfree(pt);
+ return 0;
+ }
+
+ /* check if partition table looks correct */
+ if (pt->hdr_s.magic != pt->hdr_l.magic) {
+ printk(KERN_INFO "%s: magic values in headers do not match\n", __func__);
+ return 0;
+ }
+
+ if (pt->hdr_s.magic != NVTEGRA_PT_MAGIC) {
+ printk(KERN_INFO "%s: magic values are wrong\n", __func__);
+ return 0;
+ }
+
+ if (pt->hdr_s.version != pt->hdr_l.version) {
+ printk(KERN_INFO "%s: version mismatch in headers\n", __func__);
+ return 0;
+ }
+
+ if (pt->hdr_s.version != 0x100) {
+ printk(KERN_INFO "%s: unsupported version 0x%x\n",
+ __func__, pt->hdr_s.version);
+ return 0;
+ }
+
+ if (pt->hdr_s.length != pt->hdr_l.length) {
+ printk(KERN_INFO "%s: length mismatch in headers\n", __func__);
+ return 0;
+ }
+
+ n_parts = pt->hdr_l.num_parts;
+
+ printk(KERN_INFO "%s: partition table with %d partitions\n",
+ __func__, n_parts);
+
+ parts = kzalloc(n_parts * sizeof(temp_partinfo), GFP_KERNEL);
+ if (!parts)
+ return -1;
+
+ /* for some reason, the BCT size is incorrectly reported as too large
+ * and other partitions are shifted down.
+ * from observation, PT usually starts at 0x100000 so let's exploit that */
+ for (i = 0; i < n_parts; i++) {
+ if (!strcmp(pt->parts[i].name, "PT")) {
+ pt_offset = (pt->parts[i].start_sector << 12) - NVTEGRA_PT_OFFSET;
+ break;
+ }
+ }
+
+ /* walk the partition table */
+ p = pt->parts;
+ part = parts;
+
+ for (i = 0; i < n_parts; i++) {
+ if (!strcmp(p->name, "BCT")) {
+ offset = 0;
+ }
+ else {
+ offset = pt_offset;
+ }
+
+ printk(KERN_INFO
+ "nvtegrapart: [%-4.4s] start=%llu size=%llu\n",
+ p->name,
+ (p->start_sector << 12) - offset,
+ p->num_sectors << 12);
+
+ memcpy(part->name, p->name, NVPART_NAME_LEN);
+ part->valid = 1;
+ part->start = (p->start_sector << 3) - (offset >> 9);
+ part->size = (p->num_sectors << 3);
+ p++;
+ part++;
+ }
+
+ /* hide partitions */
+ s = hidden_parts_str;
+ while (*s) {
+ unsigned len;
+
+ len = strcspn(s, ",: ");
+ part = parts;
+
+ for (i = 0; i < n_parts; i++) {
+ if (part->valid) {
+ if (!strncmp(part->name, s, len)
+ && ((len >= NVPART_NAME_LEN)
+ || (part->name[len] == '\0'))) {
+ part->valid = 0;
+ break;
+ }
+ }
+ part++;
+ }
+ s += len;
+ s += strspn(s, ",: ");
+ }
+
+ if (*hidden_parts_str)
+ printk(KERN_INFO "\n");
+ printk(KERN_INFO "nvtegrapart: hidden_parts = %s\n", hidden_parts_str);
+
+ /* finally register valid partitions */
+ count = 1;
+ part = parts;
+ for (i = 0; i < n_parts; i++) {
+ if (part->valid) {
+ put_partition(state, count++, part->start, part->size);
+ }
+ part++;
+ }
+
+ kfree(parts);
+ kfree(pt);
+ return 1;
+}
+
+static int __init nvtegra_hideparts_setup(char *options)
+{
+ if (options)
+ hidden_parts_str = options;
+ return 0;
+}
+
+__setup("nvtegra_hideparts=", nvtegra_hideparts_setup);
View
6 fs/partitions/nvtegra.h
@@ -0,0 +1,6 @@
+/*
+ * fs/partitions/nvtegra.h
+ *
+ */
+
+int nvtegra_partition(struct parsed_partitions *);
Please sign in to comment.
Something went wrong with that request. Please try again.