Skip to content

Commit

Permalink
The kernel's build process now scans for all UDIProps files and adds …
Browse files Browse the repository at this point in the history
…them to

the index. Also added some test udiprops for some devices.
  • Loading branch information
latentPrion committed Sep 28, 2013
1 parent 5868158 commit a9b02a5
Show file tree
Hide file tree
Showing 13 changed files with 534 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ foo
*.iso
/Makefile.vars
/Makefile
*.zudi-index

14 changes: 12 additions & 2 deletions core/chipset/ibmPc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@ DELIVERABLE=../../chipsetCore.a
OBJFILES=regionMap.o i8259a.o findTables.o irqControl.o \
memoryDetection.o vgaTerminal.o zkcmCore.o \
cpuDetection.o memoryAreas.o zkcmIbmPcState.o timerControl.o \
rtcmos.o isa_busPinMappings.o busPinMappings.o i8254.o
rtcmos.o isa_busPinMappings.o busPinMappings.o i8254.o \
chipset_udi_index.o

all: Makefile $(DELIVERABLE)

chipset_udi_index.o: udi_index chipset_udi_indexTmp.s
chipset_udi_indexTmp.s: chipset_udi_index.S
$(CPP) $(CPPFLAGS) $< >$@
udi_index:
@echo "Creating driver index."
zudiindex -c le -i .
@echo "Adding drivers to index."
zudiindex-addall -drivers . .

$(DELIVERABLE): $(OBJFILES)
$(AR) -rcs $@ $(OBJFILES)

clean: fonyphile
rm -rf *.o *.s
rm -rf *.o *.s *.zudi-index

fonyphile:
rm -f clean aclean dirclean
Expand Down
51 changes: 51 additions & 0 deletions core/chipset/ibmPc/chipset_udi_index.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

#include <in_asm.h>
#include <assembler.h>

.section .rodata

ASM_GLOBAL_DATA(chipset_udi_index_driver_headers)
.incbin "driver-headers.zudi-index"
ASM_END_DATA(chipset_udi_index_driver_headers)
ASM_GLOBAL_DATA(chipset_udi_index_driver_headers_end)

ASM_GLOBAL_DATA(chipset_udi_index_driver_data)
.incbin "driver-data.zudi-index"
ASM_END_DATA(chipset_udi_index_driver_data)
ASM_GLOBAL_DATA(chipset_udi_index_driver_data_end)

ASM_GLOBAL_DATA(chipset_udi_index_regions)
.incbin "regions.zudi-index"
ASM_END_DATA(chipset_udi_index_regions)
ASM_GLOBAL_DATA(chipset_udi_index_region_end)

ASM_GLOBAL_DATA(chipset_udi_index_devices)
.incbin "devices.zudi-index"
ASM_END_DATA(chipset_udi_index_devices)
ASM_GLOBAL_DATA(chipset_udi_index_devices_end)

ASM_GLOBAL_DATA(chipset_udi_index_ranks)
.incbin "ranks.zudi-index"
ASM_END_DATA(chipset_udi_index_ranks)
ASM_GLOBAL_DATA(chipset_udi_index_ranks_end)

ASM_GLOBAL_DATA(chipset_udi_index_messages)
.incbin "messages.zudi-index"
ASM_END_DATA(chipset_udi_index_messages)
ASM_GLOBAL_DATA(chipset_udi_index_device_messages_end)

ASM_GLOBAL_DATA(chipset_udi_index_disaster_messages)
.incbin "disaster-messages.zudi-index"
ASM_END_DATA(chipset_udi_index_disaster_messages)
ASM_GLOBAL_DATA(chipset_udi_index_device_disaster_messages_end)

ASM_GLOBAL_DATA(chipset_udi_index_message_files)
.incbin "message-files.zudi-index"
ASM_END_DATA(chipset_udi_index_message_files)
ASM_GLOBAL_DATA(chipset_udi_index_device_message_files_end)

ASM_GLOBAL_DATA(chipset_udi_index_readable_files)
.incbin "readable-files.zudi-index"
ASM_END_DATA(chipset_udi_index_readable_files)
ASM_GLOBAL_DATA(chipset_udi_index_device_readable_files_end)

75 changes: 75 additions & 0 deletions core/chipset/ibmPc/i8254_pit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

#define UDI_VERSION 0x101
#include <kernel/common/floodplainn/udi/udi.h>


/* Data type used to represent i8254-pit CLK cycles. CLK cycles are /not/ 1:1
* related to actual microseconds. The i8254 PIT has an input frequency of
* 1,193,180Hz.
**/
typedef udi_ubit16_t timer_clk_t;

struct timerRDataS
{
enum timerIrqStatusE { IRQ_DISABLED, IRQ_ENABLED };
enum timerApiStatusE { API_DISABLED, API_ENABLED };
enum timerModeE { ONESHOT, PERIODIC };

// Whether or not the channel 0 IRQ is active.
timerIrqStatusE irqStatus;
// Whether or not the device is logically enabled currently.
timerApiStatusE apiStatus;
timerModeE timerMode;
// The current value programmed into the counter register.
timer_clk_t currentClkVal;
// The current microsecond time requested by the bound child.
udi_time_t currentTimeoutVal;
};

struct speakerRDataS
{
};

static udi_channel_event_ind_op_t timer_intr_channel_event_ind;
static udi_intr_event_ind_op_t timer_intr_event_ind;

static udi_intr_dispatcher_ops_t
{
&timer_intr_channel_event_ind,
&timer_intr_event_ind
} timer_intr_dispatcher_ops;

void timer_intr_event_ind(udi_intr_event_cb_t *cb, udi_ubit8_t flags)
{
timerRDataS *timerData;

timerData = (timerRDataS *)cb->gcb.context;

// If the IRQ is disabled, don't claim the IRQ.
if (timerData->irqStatus == timerRDataS::IRQ_DISABLED)
{
cb->intr_result = UDI_INTR_UNCLAIMED;
udi_intr_event_rdy(cb);
return;
};

/* ELSE:
* If API status is API_ENABLED:
* This is a normal IRQ.
* If API status is API_DISABLED:
* This is a "shutting down" IRQ.
**/
switch (timerData->apiStatus)
{
case timerRDataS::API_DISABLED:
// Call udi_intr_detach_req().
return;

default:
/* Normal case: Normal IRQ has occured. Call
* zudi_timer_event_ind.
**/
//udi_cb_alloc(&timer_intr_event_ind_normal_cb_alloc, ...);
return;
}

39 changes: 39 additions & 0 deletions core/chipset/ibmPc/i8254_pit.udidprops
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# UDI static properties for the IBM-PC i8254 PIT.
#
properties_version 0x101

message 1 IBM-PC i8254-PIT driver
message 2 Zambesii
message 3 http://github.com/latentprion/zambesii

name 1
shortname i8254_pit
supplier 2
contact 3
release 1 0.00.000

requires udi 0x101
requires zudi_gio 0x101
requires zbz_timer 0x1
requires zudi_physio 0x101
requires zbz_pcisa 0x1

meta 1 zbz_timer
meta 2 zbz_pcisa
meta 3 zudi_gio

# child_bind_ops 1 0 # Unknown ops_idx for now.
# parent_bind_ops 2 0 # Unknown ops_idx and cb_idx for now.
# internal_bind_ops 3 1 # Unknown ops_idx0, ops_idx1 and cb_idx for now.

message 4 IBM-PC compatible i8254 PIT
device 4 2 \
bus_type string pcisa \
pcisa_device_name string i8254-pit \

module i8254_pit
# Primary region handles the channel 0 timer.
region 0 type interrupt
# Secondary region handles the PC speaker.
region 1

37 changes: 37 additions & 0 deletions core/chipset/ibmPc/rs232.udidprops
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Test udiprops for an rs-232 serial device.
properties_version 0x101

message 1 IBM-PC rs-232 driver
message 2 Zambesii
message 3 N/A

name 1
supplier 2
contact 3
shortname pc_rs232
release 1 v0.00.000

module main

requires udi 0x101
requires udi_bridge 0x101
requires udi_physio 0x101
requires udi_nic 0x101
requires udi_pci 0x101

region 0
region 1 type interrupt

meta 1 udi_nic
meta 2 udi_pci

message 100 IBM-PC RS-232 Serial (COM)
device 100 2 \
bus_type string pci \
pci_vendor_id ubit32 0x1234 \
pci_device_id ubit32 0x5678

#parent_bind_ops
#child_bind_ops
#internal_bind_ops

21 changes: 21 additions & 0 deletions core/chipset/ibmPc/rtc.udidprops
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
properties_version 0x101

message 1 PC RTC Driver
message 2 Zambesii
message 3 N/A

name 1
supplier 2
contact 3
shortname pc_rtc
release 1 v0.00.000

module main

requires udi 0x101
requires udi_physio 0x101
requires udi_gio 0x101

region 0

#
13 changes: 9 additions & 4 deletions core/include/kernel/common/floodplainn/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ namespace fplainn
public:
deviceC(ubit16 id, utf8Char *shortName)
:
id(id), driver(__KNULL), instance(__KNULL), attributes(__KNULL)
id(id), driver(__KNULL), driverInstance(__KNULL),
nEnumerationAttribs(0), nInstanceAttribs(0),
enumeration(__KNULL), instance(__KNULL)
{
if (shortName != __KNULL)
{
Expand All @@ -56,9 +58,11 @@ namespace fplainn

public:
driverC *getDriver(void) { return driver; }
driverInstanceC *getDriverInstance(void) { return instance; }
driverInstanceC *getDriverInstance(void)
{ return driverInstance; }

error_t addClass(utf8Char *name);
error_t addEnumerationAttribute(utf8Char *name);

struct instanceAttributeS
{
Expand Down Expand Up @@ -87,8 +91,9 @@ namespace fplainn

numaBankId_t bankId;
driverC *driver;
driverInstanceC *instance;
instanceAttributeS *attributes;
driverInstanceC *driverInstance;
ubit8 nEnumerationAttribs, nInstanceAttribs;
instanceAttributeS **enumeration, **instance;
utf8Char (*classes)[DEVICE_CLASS_MAXLEN];
};

Expand Down
8 changes: 5 additions & 3 deletions core/include/kernel/common/floodplainn/floodplainn.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <kernel/common/floodplainn/device.h>
#include <kernel/common/vfsTrib/commonOperations.h>

#define DRIVERINDEX_REQUEST_DEVNAME_MAXLEN (256)
#define DRIVERINDEX_REQUEST_DEVNAME_MAXLEN (128)

#define FPLAINNIDX "FplainnIndex: "

class floodplainnC
:
Expand Down Expand Up @@ -144,7 +146,7 @@ public tributaryC//, public vfs::directoryOperationsC
static void __kdriverEntry(void);
static void driverIndexerEntry(void);

private:
public:
struct driverIndexRequestS
{
driverIndexRequestS(utf8Char *name, indexLevelE indexLevel)
Expand All @@ -162,7 +164,7 @@ public tributaryC//, public vfs::directoryOperationsC

indexLevelE indexLevel;
};

processId_t indexerThreadId;
ubit16 indexerQueueId;
};
Expand Down
Loading

0 comments on commit a9b02a5

Please sign in to comment.