aboutsummaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2015-02-19change direct use of LSH to SETFIELDDan Streetman3-0/+3
In several places, a "bus/device/function" u16 was being directly or'ed into an address using a left-shift. This should be using SETFIELD, especially now that all _LSH have been removed. Change use of BDFN (bus/device/function) field from using plain left-shift to using SETFIELD(). Add proper BDFN field definitions. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-19Change user-defined _MASK/_LSH to just maskDan Streetman7-340/+170
The last patch changed the SETFIELD() and GETFIELD() macros to automatically calculate the shift of a given mask, so manually specifying the shift is no longer needed. Additionally, any masks should have the _MASK suffix removed since the GETFIELD() and SETFIELD() operations expected to be passed the mask name without the _MASK suffix (and so either the mask name or the get/setfield call needs to have its mask name changed). Change all _MASK masks to remove the _MASK suffix, except for any places that leaving _MASK makes sense (e.g. already an existing define without _MASK suffix). Remove all _LSH defines, as they are no longer needed. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-19simplify GET/SETFIELD() use, add MASK_TO_LSH()Dan Streetman1-5/+6
Currently, the GETFIELD() and SETFIELD() macros require the user to define both the _MASK and the _LSH of the field. However, the shift of the field is trivially determinable and there is no reason it needs to be specified by the user. Add MASK_TO_LSH() macro, which determines the shift of a given mask. Change GETFIELD() and SETFIELD() to use MASK_TO_LSH() to determine the shift of the specified mask, instead of requiring it to be specified by the user. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-19core/flash: Move flash NVRAM handling to new flash moduleJeremy Kerr1-3/+0
Since we want to prevent conflicts between PNOR and NVRAM, this change moves the flash-nvram handling out of flash-nvram.c and into the generic flash module. This way, the OPAL_FLASH_{READ,WRITE,ERASE} API won't conflict with the OPAL_*_NVRAM api. To do this, we use the flash_register function to look for an "NVRAM" partition. If one is found, it is automatically registered as the system NVRAM backend. We also change the rhesus and astmbc platforms to use the common flash code. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-19core/flash: port pnor_load_resource to flash codeJeremy Kerr1-1/+2
Since we have a flash device registered as the system flash, use this as a generic load_resource backend. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-19core/flash: Add flash APIJeremy Kerr2-2/+9
We'd like to enable access to the system PNOR, on platforms where its present. This change introduces an API for global flash operations: opal_flash_read opal_flash_erase opal_flash_write - plus device-tree bindings to expose the flash details. Since there are other components of the system that use the PNOR (NVRAM and pnor_load_resource), upcoming changes will port this these over to use the new interface. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-18Replace is_mambo_chip with a better chip quirk mechanismBenjamin Herrenschmidt1-3/+15
And add some basic qemu quirks Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-18chiptod: Remove fallback to master CPUBenjamin Herrenschmidt1-2/+1
If the chiptod is not in the device-tree, we must fail, the old OPAL mode isn't supported anymore Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-18lock: Add lock depth recording per CPUBenjamin Herrenschmidt1-0/+1
We want to move to pollers being run inly when no lock is held so let's start recording lock depth. It will also be a useful debugging tool. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-18hostservices: Cache lids prior to first load requestAnanth N Mavinakayanahalli1-0/+1
... to prevent any potential poller recursions during lid load. With this change: ... [10810950484,5] CUPD: P side ML Keyword = FW830.00 [10832756491,6] HBRT: 1 lids to load [10832762732,7] FSP: Fetch data id: 05 sid: 81e00430 to 0x306cf500(0x100000 bytes) [10832766825,7] FSP: 0x00100000 bytes balign=306cf000 boff=500 bsize=101000 [10857829395,5] CUPD: Marker LID id : size : status = 0x80a08001 : 0x5d0 : 0x0 [10966464432,7] FSP: -> rc=0x00 off: 00000000 twritten: 0007fb80 [10966468418,7] HBRT: LID 0x81e00430 successfully loaded, len=0x31b83db8 ... [19485180658,7] HBRT: stopOCCs() rc = 0 [19582727570,6] OCC: Got OCC Load message, scope=0x2 dbob=0x0 seq=0x10 [19582732660,7] HBRT: OCC Load requested [19582734678,7] HBRT: Calling loadOCC() homer 0000000401400000, occ_common_area 0000000400800000, chip 0000 [19582803643,6] HBRT: Lid load request for 0x81e00430 [19582806532,7] HBRT: Serviced from cache, len=0x7fb80 [19582996931,7] HBRT: -> rc = 0 [19582999113,7] HBRT: Calling loadOCC() homer 0000000401c00000, occ_common_area 0000000400800000, chip 0001 [19583097594,6] HBRT: Lid load request for 0x81e00430 [19583100343,7] HBRT: Serviced from cache, len=0x7fb80 [19583274638,7] HBRT: -> rc = 0 [19583277114,6] HBRT: OCC Start requested V2: Address Vasant's comments (bz reference and OPAL_NO_MEM) Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-17timebase: Add nanosleep_nopollAnanth N Mavinakayanahalli1-0/+2
For use by hservices mainly... Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-17core: Add subid to load_resource()Michael Neuling2-3/+6
This adds a subid to load_resource() so that sub-partitions can be accessed inside a PNOR partition. These sub-partitions follow the format used by the hostboot SBE image. The subid will match on the EC field of the SBE table of contents. If it's found, only that sub-partition is returned to the caller. Current partitions (kernel and ramfs) don't support sub-partitions. If caller tries to access a sub-partition within these, we fail the call. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-17core: Add load_resource()Michael Neuling1-0/+3
Add new function call load_resource(). This helps cleanup the callers of platform.load_resource(). Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-16s/OpalMessageType/opal_msg_type/ removing CamelCase and being consistent!Stewart Smith2-2/+2
We now consistently use msg as abbreviation for message in OPAL API. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-13FSP/LEDS: Do not expose driver specific functionsVasant Hegde1-4/+0
Don't expose functions which are not used outside LED driver. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-12Use LOCK_UNLOCKED macro to in init_lock()Michael Neuling1-2/+1
Avoids duplication of init values. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-11core/device: Function to return child node using nameNeelesh Gupta1-0/+3
Add a function dt_find_by_name() that returns the child node if matches the given name, otherwise NULL. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-10Use __be64 annotations in opal.h for opal_sg_list and oppanel-lineStewart Smith1-6/+6
Now matches linux. Fix up all the fsp code using these structs to do the proper be64_to_cpu conversions so at least everything is annotated correctly. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-10fix whitespace in structOpalIoP7IOCBiErrorData in opal.hStewart Smith1-1/+1
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-10Add #ifdef __SKIBOOT__ around types.h include in opal.hStewart Smith1-0/+2
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-10Fix whitespace in oppanel_line in opal.hStewart Smith1-1/+1
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09sync opal.h whitespace and comments with linuxStewart Smith1-2/+3
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09fix whitespace in enum OpalsysparamPermStewart Smith1-3/+3
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09Use OPAL_DUMP_REGION_HOST_START (and END)Stewart Smith2-5/+5
Rather than have DUMP_REGION_HOST_START and (unused) OPAL_DUMP_REGION_HOST_START let's use the defines we have in opal.h as this is API that just happens to match with what FSP expects. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09move struct opal_ipmi_msg to opal.h as it's an APIStewart Smith1-0/+11
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09Move flags for PM states to opal.h, exposing defines to OSStewart Smith1-0/+10
In Linux, we had OPAL_PM_(NAP|SLEEP|WINKLE)_ENABLED defines, this makes sense from an API PoV as having defines for flags in DT is useful, but we should clearly define what these flags are. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09Add OPAL_INVALID_CALL to opal.hStewart Smith1-0/+1
Never used, but exists for testing. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09PSI: Report a PEL for PSI timeoutAnanth N Mavinakayanahalli1-0/+1
We currently just log an error when we don't find an active PSI link 15 minutes after it went down. Add a PEL log, with sufficient severity so it gets pushed to the administrator. V2: Reset the timeout correctly to prevent error log flooding. Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Tested-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi/wdt: Add ipmi watchdog timer supportAlistair Popple1-0/+12
Add support for an ipmi watchdog timer. During skiboot initialisation this patch will cause the system to be reset if opal_run_pollers() isn't called for more than 60 seconds. Once the payload is started the watchdog timer will be reset and a pre-timeout interrupt set. The payload should then receive the interrupt and call into skiboot which will disable the watchdog timer. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: Message Linux to perform graceful shutdownJoel Stanley1-1/+1
This sends the previously unused OPAL_MSG_SHUTDOWN using opal_queue_msg to initiate a graceful shutdown. The message provides a single parameter indicating weather the shutdown is will result in a power-off, or a reboot. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: Implement Read Event and SEL parsingJoel Stanley1-0/+3
The read event mechanism is used when the BMC has an asynchronous message for the host. It sets a flag that we read with Get Message Flags, and then we read the message using Read Event. This event message contains a SEL message. There are two OEM SEL messages we expect from the AMI BMC: - graceful power operations. This is when the BMC wants the host to power down or reboot. - PNOR Locking. When the BMC wants to access the PNOR, it requests that the host not touch it. This patch implements the parsing. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: Set BMC Global Enables to enable notificationsJoel Stanley1-0/+2
For OEM events including graceful power down and BMC PNOR access we want to receive notification whenever a message is ready to be read from the BMC. This requires the Event Message Buffer flag to be enabled. This is the equivalent of doing mc setenables event_msg=on with ipmitool, except the message must come from the BT interface in order to have permission to modify the flags. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: handle SMS_ATN eventsJeremy Kerr1-0/+15
When the bt interface sets the SMS_ATN flag, we perform a Get Message Flags to determine what messages are available. The only message type currently processed is the Event Message Buffer, which provides SEL messages for indicating OEM specific events such as graceful system shutdown and PNOR access requested. These events will be handled by the IPMI layer in skiboot. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: Add support for synchronous message sendingAlistair Popple1-0/+4
This patch adds support for sending ipmi messages synchronously. This is necessary to allow messages to be sent during skiboot initialisation as interrupt servicing/polling is controlled by the host operating system which is not yet running. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09platform: Add exit platform hookAlistair Popple1-0/+5
Add a platform hook that is called just prior to loading and running the payload. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09ipmi: Add a function to (re)initialise a message without allocationAlistair Popple1-0/+7
Currently the only functions we have for initialising ipmi messages with the correct values also allocate memory for the message. In some cases we want to reuse previously allocated messages to avoid continually freeing/allocating memory. This patch introduces a function which (re)initialises a previously allocated message and converts existing instances of this behaviour over to the new function. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-09Fix commit 16c80346Jeremy Kerr1-2/+1
Commit 16c80346 change included some reverts of previous commits, which we need. This change reverts those reverts, leaving the original intent of that change. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-06Whitespace style fixups in opal.hStewart Smith1-0/+3
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-06Move skiboot internal things from opal.h to opal-api.hStewart Smith3-63/+85
This is probably not the best collection of things in the world, but it means that opal.h is much closer to being directly usable by an OS. This triggers a bunch of #include fixes throughout the tree. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-06fix up opal.h whitespace to match linux and be more consistentStewart Smith1-35/+36
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-06Remove unneeded includes from opal.hStewart Smith1-3/+0
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-06opal.h: s/uintXX_t/__beXX/ to match with linux and sparse in the futureStewart Smith1-140/+144
The __be64 (etc) annotations are likely going to be useful in the future if/when we start running sparse around skiboot and it's already useful in linux, so it's completely harmless having __be64 rather than uint64_t in skiboot. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-05Add OPAL_INVALID_CALL explicitly in opal.h and docsStewart Smith1-3/+2
Was mentioned in linux as possibly being used by some external test modules. It's harmless to make this official behaviour. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-05sync whitespace in opal.h with linuxStewart Smith1-1/+3
Also means we start getting consistent codestyle Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-04Allow ELF executables with function descriptor entrypoint to be skiboot payloadsNathan Whitehorn1-0/+17
Big-endian ELF64 ELF executables normally (the Linux kernel is an exception) have their entry point refer to a function descriptor instead of the first instruction. Distinguish between the Linux case and the function descriptor case, which is used for the FreeBSD kernel, by checking whether the entry point points into an executable section or not. This allows use of the FreeBSD kernel as a skiboot payload. Signed-off-by: Nathan Whitehorn <nwhitehorn@freebsd.org> [stewart@linux.vnet.ibm.com: reverse test polarity, change continue to break] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-22rtc: Remove the not used prototypeNeelesh Gupta1-2/+0
This seem to be left behind during the previous commit for creating a generic interface of reading the cached tod on non-fsp systems. So, remove the old prototype fsp_rtc_get_cached_tod(). Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-10Enable warn_unused_result for fsp_fetch_data_queue()Vasant Hegde1-1/+1
fsp_fetch_data_queue() internally calls fsp_queue_msg(). So ideally we should consume the result of this function. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-05occ: Fix clearing of OCC interrupt on remote fixBenjamin Herrenschmidt1-1/+1
If the OCC interrupt comes from another chip, we incorrectly try to clear it on the local one. This causes hangs at boot on some machines. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-02elog: Clean up error logging headersAlistair Popple2-189/+174
Commit cf6f4e8912d29fb89ce85c84834607065ad595a5 introduced a platform independent frontend for error logging. However it failed to move the generic parts of the fsp-elog.h header into the platform independent one, instead relying on the fact that up until now fsp-elog.h was included whenever a function needed to log errors. This patch moves the platform independent defines into the frontend header file (errorlog.h) and removes the include of the platform specific header in generic code paths. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-02esel: Add a logging backend for bmc based machinesAlistair Popple1-0/+8
This patch adds a backend for bmc based machines running AMI firmware supporting the OEM extended sel commands. Errors are logged in pel format to the bmc. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>