Commit Graph

69 Commits

Author SHA1 Message Date
Zbigniew Bodek
18c72666ce Add domain support to PCI bus allocation
When the system has more than a single PCI domain, the bus numbers
are not unique, thus they cannot be used for "pci" device numbering.
Change bus numbers to -1 (i.e. to-be-determined automatically)
wherever the code did not care about domains.

Reviewed by:   jhb
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3406
2015-09-16 23:34:51 +00:00
Jung-uk Kim
fd90e2ed54 CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten
years for head.  However, it is continuously misused as the mpsafe argument
for callout_init(9).  Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision:	https://reviews.freebsd.org/D2613
Reviewed by:	jhb
MFC after:	2 weeks
2015-05-22 17:05:21 +00:00
Ian Lepore
2a6a72f113 Use sbuf_printf() for sysctl strings instead of static buffers and snprintf. 2015-03-14 23:30:03 +00:00
Jayachandran C.
c483877531 Whitespace fixes for sys/mips/nlm/dev
Clean up whitespace issues under sys/mips/nlm/dev. No functional
change in this commit.
2015-02-28 00:22:10 +00:00
Jayachandran C.
72e64728c9 Whitespace fixes for files in sys/mips/nlm
Clean up whitespace issues under sys/mips/nlm (except dev). No
functional change in this commit.
2015-02-28 00:17:29 +00:00
Jayachandran C.
e45f3fe8bd Add subclass of simplebus for Broadcom XLP
This will override the resource allocation of simplebus, and also
merge the resource allocation code which was in xlp_pci.c.

With this change the SoC devices that does not have proper PCI
resources will be on the FDT simplebus. We can remove
sys/mips/nlm/dev/cfi_pci_xlp.c and sys/mips/nlm/dev/uart_pci_xlp.c
2015-02-27 23:33:53 +00:00
Jayachandran C.
020a664210 Move PCI bus below simplebus for Broadcom XLP
This will enable us to do common allocation code for memory and
interrupts for SoC devices as well as PCI devices.
2015-02-27 02:21:52 +00:00
Jayachandran C.
af444e780c Improve additional interrupt ACK for Broadcom XLP
Handling some interrupts in XLP (like PCIe and SATA) involves writing to
vendor specific registers as part of interrupt acknowledgement.

This was earlier done with xlp_establish_intr(), but a better solution
is to provide a function xlp_set_bus_ack() that can be used with
cpu_establish_hardintr(). This will allow platform initialization code to
setup these ACKs without changing the standrard drivers.
2015-02-27 00:57:09 +00:00
Jayachandran C.
5441635eb0 Remove run-time allocation of XLP IRQs
Follow the same static IRQ to Interrupt Table Entry mapping as the other
OS supported on XLP.
2015-02-26 02:22:47 +00:00
Jayachandran C.
70abc1ff8e Add netlogic,xlp-pic as interrupt controller for XLP
Add an empty driver for netlogic,xlp-pic to ensure that the device tree
is correct and has an interrupt controller.
2015-02-26 02:05:45 +00:00
Jayachandran C.
fb3ba470da Fix up interrupt definitions for Broadcom XLP
Gather all the IRQ definitions to interrupt.h. Earlier these were in xlp.h
and pic.h.  Update the definition of XLP_IRQ_IS_PICINTR to check for last
irq as well.
2015-02-26 01:53:24 +00:00
Davide Italiano
2be111bf7d Follow up to r225617. In order to maximize the re-usability of kernel code
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by:   kmacy
Tested by:      make universe
2014-10-16 18:04:43 +00:00
Gleb Smirnoff
d8cc52c9a1 Mechanically convert to if_inc_counter(). 2014-09-19 09:19:49 +00:00
Eitan Adler
7a22215c53 Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit.  Instead use (1U << 31) which gets the
expected result.

This fix is not ideal as it assumes a 32 bit int, but does fix the issue
for most cases.

A similar change was made in OpenBSD.

Discussed with:	-arch, rdivacky
Reviewed by:	cperciva
2013-11-30 22:17:27 +00:00
Andre Oppermann
a742d143c7 nclude missing net/if_var.h.
Due to header pollution it wasn't noticed before.
2013-10-30 16:56:46 +00:00
Nathan Whitehorn
a5c296c5c5 Panics about how things can't be attached should probably happen in the
attach method rather than probe.

Submitted by:	brooks
2013-10-29 20:38:58 +00:00
Nathan Whitehorn
5543a1b98e Devices that rely on hints or identify routines for discovery need to
return BUS_PROBE_NOWILDCARD from their probe routines to avoid claiming
wildcard devices on their parent bus. Do a sweep through the MIPS tree.

MFC after: 2 weeks
2013-10-29 14:07:31 +00:00
Jayachandran C.
e80cbd997b Fixes for the Netlogic XLP on-chip RSA block driver
The changes are to:
* Use contigmalloc/contigfree which handling microcode buffer
* Use a different buffer to send microcode to each engine
* Swap microcode in little-endian compilation
* Fix freeback message queue id field
* Simplify xlp_get_rsa_opsize() to remove unnecessary checks
* Fix NULL check after use in xlp_free_cmd_params()
* Do better error handling when the hardware returns error
* Fix error codes in few cases

Submitted by:	Vekatesh J. V. <venkatesh.vivekanandan@broadcom.com>
Approved by:	re (hrs)
2013-10-04 11:11:51 +00:00
Jayachandran C.
9dc640432c Style fixes for the Netlogic XLP RSA driver
Updates to the Netlogic XLP on-chp RSA block driver. The changes are
to follow style(9) guidelines, to improve readability and to remove
unnecessary initialization.

No changes to logic have been introduced by this commit.

Submitted by:	Venkatesh J. V. <venkatesh.vivekanandan@broadcom.com>
Approved by:	re (hrs)
2013-10-04 10:01:20 +00:00
Jayachandran C.
485a81908b Netlogic XLP network driver update
Changes are to
- update board and network interface detection logic
- fix reading onboard CPLD in little-endian config
- print NAE frequency conrrectly for Bx chips
- update XAUI config to disable Rx/Tx until interface is up

Submitted by:	Venkatesh J V <venkatesh.vivekanandan@broadcom.com>
2013-09-07 18:26:16 +00:00
Jayachandran C.
d1a51785b3 Fix incorrect KASSERTs in xlpge
Fix for crash in Netlogic XLP network accelerator driver when invariants
are enabled - use correct the condition for KASSERT.
2013-04-12 16:03:22 +00:00
Alexander Motin
fdc5dd2d2f MFcalloutng:
Switch eventtimers(9) from using struct bintime to sbintime_t.
Even before this not a single driver really supported full dynamic range of
struct bintime even in theory, not speaking about practical inexpediency.
This change legitimates the status quo and cleans up the code.
2013-02-28 13:46:03 +00:00
Jayachandran C.
9f499cc5ae Little-endian and other fixes for Broadcom XLP network driver
The changes are:
 - the microcore code loaded into the NAE has to be byteswapped
   in LE
 - the descriptors in memory for a P2P NAE descriptor has to be
   byteswapped in LE
 - the m_data pointer is already cacheline aligned, so the
   unnecessary m_adj to cacheline size can be removed
 - fix mask used to obtain physical address from the Tx freeback
   descriptor
 - fix a compile error in code under #ifdef

Obtained from:	Venkatesh J V <venkatesh.vivekanandan@broadcom.com>
2013-01-24 15:49:47 +00:00
Jayachandran C.
d4aba0f611 Fix credit configuration on Broadcom XLP CMS
The CMS output queue credit configuration register is 64 bit, so use
a 64 bit variable while updating it.
Obtained from:	Venkatesh J V <venkatesh.vivekanandan@broadcom.com>
2013-01-24 15:23:01 +00:00
Jayachandran C.
0a82286445 Broadcom XLP network driver update for XLP 8xx B1 rev
Update MDIO reset code to support Broadcom XLP B1 revisions.
Update nlm_xlpge_ioctl, nlm_xlpge_port_enable need not be
called after nlm_xlpge_init.

Obtained from:	Venkatesh J V <venkatesh.vivekanandan@broadcom.com>
2013-01-24 15:14:22 +00:00
Jayachandran C.
a10ce85526 Minor updates to the Broadcom XLP NAE driver
Remove unnecessary SGMII initialization code from nae.c. While there
clean up some prints and whitespace.
2013-01-24 14:42:58 +00:00
Jayachandran C.
301b961c3e Broadcom XLP updates for the new firmware
Support few more versions of board firmware.  In case the security
block is disabled, enable it at boot. Also increase the excluded
memory region to cover the area used by the firmware to initialize
devices.
2013-01-24 14:33:25 +00:00
Jayachandran C.
d30a6b30fc Little-endian fix for PCI on Broadcom XLP.
Update the function xlp_pcib_hardware_swap_enable() to do nothing
when BYTE_ORDER is not BIG_ENDIAN. PCIe hardware swap is not requred
in little-endian mode as the endianness matches that of CPU.
2013-01-24 11:42:16 +00:00
Gleb Smirnoff
eb1b1807af Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags within sys.

Exceptions:

- sys/contrib not touched
- sys/mbuf.h edited manually
2012-12-05 08:04:20 +00:00
Jayachandran C.
8099aeffc3 Add correct range parameter in XLP DTS
r239274 added support for ranges. Update XLP DTS to provide the correct
range parameter for the XLP SoC bus.  Also fix bus_space_map method
for XLP bus space.

Submitted by:	Sreekanth M. <sreekanth.molagavalli@broadcom.com>
2012-08-21 09:37:23 +00:00
Jayachandran C.
718444dcc1 Define and exclude DRAM regions used by hardware/bootloder on XLP
Fix xlp_mem_init() - remove the ad-hoc code for excluding memory regions
and use an array of regions.
2012-08-20 11:51:49 +00:00
Jayachandran C.
92184b6098 Support Netlogic XLP 8xx B1 revisions in xlpge.
Updates to the MDIO access code for the new revision of the
XLP chip.
2012-07-09 10:39:57 +00:00
Jayachandran C.
fe60722c96 Identify Netlogic XLP 8xx B1 chip revisions
Add functions to check for 8xx B0 and 3xx Ax revisions which will
be used in network block initialization.
2012-07-09 10:24:45 +00:00
Jayachandran C.
21221d1f6b Fix PCIe hardware swap configuration for Netlogic XLP
The last 12 bits of the limit registers have to be set to 1. These
bits are not significant in bridge BARs and are 0 on read, but the
bits are valid in the swap limit register and needs to be set.
2012-07-09 10:17:06 +00:00
Jayachandran C.
7fb26c47df Remove unnecessary assembly code.
The compiler should generate lw/sw corresponding to register
operations.
2012-03-29 11:46:29 +00:00
Juli Mallett
39dec33f2b Supply endianness implied by the -m flag when compiling ucore code. 2012-03-29 02:03:06 +00:00
Juli Mallett
5c3c01764b Fix little-endian built. 2012-03-29 02:02:23 +00:00
Jayachandran C.
eff39d0f38 Fix size of PCI softc. 2012-03-27 18:26:35 +00:00
Jayachandran C.
4b3aada9d4 Resource allocation for XLP SoC SDHCI slots
The on-chip SD slots do not have PCI BARs corresponding to them, so
this has to be handled in the custom SoC memory allocation.

Provide memory resource for rids corresponding to BAR 0 and 1 in
the custom allocation code.
2012-03-27 15:43:32 +00:00
Jayachandran C.
d5d4261f35 Update memory and resource allocation code for SoC devices
The XLP on-chip devices have PCI configuration headers, but some of the
devices need custom resource allocation code.
- devices with no MEM/IO BARs with registers in PCIe extended reg
  space have to be handled in memory resource allocation
- devices without INTPIN/INTLINE in PCI header can be supported
  by having these faked with a shadow register.
- Some devices does not allow 8/16 bit access to the register space,
  he default bus space cannot be used for these.

Subclass pci and override attach and resource allocation methods to
take care of this.

Remove earlier code which did this partially.
2012-03-27 15:39:55 +00:00
Jayachandran C.
2652f84c92 NOR flash driver for XLP.
The NOR interface on the SoC appears on the top level PCI bus. Add
a simple driver for this.
2012-03-27 15:16:38 +00:00
Jayachandran C.
250a191260 XLP UART code udpate.
Move XLP PCI UART device to sys/mips/nlm/dev/ directory.  Other
drivers for the XLP SoC devices will be added here as well.
Update uart_cpu_xlp.c and uart_pci_xlp.c use macros for uart port,
speed and IO frequency.
2012-03-27 14:48:40 +00:00
Jayachandran C.
35011d20cb xlpge : driver for XLP network accelerator
Features:
- network driver for the four 10G interfaces and two management ports
  on XLP 8xx.
- Support 4xx and 3xx variants of the processor.
- Source code and firmware building for the 16 mips32r2 micro-code engines
  in the Network Accelerator.
- Basic initialization code for Packet ordering Engine.

Submitted by:	Prabhath Raman (prabhath at netlogicmicro com)
		[refactored and fixed up for style by jchandra]
2012-03-27 14:05:12 +00:00
Jayachandran C.
ca950537bb Support for EEPROM and CPLD on XLP EVP boards.
On XLP evaluation platform, the board information is stored
in an I2C eeprom and the network block configuration is available
from a CPLD connected to the GBU (NOR flash bus). Add support
for both of these.
2012-03-27 12:25:47 +00:00
Jayachandran C.
9b4d140639 Opencrypto driver for XLP Security and RSA/ECC blocks
Support for the Security and RSA blocks on XLP SoC. Even though
the XLP supports many more algorithms, only the ones supported
in OCF have been added.

Submitted by:	Venkatesh J. V. (venkatesh at netlogicmicro com)
2012-03-27 11:43:46 +00:00
Jayachandran C.
8f57f9e0d7 I2C support for XLP, add hints for I2C devices and update PCI resource
allocation code.
2012-03-27 11:17:04 +00:00
Jayachandran C.
e12ed67f35 XLP PCIe code update.
- XLP supports hardware swap for PCIe IO/MEM accesses. Since we
  are in big-endian mode, enable hardware swap and use the normal
  bus space.
- move some printfs to bootverbose, and remove others.
- fix SoC device resource allocation code
- Do not use '|' while updating PCIE_BRIDGE_MSI_ADDRL
- some style fixes

In collaboration with: Venkatesh J. V. (venkatesh at netlogicmicro com)
2012-03-27 07:57:41 +00:00
Jayachandran C.
752a2fe776 Update the L1D cache flush sequence when enabling threads.
Added more comments to the code.
2012-03-27 07:51:42 +00:00
Jayachandran C.
68790561a5 Switch to interrupt based message handling for XLP 8xx B0.
Fixup some style issues in the file as well.
2012-03-27 07:47:13 +00:00
Jayachandran C.
91339fd498 Support for XLP4xx and XLP 8xx B0 revision
- Add 4xx processor IDs, add workaround in CPU detection code.
- Update frequency detection code for XLP 8xx.
- Add setting device frequency code.
- Update processor ID checking code.
2012-03-27 07:39:05 +00:00