[PATCH 02/15] x86: Add device tree support
Sebastian Andrzej Siewior
bigeasy at linutronix.de
Mon Jan 3 23:20:39 EST 2011
Grant Likely wrote:
>> +extern char cmd_line[COMMAND_LINE_SIZE];
>> +/* This number is used when no interrupt has been assigned */
>> +#define NO_IRQ (-1)
>
> 0 means NO_IRQ on x86 and most architectures. I will change this when
> I pick up the patch.
cat /proc/interrupts
CPU0
0: 40 IO-APIC-edge timer
>> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
>> index 577d06b..26f2c9a 100644
>> --- a/arch/x86/kernel/setup.c
>> +++ b/arch/x86/kernel/setup.c
>> @@ -113,6 +113,7 @@
>> #endif
>> #include <asm/mce.h>
>> #include <asm/alternative.h>
>> +#include <asm/prom.h>
>>
>> /*
>> * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
>> @@ -445,6 +446,9 @@ static void __init parse_setup_data(void)
>> case SETUP_E820_EXT:
>> parse_e820_ext(data);
>> break;
>> + case SETUP_DTB:
>> + add_dtb(pa_data);
>> + break;
>
> Why is the physical address being passed in when the virtual address
> is needed to be stored in initial_boot_params by add_dtb()?
add_dtb() changes it via phys_to_virt() so it is stored as virtual. I
can't touch this memory that early in the boot process so it is passed as
phys. phys_to_virt() isn't working (yet) so you need a fixmap or an
early_ioremap(). Earlier I used the device tree very late so the
phys_to_virt() memory was working.
Later in the series add_dtb() stores it in a custom u64 variable because I
might have to use the built-in dtb, I have to relocate the dtb (so the
boot loader does not have to care about kernel's memory layout) and I have
to use it "early" so I create a fixmap for it.
The dtb is not usable before the ->get_config() hook (x86_dtb_get_config,
patch #5) is called. After that initial_boot_params is set and can be used.
>> default:
>> break;
>> }
>> --
>> 1.7.3.2
Sebastian
More information about the devicetree-discuss
mailing list