History log of /fuchsia/zircon/kernel/dev/pcie/pcie_caps.cpp
Revision Date Author Comments
# 4c4c010e 29-Jan-2018 Christopher Anderson <cja@google.com>

[pci] Improve pcie check for capabilities parsing

It was possible to dereference a nullptr.

Change-Id: Ibb33ebbfc25ad2ead8afe2f6ee653bded3379410


# 9a709d3b 26-Sep-2017 George Kulakowski <kulakowski@google.com>

[kernel][pcie][status] Use zx_status_t

Change-Id: I358be7e0a47a235ad489d1cfa52fde2606204df3


# f3e2126c 12-Sep-2017 Roland McGrath <mcgrathr@google.com>

[zx] Magenta -> Zircon

The Great Renaming is here!

Change-Id: I3229bdeb2a3d0e40fb4db6fec8ca7d971fbffb94


# 59e644b1 07-Sep-2017 George Kulakowski <kulakowski@google.com>

[zircon][mxtl->fbl] Rename mxtl to fbl

Change-Id: Ie21b6498e1bfb0a7fa0315e40b9e5c3ee78646be


# c58222d2 14-Aug-2017 George Kulakowski <kulakowski@google.com>

[kernel][mxtl] Clean up some dependencies of mxtl::count_of

This adds both explicit includes of mxtl/algorithm.h, and module
dependencies.

Change-Id: I3b102a42df56c982b9c2c8913d8151c9c66198b6


# e45d6f4b 11-Aug-2017 George Kulakowski <kulakowski@google.com>

[mxtl[[count_of] Prefer mxtl::count_of to countof in C++

Change-Id: I1fcbc61031df91542fc60d224b9c24e9b3b260cb


# 10a03ab6 03-Aug-2017 Jeff Brown <jeffbrown@google.com>

[mxtl][mxalloc] Redirect all clients of mxalloc to mxtl.

Change-Id: Ib6d88937212ab23612f59add8bd028862308ead5


# 1903af67 15-Jun-2017 George Kulakowski <kulakowski@google.com>

[kernel][dev] Use the new MX_OK and MX_ERR_* names

Change-Id: I8a280c31fdaedf7476c02f3b5ea8d0b473bf7979


# 1fb8124a 16-May-2017 George Kulakowski <kulakowski@google.com>

[mxcpp][mxalloc] Split mxcpp into mxcpp and mxalloc

mxcpp used to provide three things.

(1) is a very minimal C++ runtime environment. This means essentially
the definition of __cxa_pure_virtual, which is a function the compiler
expects to have ambient. This functionality is necessary for code
written in environments which cannot link the standard library (the
kernel and a handful of initial userspace processes).

(2) is the definitions of the standard new and delete
overloads. Again, these are needed for code that wants to call them
but to not link the standard library, but this time only in userspace
(the kernel does not want certain behavior stemming from the standard
overloads). The behavior is slightly different than the standard ones
in failure cases, but not in a way particularly interesting to the
rest of this email.

(3) is the userspace version of our special AllocChecker new
overloads. This mechanism exists for kernelspace, where allocation
failure is real and needs to be handled. This mechanism works
perfectly well in userspace, in that it compiles, even though the
underlying allocator is unlikely to ever return nullptr. It's
therefore essentially harmless in userspace. A handful of small
libraries are used in both userspace and in the kernel, and also use
this mechanism. Note that this feature is essentially copy-pasted
between the kernel and userspace.

This all works perfectly well for the kernel.

Some userspace code also uses these mechanisms, as mentioned. As long
as the standard library isn't linked, there are again no issues.

But as soon as you want both (3) and std::vector, which is a
reasonable thing to want!, there are issues because (1) and (3) come
in the same static library. This causes link failures due to duplicate
__cxa_pure_virtual symbols. This issue is exacerbated by different
behavior in Linux, OS X, and target linkage, in terms of confusion and
it-works-on-my-machine sort of issues.

This patch splits mxcpp into: mxcpp, containing (1) __cxa_pure_virtual
and (2) only if in userspace, the standard new and delete overloads;
and mxalloc, containing (3) AllocChecker. mxcpp is mutually exclusive
of the standard library. mxalloc can be linked against both code using
the standard library, and against code using mxcpp.

This patch also deduplicates the AllocChecker between userspace and
kernel, and moves the InlineArray class into the kernel (its only
callsites are in the kernel).

Change-Id: Id42d5d019ee977d44d6cb89ce7ab6884f7a56cd1


# edf7cbfd 31-Jan-2017 Christopher Anderson <cja@google.com>

[pci] Correct an assert and conditional in IRQ path

- A DEBUG_ASSERT for MSI is no longer necessary after the rework
- Ensure that MSI is both found as a pci capability and in a valid
configuration before allowing its capabilities queried / set.
- Add another LTRACEF to pcie_caps.cpp that will be useful catching
these sorts of things in the future.

Change-Id: I7d80cf1b9aa563bc184717ff78bb34a5e8c3a777


# 5077b76a 05-Jan-2017 Christopher Anderson <cja@google.com>

[pci] PCI refactor for C++/PIO/MMIO

- Create PciConfig/PciMmioConfig/PciPioConfig classes for abstracting
out all PCI configuration reads/writes.
- Modify existing PCI codebase to not assume memory mapped MMIO address
space for all devices.
- Unify PCI device and bridge device types into a single entity
separated only by config register mappings.
- Update lspci command so it can properly show configuration data
whether a device is MMIO or PIO.
- Rework PCI Capabilities to use an object hierarchy and common
interface.
- Convert the remaining C interfaces in the PCI codebase to C++.
- Fix clang build.

Change-Id: Ia5b32f88f48ba317848befde853b9af9a489205d


# 3b4d5f55 27-Oct-2016 John Grossman <johngro@google.com>

[pcie][c++] Continue conversion to C++

This time, turn pcie_(device|bridge)_state_t into Pcie(Device|Bridge).
The process of turning these structs into proper C++ classes is not
quite complete yet, but it is close. There are some surface area
issues (exposing too much internal state) which still needs to be
cleaned up. The areas where some further cleanup is needed
include...

1) Capability parsing.
2) Refactoring code so that PCI device tree roots are not modeled as
PcieBridges.
3) Legacy IRQ pin swizzling and handling.
4) Debug console code.
5) MMIO/PIO window allocation.
6) Bus topology locking (hot plug/unplug)

Still, the major objects in the system are mostly well behaved classes
now. This code should be landed soon in order to allow concurrent
development without having a huge style refactor looming over
everyone.

Change-Id: Ib880c9690f2554aaf23823c1ccf891fead03b71b


# d48a7a11 04-Oct-2016 John Grossman <johngro@google.com>

[pcie][c++] Make progress on conversion to C++

++ Make pcie_bridge_state_t derive from pcie_device_state_t
++ Convert almost all malloc/calloc/frees to new/delete
++ Convert most dynamically allocated raw pointers to managed pointers

MG-311 #comment Conversion to managed pointers mostly complete.

Change-Id: If1a88ad8a64c4cc481dbb0f6d60df1af538dc831


# 93e42fdd 29-Sep-2016 John Grossman <johngro@google.com>

[pcie] Convert PCIe bus driver to "C++"

Note: this does not actually convert the driver to full on C++, it
just switches to building with the C++ compiler and deals with some of
the annoying differences between C++ and C compiler.

In the short term, this will give the PCIe bus to ability to use other
library code which is written in C++. In the longer term, other parts
of the driver can be converted (as appropriate) to take advantage of
some of the nicer safety oriented things which can be done with C++'s
stronger stance on type safety.

MG-311 #comment Initial conversion started. Code compiles with g++

Change-Id: If7c9fe98734ddfd64d587a6f73bc2ea6a515f6db