From 5f84bfe465818d9bfab537ac73d57c2e0d63a2dd Mon Sep 17 00:00:00 2001 From: Avik Sil Date: Mon, 23 Sep 2013 14:07:36 +0530 Subject: Add bcm57xx network driver in libbcm Signed-off-by: Avik Sil Signed-off-by: Nikunj A Dadhania --- board-js2x/Makefile | 2 +- board-js2x/slof/Makefile | 10 +++-- board-js2x/slof/bcm57xx.fs | 75 +++++++++++++++++++++++++++++++++ board-js2x/slof/pci-device_14e4_16a8.fs | 23 ++++++++++ 4 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 board-js2x/slof/bcm57xx.fs create mode 100644 board-js2x/slof/pci-device_14e4_16a8.fs (limited to 'board-js2x') diff --git a/board-js2x/Makefile b/board-js2x/Makefile index 2f6e79a..4747f41 100644 --- a/board-js2x/Makefile +++ b/board-js2x/Makefile @@ -13,7 +13,7 @@ BOARD_TARGETS = tools_build romfs_build clients_build netdrivers stage1 subdirs SUBDIRS = slof rtas -COMMON_LIBS = libc libipmi libbootmsg libbases libnvram libelf libusb +COMMON_LIBS = libc libipmi libbootmsg libbases libnvram libelf libusb libbcm all: $(BOARD_TARGETS) $(MAKE) boot_rom.bin diff --git a/board-js2x/slof/Makefile b/board-js2x/slof/Makefile index 1dd9be5..5be9f07 100644 --- a/board-js2x/slof/Makefile +++ b/board-js2x/slof/Makefile @@ -20,19 +20,21 @@ include $(TOPCMNDIR)/make.rules all: Makefile.dep OF.ffs paflof $(SLOFCMNDIR)/xvect.bin CPPFLAGS = -I$(LIBCMNDIR)/libbootmsg -I$(LIBCMNDIR)/libnvram \ - -I$(LIBCMNDIR)/libusb + -I$(LIBCMNDIR)/libusb -I$(LIBCMNDIR)/libbcm SLOF_LIBS = \ $(LIBCMNDIR)/libbootmsg.a \ $(LIBCMNDIR)/libelf.a \ $(LIBCMNDIR)/libusb.a \ - $(LIBCMNDIR)/libnvram.a + $(LIBCMNDIR)/libnvram.a \ + $(LIBCMNDIR)/libbcm.a BOARD_SLOF_IN = \ $(LIBCMNDIR)/libbootmsg/bootmsg.in \ $(LIBCMNDIR)/libelf/libelf.in \ $(LIBCMNDIR)/libusb/usb.in \ $(LIBCMNDIR)/libbases/libbases.in \ $(LIBCMNDIR)/libnvram/libnvram.in \ - $(LIBCMNDIR)/libnativeio/nativeio.in + $(LIBCMNDIR)/libnativeio/nativeio.in \ + $(LIBCMNDIR)/libbcm/bcm.in BOARD_SLOF_CODE = $(BOARD_SLOF_IN:%.in=%.code) include $(SLOFCMNDIR)/Makefile.inc @@ -61,6 +63,8 @@ OF_FFS_FILES = \ $(SLOFBRDDIR)/pci-device_1022_7468.fs \ $(SLOFBRDDIR)/pci-device_1022_7469.fs \ $(SLOFBRDDIR)/pci-device_1022_7451.fs \ + $(SLOFBRDDIR)/pci-device_14e4_16a8.fs \ + $(SLOFBRDDIR)/bcm57xx.fs \ $(SLOFBRDDIR)/pci-class_03.fs \ $(SLOFBRDDIR)/vga-display.fs \ $(SLOFBRDDIR)/freq.fs \ diff --git a/board-js2x/slof/bcm57xx.fs b/board-js2x/slof/bcm57xx.fs new file mode 100644 index 0000000..e4f8776 --- /dev/null +++ b/board-js2x/slof/bcm57xx.fs @@ -0,0 +1,75 @@ +\ ***************************************************************************** +\ * Copyright (c) 2013 IBM Corporation +\ * All rights reserved. +\ * This program and the accompanying materials +\ * are made available under the terms of the BSD License +\ * which accompanies this distribution, and is available at +\ * http://www.opensource.org/licenses/bsd-license.php +\ * +\ * Contributors: +\ * IBM Corporation - initial implementation +\ ****************************************************************************/ + +\ Handle bcm57xx device + +s" network" device-type + +my-space pci-alias-net + +VARIABLE obp-tftp-package + +0 VALUE bcm57xx-priv +0 VALUE open-count + +: open ( -- okay? ) + open-count 0= IF + open IF + my-args s" obp-tftp" $open-package obp-tftp-package ! + bcm57xx-open dup not IF ." bcm57xx-open failed" EXIT THEN + drop dup TO bcm57xx-priv + 6 encode-bytes s" local-mac-address" property + true + ELSE + false + THEN + ELSE + true + THEN + open-count 1 + to open-count +; + + +: close ( -- ) + open-count 0> IF + open-count 1 - dup to open-count + 0= IF + s" close" obp-tftp-package @ $call-method + bcm57xx-priv bcm57xx-close + close + THEN + THEN +; + +: read ( buf len -- actual ) + dup IF + bcm57xx-read + ELSE + nip + THEN +; + +: write ( buf len -- actual ) + dup IF + bcm57xx-write + ELSE + nip + THEN +; + +: load ( addr -- len ) + s" load" obp-tftp-package @ $call-method +; + +: ping ( -- ) + s" ping" obp-tftp-package @ $call-method +; diff --git a/board-js2x/slof/pci-device_14e4_16a8.fs b/board-js2x/slof/pci-device_14e4_16a8.fs new file mode 100644 index 0000000..ef782c9 --- /dev/null +++ b/board-js2x/slof/pci-device_14e4_16a8.fs @@ -0,0 +1,23 @@ +\ ***************************************************************************** +\ * Copyright (c) 2013 IBM Corporation +\ * All rights reserved. +\ * This program and the accompanying materials +\ * are made available under the terms of the BSD License +\ * which accompanies this distribution, and is available at +\ * http://www.opensource.org/licenses/bsd-license.php +\ * +\ * Contributors: +\ * IBM Corporation - initial implementation +\ ****************************************************************************/ + +\ Handle bcm57xx device + +s" bcm57xx [ net ]" type cr + +my-space pci-device-generic-setup + +pci-io-enable + +s" bcm57xx.fs" included + +pci-device-disable -- cgit v1.1