Commit Graph

725 Commits

Author SHA1 Message Date
Thomas Huth 2ece1754f7 Fix "key?" Forth word when using USB keyboards
The "key?" Forth word did not work when being used for polling keyboard
events from USB keyboards since the usb_key_available() function never
triggered any USB transfers. Fix it by also refactoring usb_read_keyb()
a little bit so that both functions now use the same code for checking
for new keyboard events.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-03-23 11:43:35 +11:00
Thomas Huth f2fb1c6173 Remove bulk.fs package
The bulk.fs package was part of the old USB stack and is now not
required anymore.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-03-23 11:43:29 +11:00
Thomas Huth 5f79afca64 Include make.rules in the library Makefiles
Make sure to include make.rules from the Makefiles in the common
lib folder to get some more sane console output during the build
process.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-03-23 11:43:20 +11:00
Alexey Kardashevskiy c89b0df661 version: update to 20150313 2015-03-13 22:33:47 +11:00
Alexey Kardashevskiy 750aec6ff6 virtio: Fix vring allocation
The value returned by virtio_vring_size() is used to allocate memory
for vring. The used descriptor list (array of vring_used_elem) is
counted by the header - vring_used struct - is not.

This fixes virtio_vring_size() to return the correct size.
At the moment rings are quite small (256) and allocated with
4096 alignment, this is why we have not been having issues with
this so far.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* remove magic numbers
2015-03-13 22:31:11 +11:00
Alexey Kardashevskiy 8d96fe983f helpers: Fix SLOF_alloc_mem_aligned to meet callers expectation
Every caller of SLOF_alloc_mem_aligned() assumes the size is the first
argument while it is not.

This switches align and size and fixes random memory corruptions.

This is grep for SLOF_alloc_mem_aligned with this patch applied:

include/helpers.h|27| extern void *SLOF_alloc_mem_aligned(long size, long align);
lib/libveth/veth.c|103| buffer_list = SLOF_alloc_mem_aligned(8192, 4096);
lib/libveth/veth.c|105| rx_queue = SLOF_alloc_mem_aligned(rx_queue_len, 16);
lib/libvirtio/virtio-net.c|101| vq[i].desc = SLOF_alloc_mem_aligned(virtio_vring_size(vq[i].size), 4096);
slof/helpers.c|70| void *SLOF_alloc_mem_aligned(long size, long align)

Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-03-13 20:06:46 +11:00
Thomas Huth a3d4e896e5 Set default palette according to "16-color Text Extension" document
The "Open Firmware Recommended Practice: 16-color Text Extension"
document specifies how the first 16 colors of a palette should be
set. So let's use these colors in SLOF, too.
Also move the function for initializing the palette into the
common graphics.fs file so that we do not have to do this change
twice.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2015-03-12 18:25:35 +11:00
Thomas Huth 088baa0de4 Fix rectangle drawing functions to work also with higher bit depths
draw-rectangle, fill-rectangle and read-rectangle were only working
with 8-bit color depth displays so far. This is fixed now for 16-bit,
24-bit and 32-bit color depths, too, by taking the "screen-depth"
into account.
And while we're at it, consolidate all the same copies of these
functions into one common file (graphics.fs) so that we do not
have to do these modifications multiple times in different files.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2015-03-12 18:25:35 +11:00
Thomas Huth 21d5f489c2 Fix the x86emu patch file
One of the hunks in the patch file was bad, so replace it with a proper hunk.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2015-03-12 18:25:35 +11:00
Thomas Huth 4d8debd01d Silence compiler warning when building the biosemu
Fixed the compiler warnings about wrong and missing prototypes in the
biosemu snk code.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2015-03-12 18:25:35 +11:00
Thomas Huth 18b1f60976 Use device-type Forth word to set up the corresponding property
It's easier to use "device-type" instead of creating the
corresponding properties manually.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-03-12 18:25:35 +11:00
Thomas Huth e6c14049ae Improve /openprom node
There's no need for a device_type property here, but according
to IEEE1275, it should have a "relative-addressing" propery instead.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-03-12 18:25:35 +11:00
Alexey Kardashevskiy 9b82c855c5 pci-properties: Remove redundant call to device-type
At the moment SLOF adds a "device_type" property automatically for
every single PCI device based on its class even if there is no SLOF
driver for such a device. OF1275 says that "device_type" is for
implemented interfaces only. A side effect of this is virtio-balloon
getting device_type=="memory" while it should not have.

This removes automatic call to device-type from the common PCI code.
Since now, we rely on existing SLOF PCI drivers to call device-type if
needed. virtio-blk/net, e1000, ohci/ehci/xhci do this. virtio-scsi
does not create the property for itself but disks on its bus do.
virtio-ballon won't get the device_type property as there is no driver
for it.

While we are here, remove device-type from usb-mouse as well.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* removed usb mouse as well - slof does not implement it
2015-03-12 18:25:30 +11:00
Nikunj A Dadhania ea2b48a7a3 cas: reconfigure memory nodes
For supporting memory hotplug feature, some changes are need in the
way memory is represented during VM bootup. Now the guest boots from
RMA and rest of the memory is configured only during
client-architecture call.  SLOF adds support for creation of these
nodes dynamically.

If the guest supports ibm,dynamic-reconfiguration-memory, qemu would
create memory as part of /ibm,dynamic-reconfiguration-memory

While for older guests, memory@ would be populated.

CC: bharata@linux.vnet.ibm.com
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-12-03 16:08:41 +05:30
Nikunj A Dadhania 112cdf9375 pci: use 64bit bar ranges
Add support for the new ranges property for 64bit BARs. This will
enable devices with higher BAR requirements. Currently, the device
could not get more than 256MB, as the 512MB memory range passed by
Qemu was divided between prefetchable and non-prefetchable MMIO range.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2014-12-03 16:08:37 +05:30
Alexey Kardashevskiy a70dbda2e2 version: update to 20141202 2014-12-02 15:18:31 +11:00
Nikunj A Dadhania 1f33e4f29e ipv4: Fix send packet across a subnet
The send packet code does understand that the IP is not part of the
current network and needs to use the router. And then tries to get the
MAC address of the router IP from arp cache, that fails. This is
becuase there was no ARP Request send for the router IP.

So in case when there is router involved, send arp request for the
router IP and after the reply, we have the router mac cached to
communicate with.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29 17:02:08 +05:30
Nikunj A Dadhania b931c7bc10 pci: scan only type 0 and type 1
In certain cases when a PCI device is passthru and is frozen before it
reaches SLOF.  All PCI read result reading FF. This exposed a bug in
the pci scan code which would wrongly take it as a pci brigde and try
to scan devices below that and that would enter an infinite loop.

Explicitly scan for type 0/1 and rest are not supported.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29 16:19:39 +05:30
Nikunj A Dadhania 792984914c usb-xhci: support xhci extended capabilities
commit 706c69e4 "xhci: fix port assignment" partially fixed the
usb port numbering.

Adding parsing of xhci extended capabilities, we can parse the
overlapped ports accordingly and have proper port numbering.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29 16:19:35 +05:30
Thomas Huth 40a88835cd Fix term-io-key to also work when stdin has not been set yet
term-io-key simply did nothing when the stdin had not been set yet.
Especially, it even did not put an output item on the stack, which led
to very ugly crashes in case we dropped to the Forth prompt before
the console had been set up. Fix it by running the behaviour of the
previous key handler instead.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29 16:19:31 +05:30
Benjamin Herrenschmidt 824b4522ef net-snk: llfw startup is using the wrong offset to handler
It's loading from handler + 0x160 instead of 0x60. Not a big problem
in practice but should be fixed.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:17:45 +05:30
Benjamin Herrenschmidt 745d1fe80c net-snk: Make call_client_interface() a bit more ABI compliant
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:17:41 +05:30
Benjamin Herrenschmidt f209bf95ec net-snk: Remove custom printf version
In favor of the libc one

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:17:38 +05:30
Benjamin Herrenschmidt c3c8d6ae27 net-snk: Sanitize our .lds file
No need to have a single giant section, break it back up, add
some missing bits, and make sure .opd is separate so that objdump
and gdb can properly reconstitute the dot symbols.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[ do not discard .comment, this is fixed with binutils 2.24]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29 16:17:34 +05:30
Benjamin Herrenschmidt 1e732c553f net-snk: Avoid type clash for stdin & stdout
Now that we are using the libc stdio

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:17:28 +05:30
Nikunj A Dadhania 8e6f2bba50 net-snk: use socket descriptor in the network stack
With module layer cleanup, and a fixed socket() call, start using the
fd across the network stack.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:17:10 +05:30
Benjamin Herrenschmidt 4ca13ddf7f net-snk: Remove printk() in favor of printf()
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:17:05 +05:30
Benjamin Herrenschmidt b95d825202 net-snk: Remove redundant prototypes
Those functions are in string.h

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:17:01 +05:30
Benjamin Herrenschmidt 3154514d5d net-snk: Remove unused timer functions
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:16:58 +05:30
Benjamin Herrenschmidt 0a341a279b net-snk: Remove some unused PCI functions
The read/write_io ones are used by biosemu, though we should
probably fix them to work on qemu platform at some stage.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:16:54 +05:30
Benjamin Herrenschmidt 6495aef5b6 net-snk: Remove module system
It's not used anymore, let's just call directly into the relevant
OF functions. While at it, also make socket() actually return
an fd.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:16:48 +05:30
Benjamin Herrenschmidt a7a11bcf51 net-snk: Remove insmod/rmmod
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:16:44 +05:30
Benjamin Herrenschmidt 34729a27ec net-snk: Remove snk_kernel_interface and related definitions
None of this if of any use anymore

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:16:41 +05:30
Benjamin Herrenschmidt 8d29a17710 net-snk: Remove pci/vio_config gunk
None of that is used anymore

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:16:37 +05:30
Benjamin Herrenschmidt b7489d4673 js2x: Fix build
Add a dummy version.c to please the Makefile

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:16:31 +05:30
Benjamin Herrenschmidt 00446893c3 net-snk: Remoe some now unused "kernel" functions
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:16:09 +05:30
Nikunj A Dadhania 1c17c13a57 rtas: Improve error handling in instantiate-rtas
Error handling, even when the call is not implemented,
code was printing failed.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29 15:59:24 +05:30
Alexey Kardashevskiy 5cb3875785 version: update to 20140827 2014-08-27 15:57:34 +10:00
Nikunj A. Dadhania f9a60de304 Add private HCALL to inform updated RTAS base and entry
This patch adds a private HCALL to inform qemu the updated
rtas-base and rtas-entry address when OS invokes the call
"instantiate-rtas". This is required as qemu allocates the
error reporting structure in RTAS space upon a machine check
exception and hence needs to know the updated RTAS.

Enhancements to qemu to handle the private HCALL, prepare
error log and invoke machine check notification routine
are in a separate patch.

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-08-27 11:10:45 +05:30
Nikunj A Dadhania 706c69e46b xhci: fix port assignment
Port assignment logic was generating negative port number

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-07-17 12:43:29 +05:30
Nikunj A Dadhania f284ab3f03 version: update to 20140630 2014-06-30 12:19:36 +05:30
Nikunj A Dadhania e748fc4a37 Quieten the grub warning
Replace the warning with code comment

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-06-26 12:13:59 +05:30
Avik Sil 6180178869 Add boot menu support
This patch adds boot menu support to SLOF. When boot menu is enabled from qemu
commandline with '-boot menu=on', on pressing F12 key it displays the list of
devices to boot from and waits for user's input. This is in line with x86 qemu
bios feature.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-06-13 12:33:54 +05:30
Nikunj A Dadhania f1c40e50b5 boot from disk having chrp-boot file
SLES when creating an LVM, creates a boot partition with
CHRP-BOOT. This was only being handled for CDROM case. Add this for
the hard-disk as well.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-06-13 12:33:54 +05:30
Nikunj A Dadhania 4034b51fa0 fat16: fix read and remove debug messages
* fat16 code had old debug prints, get rid of that
* yaboot tried reading a file beyond the size of file, fix read
  routine to override and read only till the file-size

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-06-13 12:33:54 +05:30
Nikunj A Dadhania ac72005f77 version: update to 20140613 2014-06-13 00:22:04 +05:30
Nikunj A Dadhania 7fb8bdae84 dhcparch define missing in compilation
Include DHCPARCH define  in the FLAG variable
Set the flag, so that dhcp request would contain DHCPARCH

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-06-12 23:57:12 +05:30
Nikunj A Dadhania f4d823ffab version: update to 20140514 2014-05-14 16:43:26 +05:30
Nikunj A Dadhania e53c254178 pci-scan: reserve memory for pci-bridge without devices
A pci-bridge without a downstream device will end up with no memory
range allocated. For cases like hotplug, reserve some memory for the
bridge device.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-05-14 16:29:40 +05:30
Nikunj A Dadhania 7cc0b6c5ce pci-bridge: Fix ranges when no device beyond the bridge
Before starting pci-bridge probing the ranges property is set to the
max limit, and then pci bridge is probed. Once the probe is over we
would update the ranges property.

In case when there is no device beyond the bridge, ranges will be null
and the code moves ahead. The actual problem here is that before
probing the bridge the ranges property was set to max limit. That
stays and cause overlapping ranges for sibling devices.

So empty the ranges property for this bridge when there is no device present.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-05-14 15:39:24 +05:30