1 \ *****************************************************************************
2 \ * Copyright (c) 2011 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
13 \ ." Populating " pwd cr
15 s" network" device-type
17 INSTANCE VARIABLE obp-tftp-package
19 /vd-len BUFFER: virtiodev
20 virtiodev virtio-setup-vd
21 0 VALUE virtio-net-priv
27 \ my-unit 1 rtas-set-tce-bypass
28 s" local-mac-address" get-node get-property not IF
29 virtiodev virtio-net-open dup not IF ." virtio-net-open failed" EXIT THEN
30 drop TO virtio-net-priv
39 my-args s" obp-tftp" $open-package obp-tftp-package !
40 open-count 1 + to open-count
46 open-count 1 - dup to open-count
48 virtio-net-priv virtio-net-close
49 \ my-unit 0 rtas-set-tce-bypass
53 s" close" obp-tftp-package @ $call-method
56 : read ( buf len -- actual )
64 : write ( buf len -- actual )
72 : load ( addr -- len )
73 s" load" obp-tftp-package @ $call-method
77 s" ping" obp-tftp-package @ $call-method
80 \ Set up MAC address from config virtqueue
84 virtiodev i 1 virtio-get-config
87 local-mac 6 encode-bytes s" local-mac-address" property
92 " net" get-next-alias ?dup IF
93 get-node node>path set-alias