1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <types.h>
25#include <lib.h>
26#include <console.h>
27#include <device/pci.h>
28#include <msr.h>
29#include <legacy.h>
30#include <device/pci_ids.h>
31#include <statictree.h>
32#include <config.h>
33#include "mcp55.h"
34
35
36static void sata_init(struct device *dev)
37{
38 u32 dword;
39
40 struct southbridge_nvidia_mcp55_sata_config *conf =
41 (struct southbridge_nvidia_mcp55_sata_config *)dev->device_configuration;
42
43 dword = pci_read_config32(dev, 0x50);
44
45 dword &= ~((1 << 15) | (1 << 13));
46 if(conf) {
47 if (conf->sata1_enable) {
48 dword |= (1<<0);
49 printk(BIOS_DEBUG, "Enable secondary SATA interface\t");
50 }
51 if (conf->sata0_enable) {
52 dword |= (1<<1);
53 printk(BIOS_DEBUG, "Enable primary SATA interface\n");
54 }
55 } else {
56 dword |= (1<<1) | (1<<0);
57 printk(BIOS_DEBUG, "Enable primary and secondary SATA interfaces\n");
58 }
59
60
61#if 1
62 dword &= ~(0x1f<<24);
63 dword |= (0x15<<24);
64#endif
65 pci_write_config32(dev, 0x50, dword);
66
67 dword = pci_read_config32(dev, 0xf8);
68 dword |= 2;
69 pci_write_config32(dev, 0xf8, dword);
70}
71
72struct device_operations mcp55_sata = {
73 .id = {.type = DEVICE_ID_PCI,
74 {.pci = {.vendor = PCI_VENDOR_ID_NVIDIA,
75 .device = PCI_DEVICE_ID_NVIDIA_MCP55_SATA1}}},
76 .constructor = default_device_constructor,
77 .phase3_scan = 0,
78 .phase4_read_resources = pci_dev_read_resources,
79 .phase4_set_resources = pci_set_resources,
80 .phase5_enable_resources = pci_dev_enable_resources,
81 .phase6_init = sata_init,
82 .ops_pci = &mcp55_pci_dev_ops_pci,
83};
84