|
|
1.1 root 1: \ *****************************************************************************
2: \ * Copyright (c) 2004, 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
8: \ *
9: \ * Contributors:
10: \ * IBM Corporation - initial implementation
11: \ ****************************************************************************/
12:
13: \ Starting alias number for net devices after the onboard devices.
14: 0 VALUE pci-net-num
15: \ Starting alias number for disks after the onboard devices.
16: 0 VALUE pci-disk-num
17: \ Starting alias number for cdroms after the onboard devices.
18: 0 VALUE pci-cdrom-num
19:
20: \ define a new alias for this device
21: : pci-set-alias ( str-addr str-len num -- )
22: $cathex strdup \ create alias name
23: get-node node>path \ get path string
24: set-alias \ and set the alias
25: ;
26:
27: \ define a new net alias
28: : unknown-enet ( -- pci-net-num )
29: pci-net-num dup 1+ TO pci-net-num
30: ;
31: : pci-alias-net ( config-addr -- )
32: drop \ forget the config address
33: pci-net-num dup 1+ TO pci-net-num \ increase the pci-net-num
34: s" net" rot pci-set-alias \ create the alias
35: ;
36:
37: \ define a new disk alias
38: : pci-alias-disk ( config-addr -- )
39: drop \ forget the config address
40: pci-disk-num dup 1+ TO pci-disk-num \ increase the pci-disk-num
41: s" disk" rot pci-set-alias \ create the alias
42: ;
43: \ define a new cdrom alias
44: : pci-alias-cdrom ( config-addr -- )
45: drop \ forget the config address
46: pci-cdrom-num dup 1+ TO pci-cdrom-num \ increase the pci-cdrom-num
47: s" cdrom" rot pci-set-alias \ create the alias
48: ;
49:
50: \ define the alias for the calling device
51: : pci-alias ( config-addr -- )
52: dup pci-class@
53: 10 rshift CASE
54: 01 OF pci-alias-disk ENDOF
55: 02 OF pci-alias-net ENDOF
56: dup OF drop ENDOF
57: ENDCASE
58: ;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.