⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 booting-without-of.txt

📁 linux 内核源代码
💻 TXT
📖 第 1 页 / 共 5 页
字号:
child node is a full node structure itself as defined above.NOTE: The above definition requires that all property definitions fora particular node MUST precede any subnode definitions for that node.Although the structure would not be ambiguous if properties andsubnodes were intermingled, the kernel parser requires that theproperties come first (up until at least 2.6.22).  Any toolsmanipulating a flattened tree must take care to preserve thisconstraint.4) Device tree "strings" blockIn order to save space, property names, which are generally redundant,are stored separately in the "strings" block. This block is simply thewhole bunch of zero terminated strings for all property namesconcatenated together. The device-tree property definitions in thestructure block will contain offset values from the beginning of thestrings block.III - Required content of the device tree=========================================WARNING: All "linux,*" properties defined in this document apply onlyto a flattened device-tree. If your platform uses a realimplementation of Open Firmware or an implementation compatible withthe Open Firmware client interface, those properties will be createdby the trampoline code in the kernel's prom_init() file. For example,that's where you'll have to add code to detect your board model andset the platform number. However, when using the flattened device-treeentry point, there is no prom_init() pass, and thus you have toprovide those properties yourself.1) Note about cells and address representation----------------------------------------------The general rule is documented in the various Open Firmwaredocumentations. If you choose to describe a bus with the device-treeand there exist an OF bus binding, then you should follow thespecification. However, the kernel does not require every singledevice or bus to be described by the device tree.In general, the format of an address for a device is defined by theparent bus type, based on the #address-cells and #size-cellsproperty. In the absence of such a property, the parent's parentvalues are used, etc... The kernel requires the root node to havethose properties defining addresses format for devices directly mappedon the processor bus.Those 2 properties define 'cells' for representing an address and asize. A "cell" is a 32-bit number. For example, if both contain 2like the example tree given above, then an address and a size are bothcomposed of 2 cells, and each is a 64-bit number (cells areconcatenated and expected to be in big endian format). Another exampleis the way Apple firmware defines them, with 2 cells for an addressand one cell for a size.  Most 32-bit implementations should define#address-cells and #size-cells to 1, which represents a 32-bit value.Some 32-bit processors allow for physical addresses greater than 32bits; these processors should define #address-cells as 2."reg" properties are always a tuple of the type "address size" wherethe number of cells of address and size is specified by the bus#address-cells and #size-cells. When a bus supports various addressspaces and other flags relative to a given address allocation (likeprefetchable, etc...) those flags are usually added to the top levelbits of the physical address. For example, a PCI physical address ismade of 3 cells, the bottom two containing the actual address itselfwhile the top cell contains address space indication, flags, and pcibus & device numbers.For busses that support dynamic allocation, it's the accepted practiceto then not provide the address in "reg" (keep it 0) though whileproviding a flag indicating the address is dynamically allocated, andthen, to provide a separate "assigned-addresses" property thatcontains the fully allocated addresses. See the PCI OF bindings fordetails.In general, a simple bus with no address space bits and no dynamicallocation is preferred if it reflects your hardware, as the existingkernel address parsing functions will work out of the box. If youdefine a bus type with a more complex address format, including thingslike address space bits, you'll have to add a bus translator to theprom_parse.c file of the recent kernels for your bus type.The "reg" property only defines addresses and sizes (if #size-cellsis non-0) within a given bus. In order to translate addresses upward(that is into parent bus addresses, and possibly into CPU physicaladdresses), all busses must contain a "ranges" property. If the"ranges" property is missing at a given level, it's assumed thattranslation isn't possible. The format of the "ranges" property for abus is a list of:	bus address, parent bus address, size"bus address" is in the format of the bus this bus node is defining,that is, for a PCI bridge, it would be a PCI address. Thus, (busaddress, size) defines a range of addresses for child devices. "parentbus address" is in the format of the parent bus of this bus. Forexample, for a PCI host controller, that would be a CPU address. For aPCI<->ISA bridge, that would be a PCI address. It defines the baseaddress in the parent bus where the beginning of that range is mapped.For a new 64-bit powerpc board, I recommend either the 2/2 format orApple's 2/1 format which is slightly more compact since sizes usuallyfit in a single 32-bit word.   New 32-bit powerpc boards should use a1/1 format, unless the processor supports physical addresses greaterthan 32-bits, in which case a 2/1 format is recommended.2) Note about "compatible" properties-------------------------------------These properties are optional, but recommended in devices and the rootnode. The format of a "compatible" property is a list of concatenatedzero terminated strings. They allow a device to express itscompatibility with a family of similar devices, in some cases,allowing a single driver to match against several devices regardlessof their actual names.3) Note about "name" properties-------------------------------While earlier users of Open Firmware like OldWorld macintoshes tendedto use the actual device name for the "name" property, it's nowadaysconsidered a good practice to use a name that is closer to the deviceclass (often equal to device_type). For example, nowadays, ethernetcontrollers are named "ethernet", an additional "model" propertydefining precisely the chip type/model, and "compatible" propertydefining the family in case a single driver can driver more than oneof these chips. However, the kernel doesn't generally put anyrestriction on the "name" property; it is simply considered goodpractice to follow the standard and its evolutions as closely aspossible.Note also that the new format version 16 makes the "name" propertyoptional. If it's absent for a node, then the node's unit name is thenused to reconstruct the name. That is, the part of the unit namebefore the "@" sign is used (or the entire unit name if no "@" signis present).4) Note about node and property names and character set-------------------------------------------------------While open firmware provides more flexible usage of 8859-1, thisspecification enforces more strict rules. Nodes and properties shouldbe comprised only of ASCII characters 'a' to 'z', '0' to'9', ',', '.', '_', '+', '#', '?', and '-'. Node names additionallyallow uppercase characters 'A' to 'Z' (property names should belowercase. The fact that vendors like Apple don't respect this rule isirrelevant here). Additionally, node and property names should alwaysbegin with a character in the range 'a' to 'z' (or 'A' to 'Z' for nodenames).The maximum number of characters for both nodes and property namesis 31. In the case of node names, this is only the leftmost part ofa unit name (the pure "name" property), it doesn't include the unitaddress which can extend beyond that limit.5) Required nodes and properties--------------------------------  These are all that are currently required. However, it is strongly  recommended that you expose PCI host bridges as documented in the  PCI binding to open firmware, and your interrupt tree as documented  in OF interrupt tree specification.  a) The root node  The root node requires some properties to be present:    - model : this is your board name/model    - #address-cells : address representation for "root" devices    - #size-cells: the size representation for "root" devices    - device_type : This property shouldn't be necessary. However, if      you decide to create a device_type for your root node, make sure it      is _not_ "chrp" unless your platform is a pSeries or PAPR compliant      one for 64-bit, or a CHRP-type machine for 32-bit as this will      matched by the kernel this way.  Additionally, some recommended properties are:    - compatible : the board "family" generally finds its way here,      for example, if you have 2 board models with a similar layout,      that typically get driven by the same platform code in the      kernel, you would use a different "model" property but put a      value in "compatible". The kernel doesn't directly use that      value but it is generally useful.  The root node is also generally where you add additional properties  specific to your board like the serial number if any, that sort of  thing. It is recommended that if you add any "custom" property whose  name may clash with standard defined ones, you prefix them with your  vendor name and a comma.  b) The /cpus node  This node is the parent of all individual CPU nodes. It doesn't  have any specific requirements, though it's generally good practice  to have at least:               #address-cells = <00000001>               #size-cells    = <00000000>  This defines that the "address" for a CPU is a single cell, and has  no meaningful size. This is not necessary but the kernel will assume  that format when reading the "reg" properties of a CPU node, see  below  c) The /cpus/* nodes  So under /cpus, you are supposed to create a node for every CPU on  the machine. There is no specific restriction on the name of the  CPU, though It's common practice to call it PowerPC,<name>. For  example, Apple uses PowerPC,G5 while IBM uses PowerPC,970FX.  Required properties:    - device_type : has to be "cpu"    - reg : This is the physical CPU number, it's a single 32-bit cell      and is also used as-is as the unit number for constructing the      unit name in the full path. For example, with 2 CPUs, you would      have the full path:        /cpus/PowerPC,970FX@0        /cpus/PowerPC,970FX@1      (unit addresses do not require leading zeroes)    - d-cache-block-size : one cell, L1 data cache block size in bytes (*)    - i-cache-block-size : one cell, L1 instruction cache block size in      bytes    - d-cache-size : one cell, size of L1 data cache in bytes    - i-cache-size : one cell, size of L1 instruction cache in bytes(*) The cache "block" size is the size on which the cache managementinstructions operate. Historically, this document used the cache"line" size here which is incorrect. The kernel will prefer the cacheblock size and will fallback to cache line size for backwardcompatibility.  Recommended properties:    - timebase-frequency : a cell indicating the frequency of the      timebase in Hz. This is not directly used by the generic code,      but you are welcome to copy/paste the pSeries code for setting      the kernel timebase/decrementer calibration based on this      value.    - clock-frequency : a cell indicating the CPU core clock frequency      in Hz. A new property will be defined for 64-bit values, but if      your frequency is < 4Ghz, one cell is enough. Here as well as      for the above, the common code doesn't use that property, but      you are welcome to re-use the pSeries or Maple one. A future      kernel version might provide a common function for this.    - d-cache-line-size : one cell, L1 data cache line size in bytes      if different from the block size    - i-cache-line-size : one cell, L1 instruction cache line size in      bytes if different from the block size  You are welcome to add any property you find relevant to your board,  like some information about the mechanism used to soft-reset the  CPUs. For example, Apple puts the GPIO number for CPU soft reset  lines in there as a "soft-reset" property since they start secondary  CPUs by soft-resetting them.  d) the /memory node(s)  To define the physical memory layout of your board, you should  create one or more memory node(s). You can either create a single  node with all memory ranges in its reg property, or you can create  several nodes, as you wish. The unit address (@ part) used for the  full path is the address of the first range of memory defined by a  given node. If you use a single memory node, this will typically be  @0.  Required properties:    - device_type : has to be "memory"    - reg : This property contains all the physical memory ranges of      your board. It's a list of addresses/sizes concatenated      together, with the number of cells of each defined by the      #address-cells and #size-cells of the root node. For example,      with both of these properties being 2 like in the example given      earlier, a 970 based machine with 6Gb of RAM could typically      have a "reg" property here that looks like:      00000000 00000000 00000000 80000000      00000001 00000000 00000001 00000000      That is a range starting at 0 of 0x80000000 bytes and a range      starting at 0x100000000 and of 0x100000000 bytes. You can see      that there is no memory covering the IO hole between 2Gb and      4Gb. Some vendors prefer splitting those ranges into smaller      segments, but the kernel doesn't care.  e) The /chosen node  This node is a bit "special". Normally, that's where open firmware  puts some variable environment information, like the arguments, or  the default input/output devices.  This specification makes a few of these mandatory, but also defines  some linux-specific properties that would be normally constructed by  the prom_init() trampoline when booting with an OF client interface,  but that you have to provide yourself when using the flattened format.  Recommended properties:    - bootargs : This zero-terminated string is passed as the kernel      command line    - linux,stdout-path : This is the full path to your standard      console device if any. Typically, if you have serial devices on      your board, you may want to put the full path to the one set as      the default console in the firmware here, for the kernel to pick      it up as its own default console. If you look at the function      set_preferred_console() in arch/ppc64/kernel/setup.c, you'll see

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -