x86/mrst: add SFI platform device parsing code
Subsystems (4)
PATCH 1/1 x86/mrst: add SFI platform device parsing code
From: Feng Tang <[email protected]>
SFI provides a series of tables (differing between 0.7 and 0.8 firmware). These describe the platform devices present including SPI and I²C devices, as well as various sensors, keypads and other glue as well as interfaces provided via the SCU IPC mechanism (intel_scu_ipc.c)
This patch is a merge of the core elements and relevant fixes from the Intel development code by Feng, Alek, myself into a single coherent patch for upstream submission.
It provides the needed infrastructure to register I2C, SPI and platform devices described by the tables, as well as handlers for some of the hardware already supported in kernel. The 0.8 firmware also provides GPIO tables.
Devices are created at boot time or if they are SCU dependant at the point an SCU is discovered. The existing Linux device mechanisms will then handle the device binding. At an abstract level this is an SFI to Linux device translator.
Device/platform specific setup/glue is in this file. This is done so that the drivers for the generic I²C and SPI bus devices remain cross platform as they should.
(Updated from RFC version to correct the emc1403 name used by the firmware
and a wrongly used #define)
[Ingo - let me know if you only see this via the kernel list]
---
arch/x86/Kconfig | 2 arch/x86/include/asm/mrst.h | 6 arch/x86/kernel/mrst.c | 700 ++++++++++++++++++++++++++++++++++ drivers/platform/x86/intel_scu_ipc.c | 5 4 files changed, 713 insertions(+), 0 deletions(-)
arch/x86/Kconfig +2 -0
@@ -410,6 +410,8 @@ config X86_MRST depends on X86_EXTENDED_PLATFORM depends on X86_IO_APIC select APB_TIMER + select I2C + select SPI ---help--- Moorestown is Intel's Low Power Intel Architecture (LPIA) based Moblin Internet Device(MID) platform. Moorestown consists of two chips:
arch/x86/include/asm/mrst.h +6 -0
@@ -10,7 +10,11 @@*/ #ifndef _ASM_X86_MRST_H#define _ASM_X86_MRST_H + +#include <linux/sfi.h> +extern int pci_mrst_init (void ); +int __init sfi_parse_mrtc (struct sfi_table_header *table);/*
@@ -42,4 +46,6 @@ extern enum mrst_timer_options mrst_timer_options;#define SFI_MTMR_MAX_NUM 8#define SFI_MRTC_MAX 8 +extern void intel_scu_devices_create (void ); +extern void intel_scu_devices_destroy (void );#endif /* _ASM_X86_MRST_H */
arch/x86/kernel/mrst.c +700 -0
715 lines not on this page · raw message
drivers/platform/x86/intel_scu_ipc.c +5 -0
@@ -26,6 +26,7 @@#include <linux/sfi.h> #include <asm/mrst.h> #include <asm/intel_scu_ipc.h> +#include <asm/mrst.h> /* IPC defines the following message types */ #define IPCMSG_WATCHDOG_TIMER 0xF8/* Set Kernel Watchdog Threshold */
@@ -699,6 +700,9 @@ static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)iounmap (ipcdev.ipc_base);return -ENOMEM ; } + +intel_scu_devices_create (); +return 0 ; }
@@ -720,6 +724,7 @@ static void ipc_remove(struct pci_dev *pdev)iounmap (ipcdev.ipc_base);iounmap (ipcdev.i2c_base); ipcdev.pdev =NULL ; +intel_scu_devices_destroy (); }static const struct pci_device_id pci_ids[] = {
Quoted 7 lines · Alan Cox
arch/x86/kernel/mrst.c +6
-0+static void *max3111_platform_data (void *info) +{ +static int dummy; +struct spi_board_info *spi_info = (struct spi_board_info *)info; +int intr =get_gpio_by_name ("max3111_int" ); +/* we have multiple max7315 on the board ... */
arch/x86/kernel/mrst.c static inline int __init setup_x86_mrst_timer(char *arg) · line 479
Quoted 10 lines
arch/x86/kernel/mrst.c +8
-0+#define MAX7315_NUM 2 +static void *max7315_platform_data (void *info) +static void *emc1403_platform_data(void *info) +{ +static void *lis331dl_platform_data (void *info) +{ +static short intr2nd_pdata; +struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
It's rather concerning that the parser here needs to have all this knowledge about the specific chips that will be on the boards. Is there a plan for how this will be managed once system integrators begin putting other chips onto Moorestown boards?
Quoted 10 lines
Quoted 5 lines
arch/x86/kernel/mrst.c +4
-0+static void *lis331dl_platform_data (void *info) +{ +static short intr2nd_pdata; + struct i2c_board_info *i2c_info = (struct i2c_board_info*)info;
It's rather concerning that the parser here needs to have all this knowledge about the specific chips that will be on the boards. Is there a plan for how this will be managed once system integrators begin putting other chips onto Moorestown boards?
It depends on the device. The information for the platform device has to come from somewhere and the kernel has no formal standard structure for private data passed from platform devices - so in a lot of cases its really just the needed glue so the platform device code in drivers/i2c etc stays independent.
For a device that doesn't need any private structure passing it's just a case of knowing the Linux name that matches the firmware description. For a chip that already has a Linux driver that expects private data (or a new driver that needs to) the info has to come from somewhere and Linux packages it in per device fashion.
The parser has the knowledge precisely because we don't want to put the knowledge in the driver.
Alan
Quoted 10 lines · Alan Cox
Quoted 4 lines
It's rather concerning that the parser here needs to have all this knowledge about the specific chips that will be on the boards. Is there a plan for how this will be managed once system integrators begin putting other chips onto Moorestown boards?
For a device that doesn't need any private structure passing it's just a case of knowing the Linux name that matches the firmware description. For a chip that already has a Linux driver that expects private data (or a new driver that needs to) the info has to come from somewhere and Linux packages it in per device fashion.
Right, we need to do something and given that folks decided that OF wasn't for them... :/
Quoted 2 lines
The parser has the knowledge precisely because we don't want to put the knowledge in the driver.
This is precisely the opposite approach to that which has been taken with all the OF stuff where individual drivers take care of parsing their own data out of the OF tree. I guess it'd be good if we could achieve some level of consistency on this one, though I have this horrible feeling that we're going to end up with all sorts of board specific workarounds in here, especially around things like audio where you've got multiple chips working together.
The OF approach does have the advantage of avoiding collisions between multiple devices, and gives us some hope that the driver maintainers may have seen the definitions that are being created for the BIOSes.
Quoted 27 lines · Mark Brown
Quoted 10 lines · Alan Cox
Quoted 4 lines
It's rather concerning that the parser here needs to have all this knowledge about the specific chips that will be on the boards. Is there a plan for how this will be managed once system integrators begin putting other chips onto Moorestown boards?
For a device that doesn't need any private structure passing it's just a case of knowing the Linux name that matches the firmware description. For a chip that already has a Linux driver that expects private data (or a new driver that needs to) the info has to come from somewhere and Linux packages it in per device fashion.
Right, we need to do something and given that folks decided that OF wasn't for them... :/
Quoted 2 lines
The parser has the knowledge precisely because we don't want to put the knowledge in the driver.
This is precisely the opposite approach to that which has been taken with all the OF stuff where individual drivers take care of parsing their own data out of the OF tree. I guess it'd be good if we could achieve some level of consistency on this one, though I have this horrible feeling that we're going to end up with all sorts of board specific workarounds in here, especially around things like audio where you've got multiple chips working together.
Quoted 3 lines
The OF approach does have the advantage of avoiding collisions between multiple devices, and gives us some hope that the driver maintainers may have seen the definitions that are being created for the BIOSes.
Shudder.
Okay, before I start a long rant I'll start with this disclaimer; at least this patch is isolated to the mrst platform so that it doesn't impact the rest of the kernel. Feel free to take the stance that this is platform specific code and therefore will never have to handle the general-case of multiple machines. In that case each machine will need to have a separate copy of this functionality, but at least the damage is contained. </disclaim>
This will be an utter nightmare to maintain over the long term. It combines the worst parts of both static device tables and firmware data parsers. From the former it uses large statically allocated tables that cannot be either extended or freed at runtime which is unfriendly for multiplatform kernels.
Quoted 1 line
From the latter it takes the approach of abstracting all the details
of the firmware interface away from the device drivers which forces the abstraction layer to encode every possible permutation and combination of devices in a hunk of code that cannot be modularized and will become larger and larger for each new device that is supported. The lesson was learned with OF that the device driver is the only place where it makes sense to decode device specific data (addresses and irqs can have common code decoders, but the binding name and extra data is device driver specific). Trying to do it anywhere else is insanity.
That being said, there already is a defined method for passing in external data about the machine layout. I'm certainly not keen on adding another. It is already an uphill battle to convince device driver maintainers that adding device tree parsing code (appropriately contained) to .probe() hooks is the right thing to do. Asking them to also support SFI hooks (plus the next firmware-interface-of-the-month) is likely to end in a revolt.
Both tglx and dwmw2 [cc'd] have stated that they they are in favor of standardizing on OF device tree for x86 embedded. dwmw2 suggested translating data in other formats into the device tree during early boot so that existing OF routines can be used to parse the data by device drivers. That would keep the support code in the device drivers where it belongs without creating new SFI-specific device infrastructure. It also eliminates the statically allocated tables and board specific hacks.
Since data in the tree is free-form key-value properties, any device-specific SFI data can be imported into the tree verbatim to eliminate the risk that critical data will get discarded in the translation process. Well understood properties, like address ranges, IRQs and GPIOs would be straight forward to translate into the device tree form to make it parsable by common code.
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
Quoted 44 lines · Grant Likely
Shudder.
Okay, before I start a long rant I'll start with this disclaimer; at least this patch is isolated to the mrst platform so that it doesn't impact the rest of the kernel. Feel free to take the stance that this is platform specific code and therefore will never have to handle the general-case of multiple machines. In that case each machine will need to have a separate copy of this functionality, but at least the damage is contained. </disclaim>
This will be an utter nightmare to maintain over the long term. It combines the worst parts of both static device tables and firmware data parsers. From the former it uses large statically allocated tables that cannot be either extended or freed at runtime which is unfriendly for multiplatform kernels.
From the latter it takes the approach of abstracting all the details of the firmware interface away from the device drivers which forces the abstraction layer to encode every possible permutation and combination of devices in a hunk of code that cannot be modularized and will become larger and larger for each new device that is supported. The lesson was learned with OF that the device driver is the only place where it makes sense to decode device specific data (addresses and irqs can have common code decoders, but the binding name and extra data is device driver specific). Trying to do it anywhere else is insanity.
That being said, there already is a defined method for passing in external data about the machine layout. I'm certainly not keen on adding another. It is already an uphill battle to convince device driver maintainers that adding device tree parsing code (appropriately contained) to .probe() hooks is the right thing to do. Asking them to also support SFI hooks (plus the next firmware-interface-of-the-month) is likely to end in a revolt.
Both tglx and dwmw2 [cc'd] have stated that they they are in favor of standardizing on OF device tree for x86 embedded. dwmw2 suggested translating data in other formats into the device tree during early boot so that existing OF routines can be used to parse the data by device drivers. That would keep the support code in the device drivers where it belongs without creating new SFI-specific device infrastructure. It also eliminates the statically allocated tables and board specific hacks.
Quoted 6 lines
Since data in the tree is free-form key-value properties, any device-specific SFI data can be imported into the tree verbatim to eliminate the risk that critical data will get discarded in the translation process. Well understood properties, like address ranges, IRQs and GPIOs would be straight forward to translate into the device tree form to make it parsable by common code.
What Grant said.
This patch (and SFI in general) seems like entirely the wrong approach. You're gratuitously reinventing the wheel, and your proposed replacement isn't even round.
As Grant says, we already have a defined method for passing this kind of information to the kernel. We have well-thought-out bindings for various different types of devices -- which have been designed to ensure that we're describing the *hardware* and not specifically tied to implementation details in the current Linux driver setup.
It makes *no* sense to add probe support for your 'special' platform devices to drivers which already have (or will need anyway) proper device-tree support.
Seriously, just convert whatever crap you have into a device-tree at early boot (or preferably in the bootloader, and *beat* the firmware idiots until they provide it natively), and don't pollute the kernel any more than you have to with this idiocy.
Signature · 1 line
dwmw2
Quoted 3 lines · David Woodhouse
It makes *no* sense to add probe support for your 'special' platform devices to drivers which already have (or will need anyway) proper device-tree support.
To be fair they're not doing this, all this code is in the arch code rather than the driver code (which is a separate concern).
Quoted 4 lines
Seriously, just convert whatever crap you have into a device-tree at early boot (or preferably in the bootloader, and *beat* the firmware idiots until they provide it natively), and don't pollute the kernel any more than you have to with this idiocy.
This is roughly what it's doing except that it's going to native Linux bus types and platform data rather than to device tree.
Quoted 9 lines · Mark Brown
Quoted 3 lines · David Woodhouse
It makes *no* sense to add probe support for your 'special' platform devices to drivers which already have (or will need anyway) proper device-tree support.
To be fair they're not doing this, all this code is in the arch code rather than the driver code (which is a separate concern).
Quoted 7 lines
Quoted 4 lines
Seriously, just convert whatever crap you have into a device-tree at early boot (or preferably in the bootloader, and *beat* the firmware idiots until they provide it natively), and don't pollute the kernel any more than you have to with this idiocy.
This is roughly what it's doing except that it's going to native Linux bus types and platform data rather than to device tree.
It still means that drivers for chips which are seen both on this bizarre abomination and also on other machines which use a device-tree will need to support *both* probe types.
Signature · 1 line
dwmw2
Quoted 8 lines · David Woodhouse
Quoted 2 lines · Mark Brown
This is roughly what it's doing except that it's going to native Linux bus types and platform data rather than to device tree.
It still means that drivers for chips which are seen both on this bizarre abomination and also on other machines which use a device-tree will need to support *both* probe types.
No, the drivers don't see any of this but instead someone has to write (and maintain) explicit code to do the translation in arch/x86 outside the drivers. The drivers just see platform data and regular bus probes which they'll be doing anyway until such time as device tree is well enough established for people to stop doing platform data.
Quoted 3 lines
This patch (and SFI in general) seems like entirely the wrong approach. You're gratuitously reinventing the wheel, and your proposed replacement isn't even round.
SFI is what is implemented on these platforms. SFI is what you get. Now it's possible the firmware folks may move away from SFI for future hardware but that remains
Quoted 2 lines
As Grant says, we already have a defined method for passing this kind of information to the kernel. We have well-thought-out bindings for
No we don't. The existing drivers we need don't support it.
Quoted 3 lines
It makes *no* sense to add probe support for your 'special' platform devices to drivers which already have (or will need anyway) proper device-tree support.
I've not seen any which have device tree support that are being used.
Quoted 4 lines
Seriously, just convert whatever crap you have into a device-tree at early boot (or preferably in the bootloader, and *beat* the firmware idiots until they provide it natively), and don't pollute the kernel any more than you have to with this idiocy.
Thats why its in arch/x86/kernel/mrst.c - an arch private file specific to the platform which then provides platform data in the format drivers already use.
It's really quite simple
If drivers expect device tree the mrst.c code can provide device tree - but in the real world none we care about do so yet. If stuff moves to device tree then the translation will move that way because its job is to convert SFI to what the kernel wants.
Right now the kernel wants a mix of private structs and as far as possible platform_foo() stuff. When that is changes the rest will follow.
Alan
Quoted 7 lines
Okay, before I start a long rant I'll start with this disclaimer; at least this patch is isolated to the mrst platform so that it doesn't impact the rest of the kernel. Feel free to take the stance that this is platform specific code and therefore will never have to handle the general-case of multiple machines. In that case each machine will need to have a separate copy of this functionality, but at least the damage is contained. </disclaim>
Simple answer to this. It's intended that SFI will be used on certain Intel MID platforms. I am hopeful that something more sensible will happen with future firmware for future platforms but for existing MID platforms its not negotiable, we either support SFI or we don't run on them.
Quoted 1 line
This will be an utter nightmare to maintain over the long term. It
Intel will be maintaining it. While I can't speak for Intel on the matter my personal way of seeing this is "our turd, our shovel" and its localised so there will be no funny smells elsewhere.
Quoted 4 lines
combines the worst parts of both static device tables and firmware data parsers. From the former it uses large statically allocated tables that cannot be either extended or freed at runtime which is unfriendly for multiplatform kernels.
I know this. I've been managing it internally for a while. I have a deeper understanding than I want but the SFI side is fixed and better firmware design is a thing that you talk about now for products 'n' years down the line because of the way all the design/bringup/development for plaforms works.
In truth SFI is closer to being a device enumeration than a configuration description.
Quoted 5 lines
adding another. It is already an uphill battle to convince device driver maintainers that adding device tree parsing code (appropriately contained) to .probe() hooks is the right thing to do. Asking them to also support SFI hooks (plus the next firmware-interface-of-the-month) is likely to end in a revolt.
You need to look at the code again. There is *no* SFI specific hookery in drivers. In fact I have been going around removing that from code as we submit drivers upstream - and rightfully if I didn't the i²c maintainers and the like would reject the code.
If a driver wants device tree the SFI parser would ideally supply it with device tree. If the entire kernel goes device tree I will whoop with joy and make SFI use it.
Quoted 6 lines
Since data in the tree is free-form key-value properties, any device-specific SFI data can be imported into the tree verbatim to eliminate the risk that critical data will get discarded in the translation process. Well understood properties, like address ranges, IRQs and GPIOs would be straight forward to translate into the device tree form to make it parsable by common code.
In the idea world SFI would be replaced with a self describing expandable data format that translated neatly into whatever we needed, and the kernel drivers we are re-using would have corresponding interfaces. Lots of people understand this, but it simply won't happen for these existing SFI platforms.
In the real world they don't - yet, but if they do we'll be happy to join the revolution.
Alan
Quoted 40 lines · Alan Cox
Quoted 7 lines
Okay, before I start a long rant I'll start with this disclaimer; at least this patch is isolated to the mrst platform so that it doesn't impact the rest of the kernel. Feel free to take the stance that this is platform specific code and therefore will never have to handle the general-case of multiple machines. In that case each machine will need to have a separate copy of this functionality, but at least the damage is contained. </disclaim>
Simple answer to this. It's intended that SFI will be used on certain Intel MID platforms. I am hopeful that something more sensible will happen with future firmware for future platforms but for existing MID platforms its not negotiable, we either support SFI or we don't run on them.
Quoted 1 line
This will be an utter nightmare to maintain over the long term. It
Intel will be maintaining it. While I can't speak for Intel on the matter my personal way of seeing this is "our turd, our shovel" and its localised so there will be no funny smells elsewhere.
Quoted 4 lines
combines the worst parts of both static device tables and firmware data parsers. From the former it uses large statically allocated tables that cannot be either extended or freed at runtime which is unfriendly for multiplatform kernels.
I know this. I've been managing it internally for a while. I have a deeper understanding than I want but the SFI side is fixed and better firmware design is a thing that you talk about now for products 'n' years down the line because of the way all the design/bringup/development for plaforms works.
In truth SFI is closer to being a device enumeration than a configuration description.
Quoted 5 lines
adding another. It is already an uphill battle to convince device driver maintainers that adding device tree parsing code (appropriately contained) to .probe() hooks is the right thing to do. Asking them to also support SFI hooks (plus the next firmware-interface-of-the-month) is likely to end in a revolt.
Quoted 4 lines
You need to look at the code again. There is *no* SFI specific hookery in drivers. In fact I have been going around removing that from code as we submit drivers upstream - and rightfully if I didn't the i??c maintainers and the like would reject the code.
Heh; impedance mismatch. Let me clarify...
I'm in full agreement that SFI platforms exist now and must be supported (firmware replacement is not an option). I also understand that this patch is fully contained withing the moorestown platform code. It is obvious that pains were taken to ensure zero impact on existing device drivers (hence my original disclaimer).
My point is that an isolated translation layer becomes (exponentially?) more difficult to maintain for each additional platform that depends on it. Support must be explicitly added for every device that gets attached to a moorestown system in a way that cannot be modularized and has the potential to become very large.
How to interpret device specific data, including interpreting the binding name, really does belong in device driver. The SFI data should be exported to the driver where intelligent decisions can be made.
I think we both agree that calling a new API from drivers for each and every firmware interface is a path of madness. Instead, I was suggesting dumping the SFI data into device tree properties and using the existing API with an SFI-specific namespace, however...
I just spent some time looking closer at what SFI is providing and reading the spec. Wow. Okay, I take it all back. I don't see how any of this code could ever be made generic. The spec seems to only cover the data structure, and relationships between devices seem to be left to whatever convention the firmware writer feels like using, or am I missing something?
Quoted 1 line
From what I've seen tonight, dumping SFI data verbatim into a device
tree isn't an option because SFI doesn't naturally group device data. I withdraw the suggestion. So, I guess I agree. There doesn't seem to be any way around machine-specific SFI translation code, regardless of whether it translates into direct registrations, or into a device tree.
Quoted 3 lines
If a driver wants device tree the SFI parser would ideally supply it with device tree. If the entire kernel goes device tree I will whoop with joy and make SFI use it.
:-)
Quoted 17 lines
Quoted 6 lines
Since data in the tree is free-form key-value properties, any device-specific SFI data can be imported into the tree verbatim to eliminate the risk that critical data will get discarded in the translation process. Well understood properties, like address ranges, IRQs and GPIOs would be straight forward to translate into the device tree form to make it parsable by common code.
In the idea world SFI would be replaced with a self describing expandable data format that translated neatly into whatever we needed, and the kernel drivers we are re-using would have corresponding interfaces. Lots of people understand this, but it simply won't happen for these existing SFI platforms.
In the real world they don't - yet, but if they do we'll be happy to join the revolution.
Alan
Quoted 5 lines · Grant Likely
My point is that an isolated translation layer becomes (exponentially?) more difficult to maintain for each additional platform that depends on it. Support must be explicitly added for every device that gets attached to a moorestown system in a way that cannot be modularized and has the potential to become very large.
It's not just the per-device aspect of it, it's also what happens when OEMs start placing devices with no upstream defined mappings on their boards. Regardless of any specs it seems unlikely that OEMs can be reliably persuaded to coordinate the creation of new SFI mappings for these devices with anyone which means that we're likely to end up with multiple incompatible definitions. Looking at the code as it is I don't see any structure in there for handling that - it's assuming that we know what the platform data for a given device is going to look like.
Quoted 6 lines
From what I've seen tonight, dumping SFI data verbatim into a device tree isn't an option because SFI doesn't naturally group device data. I withdraw the suggestion. So, I guess I agree. There doesn't seem to be any way around machine-specific SFI translation code, regardless of whether it translates into direct registrations, or into a device tree.
One thing that might help here is to put in place the mechanisms for adding board-specific overrides now (I'm presuming there's board naming data in the SFI somewhere, I've not looked). That should hopefully provide some hints to people and would at least mean we've got something to hang machine specific workarounds on.
To be honest I'd actually be inclined to go more towards the way the non-DT embedded platforms have gone and just ignore the data we get from SFI as much as possible and have board specific initialisation in code; it's boring and repetitive but it's also clear and *relatively* robust.
Quoted 5 lines
Quoted 3 lines
If a driver wants device tree the SFI parser would ideally supply it with device tree. If the entire kernel goes device tree I will whoop with joy and make SFI use it.
:-)
To be honest I suspect we'll have similar issue with or without device tree.
Quoted 5 lines
To be honest I'd actually be inclined to go more towards the way the non-DT embedded platforms have gone and just ignore the data we get from SFI as much as possible and have board specific initialisation in code; it's boring and repetitive but it's also clear and *relatively* robust.
And even more unmaintainable. Won't happen.
Alan
Quoted 4 lines
any of this code could ever be made generic. The spec seems to only cover the data structure, and relationships between devices seem to be left to whatever convention the firmware writer feels like using, or am I missing something?
Not really no. It's basically little more than a component and IRQ list. The GPIO table in 0.8 exposes the GPIO lines a bit more sanely.
In fact all that SFI provides generically pretty much fits into platform_foo() already because there is so little - or into the I²C or SPI bus data.
Alan
Quoted 7 lines · Alan Cox
Quoted 5 lines
To be honest I'd actually be inclined to go more towards the way the non-DT embedded platforms have gone and just ignore the data we get from SFI as much as possible and have board specific initialisation in code; it's boring and repetitive but it's also clear and *relatively* robust.
And even more unmaintainable. Won't happen.
So what is the plan for coping with OEM systems? Right now the code makes no provision at all that I can see for system-specific handling of the SFI data which seems very optimistic.
Quoted 8 lines · On Thu, 23 Sep 2010 11:27:08 +0100 Mark Brown…
Quoted 5 lines · Alan Cox
Quoted 5 lines
To be honest I'd actually be inclined to go more towards the way the non-DT embedded platforms have gone and just ignore the data we get from SFI as much as possible and have board specific initialisation in code; it's boring and repetitive but it's also clear and *relatively* robust.
Quoted 5 lines
Quoted 1 line
And even more unmaintainable. Won't happen.
So what is the plan for coping with OEM systems? Right now the code makes no provision at all that I can see for system-specific handling of the SFI data which seems very optimistic.
There are various system specific drivers which have their own sfi entry and name. Telling platforms apart is a problem with SFI but the latest firmware also supports DMI so we can get platform identification via the normal PC interfaces.
Alan
Quoted 10 lines · Alan Cox
Quoted 3 lines · Mark Brown
So what is the plan for coping with OEM systems? Right now the code makes no provision at all that I can see for system-specific handling of the SFI data which seems very optimistic.
There are various system specific drivers which have their own sfi entry and name. Telling platforms apart is a problem with SFI but the latest firmware also supports DMI so we can get platform identification via the normal PC interfaces.
So the expectation is that the platform data parser functions in the SFI device list will be querying the DMI data and selecting the actual parsing based on that? Perhaps adding DMI keys to the match tables so the infrastructure is there for doing the device specific things would cover it; minor differences could be worked out in the default match function and we can drop back to board specific functions when it gets too messy.
My main issue here is that the code is working on the assumption that we have one standard idea of what the SFI data means and provides no guidance to users about handling the inevitable variations.
Quoted 11 lines · Alan Cox
Quoted 4 lines
any of this code could ever be made generic. The spec seems to only cover the data structure, and relationships between devices seem to be left to whatever convention the firmware writer feels like using, or am I missing something?
Not really no. It's basically little more than a component and IRQ list. The GPIO table in 0.8 exposes the GPIO lines a bit more sanely.
In fact all that SFI provides generically pretty much fits into
platform_foo()already because there is so little - or into the I²C or SPI bus data.
I believe the issue here is the handling of things where the functionality Linux needs is implemented over multiple chips so we need a way for the chips to find each other.
Quoted 7 lines
So the expectation is that the platform data parser functions in the SFI device list will be querying the DMI data and selecting the actual parsing based on that? Perhaps adding DMI keys to the match tables so the infrastructure is there for doing the device specific things would cover it; minor differences could be worked out in the default match function and we can drop back to board specific functions when it gets too messy.
That will just encourage people not to be careful.
Quoted 3 lines
My main issue here is that the code is working on the assumption that we have one standard idea of what the SFI data means and provides no guidance to users about handling the inevitable variations.
There should be no variations and the nature of the platform means that might even work out. I don't really want to add it to the table unless we have lots needing DMI data. Right now we don't and there are multiple platform implementations in existence.
Alan
Quoted 6 lines · Alan Cox
Quoted 4 lines
So the expectation is that the platform data parser functions in the SFI device list will be querying the DMI data and selecting the actual parsing based on that? Perhaps adding DMI keys to the match tables so the infrastructure is there for doing the device specific things would
That will just encourage people not to be careful.
I'm not see anything here which provides a way for people to be careful
- people just need to add the code directly into the parser if there's no format defined in the kernel the're working on. If (as will be the case with most chips) there's nothing there then people are pretty much left to their own devices unless they choose to work upstream. From experience what the overwheming majority of OEMs will actually do is work on the latest kernel from their distro of choice, normally without contributing their changes anywhere.
Quoted 8 lines
Quoted 3 lines
My main issue here is that the code is working on the assumption that we have one standard idea of what the SFI data means and provides no guidance to users about handling the inevitable variations.
There should be no variations and the nature of the platform means that might even work out. I don't really want to add it to the table unless we have lots needing DMI data. Right now we don't and there are multiple platform implementations in existence.
What is it about this platform that is going to restrict the problem?
Code which makes this sort of assumption about knowing the platforms that the device will be deployed on well is relatively common but the usual result is that OEMs want to change the reference platforms and the assumptions that the code has been making about the systems and about how people will work with the code break down. This problem is much more pronounced in the embedded space where the hardware is much less self-describing and regular than on PCs.
Quoted 6 lines
Quoted 4 lines
There should be no variations and the nature of the platform means that might even work out. I don't really want to add it to the table unless we have lots needing DMI data. Right now we don't and there are multiple platform implementations in existence.
What is it about this platform that is going to restrict the problem?
The sort of people who will be using it and how,
Quoted 5 lines
Code which makes this sort of assumption about knowing the platforms that the device will be deployed on well is relatively common but the usual result is that OEMs want to change the reference platforms and the assumptions that the code has been making about the systems and about how people will work with the code break down.
There are non reference platforms in existence without the problem you envisage having occurred. So I think we'll worry about it if it happens but knowing that with DMI we have the tools to deal with this.
Alan
Quoted 3 lines · Alan Cox
Quoted 1 line
What is it about this platform that is going to restrict the problem?
The sort of people who will be using it and how,
Can you be more specific? This is the same sort of thing people normally say but the experience is that it rarely survives a successful product.
Quoted 9 lines
Quoted 5 lines
Code which makes this sort of assumption about knowing the platforms that the device will be deployed on well is relatively common but the usual result is that OEMs want to change the reference platforms and the assumptions that the code has been making about the systems and about how people will work with the code break down.
There are non reference platforms in existence without the problem you envisage having occurred. So I think we'll worry about it if it happens but knowing that with DMI we have the tools to deal with this.
It doesn't break down immediately; a combination of volume and the next generation product coming along and grabbing attention is usually what causes things to break down. However, if you're totally confident that all the BIOS authors at the OEMs are going to work well together here then I guess it's only Moorestown that's affected.
Quoted 3 lines
usually what causes things to break down. However, if you're totally confident that all the BIOS authors at the OEMs are going to work well together here then I guess it's only Moorestown that's affected.
I'm not 100% confident which is why we lobbied hard to get DMI into the firmware, but I think there is a good chance the SFI stuff will be fine. My bigger worry to be honest is going to be people adding stuff which isn't even in firmware enumerations.