[U-Boot] [PATCH 14/14] dm: pci: Disable PCI compatibility functions by default
Bin Meng
bmeng.cn at gmail.com
Fri Nov 13 08:11:35 CET 2015
Hi Simon,
On Fri, Nov 13, 2015 at 5:45 AM, Simon Glass <sjg at chromium.org> wrote:
> We eventually need to drop the compatibility functions for driver model. As
> a first step, create a configuration option to enable them and hide them
> when the option is disabled.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> arch/arm/mach-tegra/Kconfig | 2 ++
> arch/x86/Kconfig | 3 +++
> configs/sandbox_defconfig | 10 +++++-----
> drivers/pci/Kconfig | 9 +++++++++
> drivers/pci/Makefile | 3 ++-
> include/pci.h | 21 +++++++++++++++++----
> 6 files changed, 38 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
> index e5215ab..3906fc1 100644
> --- a/arch/arm/mach-tegra/Kconfig
> +++ b/arch/arm/mach-tegra/Kconfig
> @@ -13,6 +13,7 @@ config TEGRA_ARMV7_COMMON
> select DM_SPI
> select DM_GPIO
> select DM_PCI
> + select DM_PCI_COMPAT
>
> choice
> prompt "Tegra SoC select"
> @@ -45,6 +46,7 @@ config TEGRA210
> select DM_SPI
> select DM_GPIO
> select DM_PCI
> + select DM_PCI_COMPAT
>
> endchoice
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index f92082d..e972973 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -93,6 +93,9 @@ config SYS_X86_START16
> depends on X86_RESET_VECTOR
> default 0xfffff800
>
> +config DM_PCI_COMPAT
> + default y # Until we finish moving over to the new API
> +
> config BOARD_ROMSIZE_KB_512
> bool
> config BOARD_ROMSIZE_KB_1024
> diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
> index 94c8e68..92725d8 100644
> --- a/configs/sandbox_defconfig
> +++ b/configs/sandbox_defconfig
> @@ -6,6 +6,7 @@ CONFIG_FIT_SIGNATURE=y
> # CONFIG_CMD_ELF is not set
> # CONFIG_CMD_IMLS is not set
> # CONFIG_CMD_FLASH is not set
> +CONFIG_CMD_REMOTEPROC=y
> # CONFIG_CMD_SETEXPR is not set
> CONFIG_CMD_SOUND=y
> CONFIG_BOOTSTAGE=y
> @@ -19,6 +20,8 @@ CONFIG_OF_HOSTFILE=y
> CONFIG_REGMAP=y
> CONFIG_SYSCON=y
> CONFIG_DEVRES=y
> +CONFIG_ADC=y
> +CONFIG_ADC_SANDBOX=y
> CONFIG_CLK=y
> CONFIG_SANDBOX_GPIO=y
> CONFIG_SYS_I2C_SANDBOX=y
> @@ -34,6 +37,7 @@ CONFIG_SPI_FLASH_SANDBOX=y
> CONFIG_SPI_FLASH=y
> CONFIG_DM_ETH=y
> CONFIG_DM_PCI=y
> +CONFIG_DM_PCI_COMPAT=y
> CONFIG_PCI_SANDBOX=y
> CONFIG_PINCTRL=y
> CONFIG_PINCONF=y
> @@ -43,12 +47,12 @@ CONFIG_DM_PMIC_SANDBOX=y
> CONFIG_DM_REGULATOR=y
> CONFIG_DM_REGULATOR_SANDBOX=y
> CONFIG_RAM=y
> +CONFIG_REMOTEPROC_SANDBOX=y
> CONFIG_DM_RTC=y
> CONFIG_SANDBOX_SERIAL=y
> CONFIG_SOUND=y
> CONFIG_SOUND_SANDBOX=y
> CONFIG_SANDBOX_SPI=y
> -CONFIG_DM_TPM=y
> CONFIG_TPM_TIS_SANDBOX=y
> CONFIG_USB=y
> CONFIG_DM_USB=y
> @@ -63,7 +67,3 @@ CONFIG_UNIT_TEST=y
> CONFIG_UT_TIME=y
> CONFIG_UT_DM=y
> CONFIG_UT_ENV=y
> -CONFIG_REMOTEPROC_SANDBOX=y
> -CONFIG_CMD_REMOTEPROC=y
> -CONFIG_ADC=y
> -CONFIG_ADC_SANDBOX=y
> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> index c219c19..26aa2b0 100644
> --- a/drivers/pci/Kconfig
> +++ b/drivers/pci/Kconfig
> @@ -9,6 +9,15 @@ config DM_PCI
> available PCI devices, allows scanning of PCI buses and provides
> device configuration support.
>
> +config DM_PCI_COMPAT
> + bool "Enable compatible functions for PCI"
> + depends on DM_PCI
> + help
> + Enable compatibility functions for PCI so that old code can be used
> + with CONFIG_DM_PCI enabled. This should be used as an interim
> + measure when porting a board to use driver model for PCI. Once the
> + board is fully supported, this option should be disabled.
> +
> config PCI_SANDBOX
> bool "Sandbox PCI support"
> depends on SANDBOX && DM_PCI
> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
> index 1f8f86f..6b761b4 100644
> --- a/drivers/pci/Makefile
> +++ b/drivers/pci/Makefile
> @@ -6,7 +6,8 @@
> #
>
> ifneq ($(CONFIG_DM_PCI),)
> -obj-$(CONFIG_PCI) += pci-uclass.o pci_compat.o
> +obj-$(CONFIG_PCI) += pci-uclass.o
> +obj-$(CONFIG_DM_PCI_COMPAT) += pci_compat.o
> obj-$(CONFIG_PCI_SANDBOX) += pci_sandbox.o
> obj-$(CONFIG_SANDBOX) += pci-emul-uclass.o
> obj-$(CONFIG_X86) += pci_x86.o
> diff --git a/include/pci.h b/include/pci.h
> index c4f6577..fc7d494 100644
> --- a/include/pci.h
> +++ b/include/pci.h
> @@ -656,6 +656,7 @@ extern pci_addr_t pci_hose_phys_to_bus(struct pci_controller* hose,
> pci_bus_to_virt((dev), (addr), PCI_REGION_IO, (len), (map_flags))
>
> /* For driver model these are defined in macros in pci_compat.c */
> +#if !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT)
> extern int pci_hose_read_config_byte(struct pci_controller *hose,
> pci_dev_t dev, int where, u8 *val);
> extern int pci_hose_read_config_word(struct pci_controller *hose,
> @@ -668,6 +669,7 @@ extern int pci_hose_write_config_word(struct pci_controller *hose,
> pci_dev_t dev, int where, u16 val);
> extern int pci_hose_write_config_dword(struct pci_controller *hose,
> pci_dev_t dev, int where, u32 val);
> +#endif
>
> #ifndef CONFIG_DM_PCI
> extern int pci_read_config_byte(pci_dev_t dev, int where, u8 *val);
> @@ -678,6 +680,13 @@ extern int pci_write_config_word(pci_dev_t dev, int where, u16 val);
> extern int pci_write_config_dword(pci_dev_t dev, int where, u32 val);
> #endif
>
> +void pciauto_region_init(struct pci_region *res);
> +void pciauto_region_align(struct pci_region *res, pci_size_t size);
> +void pciauto_config_init(struct pci_controller *hose);
> +int pciauto_region_allocate(struct pci_region *res, pci_size_t size,
> + pci_addr_t *bar);
> +
> +#if !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT)
> extern int pci_hose_read_config_byte_via_dword(struct pci_controller *hose,
> pci_dev_t dev, int where, u8 *val);
> extern int pci_hose_read_config_word_via_dword(struct pci_controller *hose,
> @@ -696,9 +705,6 @@ extern int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev);
> extern int pci_hose_scan(struct pci_controller *hose);
> extern int pci_hose_scan_bus(struct pci_controller *hose, int bus);
>
> -extern void pciauto_region_init(struct pci_region* res);
> -extern void pciauto_region_align(struct pci_region *res, pci_size_t size);
> -extern int pciauto_region_allocate(struct pci_region* res, pci_size_t size, pci_addr_t *bar);
> extern void pciauto_setup_device(struct pci_controller *hose,
> pci_dev_t dev, int bars_num,
> struct pci_region *mem,
> @@ -708,7 +714,6 @@ extern void pciauto_prescan_setup_bridge(struct pci_controller *hose,
> pci_dev_t dev, int sub_bus);
> extern void pciauto_postscan_setup_bridge(struct pci_controller *hose,
> pci_dev_t dev, int sub_bus);
> -extern void pciauto_config_init(struct pci_controller *hose);
> extern int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev);
>
> extern pci_dev_t pci_find_device (unsigned int vendor, unsigned int device, int index);
> @@ -739,6 +744,7 @@ extern void board_pci_fixup_dev(struct pci_controller *hose, pci_dev_t dev,
> unsigned short device,
> unsigned short class);
> #endif
> +#endif /* !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT) */
>
> const char * pci_class_str(u8 class);
> int pci_last_busno(void);
> @@ -747,6 +753,7 @@ int pci_last_busno(void);
> extern void pci_mpc85xx_init (struct pci_controller *hose);
> #endif
>
> +#if !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT)
> /**
> * pci_write_bar32() - Write the address of a BAR including control bits
> *
> @@ -783,6 +790,7 @@ u32 pci_read_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum);
> */
> pci_dev_t pci_hose_find_devices(struct pci_controller *hose, int busnum,
> struct pci_device_id *ids, int *indexp);
> +#endif /* !CONFIG_DM_PCI || CONFIG_DM_PCI_COMPAT */
>
> /* Access sizes for PCI reads and writes */
> enum pci_size_t {
> @@ -1041,6 +1049,7 @@ int dm_pci_write_config32(struct udevice *dev, int offset, u32 value);
> */
> int pci_write_config32(pci_dev_t pcidev, int offset, u32 value);
>
> +#ifdef CONFIG_DM_PCI_COMPAT
> /* Compatibility with old naming */
> static inline int pci_write_config_dword(pci_dev_t pcidev, int offset,
> u32 value)
> @@ -1093,6 +1102,10 @@ static inline int pci_read_config_byte(pci_dev_t pcidev, int offset,
> return pci_read_config8(pcidev, offset, valuep);
> }
>
> +int dm_pciauto_config_device(struct udevice *dev);
Why is this declaration put inside #ifdef CONFIG_DM_PCI_COMPAT #endif?
> +
> +#endif /* CONFIG_DM_PCI_COMPAT */
> +
> /**
> * pci_conv_32_to_size() - convert a 32-bit read value to the given size
> *
> --
Regards,
Bin
More information about the U-Boot
mailing list