Converted sources that include the private <vm/vm.h> to C++. Fixes the build.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37081 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-06-10 10:38:29 +00:00
parent d0a2818e88
commit 297bfa1aba
9 changed files with 62 additions and 42 deletions
+3 -3
View File
@@ -21,7 +21,7 @@ local events_src =
evxfregn.c evxfregn.c
; ;
local hardware_src = local hardware_src =
hwacpi.c hwacpi.c
hwgpe.c hwgpe.c
hwregs.c hwregs.c
@@ -158,7 +158,7 @@ local utilities_src =
utresrc.c utresrc.c
utstate.c utstate.c
uttrack.c uttrack.c
utxface.c utxface.c
; ;
StaticLibrary libacpi_ca.a : StaticLibrary libacpi_ca.a :
@@ -184,7 +184,7 @@ SEARCH on [ FGristFiles $(executer_src) ] = [ FDirName $(HAIKU_TOP) src add-ons
SEARCH on [ FGristFiles $(parser_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi parser ] ; SEARCH on [ FGristFiles $(parser_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi parser ] ;
KernelAddon acpi : KernelAddon acpi :
oshaiku.c oshaiku.cpp
acpi_busman.c acpi_busman.c
acpi_module.c acpi_module.c
acpi_device.c acpi_device.c
@@ -114,8 +114,8 @@
*****************************************************************************/ *****************************************************************************/
#include <stdio.h> #include <stdio.h>
#include <sys/cdefs.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@@ -131,11 +131,13 @@
# include <vm/vm.h> # include <vm/vm.h>
#endif #endif
__BEGIN_DECLS
#include "acpi.h" #include "acpi.h"
#include "accommon.h" #include "accommon.h"
#include "amlcode.h" #include "amlcode.h"
#include "acparser.h" #include "acparser.h"
#include "acdebug.h" #include "acdebug.h"
__END_DECLS
ACPI_MODULE_NAME("Haiku ACPI Module") ACPI_MODULE_NAME("Haiku ACPI Module")
@@ -318,7 +320,7 @@ void
AcpiOsRedirectOutput(void *destination) AcpiOsRedirectOutput(void *destination)
{ {
DEBUG_FUNCTION(); DEBUG_FUNCTION();
AcpiGbl_OutputFile = destination; AcpiGbl_OutputFile = (FILE*)destination;
} }
@@ -890,7 +892,7 @@ AcpiOsReadPciConfiguration(ACPI_PCI_ID *pciId, UINT32 reg, void *value,
UINT32 width) UINT32 width)
{ {
uint32 *val; uint32 *val;
val = value; val = (uint32*)value;
#ifdef _KERNEL_MODE #ifdef _KERNEL_MODE
DEBUG_FUNCTION(); DEBUG_FUNCTION();
@@ -1198,7 +1200,7 @@ AcpiOsSignal(UINT32 function, void *info)
switch (function) { switch (function) {
case ACPI_SIGNAL_FATAL: case ACPI_SIGNAL_FATAL:
#ifdef _KERNEL_MODE #ifdef _KERNEL_MODE
panic(info == NULL ? "AcpiOsSignal: fatal" : info); panic(info == NULL ? "AcpiOsSignal: fatal" : (const char*)info);
break; break;
#endif #endif
case ACPI_SIGNAL_BREAKPOINT: case ACPI_SIGNAL_BREAKPOINT:
@@ -1234,16 +1236,16 @@ AcpiOsSignal(UINT32 function, void *info)
int int
AcpiOsAcquireGlobalLock(uint32 *lock) AcpiOsAcquireGlobalLock(uint32 *lock)
{ {
uint32 new; uint32 newValue;
uint32 old; uint32 oldValue;
do { do {
old = *lock; oldValue = *lock;
new = ((old & ~GL_BIT_MASK) | GL_BIT_OWNED) | newValue = ((oldValue & ~GL_BIT_MASK) | GL_BIT_OWNED) |
((old >> 1) & GL_BIT_PENDING); ((oldValue >> 1) & GL_BIT_PENDING);
atomic_test_and_set(lock, new, old); atomic_test_and_set((int32*)lock, newValue, oldValue);
} while (*lock == old); } while (*lock == oldValue);
return ((new < GL_BIT_MASK) ? GL_ACQUIRED : GL_BUSY); return ((newValue < GL_BIT_MASK) ? GL_ACQUIRED : GL_BUSY);
} }
@@ -1257,15 +1259,15 @@ AcpiOsAcquireGlobalLock(uint32 *lock)
int int
AcpiOsReleaseGlobalLock(uint32 *lock) AcpiOsReleaseGlobalLock(uint32 *lock)
{ {
uint32 new; uint32 newValue;
uint32 old; uint32 oldValue;
do { do {
old = *lock; oldValue = *lock;
new = old & ~GL_BIT_MASK; newValue = oldValue & ~GL_BIT_MASK;
atomic_test_and_set(lock, new, old); atomic_test_and_set((int32*)lock, newValue, oldValue);
} while (*lock == old); } while (*lock == oldValue);
return (old & GL_BIT_PENDING); return (oldValue & GL_BIT_PENDING);
} }
+2 -2
View File
@@ -14,9 +14,9 @@ KernelAddon scsi :
ccb.c ccb.c
device_scan.c device_scan.c
devices.c devices.c
dma_buffer.c dma_buffer.cpp
dpc.c dpc.c
emulation.c emulation.cpp
queuing.c queuing.c
scsi.c scsi.c
scsi_io.c scsi_io.c
@@ -12,12 +12,18 @@
#ifndef _KERNEL_EXPORT_EXT_H #ifndef _KERNEL_EXPORT_EXT_H
#define _KERNEL_EXPORT_EXT_H #define _KERNEL_EXPORT_EXT_H
#include <sys/cdefs.h>
#include <KernelExport.h> #include <KernelExport.h>
#include <iovec.h> #include <iovec.h>
__BEGIN_DECLS
// get memory map of iovec // get memory map of iovec
status_t get_iovec_memory_map( status_t get_iovec_memory_map(
iovec *vec, // iovec to analyze iovec *vec, // iovec to analyze
size_t vec_count, // number of entries in vec size_t vec_count, // number of entries in vec
size_t vec_offset, // number of bytes to skip at beginning of vec size_t vec_offset, // number of bytes to skip at beginning of vec
@@ -28,4 +34,8 @@ status_t get_iovec_memory_map(
size_t *mapped_len // actual number of bytes described by map size_t *mapped_len // actual number of bytes described by map
); );
__END_DECLS
#endif #endif
@@ -101,12 +101,12 @@ scsi_copy_dma_buffer(scsi_ccb *request, uint32 size, bool to_buffer)
dma_buffer *buffer = request->dma_buffer; dma_buffer *buffer = request->dma_buffer;
const physical_entry *sg_list = buffer->sg_list_orig; const physical_entry *sg_list = buffer->sg_list_orig;
uint32 num_vecs = buffer->sg_count_orig; uint32 num_vecs = buffer->sg_count_orig;
char *buffer_data = buffer->address; uchar *buffer_data = buffer->address;
SHOW_FLOW(1, "to_buffer=%d, %d bytes", to_buffer, (int)size); SHOW_FLOW(1, "to_buffer=%d, %d bytes", to_buffer, (int)size);
// survive even if controller returned invalid data size // survive even if controller returned invalid data size
size = min(size, request->data_length); size = min_c(size, request->data_length);
// we have to use S/G list to original data; the DMA buffer // we have to use S/G list to original data; the DMA buffer
// was allocated in kernel and is thus visible even if the thread // was allocated in kernel and is thus visible even if the thread
@@ -114,7 +114,7 @@ scsi_copy_dma_buffer(scsi_ccb *request, uint32 size, bool to_buffer)
for (; size > 0 && num_vecs > 0; ++sg_list, --num_vecs) { for (; size > 0 && num_vecs > 0; ++sg_list, --num_vecs) {
size_t bytes; size_t bytes;
bytes = min( size, sg_list->size ); bytes = min_c( size, sg_list->size );
if (to_buffer) { if (to_buffer) {
vm_memcpy_from_physical(buffer_data, sg_list->address, bytes, vm_memcpy_from_physical(buffer_data, sg_list->address, bytes,
@@ -495,7 +495,7 @@ scsi_release_dma_buffer(scsi_ccb *request)
void void
scsi_dma_buffer_daemon(void *dev, int counter) scsi_dma_buffer_daemon(void *dev, int counter)
{ {
scsi_device_info *device = dev; scsi_device_info *device = (scsi_device_info*)dev;
dma_buffer *buffer; dma_buffer *buffer;
ACQUIRE_BEN(&device->dma_buffer_lock); ACQUIRE_BEN(&device->dma_buffer_lock);
@@ -71,8 +71,8 @@ scsi_init_emulation_buffer(scsi_device_info *device, size_t buffer_size)
// to satisfy alignment, we must allocate a buffer twice its required size // to satisfy alignment, we must allocate a buffer twice its required size
// and find the properly aligned part of it, ouch! // and find the properly aligned part of it, ouch!
device->buffer_area = create_area("ATAPI buffer", (void *)&unaligned_addr, B_ANY_KERNEL_ADDRESS, device->buffer_area = create_area("ATAPI buffer", (void**)&unaligned_addr,
2 * total_size, B_CONTIGUOUS, 0); B_ANY_KERNEL_ADDRESS, 2 * total_size, B_CONTIGUOUS, 0);
if (device->buffer_area < 0) { if (device->buffer_area < 0) {
SHOW_ERROR( 1, "cannot create DMA buffer (%s)", strerror(device->buffer_area)); SHOW_ERROR( 1, "cannot create DMA buffer (%s)", strerror(device->buffer_area));
@@ -91,10 +91,10 @@ scsi_init_emulation_buffer(scsi_device_info *device, size_t buffer_size)
B_PRIxPHYSADDR ", unaligned_addr = %#" B_PRIxADDR ", aligned_addr = %#" B_PRIxPHYSADDR ", unaligned_addr = %#" B_PRIxADDR ", aligned_addr = %#"
B_PRIxADDR, unaligned_phys, aligned_phys, unaligned_addr, aligned_addr); B_PRIxADDR, unaligned_phys, aligned_phys, unaligned_addr, aligned_addr);
device->buffer = (void *)aligned_addr; device->buffer = (char*)aligned_addr;
device->buffer_size = buffer_size; device->buffer_size = buffer_size;
// s/g list is directly after buffer // s/g list is directly after buffer
device->buffer_sg_list = (void *)(aligned_addr + buffer_size); device->buffer_sg_list = (physical_entry*)(aligned_addr + buffer_size);
device->buffer_sg_list[0].address = aligned_phys; device->buffer_sg_list[0].address = aligned_phys;
device->buffer_sg_list[0].size = buffer_size; device->buffer_sg_list[0].size = buffer_size;
device->buffer_sg_count = 1; device->buffer_sg_count = 1;
@@ -482,14 +482,14 @@ copy_sg_data(scsi_ccb *request, uint offset, uint allocation_length,
return 0; return 0;
// remaining bytes we are allowed to copy from/to request // remaining bytes we are allowed to copy from/to request
req_size = min(allocation_length, request->data_length) - offset; req_size = min_c(allocation_length, request->data_length) - offset;
// copy one S/G entry at a time // copy one S/G entry at a time
for (; size > 0 && req_size > 0 && sg_count > 0; ++sg_list, --sg_count) { for (; size > 0 && req_size > 0 && sg_count > 0; ++sg_list, --sg_count) {
size_t bytes; size_t bytes;
bytes = min(size, req_size); bytes = min_c(size, req_size);
bytes = min(bytes, sg_list->size); bytes = min_c(bytes, sg_list->size);
SHOW_FLOW(0, "buffer = %p, virt_addr = %#" B_PRIxPHYSADDR ", bytes = %" SHOW_FLOW(0, "buffer = %p, virt_addr = %#" B_PRIxPHYSADDR ", bytes = %"
B_PRIuSIZE ", to_buffer = %d", buffer, sg_list->address + offset, B_PRIuSIZE ", to_buffer = %d", buffer, sg_list->address + offset,
@@ -7,6 +7,7 @@
//! Internal structures/definitions //! Internal structures/definitions
#include <sys/cdefs.h>
#include <bus/SCSI.h> #include <bus/SCSI.h>
#include <scsi_cmds.h> #include <scsi_cmds.h>
@@ -110,7 +111,7 @@ typedef struct scsi_bus_info {
device_node *node; // pnp node of bus device_node *node; // pnp node of bus
dma_params dma_params; // dma restrictions of controller struct dma_params dma_params; // dma restrictions of controller
scsi_path_inquiry inquiry_data; // inquiry data as read on init scsi_path_inquiry inquiry_data; // inquiry data as read on init
} scsi_bus_info; } scsi_bus_info;
@@ -176,7 +177,7 @@ typedef struct scsi_device_info {
struct mutex dma_buffer_lock; // lock between DMA buffer user and clean-up daemon struct mutex dma_buffer_lock; // lock between DMA buffer user and clean-up daemon
sem_id dma_buffer_owner; // to be acquired before using DMA buffer sem_id dma_buffer_owner; // to be acquired before using DMA buffer
dma_buffer dma_buffer; // DMA buffer struct dma_buffer dma_buffer; // DMA buffer
// buffer used for emulating SCSI commands // buffer used for emulating SCSI commands
char *buffer; char *buffer;
@@ -211,7 +212,7 @@ enum {
SCSI_STATE_QUEUED = 2, SCSI_STATE_QUEUED = 2,
SCSI_STATE_SENT = 3, SCSI_STATE_SENT = 3,
SCSI_STATE_FINISHED = 5, SCSI_STATE_FINISHED = 5,
} scsi_state; };
extern locked_pool_interface *locked_pool; extern locked_pool_interface *locked_pool;
@@ -223,6 +224,8 @@ extern scsi_device_interface scsi_device_module;
extern struct device_module_info gSCSIBusRawModule; extern struct device_module_info gSCSIBusRawModule;
__BEGIN_DECLS
// busses.c // busses.c
uchar scsi_inquiry_path(scsi_bus bus, scsi_path_inquiry *inquiry_data); uchar scsi_inquiry_path(scsi_bus bus, scsi_path_inquiry *inquiry_data);
@@ -298,4 +301,8 @@ void scsi_finish_emulation(scsi_ccb *request);
void scsi_free_emulation_buffer(scsi_device_info *device); void scsi_free_emulation_buffer(scsi_device_info *device);
status_t scsi_init_emulation_buffer(scsi_device_info *device, size_t buffer_size); status_t scsi_init_emulation_buffer(scsi_device_info *device, size_t buffer_size);
__END_DECLS
#endif /* _SCSI_INTERNAL_H */ #endif /* _SCSI_INTERNAL_H */
+1 -1
View File
@@ -11,5 +11,5 @@ KernelAddon ahci :
ahci_port.cpp ahci_port.cpp
ahci_sim.cpp ahci_sim.cpp
sata_request.cpp sata_request.cpp
util.c util.cpp
; ;
@@ -50,7 +50,8 @@ alloc_mem(void **virt, void **phy, size_t size, uint32 protection,
*virt = virtadr; *virt = virtadr;
if (phy) if (phy)
*phy = (void*)(addr_t)pe.address; *phy = (void*)(addr_t)pe.address;
TRACE("area = %ld, size = %ld, virt = %p, phy = %p\n", areaid, size, virtadr, pe.address); TRACE("area = %ld, size = %ld, virt = %p, phy = %#" B_PRIxPHYSADDR "\n",
areaid, size, virtadr, pe.address);
return areaid; return areaid;
} }
@@ -110,7 +111,7 @@ sg_memcpy(const physical_entry *sgTable, int sgCount, const void *data,
void void
swap_words(void *data, size_t size) swap_words(void *data, size_t size)
{ {
uint16 *word = data; uint16 *word = (uint16*)data;
size_t count = size / 2; size_t count = size / 2;
while (count--) { while (count--) {
*word = (*word << 8) | (*word >> 8); *word = (*word << 8) | (*word >> 8);