mirror of https://github.com/dzavalishin/openpod
misc
This commit is contained in:
parent
be4884b7c4
commit
0341bb9121
|
@ -24,7 +24,7 @@
|
|||
//#include <mem/page.h>
|
||||
|
||||
static const int vbuf_max_bytes = VBE_DISPI_MAX_XRES * VBE_DISPI_MAX_YRES * VBE_DISPI_MAX_BPP / 8;
|
||||
static physaddr_t vbuf_mem = 0;
|
||||
static physaddr_t vbuf_physmem = 0;
|
||||
static void * vbuf_vaddr = 0;
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ errno_t pod_bochs_activate( struct pod_driver *drv )
|
|||
errno_t rc;
|
||||
|
||||
// Not actually found?
|
||||
if( vbuf_mem == 0 )
|
||||
if( vbuf_physmem == 0 )
|
||||
return ENODEV;
|
||||
|
||||
if( vbuf_vaddr == 0 )
|
||||
|
@ -95,7 +95,7 @@ errno_t pod_bochs_activate( struct pod_driver *drv )
|
|||
if( rc ) return rc;
|
||||
}
|
||||
|
||||
rc = pod_map_mem( vbuf_mem, vbuf_vaddr, vbuf_max_bytes, POD_MAP_RW|POD_MAP_NOCACHE );
|
||||
rc = pod_map_mem( vbuf_physmem, vbuf_vaddr, vbuf_max_bytes, POD_MAP_RW|POD_MAP_NOCACHE );
|
||||
if( rc ) return rc;
|
||||
|
||||
return single_dev_driver_activate(drv);
|
||||
|
@ -105,13 +105,13 @@ errno_t pod_bochs_deactivate( struct pod_driver *drv )
|
|||
{
|
||||
errno_t rc;
|
||||
|
||||
if( vbuf_mem == 0 )
|
||||
if( vbuf_physmem == 0 )
|
||||
return ENODEV;
|
||||
|
||||
rc = single_dev_driver_deactivate(drv);
|
||||
if( rc ) pod_log_print( 0, "Bochs video drv: can't deactivate, rc = %d", rc );
|
||||
|
||||
rc = pod_unmap_mem( vbuf_mem, vbuf_vaddr, vbuf_max_bytes, 0 );
|
||||
rc = pod_unmap_mem( vbuf_physmem, vbuf_vaddr, vbuf_max_bytes, 0 );
|
||||
if( rc ) return rc;
|
||||
|
||||
return 0;
|
||||
|
@ -244,6 +244,8 @@ pod_bochs_io_setmode( pod_device *dev, void *arg )
|
|||
errno_t
|
||||
pod_bochs_sense( struct pod_driver *drv )
|
||||
{
|
||||
errno_t rc;
|
||||
|
||||
pod_device *dev = &pod_bochs_device;
|
||||
drv->private_data = dev;
|
||||
|
||||
|
@ -251,6 +253,13 @@ pod_bochs_sense( struct pod_driver *drv )
|
|||
|
||||
POD_DEV_STATE_SET( dev, POD_DEV_STATE_INIT );
|
||||
|
||||
pod_bus_pci_dev pdev;
|
||||
rc = pod_bus_pic_find_dev( PCI_VENDOR_ID_BOCHS, PCI_DEV_ID_BOCHS_VGA, &pdev );
|
||||
if( rc )
|
||||
return ENOENT;
|
||||
|
||||
// TODO
|
||||
vbuf_physmem = (pdev->base[0] & ~0xf); /* FIXME */
|
||||
|
||||
// Actually detect hardware
|
||||
pod_bochs_vbe_write(VBE_DISPI_INDEX_ID, VBE_DISPI_ID2);
|
||||
|
@ -260,8 +269,6 @@ pod_bochs_sense( struct pod_driver *drv )
|
|||
return ENOENT;
|
||||
|
||||
|
||||
// TODO
|
||||
//vbuf_mem =
|
||||
|
||||
POD_DEV_STATE_SET( dev, POD_DEV_STATE_FOUND );
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#include "pod_types.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
//*******************************************************************
|
||||
//
|
||||
// OpenPOD
|
||||
//
|
||||
// Default implementations of typical functions.
|
||||
//
|
||||
//*******************************************************************
|
||||
|
||||
|
||||
|
||||
typedef struct pod_bus_pci_dev
|
||||
{
|
||||
|
||||
/* normal header stuff */
|
||||
u_int16_t vendor_id;
|
||||
u_int16_t device_id;
|
||||
|
||||
u_int16_t command;
|
||||
u_int16_t status;
|
||||
|
||||
u_int8_t revision_id;
|
||||
u_int8_t interface;
|
||||
u_int8_t sub_class;
|
||||
u_int8_t base_class;
|
||||
|
||||
u_int8_t cache_line_size;
|
||||
u_int8_t latency_timer;
|
||||
u_int8_t header_type;
|
||||
u_int8_t bist;
|
||||
|
||||
/* device info */
|
||||
u_int8_t bus;
|
||||
u_int8_t dev;
|
||||
u_int8_t func;
|
||||
u_int8_t _pad; // why?
|
||||
|
||||
/* base registers */
|
||||
u_int32_t base[6];
|
||||
u_int32_t size[6];
|
||||
u_int8_t is_mem[6]; // true if this is memory addr
|
||||
|
||||
u_int32_t interrupt;
|
||||
|
||||
} pod_bus_pci_dev;
|
||||
|
||||
|
||||
errno_t pod_bus_pic_find_dev( int pci_vendor_id, int pci_dev_id, pod_bus_pci_dev *pdev );
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
include ../../config.mk
|
||||
|
||||
TARGET=openpod_embox
|
||||
EMBOX_SRC_ROOT=/embox
|
||||
EMBOX_SRC_ROOT=p:/embox/trunk
|
||||
|
||||
CFLAGS += -I../../openpod -I../..
|
||||
CFLAGS += -I../../openpod -I../.. -I$(EMBOX_SRC_ROOT)/src -I$(EMBOX_SRC_ROOT)/src/include
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#include <openpod.h>
|
||||
#include <pod_io_video.h>
|
||||
|
||||
#include "pod_kernel_globals.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Link/unlink device.
|
||||
|
@ -12,7 +15,7 @@
|
|||
// ------------------------------------------------------------------
|
||||
|
||||
pod_device *active_video_driver;
|
||||
static void attach_pod_framebuf();
|
||||
static errno_t attach_pod_framebuf();
|
||||
|
||||
|
||||
// Report a new available device to the OS kernel
|
||||
|
@ -96,7 +99,7 @@ static int openpod_set_var(struct fb_info *info, const struct fb_var_screeninfo
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
errnp_t rc = pod_dev_method( active_video_driver, pod_video_setmode, &m );
|
||||
errno_t rc = pod_dev_method( active_video_driver, pod_video_setmode, &m );
|
||||
if( rc )
|
||||
return -rc; // TODO check rc;
|
||||
|
||||
|
@ -119,10 +122,10 @@ static int openpod_get_var(struct fb_info *info, struct fb_var_screeninfo *var)
|
|||
|
||||
switch( m.buf_fmt )
|
||||
{
|
||||
case pod_pixel_rgba: ar->bits_per_pixel = 32; break;
|
||||
case pod_pixel_rgb: ar->bits_per_pixel = 24; break;
|
||||
case pod_pixel_r5g6b5: ar->bits_per_pixel = 16; break;
|
||||
case pod_pixel_r5g6b5: ar->bits_per_pixel = 16; break;
|
||||
case pod_pixel_rgba: var->bits_per_pixel = 32; break;
|
||||
case pod_pixel_rgb: var->bits_per_pixel = 24; break;
|
||||
case pod_pixel_r5g6b5: var->bits_per_pixel = 16; break;
|
||||
case pod_pixel_r5g6b5: var->bits_per_pixel = 16; break;
|
||||
default: return ENXIO;
|
||||
}
|
||||
|
||||
|
@ -142,6 +145,14 @@ static const struct fb_ops openpod_ops = {
|
|||
|
||||
static errno_t attach_pod_framebuf()
|
||||
{
|
||||
errno_t rc;
|
||||
|
||||
struct pod_video_rq_mode m;
|
||||
rc = pod_dev_method( active_video_driver, pod_video_getmode, &m );
|
||||
if(rc) return rc;
|
||||
|
||||
// TODO fb_create - virt or phys addr?
|
||||
|
||||
struct fb_info *info;
|
||||
|
||||
info = fb_create(&openpod_ops, mmap_base, mmap_len);
|
||||
|
|
Loading…
Reference in New Issue