map registers and print some information
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22137 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1a941c2e04
commit
093a713df2
@ -4,4 +4,5 @@ KernelAddon ahci :
|
||||
ahci.c
|
||||
ahci_controller.cpp
|
||||
ahci_sim.cpp
|
||||
util.c
|
||||
;
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "ahci_controller.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <stdio.h>
|
||||
@ -61,7 +62,33 @@ AHCIController::Init()
|
||||
TRACE("satacr0 = 0x%08lx, satacr1 = 0x%08lx\n", satacr0, satacr1);
|
||||
}
|
||||
|
||||
fDevicePresentMask = (1 << 7) | (1 << 19);
|
||||
void *addr = (void *)pciInfo.u.h0.base_registers[5];
|
||||
size_t size = pciInfo.u.h0.base_register_sizes[5];
|
||||
|
||||
TRACE("registers at %p, size %#lx\n", addr, size);
|
||||
|
||||
fRegsArea = map_mem((void **)&fRegs, addr, size, 0, "AHCI HBA regs");
|
||||
if (fRegsArea < B_OK) {
|
||||
TRACE("mapping registers failed\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
TRACE("cap: Interface Speed Support: %lu\n", (fRegs->cap >> CAP_ISS_SHIFT) & CAP_ISS_MASK);
|
||||
TRACE("cap: Number of Command Slots: %lu\n", (fRegs->cap >> CAP_NCS_SHIFT) & CAP_NCS_MASK);
|
||||
TRACE("cap: Number of Ports: %lu\n", (fRegs->cap >> CAP_NP_SHIFT) & CAP_NP_MASK);
|
||||
TRACE("cap: Supports Port Multiplier: %s\n", (fRegs->cap & CAP_SPM) ? "yes" : "no");
|
||||
TRACE("cap: Supports External SATA: %s\n", (fRegs->cap & CAP_SXS) ? "yes" : "no");
|
||||
TRACE("cap: Enclosure Management Supported: %s\n", (fRegs->cap & CAP_EMS) ? "yes" : "no");
|
||||
TRACE("cap: Supports AHCI mode only: %s\n", (fRegs->cap & CAP_SAM) ? "yes" : "no");
|
||||
TRACE("ghc: AHCI Enable: %s\n", (fRegs->ghc & GHC_AE) ? "yes" : "no");
|
||||
TRACE("Ports Implemented: %08lx\n", fRegs->pi);
|
||||
TRACE("AHCI Version %lu.%lu\n", fRegs->vs >> 16, fRegs->vs & 0xff);
|
||||
|
||||
// disable interrupts
|
||||
fRegs->ghc &= ~GHC_IE;
|
||||
// clear pending interrupts
|
||||
fRegs->is = 0xffffffff;
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@ -72,6 +99,13 @@ AHCIController::Uninit()
|
||||
{
|
||||
TRACE("AHCIController::Uninit\n");
|
||||
|
||||
// disable interrupts
|
||||
fRegs->ghc &= ~GHC_IE;
|
||||
// clear pending interrupts
|
||||
fRegs->is = 0xffffffff;
|
||||
|
||||
delete_area(fRegsArea);
|
||||
|
||||
// --- Instance check workaround begin
|
||||
delete_port(fInstanceCheck);
|
||||
// --- Instance check workaround end
|
||||
|
@ -33,6 +33,9 @@ private:
|
||||
pci_device_info* fPCIDevice;
|
||||
uint32 fDevicePresentMask;
|
||||
|
||||
ahci_hba * fRegs;
|
||||
area_id fRegsArea;
|
||||
|
||||
|
||||
// --- Instance check workaround begin
|
||||
port_id fInstanceCheck;
|
||||
|
@ -1,29 +1,16 @@
|
||||
/* Realtek RTL8169 Family Driver
|
||||
* Copyright (C) 2004 Marcus Overhagen <marcus@overhagen.de>. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies, and that both the
|
||||
* copyright notice and this permission notice appear in supporting documentation.
|
||||
*
|
||||
* Marcus Overhagen makes no representations about the suitability of this software
|
||||
* for any purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* MARCUS OVERHAGEN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL MARCUS
|
||||
* OVERHAGEN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
|
||||
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
/*
|
||||
* Copyright 2004-2007, Marcus Overhagen. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#include <Errors.h>
|
||||
#include "util.h"
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <OS.h>
|
||||
#include <string.h>
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#define TRACE(a...) dprintf("\33[34mahci:\33[0m " a)
|
||||
#define ERROR(a...) dprintf("\33[34mahci:\33[0m " a)
|
||||
|
||||
static inline uint32
|
||||
round_to_pagesize(uint32 size)
|
||||
|
@ -1,27 +1,21 @@
|
||||
/* Realtek RTL8169 Family Driver
|
||||
* Copyright (C) 2004 Marcus Overhagen <marcus@overhagen.de>. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies, and that both the
|
||||
* copyright notice and this permission notice appear in supporting documentation.
|
||||
*
|
||||
* Marcus Overhagen makes no representations about the suitability of this software
|
||||
* for any purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* MARCUS OVERHAGEN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL MARCUS
|
||||
* OVERHAGEN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
|
||||
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
/*
|
||||
* Copyright 2004-2007, Marcus Overhagen. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef __UTIL_H
|
||||
#define __UTIL_H
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
area_id alloc_mem(void **virt, void **phy, size_t size, uint32 protection, const char *name);
|
||||
area_id map_mem(void **virt, void *phy, size_t size, uint32 protection, const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user