From patchwork Tue May 24 15:31:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew McClintock X-Patchwork-Id: 97174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 13EA1B6F9C for ; Wed, 25 May 2011 01:31:43 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 49AB72811C; Tue, 24 May 2011 17:31:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NcbNX8HIZW-G; Tue, 24 May 2011 17:31:39 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4230B280FD; Tue, 24 May 2011 17:31:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 54792280FD for ; Tue, 24 May 2011 17:31:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id syOl+KOZITqH for ; Tue, 24 May 2011 17:31:32 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from TX2EHSOBE003.bigfish.com (tx2ehsobe002.messaging.microsoft.com [65.55.88.12]) by theia.denx.de (Postfix) with ESMTPS id 056A8280FC for ; Tue, 24 May 2011 17:31:30 +0200 (CEST) Received: from mail104-tx2-R.bigfish.com (10.9.14.242) by TX2EHSOBE003.bigfish.com (10.9.40.23) with Microsoft SMTP Server id 14.1.225.22; Tue, 24 May 2011 15:31:28 +0000 Received: from mail104-tx2 (localhost.localdomain [127.0.0.1]) by mail104-tx2-R.bigfish.com (Postfix) with ESMTP id C0E08A3807F; Tue, 24 May 2011 15:31:28 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1082kzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail104-tx2 (localhost.localdomain [127.0.0.1]) by mail104-tx2 (MessageSwitch) id 1306251086227856_8823; Tue, 24 May 2011 15:31:26 +0000 (UTC) Received: from TX2EHSMHS024.bigfish.com (unknown [10.9.14.237]) by mail104-tx2.bigfish.com (Postfix) with ESMTP id 187A1F70050; Tue, 24 May 2011 15:31:26 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS024.bigfish.com (10.9.99.124) with Microsoft SMTP Server (TLS) id 14.1.225.22; Tue, 24 May 2011 15:31:22 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.270.2; Tue, 24 May 2011 10:31:21 -0500 Received: from right.am.freescale.net (right.am.freescale.net [10.82.193.13]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p4OFVJE8029284; Tue, 24 May 2011 10:31:20 -0500 (CDT) Received: from right.am.freescale.net (localhost.localdomain [127.0.0.1]) by right.am.freescale.net (8.14.4/8.14.4) with ESMTP id p4OFVJNh025182; Tue, 24 May 2011 10:31:19 -0500 Received: (from mattsm@localhost) by right.am.freescale.net (8.14.4/8.14.4/Submit) id p4OFVJCD025106; Tue, 24 May 2011 10:31:19 -0500 From: Matthew McClintock To: Date: Tue, 24 May 2011 10:31:19 -0500 Message-ID: <1306251079-24800-1-git-send-email-msm@freescale.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <201105232308.56905.vapier@gentoo.org> References: <201105232308.56905.vapier@gentoo.org> MIME-Version: 1.0 X-OriginatorOrg: freescale.net Cc: Matthew McClintock , kumar.gala@freescale.com Subject: [U-Boot] [PATCH v3 1/3] disk/part.c: Make features optional X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de If we don't want to build support for any partition types we can now add #undef CONFIG_PARTITIONS in a board config file to keep this from being compiled in. Otherwise boards assume this is compiled in by default Signed-off-by: Matthew McClintock --- v2: Fix patch to apply to current tree v3: Add stubs to header file instead of each place function is called, this lets usb/sata/etc compile with partitions disabled. However, I have done limited testing on interfaces besides MMC common/cmd_ide.c | 2 ++ common/cmd_sata.c | 2 ++ common/cmd_scsi.c | 3 ++- common/usb_storage.c | 3 ++- disk/Makefile | 2 +- drivers/block/mg_disk.c | 2 ++ drivers/block/systemace.c | 2 ++ drivers/mmc/mmc.c | 2 ++ include/config_defaults.h | 1 + include/part.h | 16 ++++++++++++++++ 10 files changed, 32 insertions(+), 3 deletions(-) diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 21fe1ea..0316b17 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -732,10 +732,12 @@ void ide_init (void) /* ------------------------------------------------------------------------- */ +#ifdef CONFIG_PARTITIONS block_dev_desc_t * ide_get_dev(int dev) { return (dev < CONFIG_SYS_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL; } +#endif #ifdef CONFIG_IDE_8xx_DIRECT diff --git a/common/cmd_sata.c b/common/cmd_sata.c index 7efa859..f62c0cb 100644 --- a/common/cmd_sata.c +++ b/common/cmd_sata.c @@ -57,10 +57,12 @@ int __sata_initialize(void) } int sata_initialize(void) __attribute__((weak,alias("__sata_initialize"))); +#ifdef CONFIG_PARTITIONS block_dev_desc_t *sata_get_dev(int dev) { return (dev < CONFIG_SYS_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL; } +#endif int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index be4fe74..4c189ff 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -193,11 +193,12 @@ void scsi_init(void) scsi_scan(1); } +#ifdef CONFIG_PARTITIONS block_dev_desc_t * scsi_get_dev(int dev) { return (dev < CONFIG_SYS_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL; } - +#endif /****************************************************************************** * scsi boot command intepreter. Derived from diskboot diff --git a/common/usb_storage.c b/common/usb_storage.c index 9ecf165..16667f3 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -173,11 +173,12 @@ unsigned long usb_stor_write(int device, unsigned long blknr, struct usb_device * usb_get_dev_index(int index); void uhci_show_temp_int_td(void); +#ifdef CONFIG_PARTITIONS block_dev_desc_t *usb_stor_get_dev(int index) { return (index < usb_max_devs) ? &usb_dev_desc[index] : NULL; } - +#endif void usb_show_progress(void) { diff --git a/disk/Makefile b/disk/Makefile index 17266a2..5affe34 100644 --- a/disk/Makefile +++ b/disk/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)libdisk.o -COBJS-y += part.o +COBJS-$(CONFIG_PARTITIONS) += part.o COBJS-$(CONFIG_MAC_PARTITION) += part_mac.o COBJS-$(CONFIG_DOS_PARTITION) += part_dos.o COBJS-$(CONFIG_ISO_PARTITION) += part_iso.o diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index b74307a..f9e175d 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c @@ -522,10 +522,12 @@ mg_write_exit: return err; } +#ifdef CONFIG_PARTITIONS block_dev_desc_t *mg_disk_get_dev(int dev) { return ((block_dev_desc_t *) & mg_disk_dev); } +#endif /* must override this function */ struct mg_drv_data * __attribute__((weak)) mg_get_drv_data (void) diff --git a/drivers/block/systemace.c b/drivers/block/systemace.c index e8dff0a..58402b9 100644 --- a/drivers/block/systemace.c +++ b/drivers/block/systemace.c @@ -104,6 +104,7 @@ static void release_cf_lock(void) ace_writew((val & 0xffff), 0x18); } +#ifdef CONFIG_PARTITIONS block_dev_desc_t *systemace_get_dev(int dev) { /* The first time through this, the systemace_dev object is @@ -128,6 +129,7 @@ block_dev_desc_t *systemace_get_dev(int dev) return &systemace_dev; } +#endif /* * This function is called (by dereferencing the block_read pointer in diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 21aedba..50491ea 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1054,12 +1054,14 @@ int mmc_register(struct mmc *mmc) return 0; } +#ifdef CONFIG_PARTITIONS block_dev_desc_t *mmc_get_dev(int dev) { struct mmc *mmc = find_mmc_device(dev); return mmc ? &mmc->block_dev : NULL; } +#endif int mmc_init(struct mmc *mmc) { diff --git a/include/config_defaults.h b/include/config_defaults.h index 0337163..d023c63 100644 --- a/include/config_defaults.h +++ b/include/config_defaults.h @@ -16,5 +16,6 @@ #define CONFIG_GZIP 1 #define CONFIG_ZLIB 1 +#define CONFIG_PARTITIONS 1 #endif diff --git a/include/part.h b/include/part.h index 3cdae02..c525cc3 100644 --- a/include/part.h +++ b/include/part.h @@ -93,6 +93,7 @@ typedef struct disk_partition { } disk_partition_t; /* Misc _get_dev functions */ +#ifdef CONFIG_PARTITIONS block_dev_desc_t* get_dev(char* ifname, int dev); block_dev_desc_t* ide_get_dev(int dev); block_dev_desc_t* sata_get_dev(int dev); @@ -107,7 +108,22 @@ int get_partition_info (block_dev_desc_t * dev_desc, int part, disk_partition_t void print_part (block_dev_desc_t *dev_desc); void init_part (block_dev_desc_t *dev_desc); void dev_print(block_dev_desc_t *dev_desc); - +#else +static inline block_dev_desc_t* get_dev(char* ifname, int dev) { return NULL; } +static inline block_dev_desc_t* ide_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* sata_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* scsi_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* usb_stor_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* mmc_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* systemace_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* mg_disk_get_dev(int dev) { return NULL; } + +static inline int get_partition_info (block_dev_desc_t * dev_desc, int part, + disk_partition_t *info) { return -1; } +static inline void print_part (block_dev_desc_t *dev_desc) {} +static inline void init_part (block_dev_desc_t *dev_desc) {} +static inline void dev_print(block_dev_desc_t *dev_desc) {} +#endif #ifdef CONFIG_MAC_PARTITION /* disk/part_mac.c */