Seeking opinions on using device tree for I/O definition

I’ve been working ELLCC, a clang/LLVM based development tool chain targeting ARM, Mips, Microblaze, PowerPC, and x86 targets. The tool chain is pretty complete and runs on Linux, Windows, and Mac OS X. Linux target run-time support is complete using libc++, musl, and compiler-rt and now I’m working on adding bare metal library support. The first target I’ve been concentrating on is ARM. I’ve got pretty complete support for the ARM Cortex-A9 (MMU/non-MMU, virtual file system, multi-priority scheduler, file descriptor support, etc.) Most recently I’ve added support for LwIP and a revamped Berkeley style socket interface for it and have gotten to the point where I’ll be doing more device driver work.
I’m looking at adding device tree support to make the assignment of address, interrupt vectors, etc. a bit cleaner. Does anyone here have an opinion as to whether device trees are the way to go?

2

To avoid making a statement based on personal opinion, here is an answer based on my experience in the RF networking field and embedded ARM device programmer as an observer of inter-company shenanigans (rather than as a standard or collaboration participant / implementer)

Factors to consider when deciding to support a given standard / collaborative effort:

  • Are there more more companies than the usual suspects who are often ‘there to minimise impact on their own interests’ players. => There are very few companies involved and there doesn’t appear to be any real backing from user groups at the time of writing.

  • Are there established release specifications to work to, or is it all up in the air possibly waiting for (the squabbling to die down and achieve) agreement => no releases made, not a mature ‘collaboration’.

  • Do you need to join to get access to appreciable documentation => I don’t know.

  • Is it significant effort for you to implement and maintain compliance => Only you can say.

  • Are there any competing standards / ‘collaborations’ that would hinder uptake of this one or be a possible alternative choice => yes, for ARM devices there is embed for which ARM is a significant promoter.

Based on the above simple analysis I would suggest that device tree should not be your highest priority. NB: This doesn’t mean you shouldn’t do it though.

In general:

  • an OS should use some kind of tree data structure to keep track of the relationships between pieces of hardware

  • (in my opinion) this should be a complete tree (e.g. should include the coffee cup warmer that’s plugged into a USB hub that’s plugged into a USB controller that’s plugged into a thunderbolt port) so that it can be used for power management (e.g. which devices connected to a USB hub should be put to sleep before the USB hub is put to sleep?) and hot-plug events (e.g. if the USB hub is removed what else must’ve been removed?)

  • a complete tree can’t be static. Almost everything is potentially hot-pluggable (PCI, SATA, USB, …) while the OS is running (not just when the computer is turned off), and therefore the tree needs to be maintained/dynamically modified while the OS is running

  • a complete tree needs assistance from device drivers. When you start a driver for one thing (e.g. USB controller) then that driver is responsible for detecting child devices (e.g. if a USB hub is plugged into the USB controller, then USB controller driver adds “USB hub” to the tree).

  • during boot, an OS should use auto-detection as much as possible to build its device tree; because it’s far less hassle for everyone (end users, device manufacturers, system builders, …). For modern 80×86 PC compatible machines the entire tree can be built purely using auto-detection (primarily due to a industry wide push in the 1990s that became necessary because the old “manual end-user settings in config.sys” methods were unsustainable and inadequate for hot-plug purposes, which led to the inclusion of device enumeration being built into all later standards and “plug & play” standards retro-actively adding discover-ability to older technologies like ISA).

  • sadly, especially for embedded systems, there are cases where auto-detection can’t be used. For these cases an OS has to rely on “ugly hacks to work around the hardware design failures” (e.g. the lack of standardised device enumeration).

Now, none of the above has anything to do with DeviceTree – it’s all about the OS’s own internal tree. However, think about that last bullet point…

DeviceTree is a relatively good “de-facto standard” that exists (and is used by multiple operating systems) to fill that last “ugly hacks to work around the hardware design failures” niche. For its intended purpose (allowing an OS to initialise its internal tree up to the point where auto-detection and drivers can begin), there is no better alternative that I know of.

In other words; (in my opinion) DeviceTree is the way to go for some cases (e.g. most embedded systems) and is definitely not the way to go for other cases (e.g. modern 80×86 systems, ARM servers).

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật