* Initial work on bios_init for setting up AtomBIOS parser
* Refactor AtomBIOS parser to use non-linux-kernel calls (normally I would keep it as-is and do wrappers, but the AtomBIOS parser has been rewritten from scratch twice by its creator in the last 5 years.. so eh. * Refactor AtomBIOS parser to be more haiku-like stylewise git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42538 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -9,7 +9,7 @@ UsePrivateHeaders [ FDirName graphics radeon_hd ] ;
|
||||
UsePrivateHeaders [ FDirName graphics common ] ;
|
||||
|
||||
Addon radeon_hd.accelerant :
|
||||
#atombios/atom.c
|
||||
atombios/atom.cpp
|
||||
accelerant.cpp
|
||||
engine.cpp
|
||||
hooks.cpp
|
||||
|
||||
@@ -218,6 +218,9 @@ radeon_init_accelerant(int device)
|
||||
init_lock(&info.accelerant_lock, "radeon hd accelerant");
|
||||
init_lock(&info.engine_lock, "radeon hd engine");
|
||||
|
||||
// Init AtomBIOS
|
||||
bios_init();
|
||||
|
||||
status = detect_displays();
|
||||
//if (status != B_OK)
|
||||
// return status;
|
||||
|
||||
@@ -25,21 +25,21 @@
|
||||
#ifndef ATOM_BITS_H
|
||||
#define ATOM_BITS_H
|
||||
|
||||
static inline uint8_t get_u8(void *bios, int ptr)
|
||||
static inline uint8 get_u8(void *bios, int ptr)
|
||||
{
|
||||
return ((unsigned char *)bios)[ptr];
|
||||
}
|
||||
#define U8(ptr) get_u8(ctx->ctx->bios,(ptr))
|
||||
#define CU8(ptr) get_u8(ctx->bios,(ptr))
|
||||
static inline uint16_t get_u16(void *bios, int ptr)
|
||||
static inline uint16 get_u16(void *bios, int ptr)
|
||||
{
|
||||
return get_u8(bios,ptr)|(((uint16_t)get_u8(bios,ptr+1))<<8);
|
||||
return get_u8(bios,ptr)|(((uint16)get_u8(bios,ptr+1))<<8);
|
||||
}
|
||||
#define U16(ptr) get_u16(ctx->ctx->bios,(ptr))
|
||||
#define CU16(ptr) get_u16(ctx->bios,(ptr))
|
||||
static inline uint32_t get_u32(void *bios, int ptr)
|
||||
static inline uint32 get_u32(void *bios, int ptr)
|
||||
{
|
||||
return get_u16(bios,ptr)|(((uint32_t)get_u16(bios,ptr+2))<<16);
|
||||
return get_u16(bios,ptr)|(((uint32)get_u16(bios,ptr+2))<<16);
|
||||
}
|
||||
#define U32(ptr) get_u32(ctx->ctx->bios,(ptr))
|
||||
#define CU32(ptr) get_u32(ctx->bios,(ptr))
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -21,27 +21,26 @@
|
||||
*
|
||||
* Author: Stanislaw Skowronek
|
||||
*/
|
||||
|
||||
#ifndef ATOM_H
|
||||
#define ATOM_H
|
||||
|
||||
|
||||
#ifndef __HAIKU__
|
||||
#include <linux/types.h>
|
||||
#include "card.h"
|
||||
#else
|
||||
#include <String.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
struct card_info {
|
||||
struct drm_device *dev;
|
||||
void (* reg_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */
|
||||
uint32_t (* reg_read)(struct card_info *, uint32_t); /* filled by driver */
|
||||
void (* ioreg_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */
|
||||
uint32_t (* ioreg_read)(struct card_info *, uint32_t); /* filled by driver */
|
||||
void (* mc_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */
|
||||
uint32_t (* mc_read)(struct card_info *, uint32_t); /* filled by driver */
|
||||
void (* pll_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */
|
||||
uint32_t (* pll_read)(struct card_info *, uint32_t); /* filled by driver */
|
||||
// Filled by driver
|
||||
void (*reg_write)(uint32 offset, uint32 data);
|
||||
uint32 (*reg_read)(uint32 offset);
|
||||
void (*ioreg_write)(uint32 offset, uint32 data);
|
||||
uint32 (*ioreg_read)(uint32 offset);
|
||||
void (*mc_write)(uint32 offset, uint32 data);
|
||||
uint32 (*mc_read)(uint32 offset);
|
||||
void (*pll_write)(uint32 offset, uint32 data);
|
||||
uint32 (*pll_read)(uint32 offset);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#define ATOM_BIOS_MAGIC 0xAA55
|
||||
#define ATOM_ATI_MAGIC_PTR 0x30
|
||||
@@ -124,25 +123,25 @@ struct card_info {
|
||||
#define ATOM_IO_IIO 0x80
|
||||
|
||||
typedef struct atom_context_s {
|
||||
card_info *card;
|
||||
void *bios;
|
||||
uint32_t cmd_table, data_table;
|
||||
uint16_t *iio;
|
||||
card_info *card;
|
||||
void *bios;
|
||||
uint32 cmd_table, data_table;
|
||||
uint16 *iio;
|
||||
|
||||
uint16_t data_block;
|
||||
uint32_t fb_base;
|
||||
uint32_t divmul[2];
|
||||
uint16_t io_attr;
|
||||
uint16_t reg_block;
|
||||
uint8_t shift;
|
||||
int cs_equal, cs_above;
|
||||
int io_mode;
|
||||
uint16 data_block;
|
||||
uint32 fb_base;
|
||||
uint32 divmul[2];
|
||||
uint16 io_attr;
|
||||
uint16 reg_block;
|
||||
uint8 shift;
|
||||
int cs_equal, cs_above;
|
||||
int io_mode;
|
||||
} atom_context;
|
||||
|
||||
extern int atom_debug;
|
||||
|
||||
atom_context *atom_parse(card_info *, void *);
|
||||
void atom_execute_table(atom_context *, int, uint32_t *);
|
||||
void atom_execute_table(atom_context *, int, uint32 *);
|
||||
int atom_asic_init(atom_context *);
|
||||
void atom_destroy(atom_context *);
|
||||
|
||||
|
||||
@@ -24,3 +24,46 @@
|
||||
# define TRACE(x...) ;
|
||||
#endif
|
||||
|
||||
|
||||
// AtomBios related calls
|
||||
|
||||
|
||||
status_t
|
||||
bios_init()
|
||||
{
|
||||
struct card_info *atom_card_info
|
||||
= (card_info*)malloc(sizeof(card_info));
|
||||
|
||||
if (!atom_card_info)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
atom_card_info->reg_read = _read32;
|
||||
atom_card_info->reg_write = _write32;
|
||||
|
||||
if (false) {
|
||||
// TODO : if rio_mem, use ioreg
|
||||
//atom_card_info->ioreg_read = cail_ioreg_read;
|
||||
//atom_card_info->ioreg_write = cail_ioreg_write;
|
||||
} else {
|
||||
TRACE("%s: Cannot find PCI I/O BAR; using MMIO\n", __func__);
|
||||
atom_card_info->ioreg_read = _read32;
|
||||
atom_card_info->ioreg_write = _write32;
|
||||
}
|
||||
atom_card_info->mc_read = _read32;
|
||||
atom_card_info->mc_write = _write32;
|
||||
atom_card_info->pll_read = _read32;
|
||||
atom_card_info->pll_write = _write32;
|
||||
|
||||
// System VGA shadow bios? Why not (temporary)
|
||||
atom_parse(atom_card_info, (void*)0xC0000);
|
||||
|
||||
// TODO : we need to get a copy of the VGA bios :(
|
||||
#if 0
|
||||
rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios);
|
||||
mutex_init(&rdev->mode_info.atom_context->mutex);
|
||||
radeon_atom_initialize_bios_scratch_regs(rdev->ddev);
|
||||
atom_allocate_fb_scratch(rdev->mode_info.atom_context);
|
||||
#endif
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// AtomBios includes
|
||||
extern "C" {
|
||||
#include "atom.h"
|
||||
}
|
||||
#include "atom.h"
|
||||
|
||||
|
||||
struct bios_info {
|
||||
@@ -23,8 +20,7 @@ struct bios_info {
|
||||
};
|
||||
|
||||
|
||||
status_t AtomParser(void *parameterSpace, uint8_t index,
|
||||
void *handle, void *biosBase);
|
||||
status_t bios_init();
|
||||
|
||||
|
||||
#endif /* RADEON_HD_BIOS_H */
|
||||
|
||||
Reference in New Issue
Block a user