SlideShare una empresa de Scribd logo
1 de 37
Descargar para leer sin conexión
www.puffinbrowser.com
Identifying and Supporting"X-
compatible" Hardware Blocks
Chen-Yu Tsai / wens@csie.org
Chen-Yu Tsai
• Software engineer at CloudMosa, Inc. in Taipei
– Manages Linux servers
– Write tooling for management
• Embedded Linux hobbyist since 2011
– Co-maintainer of kernel support for Allwinner SoC
Overview
• Introduction
• Identifying hardware
• Driver implementations
• Examples
Ancient PC history
• VGA
• 8250 UART
• NE2000
• Sound Blaster
Duck Test
• Looks like a duck
• Swims like a duck
• Quacks like a duck
Compatible How?
• Looks like a duck
– Has the same interface
• Swims like a duck
– Has the same logic
• Quacks like a duck
– Gives the same response
Examples
• Standard controller interfaces
– AHCI, EHCI, OHCI, xHCI
• Licensed IP cores
• Clones
AHCI, EHCI, OHCI, xHCI
• Standard interface to access the core
– Performance varies
• Vendor specific glue layer
– Clocks, resets, PHYs
IP Vendors
• Synopsys (DesignWare)
• Mentor Graphics
• Cadence
Licensed IP Cores
• Core IP block
– May even be for HCIs
• Glue layer
• PHYs
Clones
• Same logic
• Missing registers
• Rearranged registers
• Obfuscated registers
Identifying Hardware
Resources
• Datasheets
• Vendor Kernels
Good Public Datasheets
• NXP i.MX6 Reference Manual
• TI KeyStone II User Guide Library
• Zynq UltraScale+ MPSoC Register Reference
Identifiers
• Register layout
– Register names
• DMA engine
– Logic
– Descriptor format
Experience & Luck
• Needle in a sea of needles
– One can only recognize something they’ve seen before
• Senior members of the community may help
• Might only be recognizable after driver is finished
• YMMV
Implementing Drivers
Driver Libraries
• Core logic as a library
• Platform driver
– Extra resource management
– Extra setup
– Presents parameters and callbacks to library
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
static int sun7i_gmac_probe(struct platform_device *pdev)
{
stmmac_get_platform_resources(pdev, &stmmac_res);
stmmac_probe_config_dt(pdev, &stmmac_res.mac);
/* platform specific stuff ... */
plat_dat->init = sun7i_gmac_init;
plat_dat->exit = sun7i_gmac_exit;
stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
}
Dealing with Register Changes
• Register offset table
• regmap & regmap_field
• Custom I/O callbacks
Register Offset Table
drivers/i2c/busses/i2c-mv64xxx.c:
struct mv64xxx_i2c_regs {
u8 addr;
u8 ext_addr;
u8 data;
u8 control;
u8 status;
u8 clock;
u8 soft_reset;
};
writel(0, drv_data->reg_base + drv_data->reg_offsets.soft_reset);
regmap_field
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c:
static const struct sun4i_hdmi_variant sun6i_variant = {
…
.field_ddc_en = REG_FIELD(SUN4I_HDMI_DDC_CTRL_REG, 31, 31),
.field_ddc_start = REG_FIELD(SUN4I_HDMI_DDC_CTRL_REG, 30, 30),
.field_ddc_reset = REG_FIELD(SUN4I_HDMI_DDC_CTRL_REG, 0, 0),
.field_ddc_addr_reg = REG_FIELD(SUN4I_HDMI_DDC_ADDR_REG, 0, 31),
.field_ddc_slave_addr = REG_FIELD(SUN4I_HDMI_DDC_ADDR_REG, 0, 6),
…
};
regmap_field
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c:
static const struct sun4i_hdmi_variant {
…
/* Regmap fields for I2C adapter */
struct regmap_field *field_ddc_en;
struct regmap_field *field_ddc_start;
struct regmap_field *field_ddc_reset;
struct regmap_field *field_ddc_addr_reg;
struct regmap_field *field_ddc_slave_addr;
…
};
regmap_field
regmap_field_write(hdmi->field_ddc_fifo_tx_thres,
hdmi->variant->ddc_fifo_thres_incl ? 0 : 1);
regmap_field_write(hdmi->field_ddc_fifo_rx_thres, RX_THRESHOLD);
regmap_field_write(hdmi->field_ddc_fifo_clear, 1);
if (regmap_field_read_poll_timeout(hdmi->field_ddc_fifo_clear,
reg, !reg, 100, 2000))
return -EIO;
Custom I/O Functions
drivers/usb/musb/musb_io.h:
/**
* struct musb_io - IO functions for MUSB
* @quirks: platform specific flags
* @ep_offset: platform specific function to get end point offset
* @ep_select: platform specific function to select end point
* @fifo_offset: platform specific function to get fifo offset
* @read_fifo: platform specific function to read fifo
* @write_fifo: platform specific function to write fifo
* @busctl_offset: platform specific function to get busctl offset
*/
Examples
8250 UART
• De-facto standard
– 8250 driver library
• Platform specifics
– Extra features
– Quirks or bugs
Synopsys DesignWare APB UART
• Extra “busy” interrupt
– Fires on attempts to write to LCR when UART
is busy
– “irq XX: nobody cared”
• Extra “UART status register”
• 8250_dw driver wraps 8250 library
AHCI
• libahci & libahci_platform
– Driver library
– Handles PHYs, clocks, regulators
• Platform specific ahci_*
• Generic ahci_platform
Mentor Graphics MUSB
• USB On-The-Go IP core
– Seen on a few platforms
– Has all related signals (ID & VBUS detect)
• Separate USB PHY
Allwinner USB OTG
• MUSB with rearranged registers
– Custom I/O functions
• Very weird USB PHY interface
– Generic PHY framework
• ID & VBUS detect lines not routed outside
– Controlled through custom register
– Use GPIO lines externally
– extcon framework
DesignWare MAC
• Many hardware revisions
– Later ones have feature register
• Found on 12+ platforms
• Called “stmmac” in the kernel
– Driver library
– Platform provides config and callbacks
A20 GMAC
• Old revision of DWMAC
• No DMA feature register
– Dug out feature set from vendor kernel
• Simple glue layer
A64/H3 EMAC
• DWMAC with rearranged registers
– MDC bitfield meaning is different
– Chained DMA descriptors only
• DMA descriptor format is the same
– A few fields are marked as “reserved”
DesignWare HDMI
• Found on 3+ platforms
– With either DW-HDMI-PHY or 3rd party PHY
• “dw-hdmi” in the kernel
– Library-ish driver
– Platform provides config and callbacks
A64/H3 HDMI
• Obfuscated register addresses
– Obfuscation can be turned off :)
• Found in some vendor kernel release
• Custom PHY
– Reverse engineered init code
• Limited to certain resolutions
Questions?

Más contenido relacionado

La actualidad más candente

Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)shimosawa
 
ACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelSUSE Labs Taipei
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMSherif Mousa
 
Profiling the ACPICA Namespace and Event Handing
Profiling the ACPICA Namespace and Event HandingProfiling the ACPICA Namespace and Event Handing
Profiling the ACPICA Namespace and Event HandingSUSE Labs Taipei
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and InsightsGlobalLogic Ukraine
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans VerkuilKernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans VerkuilAnne Nicolas
 
Kernel Recipes 2017 - Build farm again - Willy Tarreau
Kernel Recipes 2017 - Build farm again - Willy TarreauKernel Recipes 2017 - Build farm again - Willy Tarreau
Kernel Recipes 2017 - Build farm again - Willy TarreauAnne Nicolas
 
Tutorial: Cross-compiling Linux Kernels on x86_64
Tutorial: Cross-compiling Linux Kernels on x86_64Tutorial: Cross-compiling Linux Kernels on x86_64
Tutorial: Cross-compiling Linux Kernels on x86_64Samsung Open Source Group
 
OSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data centerOSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data centerNETWAYS
 
Tech Days 2015: Embedded Product Update
Tech Days 2015: Embedded Product UpdateTech Days 2015: Embedded Product Update
Tech Days 2015: Embedded Product UpdateAdaCore
 
Signature verification of kernel module and kexec
Signature verification of kernel module and kexecSignature verification of kernel module and kexec
Signature verification of kernel module and kexecjoeylikernel
 

La actualidad más candente (18)

Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
ACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelACPI Debugging from Linux Kernel
ACPI Debugging from Linux Kernel
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
 
Profiling the ACPICA Namespace and Event Handing
Profiling the ACPICA Namespace and Event HandingProfiling the ACPICA Namespace and Event Handing
Profiling the ACPICA Namespace and Event Handing
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and Insights
 
Qemu Introduction
Qemu IntroductionQemu Introduction
Qemu Introduction
 
Ironic
IronicIronic
Ironic
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
Linux Kernel Debugging
Linux Kernel DebuggingLinux Kernel Debugging
Linux Kernel Debugging
 
gcc and friends
gcc and friendsgcc and friends
gcc and friends
 
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans VerkuilKernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
Kernel Recipes 2017 - Build farm again - Willy Tarreau
Kernel Recipes 2017 - Build farm again - Willy TarreauKernel Recipes 2017 - Build farm again - Willy Tarreau
Kernel Recipes 2017 - Build farm again - Willy Tarreau
 
Tutorial: Cross-compiling Linux Kernels on x86_64
Tutorial: Cross-compiling Linux Kernels on x86_64Tutorial: Cross-compiling Linux Kernels on x86_64
Tutorial: Cross-compiling Linux Kernels on x86_64
 
OSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data centerOSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data center
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Tech Days 2015: Embedded Product Update
Tech Days 2015: Embedded Product UpdateTech Days 2015: Embedded Product Update
Tech Days 2015: Embedded Product Update
 
Signature verification of kernel module and kexec
Signature verification of kernel module and kexecSignature verification of kernel module and kexec
Signature verification of kernel module and kexec
 

Similar a Identifying and Supporting 'X-compatible' Hardware Blocks

Ironic 140622212631-phpapp02
Ironic 140622212631-phpapp02Ironic 140622212631-phpapp02
Ironic 140622212631-phpapp02Narender Kumar
 
Ironic 140622212631-phpapp02
Ironic 140622212631-phpapp02Ironic 140622212631-phpapp02
Ironic 140622212631-phpapp02Narender Kumar
 
Operating Systems 1 (5/12) - Architectures (Unix)
Operating Systems 1 (5/12) - Architectures (Unix)Operating Systems 1 (5/12) - Architectures (Unix)
Operating Systems 1 (5/12) - Architectures (Unix)Peter Tröger
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022Stefano Stabellini
 
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...DefconRussia
 
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, OracleXPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, OracleThe Linux Foundation
 
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest Lenz Grimmer
 
ONIE: Open Network Install Environment @ OSDC 2014 Netways, Berlin
ONIE: Open Network Install Environment @ OSDC 2014 Netways, BerlinONIE: Open Network Install Environment @ OSDC 2014 Netways, Berlin
ONIE: Open Network Install Environment @ OSDC 2014 Netways, BerlinNat Morris
 
Adding Support for Networking and Web Technologies to an Embedded System
Adding Support for Networking and Web Technologies to an Embedded SystemAdding Support for Networking and Web Technologies to an Embedded System
Adding Support for Networking and Web Technologies to an Embedded SystemJohn Efstathiades
 
Hyper-V: Best Practices
Hyper-V: Best PracticesHyper-V: Best Practices
Hyper-V: Best PracticesTomica Kaniski
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
 
OSDC 2014 ONIE by Nat Morris
OSDC 2014 ONIE by Nat MorrisOSDC 2014 ONIE by Nat Morris
OSDC 2014 ONIE by Nat MorrisCumulus Networks
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
 
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniquesLarson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniquesScott K. Larson
 

Similar a Identifying and Supporting 'X-compatible' Hardware Blocks (20)

Ironic 140622212631-phpapp02
Ironic 140622212631-phpapp02Ironic 140622212631-phpapp02
Ironic 140622212631-phpapp02
 
Ironic 140622212631-phpapp02
Ironic 140622212631-phpapp02Ironic 140622212631-phpapp02
Ironic 140622212631-phpapp02
 
#WeSpeakLinux Session
#WeSpeakLinux Session#WeSpeakLinux Session
#WeSpeakLinux Session
 
Operating Systems 1 (5/12) - Architectures (Unix)
Operating Systems 1 (5/12) - Architectures (Unix)Operating Systems 1 (5/12) - Architectures (Unix)
Operating Systems 1 (5/12) - Architectures (Unix)
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
 
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
 
HiPEAC-Keynote.pptx
HiPEAC-Keynote.pptxHiPEAC-Keynote.pptx
HiPEAC-Keynote.pptx
 
1184 Quayle
1184 Quayle1184 Quayle
1184 Quayle
 
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, OracleXPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
 
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest
 
ONIE: Open Network Install Environment @ OSDC 2014 Netways, Berlin
ONIE: Open Network Install Environment @ OSDC 2014 Netways, BerlinONIE: Open Network Install Environment @ OSDC 2014 Netways, Berlin
ONIE: Open Network Install Environment @ OSDC 2014 Netways, Berlin
 
the windows opereting system
the windows opereting systemthe windows opereting system
the windows opereting system
 
Earhart
EarhartEarhart
Earhart
 
Adding Support for Networking and Web Technologies to an Embedded System
Adding Support for Networking and Web Technologies to an Embedded SystemAdding Support for Networking and Web Technologies to an Embedded System
Adding Support for Networking and Web Technologies to an Embedded System
 
Hyper-V: Best Practices
Hyper-V: Best PracticesHyper-V: Best Practices
Hyper-V: Best Practices
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
OSDC 2014 ONIE by Nat Morris
OSDC 2014 ONIE by Nat MorrisOSDC 2014 ONIE by Nat Morris
OSDC 2014 ONIE by Nat Morris
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniquesLarson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
 
Nano Server (ATD 11)
Nano Server (ATD 11)Nano Server (ATD 11)
Nano Server (ATD 11)
 

Más de Chen-Yu Tsai

Putting Taiwan on the kernel.org Keysigning Map
Putting Taiwan on the kernel.org Keysigning MapPutting Taiwan on the kernel.org Keysigning Map
Putting Taiwan on the kernel.org Keysigning MapChen-Yu Tsai
 
Linux Kernel Patch Submission Tips
Linux Kernel Patch Submission TipsLinux Kernel Patch Submission Tips
Linux Kernel Patch Submission TipsChen-Yu Tsai
 
Allwinner Kernel Upstreaming Experiences
Allwinner Kernel Upstreaming ExperiencesAllwinner Kernel Upstreaming Experiences
Allwinner Kernel Upstreaming ExperiencesChen-Yu Tsai
 
Upstream Allwinner ARM SoC (sunxi) Support
Upstream Allwinner ARM SoC (sunxi) SupportUpstream Allwinner ARM SoC (sunxi) Support
Upstream Allwinner ARM SoC (sunxi) SupportChen-Yu Tsai
 
linux-sunxi - OSDC.tw 2014 Lightning Talk
linux-sunxi - OSDC.tw 2014 Lightning Talklinux-sunxi - OSDC.tw 2014 Lightning Talk
linux-sunxi - OSDC.tw 2014 Lightning TalkChen-Yu Tsai
 
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014Chen-Yu Tsai
 

Más de Chen-Yu Tsai (6)

Putting Taiwan on the kernel.org Keysigning Map
Putting Taiwan on the kernel.org Keysigning MapPutting Taiwan on the kernel.org Keysigning Map
Putting Taiwan on the kernel.org Keysigning Map
 
Linux Kernel Patch Submission Tips
Linux Kernel Patch Submission TipsLinux Kernel Patch Submission Tips
Linux Kernel Patch Submission Tips
 
Allwinner Kernel Upstreaming Experiences
Allwinner Kernel Upstreaming ExperiencesAllwinner Kernel Upstreaming Experiences
Allwinner Kernel Upstreaming Experiences
 
Upstream Allwinner ARM SoC (sunxi) Support
Upstream Allwinner ARM SoC (sunxi) SupportUpstream Allwinner ARM SoC (sunxi) Support
Upstream Allwinner ARM SoC (sunxi) Support
 
linux-sunxi - OSDC.tw 2014 Lightning Talk
linux-sunxi - OSDC.tw 2014 Lightning Talklinux-sunxi - OSDC.tw 2014 Lightning Talk
linux-sunxi - OSDC.tw 2014 Lightning Talk
 
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
Open Standards and Open Source in Datacenter Management - OSDC.tw 2014
 

Último

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 

Último (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 

Identifying and Supporting 'X-compatible' Hardware Blocks

  • 1. www.puffinbrowser.com Identifying and Supporting"X- compatible" Hardware Blocks Chen-Yu Tsai / wens@csie.org
  • 2. Chen-Yu Tsai • Software engineer at CloudMosa, Inc. in Taipei – Manages Linux servers – Write tooling for management • Embedded Linux hobbyist since 2011 – Co-maintainer of kernel support for Allwinner SoC
  • 3. Overview • Introduction • Identifying hardware • Driver implementations • Examples
  • 4. Ancient PC history • VGA • 8250 UART • NE2000 • Sound Blaster
  • 5. Duck Test • Looks like a duck • Swims like a duck • Quacks like a duck
  • 6. Compatible How? • Looks like a duck – Has the same interface • Swims like a duck – Has the same logic • Quacks like a duck – Gives the same response
  • 7. Examples • Standard controller interfaces – AHCI, EHCI, OHCI, xHCI • Licensed IP cores • Clones
  • 8. AHCI, EHCI, OHCI, xHCI • Standard interface to access the core – Performance varies • Vendor specific glue layer – Clocks, resets, PHYs
  • 9. IP Vendors • Synopsys (DesignWare) • Mentor Graphics • Cadence
  • 10. Licensed IP Cores • Core IP block – May even be for HCIs • Glue layer • PHYs
  • 11. Clones • Same logic • Missing registers • Rearranged registers • Obfuscated registers
  • 14. Good Public Datasheets • NXP i.MX6 Reference Manual • TI KeyStone II User Guide Library • Zynq UltraScale+ MPSoC Register Reference
  • 15. Identifiers • Register layout – Register names • DMA engine – Logic – Descriptor format
  • 16. Experience & Luck • Needle in a sea of needles – One can only recognize something they’ve seen before • Senior members of the community may help • Might only be recognizable after driver is finished • YMMV
  • 18. Driver Libraries • Core logic as a library • Platform driver – Extra resource management – Extra setup – Presents parameters and callbacks to library
  • 19. drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c static int sun7i_gmac_probe(struct platform_device *pdev) { stmmac_get_platform_resources(pdev, &stmmac_res); stmmac_probe_config_dt(pdev, &stmmac_res.mac); /* platform specific stuff ... */ plat_dat->init = sun7i_gmac_init; plat_dat->exit = sun7i_gmac_exit; stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); }
  • 20. Dealing with Register Changes • Register offset table • regmap & regmap_field • Custom I/O callbacks
  • 21. Register Offset Table drivers/i2c/busses/i2c-mv64xxx.c: struct mv64xxx_i2c_regs { u8 addr; u8 ext_addr; u8 data; u8 control; u8 status; u8 clock; u8 soft_reset; }; writel(0, drv_data->reg_base + drv_data->reg_offsets.soft_reset);
  • 22. regmap_field drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c: static const struct sun4i_hdmi_variant sun6i_variant = { … .field_ddc_en = REG_FIELD(SUN4I_HDMI_DDC_CTRL_REG, 31, 31), .field_ddc_start = REG_FIELD(SUN4I_HDMI_DDC_CTRL_REG, 30, 30), .field_ddc_reset = REG_FIELD(SUN4I_HDMI_DDC_CTRL_REG, 0, 0), .field_ddc_addr_reg = REG_FIELD(SUN4I_HDMI_DDC_ADDR_REG, 0, 31), .field_ddc_slave_addr = REG_FIELD(SUN4I_HDMI_DDC_ADDR_REG, 0, 6), … };
  • 23. regmap_field drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c: static const struct sun4i_hdmi_variant { … /* Regmap fields for I2C adapter */ struct regmap_field *field_ddc_en; struct regmap_field *field_ddc_start; struct regmap_field *field_ddc_reset; struct regmap_field *field_ddc_addr_reg; struct regmap_field *field_ddc_slave_addr; … };
  • 24. regmap_field regmap_field_write(hdmi->field_ddc_fifo_tx_thres, hdmi->variant->ddc_fifo_thres_incl ? 0 : 1); regmap_field_write(hdmi->field_ddc_fifo_rx_thres, RX_THRESHOLD); regmap_field_write(hdmi->field_ddc_fifo_clear, 1); if (regmap_field_read_poll_timeout(hdmi->field_ddc_fifo_clear, reg, !reg, 100, 2000)) return -EIO;
  • 25. Custom I/O Functions drivers/usb/musb/musb_io.h: /** * struct musb_io - IO functions for MUSB * @quirks: platform specific flags * @ep_offset: platform specific function to get end point offset * @ep_select: platform specific function to select end point * @fifo_offset: platform specific function to get fifo offset * @read_fifo: platform specific function to read fifo * @write_fifo: platform specific function to write fifo * @busctl_offset: platform specific function to get busctl offset */
  • 27. 8250 UART • De-facto standard – 8250 driver library • Platform specifics – Extra features – Quirks or bugs
  • 28. Synopsys DesignWare APB UART • Extra “busy” interrupt – Fires on attempts to write to LCR when UART is busy – “irq XX: nobody cared” • Extra “UART status register” • 8250_dw driver wraps 8250 library
  • 29. AHCI • libahci & libahci_platform – Driver library – Handles PHYs, clocks, regulators • Platform specific ahci_* • Generic ahci_platform
  • 30. Mentor Graphics MUSB • USB On-The-Go IP core – Seen on a few platforms – Has all related signals (ID & VBUS detect) • Separate USB PHY
  • 31. Allwinner USB OTG • MUSB with rearranged registers – Custom I/O functions • Very weird USB PHY interface – Generic PHY framework • ID & VBUS detect lines not routed outside – Controlled through custom register – Use GPIO lines externally – extcon framework
  • 32. DesignWare MAC • Many hardware revisions – Later ones have feature register • Found on 12+ platforms • Called “stmmac” in the kernel – Driver library – Platform provides config and callbacks
  • 33. A20 GMAC • Old revision of DWMAC • No DMA feature register – Dug out feature set from vendor kernel • Simple glue layer
  • 34. A64/H3 EMAC • DWMAC with rearranged registers – MDC bitfield meaning is different – Chained DMA descriptors only • DMA descriptor format is the same – A few fields are marked as “reserved”
  • 35. DesignWare HDMI • Found on 3+ platforms – With either DW-HDMI-PHY or 3rd party PHY • “dw-hdmi” in the kernel – Library-ish driver – Platform provides config and callbacks
  • 36. A64/H3 HDMI • Obfuscated register addresses – Obfuscation can be turned off :) • Found in some vendor kernel release • Custom PHY – Reverse engineered init code • Limited to certain resolutions