1 |
/* |
2 |
* Copyright (C) 2005 Anders Gavare. All rights reserved. |
3 |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
6 |
* |
7 |
* 1. Redistributions of source code must retain the above copyright |
8 |
* notice, this list of conditions and the following disclaimer. |
9 |
* 2. Redistributions in binary form must reproduce the above copyright |
10 |
* notice, this list of conditions and the following disclaimer in the |
11 |
* documentation and/or other materials provided with the distribution. |
12 |
* 3. The name of the author may not be used to endorse or promote products |
13 |
* derived from this software without specific prior written permission. |
14 |
* |
15 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
16 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
21 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 |
* SUCH DAMAGE. |
26 |
* |
27 |
* |
28 |
* $Id: pci_ali_m1543.c,v 1.3 2005/10/11 03:31:29 debug Exp $ |
29 |
* |
30 |
* Acer Labs M5229 PCIIDE (UDMA) controller. |
31 |
* Acer Labs M1543 PCI->ISA bridge. |
32 |
* |
33 |
* TODO: These are just dummies. |
34 |
*/ |
35 |
|
36 |
#include <stdio.h> |
37 |
#include <stdlib.h> |
38 |
#include <string.h> |
39 |
|
40 |
#include "bus_pci.h" |
41 |
#include "device.h" |
42 |
#include "devices.h" |
43 |
#include "machine.h" |
44 |
#include "memory.h" |
45 |
#include "misc.h" |
46 |
|
47 |
|
48 |
#define PCI_VENDOR_ALI 0x10b9 |
49 |
#define PCI_PRODUCT_ALI_M1543 0x1533 /* NOTE: not 1543 */ |
50 |
#define PCI_PRODUCT_ALI_M5229 0x5229 |
51 |
|
52 |
|
53 |
|
54 |
|
55 |
/* |
56 |
* pci_ali_m1543_rr(): |
57 |
*/ |
58 |
uint32_t pci_ali_m1543_rr(int reg) |
59 |
{ |
60 |
switch (reg) { |
61 |
case 0x00: |
62 |
return PCI_VENDOR_ALI + (PCI_PRODUCT_ALI_M1543 << 16); |
63 |
case 0x04: |
64 |
return 0xffffffff; /* ??? */ |
65 |
case 0x08: |
66 |
/* Revision */ |
67 |
return PCI_CLASS_CODE(PCI_CLASS_BRIDGE, |
68 |
PCI_SUBCLASS_BRIDGE_ISA, 0) + 0xc3; |
69 |
case 0x0c: |
70 |
/* Bit 7 of Header-type byte ==> multi-function device */ |
71 |
return 0x00800000; |
72 |
default: |
73 |
return 0; |
74 |
} |
75 |
} |
76 |
|
77 |
|
78 |
/* |
79 |
* pci_ali_m1543_init(): |
80 |
*/ |
81 |
void pci_ali_m1543_init(struct machine *machine, struct memory *mem) |
82 |
{ |
83 |
} |
84 |
|
85 |
|
86 |
/* |
87 |
* pci_ali_m5229_rr(): |
88 |
*/ |
89 |
uint32_t pci_ali_m5229_rr(int reg) |
90 |
{ |
91 |
switch (reg) { |
92 |
case 0x00: |
93 |
return PCI_VENDOR_ALI + (PCI_PRODUCT_ALI_M5229 << 16); |
94 |
case 0x04: |
95 |
return 0xffffffff; /* ??? */ |
96 |
case 0x08: |
97 |
/* Possibly not correct: */ |
98 |
return PCI_CLASS_CODE(PCI_CLASS_MASS_STORAGE, |
99 |
PCI_SUBCLASS_MASS_STORAGE_IDE, 0x60) + 0xc1; |
100 |
default: |
101 |
return 0; |
102 |
} |
103 |
} |
104 |
|
105 |
|
106 |
/* |
107 |
* pci_ali_m5229_init(): |
108 |
*/ |
109 |
void pci_ali_m5229_init(struct machine *machine, struct memory *mem) |
110 |
{ |
111 |
/* |
112 |
* TODO: The check for machine type shouldn't be here? |
113 |
*/ |
114 |
|
115 |
switch (machine->machine_type) { |
116 |
|
117 |
case MACHINE_CATS: |
118 |
device_add(machine, "wdc addr=0x7c0001f0 irq=46");/* primary */ |
119 |
/* The secondary channel is disabled. TODO: fix this. */ |
120 |
/* device_add(machine, "wdc addr=0x7c000170 irq=47"); */ |
121 |
break; |
122 |
|
123 |
default:fatal("pci_ali_m5229_init(): unimplemented machine type\n"); |
124 |
exit(1); |
125 |
} |
126 |
} |
127 |
|