Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
tinkeros-5.14pre
Browse files Browse the repository at this point in the history
  • Loading branch information
tinkeros committed Apr 4, 2024
1 parent cf239a5 commit 0ad5b1c
Show file tree
Hide file tree
Showing 120 changed files with 5,084 additions and 2,821 deletions.
9 changes: 6 additions & 3 deletions Adam/ABlkDev/ADskB.HC
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ public I64 RamDiskToFile(U8 drv_let='B',U8 *filename)
CBlkDev *ram_disk=Let2BlkDev(drv_let);
if (ram_disk)
{
"Attempting to write %d blocks from drive %c to file %s\n",ram_disk->max_blk,drv_let,filename;
cnt=FileWrite(filename,ram_disk->RAM_dsk,BLK_SIZE*ram_disk->max_blk,,RS_ATTR_CONTIGUOUS);
"Attempting to write %d blocks from drive %c to file %s\n",ram_disk->max_blk,
drv_let,filename;
cnt=FileWrite(filename,ram_disk->RAM_dsk,BLK_SIZE*ram_disk->max_blk
,,RS_ATTR_CONTIGUOUS);
}
return cnt;
}
Expand All @@ -227,7 +229,8 @@ public I64 FileToRamDisk(U8 drv_let='B', U8 *filename)
CBlkDev *ram_disk=Let2BlkDev(drv_let);
if (ram_disk)
{
"Attempting to read %d blocks to drive %c from file %s\n",ram_disk->max_blk,drv_let,filename;
"Attempting to read %d blocks to drive %c from file %s\n",
ram_disk->max_blk,drv_let,filename;
buf=FileRead(filename,&cnt);
if (cnt == BLK_SIZE*ram_disk->max_blk)
{
Expand Down
14 changes: 8 additions & 6 deletions Adam/ABlkDev/AHCIMount.HC
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

public I64 SATARep(I64 bd_type=BDT_NULL, I64 *first_hdd=NULL)
{// Report ATA and ATAPI drives implemented by SATA controller.
I64 i, j, i_max=0, num = 0, first_hd=-1;
I64 i, j, i_max=0, num = 0, first_hd=-1;
CAHCIPort *port;
CBlkDev *temp_blkdev;
U16 *st, *model, *serial;
Bool show_atapi = FALSE, show_ata = FALSE;
CBlkDev *temp_blkdev;
U16 *st, *model, *serial;
Bool show_atapi = FALSE, show_ata = FALSE;
switch (bd_type)
{
case BDT_NULL:
Expand All @@ -21,10 +21,12 @@ public I64 SATARep(I64 bd_type=BDT_NULL, I64 *first_hdd=NULL)
}
if (!IsRaw)
"\n$$LTBLUE$$AHCI version %X.%1X%1X$$FG$$\n\n",
blkdev.ahci_hba->version >> 16, (blkdev.ahci_hba->version & 0xFF00) >> 8, blkdev.ahci_hba->version & 0xFF;
blkdev.ahci_hba->version >> 16, (blkdev.ahci_hba->version & 0xFF00) >> 8,
blkdev.ahci_hba->version & 0xFF;
else
"\nAHCI version %X.%1X%1X\n\n",
blkdev.ahci_hba->version >> 16, (blkdev.ahci_hba->version & 0xFF00) >> 8, blkdev.ahci_hba->version & 0xFF;
blkdev.ahci_hba->version >> 16, (blkdev.ahci_hba->version & 0xFF00) >> 8,
blkdev.ahci_hba->version & 0xFF;
if (blkdev.ahci_hba)
{
"\n";
Expand Down
16 changes: 9 additions & 7 deletions Adam/ABlkDev/Mount.HC
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk, Bool just_ide=FALSE,I64 *cur_drv_hint=NULL)
U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk, Bool just_ide=FALSE,
I64 *cur_drv_hint=NULL)
{//If _doc, called by $LK,"::/Kernel/KCfg.HC"$ else called by $LK,"Mount",A="MN:Mount"$().
I64 cnt,total=0,num_hints,drv_let,type,unit,prt_num,port;
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN],
Expand Down Expand Up @@ -76,11 +77,12 @@ U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk, Bool just_ide=FALSE
"Enter port number: \n";
GetS(port_str, STR_LEN);
}
while (( type == BDT_ATAPI && AHCIPortSignatureGet(Str2I64(port_str)) != AHCI_PxSIG_ATAPI ||
type == BDT_ATA && AHCIPortSignatureGet(Str2I64(port_str)) != AHCI_PxSIG_ATA ||
0 > Str2I64(port_str) || Str2I64(port_str) > num_hints - 1
) &&
(type != BDT_AHCI_SATAPI || !boot_drv_let));
while ((type == BDT_ATAPI &&
AHCIPortSignatureGet(Str2I64(port_str)) != AHCI_PxSIG_ATAPI ||
type == BDT_ATA &&
AHCIPortSignatureGet(Str2I64(port_str)) != AHCI_PxSIG_ATA ||
0 > Str2I64(port_str) || Str2I64(port_str) > num_hints - 1) &&
(type != BDT_AHCI_SATAPI || !boot_drv_let));
port = Str2I64(port_str);
if (cur_drv_hint) *cur_drv_hint=port;
break;
Expand Down Expand Up @@ -131,7 +133,7 @@ U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk, Bool just_ide=FALSE
}
// TODO continue adding AHCI
DocPrint(doc,"bd=BlkDevNextFreeSlot(\'%C\',%d);bd->unit=%d;\n",
drv_let,type,unit);
drv_let,type,unit);
if (AHCIMode && port != -1 && *port_str)
{
DocPrint(doc, "AHCIPortInit(bd, &blkdev.ahci_hba->ports[%d], %d);\n", port, port);
Expand Down
22 changes: 12 additions & 10 deletions Adam/AExts.HC
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern U0 DocBinDel(CDoc *doc,CDocBin *b);
extern U0 DocBinsValidate(CDoc *doc);
extern U0 DocBottom(CDoc *doc=NULL);
extern U0 DocBMP(CDoc *doc=NULL,U8 *filename,
Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE);
Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE);
extern U0 DocCenter(CDoc *doc=NULL,I64 recalc_flags=RECALCt_NORMAL);
extern U0 DocClear(CDoc *doc=NULL,Bool clear_holds=FALSE);
extern Bool DocCursor(Bool show=OFF,CDoc *doc=NULL);
Expand All @@ -26,7 +26,7 @@ extern U0 DocDump(CDoc *doc,I64 uS_delay=0);
extern CDocEntry *DocEntryCopy(CDoc *doc,CDocEntry *doc_e);
extern U0 DocEntryDel(CDoc *doc,CDocEntry *doc_e);
extern Bool DocForm(U8 *_d,U8 *class_name=lastclass,
I64 dof_flags=0,U8 *header=NULL,U8 *footer=NULL);
I64 dof_flags=0,U8 *header=NULL,U8 *footer=NULL);
extern U0 DocHelpIdx(CDoc *doc,U8 *idx);
extern Bool DocHighlightCursor(Bool show=OFF,CDoc *doc=NULL);
extern U0 DocInsDoc(CDoc *doc=NULL,CDoc *doc2);
Expand All @@ -52,7 +52,7 @@ extern I64 FindWiz();
extern I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=I64_MIN,I64 hi=I64_MAX);
extern Bool GrPlot0(CDC *dc,I64 x,I64 y);
extern I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
U8 *fu_flags=NULL,U8 *_stage2_filename=NULL);
U8 *fu_flags=NULL,U8 *_stage2_filename=NULL);
extern CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name);
extern CMenu *MenuFilePush(U8 *filename);
extern U0 MenuPop();
Expand All @@ -62,23 +62,24 @@ extern CTask *Noise(I64 mS,F64 min_ona,F64 max_ona);
extern Bool Plain(U8 *filename,I64 edf_dof_flags=0);
extern Bool PopUpCancelOk(U8 *header=NULL,U8 *footer=NULL);
extern I64 PopUpColor(U8 *header=NULL,
Bool allow_transparent=TRUE,Bool allow_dft=TRUE);
Bool allow_transparent=TRUE,Bool allow_dft=TRUE);
extern I64 PopUpColorDither(U8 *header=NULL);
extern I64 PopUpColorLighting(U8 *header=NULL);
extern I64 PopUpFile(U8 *filename,
Bool warn_ext=TRUE,CTask *parent=NULL,CTask **_pu_task=NULL);
Bool warn_ext=TRUE,CTask *parent=NULL,CTask **_pu_task=NULL);
extern Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,
I64 dof_flags=DOF_SIZE_MIN,U8 *header=NULL,U8 *footer=NULL);
I64 dof_flags=DOF_SIZE_MIN,U8 *header=NULL,U8 *footer=NULL);
extern I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=I64_MIN,I64 hi=I64_MAX);
extern U8 *PopUpGetStr(U8 *header=NULL);
extern I64 PopUpMenu(CDoc *doc,I64 dof_flags=0, U8 *title=NULL);
extern Bool PopUpNoYes(U8 *header=NULL,U8 *footer=NULL);
extern Bool PopUpOk(U8 *header=NULL,U8 *footer=NULL);
extern I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL);
extern Bool PopUpTransform(I64 *r);
extern CPCIDev *PCIDevFind(U16 class_code=NULL, U16 sub_code=NULL, U16 vendor_id=NULL, U16 device_id=NULL, U8 _bus=0xFF, U8 _dev=0xFF, U8 _fun=0xFF);
extern CPCIDev *PCIDevFind(U16 class_code=NULL, U16 sub_code=NULL, U16 vendor_id=NULL,
U16 device_id=NULL, U8 _bus=0xFF, U8 _dev=0xFF, U8 _fun=0xFF);
extern I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
U8 *_stage2_filename=NULL);
U8 *_stage2_filename=NULL);
extern U0 Refresh(I64 cnt=1,Bool force=FALSE);
extern U0 RegOneTimePopUp(I64 flag_num,U8 *msg);
extern Bool RegWrite(U8 *path,U8 *fmt,...);
Expand All @@ -100,7 +101,8 @@ extern U0 WinScrollsInit(CTask *task);
extern I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE);
extern Bool WinVert(I64 top,I64 bottom,CTask *task=NULL);
extern CWinMgrGlbls winmgr;
extern U0 InUntilKey(I64 scan_code,I64 sc_mask=0xFF|SCF_SHIFT|SCF_CTRL|SCF_ALT,I64 timeout=-1);
extern U0 InUntilKey(I64 scan_code,I64 sc_mask=0xFF|SCF_SHIFT|SCF_CTRL|SCF_ALT,
I64 timeout=-1);
extern I64 InGetChar(...);
extern I64 InUntilChar(...);

extern Bool BootMHDIns(U8 drv_let,U8 *drv_lst=NULL);
12 changes: 11 additions & 1 deletion Adam/BootRAM.HC
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ _extern _HI_CALL I64 HiCall(U8 *machine_code);
_extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt);

#help_index "Boot"
public U0 BootRAM(U8 *filename=NULL)
public U0 BootRAM(U8 *filename=NULL,Bool keep_ram_drv=TRUE)
{//Softboot Kernel.BIN file. No hardware reset.
I64 size;
CBlkDev *bdrd;
CKernel *hi_image,*lo_image=mem_boot_base-sizeof(CBinFile),
reg *sys_ram_reboot;
if (!filename)
Expand All @@ -51,6 +52,15 @@ public U0 BootRAM(U8 *filename=NULL)
hi_image->sys_run_level =lo_image->sys_run_level&(RLF_VGA|RLF_16BIT);
hi_image->sys_frame_buffer = sys_frame_buffer;
hi_image->sys_vbe_mode_pitch = sys_vbe_mode_pitch;
if (DrvMounted('B'))
{
if (keep_ram_drv)
{
bdrd=Let2BlkDev('B');
hi_image->sys_initramfs_ptr=bdrd->RAM_dsk;
hi_image->sys_initramfs_size=(bdrd->max_blk+1)<<BLK_SIZE_BITS;
}
}

MemCpy(&hi_image->start,&lo_image->start,
sizeof(CKernel)-offset(CKernel.start));
Expand Down
5 changes: 2 additions & 3 deletions Adam/Device/Comm.HC
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#help_index "Comm"

#define PCIC_COMM 7
#define PCISC_SERIAL 0
#define SERIAL_16550 2

Expand Down Expand Up @@ -97,7 +96,7 @@ interrupt U0 IRQCommPCI()

I64 AddPCIComms(I64 next_port)
{
I64 class_code = PCIC_COMM << 8 | PCISC_SERIAL,
I64 class_code = PCIC_COM_CONTRL << 8 | PCISC_SERIAL,
ioport,bdf,cur_port=next_port,
b, d, f, bar;
for (b = 0; b < sys_pci_busses; b++)
Expand Down Expand Up @@ -235,7 +234,7 @@ public U0 CommPrint(I64 port,U8 *fmt,...)
Free(buf);
}

public U0 PciRerouteInterrupts(I64 base, I64 cpu)
public U0 PciRerouteInterrupts(I64 base, I64 cpu=0)
{
I64 i;
U8 *da = dev.uncached_alias + IOAPIC_REG;
Expand Down
Loading

0 comments on commit 0ad5b1c

Please sign in to comment.