139 Commits

Author SHA1 Message Date
Travis Geiselbrecht
957b9033fb [scripts][python] Move a few more scripts from python2 to python3
Turns out they were already python3 safe, so just switch to requested
version over.
2023-06-01 12:17:37 -07:00
Travis Geiselbrecht
6ad3643165 [lib][minip] add an arg to the ethernet transmit callback
Already had the registration hook for it, but was never used.
2022-03-19 15:06:57 -07:00
Travis Geiselbrecht
445f3e4ee7 [platform/target][warnings] fix -Wmissing-declarations warnings in platform/ and target/
Mostly driver code in various platforms. There are still some warnings
in this part of the tree in lesser-used platforms.
2021-10-21 23:18:09 -07:00
Travis Geiselbrecht
4edb93adde [lib][console] rename some console command types to be prefixed with console_
Some of the structures, notably 'cmd', in the lib console stuff are a
little too generically named and have collided with some other code
so prefix the names a bit more cleanly with console_

The change is largely mechanical, and folks with out of tree code can
easily switch by renaming:
cmd -> console_cmd
cmd_args -> console_cmd_args
cmd_block -> console_cmd_block
console_cmd -> console_cmd_func

Apologies if this breaks you but it should be pretty easy to fix.
2020-07-25 15:59:58 -07:00
Travis Geiselbrecht
de29964f7c [platform][zynq] tweak to build at lower optimization levels
For some reason this particular sequence isn't picked up as a warning
unless you're compiling with -O1 or below.
2020-05-16 14:29:21 -07:00
Travis Geiselbrecht
e0cdfbae17 [python] fix a few of the python tools to be python 2 and 3 compatible 2020-03-08 16:39:15 -07:00
Travis Geiselbrecht
6cb02526b7 [include][console] split lib/console.h into two
TL;DR most uses of lib/console.h -> lk/console_cmd.h

Move the part that lets a piece of code somewhere in the system to
define a console command from the actual lib/console api to start an
instance of the console. Move in almost every place the user of the
console command definition to the new header, lk/console_cmd.h which is
always in the include path.

Also remove most uses of testing for WITH_LIB_CONSOLE since you can
almost always just safely define it and then let the linker remove it.
2019-07-13 16:56:33 -07:00
Travis Geiselbrecht
3aecdda231 [includes] replace header guards with #pragma once 2019-07-13 15:46:16 -07:00
Travis Geiselbrecht
cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00
Travis Geiselbrecht
d8fa82cb91 [formatting] run everything through codestyle
Almost nothing changes here except moving braces to the same line as the
function declaration. Everything else is largely whitespace changes and
a few dangling files with tab indents.

See scripts/codestyle
2019-06-19 21:02:24 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
klemens
d0b90c2d68 [spelling] spelling-fixes. (not external/) 2016-08-25 17:30:34 -07:00
Travis Geiselbrecht
a4ca0a6e00 [vmm] move most users of arch_mmu_query directly to vaddr_to_paddr() 2016-02-14 12:45:53 -08:00
Travis Geiselbrecht
d569c090ea [vim] remove vim expandtab comments on most of the files 2016-02-14 12:32:07 -08:00
Travis Geiselbrecht
2eb32a4369 [style] mass reformat all the non external code to 4 space indents
Ran everything through scripts/codestyle.space, which uses astyle
to generally follow K&R style.

Biggest non whitespace change is pulling brackets down on function
declarations, which I'm pretty ambivalent about, but astyle insists
on taking a stance
2016-02-14 12:24:01 -08:00
Gurjant Kalsi
d9a97e7c0d [bio][flash] Added bio ioctl to return memory mapped address without putting the device into linear mode 2015-11-11 15:31:54 -08:00
Gurjant Kalsi
7e0a4d3f90 [bio] Add a flag that allows devices to declare that they only deal with cache aligned blocks of memory 2015-11-04 17:18:15 -08:00
Travis Geiselbrecht
35ebee0e40 [merge] branch 'heapswitch'
This picks up the major work of allowing multiple heap implementations
and enable dlmalloc as an alternate heap to the simple existing one
(now called 'miniheap').

Also added a novm page allocator for memory management on systems too small
or missing an mmu to have a vm. Not much more than a simple bitmap allocator
that the heap pulls from. Allows for other heaps and/or users of physical
memory to coexist and span multiple banks of memory.
2015-10-20 16:53:00 -07:00
Travis Geiselbrecht
3b2d7a268b [make] remove the need for a module to manually add $(LOCAL_DIR)/include to the global include path
Pretty much every module in the system was already doing it, so do it
automatically.
2015-10-19 19:07:16 -07:00
Travis Geiselbrecht
38f20ec0a1 [lib][console] add pointer type arg, switch some users to it.
Patch courtesy Erik Corry
2015-10-19 12:49:20 -07:00
Travis Geiselbrecht
7c09e82033 [make] make sure MEMBASE and MEMSIZE are always set exactly once 2015-10-15 17:22:16 -07:00
Travis Geiselbrecht
39662cace8 [platform][zynq] fix build after bio changes 2015-10-12 01:00:02 -07:00
Travis Geiselbrecht
fab3ea81be [lib][bio] bio devices can report what their erase state is
-tweak the bio test to use it
-tweak a few drivers to set the non default (0x00 is default)
2015-10-11 18:10:17 -07:00
Gurjant Kalsi
a6c8b005db [console] Use STATIC_COMMAND macro for all console command definitions
BUG=

Review URL: https://codereview.chromium.org/1348403002 .
2015-09-16 15:37:33 -07:00
Christopher Anderson
d0c46fcdce [gem] Allocation changes for RX
Move RX buffer allocation to a pool on the gem side rather than
using buffers from pktbuf. This allows pktbuf buffers to be smaller
despite the gem RX demanding 1536 buffers for the maximum eth frames
possible.
2015-09-15 16:28:52 -07:00
Christopher Anderson
0b86a01228 [minip][pktbuf] Move End of Frame to a flag 2015-09-15 16:28:52 -07:00
Christopher Anderson
0b3c554c4c [gem] Add a command for stack stats and descriptor status 2015-09-02 14:29:01 -07:00
John Grossman
8a7219ddb1 [lib][bio] Add erase geometry to lib/bio
Extend the block i/o system to allow registered devices to advertise
an erase geometry.  Devices which do not need to be explicitly erased
may skip this.  Extent the Zynq spiflash code to publish the erase
geometry as read from the flash device.

Signed-off-by: John Grossman <johngro@google.com>
Change-Id: I42e16fbe9a0fcf8334c317f16dea1c551c203eb2
2015-06-29 17:32:10 -07:00
Travis Geiselbrecht
f45b123db0 [platform][zynq] save the reboot status register and clear reason bits
Pretty print the reason bits.
2015-06-19 15:36:56 -07:00
Travis Geiselbrecht
5f16c6e93b [arch][arm] change conditional to only cover waiting for secondary cpus
Instead of conditionalizing arch code booting secondaries, only conditionalize
waiting for each of them to come up.

This should be semi-temporary, as the need to wait will go away once arm
switches entirely to the trampoline page table strategy.

Change-Id: Idbdb9720bfac58adf514b7fa137e59aee413f4df
2015-06-02 13:39:15 -07:00
Travis Geiselbrecht
bb15480a66 [platform][zynq][gem] hold the gem spinlock across the entire irq handler
Change-Id: Ifc88db88f60e1f6381a9d7195cfea6bffa02fa7a
2015-06-01 19:08:11 -07:00
Travis Geiselbrecht
2362022970 [arch][arm] conditionalize the code to boot the secondary cpus in arch_init()
On some platforms, the secondary cpus have been booted and trapped by the arch/arm code
and need to be brought up lockstep to make sure the temporary page mappings are
still in place as they are booted. For these platforms, set
ARM_ARCH_BOOTS_SECONDARIES=1 to have arch_init() try to release and start the cpus.

For other platforms, after arch_init() they can simply arrange for the secondary cpus
to start themselves.

Change-Id: I7619ac66d84bd26060ddd949ae6641c1ef6e2b1d
2015-06-01 18:35:25 -07:00
Travis Geiselbrecht
5635ef811d [platform][zynq] fix double acquire of spinlock
Change-Id: Ia0ac5e1e2cdc51d616676b7fd34f1976b171a01e
2015-05-29 15:18:52 -07:00
Travis Geiselbrecht
96ba54f187 [merge] merge back from smp branch 2015-05-28 12:52:41 -07:00
Travis Geiselbrecht
056b30bfe7 [app][lkboot] ask platform code if we should autoboot before booting
-have the zynq nak autobooting if the BOOT_MODE pins were set to
JTAG mode.
-Clean up some of the timeout logic a bit.

Change-Id: I4ace6354de89f2e88aa270e5ebc1bf01ebe3b046
2015-05-20 23:31:39 -07:00
Travis Geiselbrecht
f13ebc12f5 [platform][zynq] add code to read the BOOT_MODE pins sampled at power on
Change-Id: I2745b4aa5d63f1f8d6630836fec88ae0577feb7d
2015-05-20 23:31:39 -07:00
Travis Geiselbrecht
307628f29b [platform][zynq] add watchdog driver
-use lib/watchdog to manage the hardware watchdog driver
-set the default timeout to 1 second, pet at 500ms intervals

Change-Id: I04d23313083e4715791e197d4a50f319df9916aa
2015-05-20 23:31:39 -07:00
John Grossman
c2b645ef8a [zynq][gpio] Fix a collection of bugs with the GPIO driver.
+ When setting GPIOs, the MASK_DATA registers are used.  Code was
  properly computing which register to use based on register index
  (either LSW or MSW), but was improperly computing the mask/value to
  set when the GPIO to be manipulated existed in the upper 16 bits
  (the shift needed to be offset by 16 bits and was not).
+ Do not manipulate things like the IO driver type, drive speed, and
  so on when enabling/disabling the pullup in the SLCR registers.
  Previously, whenever a GPIO was being configured, the SLCR register
  was being set to be 1.8v LVCMOS, and having the DISABLE RCV bit set.
  Things like the IO type have been set by the platform and should not
  be manipulated by the GPIO driver.  Now, the GPIO code leaves those
  bits the way they were configured, and changes only the PULLUP bit
  as well as the 4 levels mux bits (arguably, it should not even
  change the mux bits; it is the platform's job to properly mux the
  pins).
+ Address an issue with the subtle (undocumented) difference between
  the DIRM and the OEN bits when configuring for input vs. output.
  Please read the extensive comment in the code for details.

Change-Id: I160069eeef92b1cf0763274ccb64c5d14744f563
Signed-off-by: John Grossman <johngro@google.com>
2015-05-19 10:21:33 -07:00
Arve Hjønnevåg
2c9c5959e7 Merge branch 'master' of https://github.com/travisg/lk into smp
Change-Id: Iecb11d57b6f089234c0826932bdb229588939750
2015-05-18 16:49:37 -07:00
John Grossman
1f2e62da4d [zynq][gpio] Fix a typo in the GPIO code.
Fix an issue with the GPIO code where it was dividing by 31 instead of
32 when attempting to map GPIO numbers to bank IDs.

Change-Id: I986eac1f9dce119445d1611666b61a7b2635ca5b
Signed-off-by: John Grossman <johngro@google.com>
2015-05-18 14:42:51 -07:00
Travis Geiselbrecht
b49071770d [zynq][gem] fix newly introduced bug setting up tx descriptors for the first time
Change-Id: I04b174fa9bde08b8a5a334bd33e049f8e445bb91
2015-05-07 19:39:48 -07:00
Travis Geiselbrecht
71313ca6e6 [platform][zynq][gem] flatten all the gem tracking registers into a single structure
This actually manifests itself as a slight win performance wise, due
to better codegen with all the variables being near each other.
2015-05-06 16:45:07 -07:00
Travis Geiselbrecht
da74d15562 [platform][zynq] a few tweaks to the gem driver to use cached pktbuf ram
-handle flushing tx/rx buffers
-tweak tx logic to handle multiple tx descriptors per interrupt
-fix subtle race with tx dma engine as descriptors are filled
2015-05-06 14:18:06 -07:00
Travis Geiselbrecht
5b830de81f [zynq-common] squelch a little bit of debug spew when compiling at lower debug levels 2015-05-02 22:48:57 -07:00
Travis Geiselbrecht
73e39eab9a [lib][minip] add reschedule arg to pktbuf_free
Make sure the zynq gem driver doesn't reschedule at interrupt time.

Change-Id: Ieaf56930253bf9e2ebb68001a62f986ea2a50a0c
2015-04-29 15:54:00 -07:00
Travis Geiselbrecht
80b3d58178 [platform][zynq] remove some extraneous debug commands at lower debug levels
Change-Id: Ib29b125d393090978f6bab32779edb934201a902
2015-04-24 15:53:55 -07:00
John Grossman
43d86bfdb0 [zynq][fpga] Add a function to check the FPGA config status.
Add a small function which checks to see if the FPGA has been
successfully configured yet.

Change-Id: If7c8f4f006b54958cf3052bb5962c964668cd5a9
2015-04-24 15:53:55 -07:00
Christopher Anderson
4a038ceef6 [zynq] Add support for GPIO interrupts 2015-04-23 13:30:39 -07:00
Christopher Anderson
d352ac1d2b [gem][minip][pktbuf] Improvements for TX scatter gather functionality
- GEM now supports asynchronous scatter-gather queuing and properly handling
  pktbuf ownership
- General stack cleanups in Minip
- pktbufs now grab buffers from the user, or from a preallocated pool
2015-04-23 13:30:39 -07:00
Christopher Anderson
165a69ebf0 [zynq] gpio driver cleanup and plumbing for later int work 2015-04-03 16:49:46 -07:00