6 Replies Latest reply on Apr 11, 2016 1:46 PM by PabloM_Intel

    bitbake Broadcom WLAN custom kernel build error when enabling ACPI

    D.Sync

      Hi guys, I've decided to rebuild release 1.6 with PREEMPT_RT patch, however this time with ACPI feature turned on and the following build errors when building the broadcom WLAN driver:

       

      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/linux_osl.o
      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/sbutils.o
      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/siutils.o
      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/wl_android.o
      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/wl_cfg80211.o
      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/wl_cfgp2p.o
      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/wl_cfg_btcoex.o
      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/wldev_common.o
      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/wl_linux_mon.o
      |   CC [M]  /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.o
      | /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c: In function 'wifi_plat_dev_drv_probe_acpi':
      | /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c:305:4: error: implicit declaration of function 'INTEL_MID_BOARD' [-Werror=implicit-function-declaration]
      |     if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) ||
      |     ^
      | /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c:305:27: error: 'TABLET' undeclared (first use in this function)
      |     if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) ||
      |                            ^
      | /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c:305:27: note: each undeclared identifier is reported only once for each function it appears in
      | /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c:305:35: error: 'BYT' undeclared (first use in this function)
      |     if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) ||
      |                                    ^
      | /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c:305:40: error: 'BLB' undeclared (first use in this function)
      |     if (INTEL_MID_BOARD(2, TABLET, BY/home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c:305:45: error: 'PRO' undeclared (first use in this function)
      |     if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) ||
      |                                              ^
      | 
      | /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c:306:45: error: 'ENG' undeclared (first use in this function)
      |         INTEL_MID_BOARD(2, TABLET, BYT, BLB, ENG)) {
      |                                              ^
      | 
      | cc1: some warnings being treated as errors
      | 
      | make[2]: *** [/home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.o] Error 1
      | make[1]: *** [_module_/home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x] Error 2
      | 
      | make: *** [all] Error 2
      | 
      | + die oe_runmake failed
      | + bbfatal oe_runmake failed
      | + echo ERROR: oe_runmake failed
      | ERROR: oe_runmake failed
      | + exit 1
      | + bb_exit_handler
      | + ret=1
      | + echo WARNING: exit code 1 from a shell command.
      | WARNING: exit code 1 from a shell command.
      | + exit 1
      | 
      | T, BLB, PRO) ||
      |                                         ^
      | /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c:305:45: error: 'PRO' undeclared (first use in this function)
      |     if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) ||
      |                                              ^
      | /home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.c:306:45: error: 'ENG' undeclared (first use in this function)
      |         INTEL_MID_BOARD(2, TABLET, BYT, BLB, ENG)) {
      |                                              ^
      | cc1: some warnings being treated as errors
      | make[2]: *** [/home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x/dhd_linux_platdev.o] Error 1
      | make[1]: *** [_module_/home/dsync/Development/edison-src/broadcom_cws/wlan/driver_bcm43x] Error 2
      | make: *** [all] Error 2
      | + die oe_runmake failed
      | + bbfatal oe_runmake failed
      | + echo ERROR: oe_runmake failed
      | ERROR: oe_runmake failed
      | + exit 1
      | + bb_exit_handler
      | + ret=1
      | + echo WARNING: exit code 1 from a shell command.
      | WARNING: exit code 1 from a shell command.
      | + exit 1
      | ERROR: Function failed: do_compile (log file is located at /home/dsync/Development/edison-src/build/tmp/work/edison-poky-linux/bcm43340-mod/1.141-r47/temp/log.do_compile.21563)
      ERROR: Task 692 (/home/dsync/Development/edison-src/device-software/meta-edison/recipes-kernel/bcm43340/bcm43340-mod.bb, do_compile) failed with exit code '1'
      

       

      From the console output, it seemed like there is a missing declaration for the INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO definitions?

       

      Source code for the dhd_linux_platdev.c file. Not sure whether bypassing the red colored if statement will works, or how it will affect the wlan driver.

      if (ACPI_HANDLE(&pdev->dev)) {
      handle = ACPI_HANDLE(&pdev->dev);
      /* Dont try to do acpi pm for the wifi module */
      if (!handle || acpi_bus_get_device(handle, &adev))
      DHD_ERROR(("%s: could not get acpi pointer!\n", __FUNCTION__));
      else
      adev->flags.power_manageable = 0;
      irq_num = acpi_get_gpio_by_index(&pdev->dev, 0, NULL);
      DHD_INFO(("%s: Using ACPI table to get IRQ number: %d\n", __FUNCTION__, irq_num));
      if (irq_num < 0) {
      if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) ||
      INTEL_MID_BOARD(2, TABLET, BYT, BLB, ENG)) {
      DHD_INFO(("%s: BYT-M hardcoding\n", __FUNCTION__));
      irq_num = acpi_get_gpio("\\_SB.GPO2", 17);
      }
      else {
      DHD_INFO(("%s: BYT-T hardcoding\n", __FUNCTION__));
      irq_num = acpi_get_gpio("\\_SB.GPO2", 15);
      }
      }
      } else {
      DHD_ERROR(("%s: Null ACPI_HANDLE, try legacy probe\n", __FUNCTION__));
      return wifi_plat_dev_drv_probe(pdev);
      }
        • 1. Re: bitbake Broadcom WLAN custom kernel build error when enabling ACPI
          PabloM_Intel

          Hi D.Sync,

           

          I believed that you had already build a kernel successfully with ACPI and HPET enabled, am I wrong? According to your last update in this case https://communities.intel.com/thread/98206. Please correct me if I’m wrong.

          Also, is the first time that you get this error while building the kernel? I would suggest you to give it a try and bypass the IF statement, just to see if you get a different error in the process or if the kernel builds successfully and then see how it works. We will investigate this a little bit more, if we get some more information we’ll get back to you.

           

          Regards,

          Pablo

          • 2. Re: bitbake Broadcom WLAN custom kernel build error when enabling ACPI
            D.Sync

            Hi there Pablo,

             

            Indeed I managed to build the kernel with ACPI and HPET last time on Release 1.6. However that time I simply uncomment the erroneous line (the IF statement block) and Wi-Fi doesn't work in that case. I can't see the wlan0 interface and thus cannot start the wpa_supplicant service. Also launching configure_edison --wifi and performing scanning doesn't work, it just hangs there instead of countdown. So I believe it might be something wrong with the broadcom driver compilation.

             

            From the source code below (in the same file dhd_linux_platdev.c), it seemed like there is another probe build without ACPI. Not sure how will the wifi chip behaves if compiled using the nonacpi function with an ACPI kernel build. Will try it out and update as I make any progress. This is certainly intriguing.

             

            static struct platform_driver wifi_platform_dev_driver = {
            #ifdef CONFIG_ACPI
            .probe  = wifi_plat_dev_drv_probe_acpi,
            #else
            .probe  = wifi_plat_dev_drv_probe,
            #endif
            .remove  = wifi_plat_dev_drv_remove,
            .suspend  = wifi_plat_dev_drv_suspend,
            .resume  = wifi_plat_dev_drv_resume,
            .driver  = {
            #ifdef CONFIG_ACPI
            .acpi_match_table = ACPI_PTR(bcm_acpi_id),
            #endif
            .name  = WIFI_PLAT_NAME,
            }
            };
            • 3. Re: bitbake Broadcom WLAN custom kernel build error when enabling ACPI
              PabloM_Intel

              Hi D.Sync,

               

              We are investigating your case to see if we find something that might help you. In case we find something we’ll let you know.

               

              Regards,

              Pablo

              • 4. Re: bitbake Broadcom WLAN custom kernel build error when enabling ACPI
                PabloM_Intel

                Hi Dsync,

                 

                Did you check that the CONFIG_ACPI is enabled at the kernel defconfig file?

                 

                Regards,

                Pablo

                • 5. Re: bitbake Broadcom WLAN custom kernel build error when enabling ACPI
                  D.Sync

                  Hi there Pablo,

                   

                  Here are several attempts that I did by modifying the dhd_platdev.c source code file when CONFIG_ACPI is enabled in the kernel.

                  Snippet from my defconfig file

                  ...
                  CONFIG_PM_ADVANCED_DEBUG=y
                  # CONFIG_PM_TEST_SUSPEND is not set
                  CONFIG_PM_SLEEP_DEBUG=y
                  # CONFIG_PM_TRACE_RTC is not set
                  CONFIG_ACPI=y
                  CONFIG_ACPI_SLEEP=y
                  # CONFIG_ACPI_PROCFS is not set
                  # CONFIG_ACPI_PROCFS_POWER is not set
                  # CONFIG_ACPI_EC_DEBUGFS is not set
                  CONFIG_ACPI_PROC_EVENT=y
                  CONFIG_ACPI_AC=y
                  CONFIG_ACPI_BATTERY=y
                  CONFIG_ACPI_BUTTON=y
                  # CONFIG_ACPI_VIDEO is not set
                  CONFIG_ACPI_FAN=y
                  # CONFIG_ACPI_DOCK is not set
                  CONFIG_ACPI_I2C=y
                  CONFIG_ACPI_PROCESSOR=y
                  ...
                  
                  
                  
                  

                   

                  First attempt - Comment out the if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) if..else statement because of the missing macro definition of  TABLET, BYT, BLB, PRO.

                  #ifdef CONFIG_ACPI
                  static int wifi_plat_dev_drv_probe_acpi(struct platform_device *pdev)
                  {
                    wifi_adapter_info_t *adapter;
                    acpi_handle handle;
                    struct acpi_device *adev;
                    int irq_num;
                  
                  
                    /* Android style wifi platform data device ("bcmdhd_wlan" or "bcm4329_wlan")
                    * is kept for backward compatibility and supports only 1 adapter
                    */
                    ASSERT(dhd_wifi_platdata != NULL);
                    ASSERT(dhd_wifi_platdata->num_adapters == 1);
                    adapter = &dhd_wifi_platdata->adapters[0];
                    adapter->wifi_plat_data = (void *)&dhd_wlan_control;
                  
                  
                  
                    if (ACPI_HANDLE(&pdev->dev)) {
                    handle = ACPI_HANDLE(&pdev->dev);
                  
                  
                    /* Dont try to do acpi pm for the wifi module */
                    if (!handle || acpi_bus_get_device(handle, &adev))
                    DHD_ERROR(("%s: could not get acpi pointer!\n", __FUNCTION__));
                    else
                    adev->flags.power_manageable = 0;
                    irq_num = acpi_get_gpio_by_index(&pdev->dev, 0, NULL);
                    DHD_INFO(("%s: Using ACPI table to get IRQ number: %d\n", __FUNCTION__, irq_num));
                    if (irq_num < 0) {
                    //if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) ||
                    //  INTEL_MID_BOARD(2, TABLET, BYT, BLB, ENG)) {
                    //DHD_INFO(("%s: BYT-M hardcoding\n", __FUNCTION__));
                    //irq_num = acpi_get_gpio("\\_SB.GPO2", 17);
                    //}
                    //else {
                    DHD_INFO(("%s: BYT-T hardcoding\n", __FUNCTION__));
                    irq_num = acpi_get_gpio("\\_SB.GPO2", 15);
                    //}
                    }
                    } else {
                    DHD_ERROR(("%s: Null ACPI_HANDLE, try legacy probe\n", __FUNCTION__));
                    return wifi_plat_dev_drv_probe(pdev);
                    }
                  
                  
                    adapter->irq_num = irq_num;
                    adapter->intr_flags = IRQF_TRIGGER_FALLING;
                  
                  
                    wifi_plat_dev_probe_ret = dhd_wifi_platform_load();
                    return wifi_plat_dev_probe_ret;
                  }
                  #endif /* CONFIG_ACPI */
                  
                  
                  
                  

                   

                  2nd Attempt - Using the generic return wifi_plat_dev_drv_probe(pdev); function

                  #ifdef CONFIG_ACPI
                  static int wifi_plat_dev_drv_probe_acpi(struct platform_device *pdev)
                  {
                    wifi_adapter_info_t *adapter;
                    acpi_handle handle;
                    struct acpi_device *adev;
                    int irq_num;
                  
                  
                    /* Android style wifi platform data device ("bcmdhd_wlan" or "bcm4329_wlan")
                    * is kept for backward compatibility and supports only 1 adapter
                    */
                    ASSERT(dhd_wifi_platdata != NULL);
                    ASSERT(dhd_wifi_platdata->num_adapters == 1);
                    adapter = &dhd_wifi_platdata->adapters[0];
                    adapter->wifi_plat_data = (void *)&dhd_wlan_control;
                  
                  
                  
                    if (ACPI_HANDLE(&pdev->dev)) {
                    handle = ACPI_HANDLE(&pdev->dev);
                  
                  
                    /* Dont try to do acpi pm for the wifi module */
                    // if (!handle || acpi_bus_get_device(handle, &adev))
                    // DHD_ERROR(("%s: could not get acpi pointer!\n", __FUNCTION__));
                    // else
                    // adev->flags.power_manageable = 0;
                    // irq_num = acpi_get_gpio_by_index(&pdev->dev, 0, NULL);
                    // DHD_INFO(("%s: Using ACPI table to get IRQ number: %d\n", __FUNCTION__, irq_num));
                    //if (irq_num < 0) {
                    //if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) ||
                    //  INTEL_MID_BOARD(2, TABLET, BYT, BLB, ENG)) {
                    //DHD_INFO(("%s: BYT-M hardcoding\n", __FUNCTION__));
                    //irq_num = acpi_get_gpio("\\_SB.GPO2", 17);
                    //}
                    //else {
                    // DHD_INFO(("%s: BYT-T hardcoding\n", __FUNCTION__));
                    // irq_num = acpi_get_gpio("\\_SB.GPO2", 15);
                    //}
                    // }
                    //} else {
                    DHD_ERROR(("%s: Null ACPI_HANDLE, try legacy probe\n", __FUNCTION__));
                    return wifi_plat_dev_drv_probe(pdev);
                    //}
                  
                  
                    adapter->irq_num = irq_num;
                    adapter->intr_flags = IRQF_TRIGGER_FALLING;
                  
                  
                    wifi_plat_dev_probe_ret = dhd_wifi_platform_load();
                    return wifi_plat_dev_probe_ret;
                  }
                  #endif /* CONFIG_ACPI */
                  
                  
                  
                  

                   

                  3rd Attempt

                  Replace the CONFIG_ACPI macro with CONFIG_ACPI88 macro so it won't compile the codes related to CONFIG_ACPI.

                   

                  Results

                  The same result is applied to all 3 attempts. In other words, the wifi driver doesn't work.

                   

                  dmesg | grep wpa

                  root@edison:~# dmesg | grep wifi
                  Using generic wifi platform data
                  no wifi platform data, skip
                  "dhd_wifi_platdata != NULL": file "dhd_linux_platdev.c", line 7
                  [<f89f1c7c>] ? dhd_wifi_platform_load+0xc/0x3e0 [bcm4334x]
                  [<f89f23d2>] ? dhd_wifi_platform_register_drv+0x1e2/0x260 [bcm4334x]
                  
                  
                  
                  

                   

                  configure_edison --wifi - No AP is listed

                  Configure Edison: WiFi Connection
                  
                  A dependency job for wpa_supplicant.service failed. See 'journalctl -xn' for details.
                  Failed to connect to non-global ctrl_ifname: (null)  error: No such file or directory
                  Failed to connect to non-global ctrl_ifname: (null)  error: No such file or directory
                  
                  0 :    Rescan for networks
                  1 :    Manually input a hidden SSID
                  
                  Enter 0 to rescan for networks.
                  Enter 1 to input a hidden network SSID:
                  
                  
                  
                  

                   

                  Really looking forward to any solution.

                  • 6. Re: bitbake Broadcom WLAN custom kernel build error when enabling ACPI
                    PabloM_Intel

                    Hi D.Sync,

                     

                    We have an update on this case, the PREEMPT_RT patch was never validated nor supported on Edison. We will make a recommendation to include PREEMPT_RT support, so hopefully we will see this in a future release.

                     

                    Regards,

                    Pablo