At least partially working notifiers that seem to do something

This commit is contained in:
starfrost013
2025-03-20 01:39:35 +00:00
parent ac63ad436f
commit fea521d3ac
3 changed files with 49 additions and 10 deletions

View File

@@ -69,13 +69,14 @@ void nv3_notify_if_needed(uint32_t name, uint32_t method_id, nv3_ramin_context_t
return;
uint32_t current_notification_object = nv3->pgraph.notifier;
uint32_t notification_type = ((current_notification_object >> NV3_PGRAPH_NOTIFY_REQUEST_TYPE) & 0x07);
// check for a software method (0 = hardware, 1 = software)
if (((current_notification_object >> NV3_PGRAPH_NOTIFY_REQUEST_TYPE) & 0x07) != 0)
if (notification_type != 0)
{
nv_log("Software Notification, firing interrupt");
nv3_pgraph_interrupt_valid(NV3_PGRAPH_INTR_0_SOFTWARE_NOTIFY);
return;
//return;
}
// set up the NvNotification structure
@@ -101,8 +102,7 @@ void nv3_notify_if_needed(uint32_t name, uint32_t method_id, nv3_ramin_context_t
/* paging information */
bool page_is_present = notify_obj_page & 0x01;
bool page_is_readwrite = (notify_obj_page >> NV3_NOTIFICATION_PAGE_ACCESS);
//uint32_t frame_value = (notify_obj_page >> NV3_NOTIFICATION_PAGE_FRAME_ADDRESS) & 0xFFFFF;
uint32_t frame_value = (notify_obj_page >> NV3_NOTIFICATION_PAGE_FRAME_ADDRESS) & 0xFFFFF000;
uint32_t frame_base = notify_obj_page & 0xFFFFF000;
// This code is temporary and will probably be moved somewhere else
// Print torns of debug info
@@ -133,8 +133,44 @@ void nv3_notify_if_needed(uint32_t name, uint32_t method_id, nv3_ramin_context_t
nv_log("Limit: 0x%08x\n", notify_obj_limit);
(page_is_present) ? nv_log("Page is present\n") : nv_log("Page is not present\n");
(page_is_readwrite) ? nv_log("Page is read-write\n") : nv_log("Page is read-only\n");
nv_log("Pageframe Address: 0x%08x\n", frame_value);
nv_log("Pageframe Address: 0x%08x\n", frame_base);
#endif
// set up the dma transfer. we need to translate to a physical address.
uint32_t final_address = 0;
/* Simple case: hardware notification, we can just take the pte since it's based on the type */
if (notification_type == 0)
{
final_address = frame_base + info_adjust;
}
else
{
// for software we have to calculate the pte index
uint32_t pte_num = ((notification_type << 4) + info_adjust) >> 12;
/* ramin entries are sorted - 1 object for each pte entry...*/
final_address = nv3_ramin_read32(notify_obj_base + (0x10 * pte_num) + 8, nv3);
final_address += (info_adjust & 0xFFF);
}
/* send the notification off */
nv_log("About to send the notification to 0x%08x (Check target)", final_address);
switch (info_notification_target)
{
case NV3_NOTIFICATION_TARGET_NVM:
svga_writel_linear(final_address, (notify.nanoseconds & 0xFFFFFFFF), nv3);
svga_writel_linear(final_address + 4, (notify.nanoseconds >> 32), nv3);
svga_writel_linear(final_address + 8, notify.info32, nv3);
svga_writel_linear(final_address + 0x0C, (notify.info16 | notify.status), nv3);
break;
case NV3_NOTIFICATION_TARGET_PCI:
case NV3_NOTIFICATION_TARGET_AGP:
dma_bm_write(final_address, (uint8_t*)&notify, sizeof(nv3_notification_t), 4);
break;
}
// we're done
nv3->pgraph.notify_pending = false;
}

View File

@@ -194,7 +194,10 @@ nv_register_t pramdac_registers[] =
{ NV3_PRAMDAC_GENERAL_CONTROL, "PRAMDAC - General Control", NULL, NULL },
{ NV3_PRAMDAC_VSERR_WIDTH, "PRAMDAC - Vertical Sync Error Width", NULL, NULL},
{ NV3_PRAMDAC_VEQU_END, "PRAMDAC - VEqu End", NULL, NULL},
{ NV3_PRAMDAC_VBBLANK_START, "PRAMDAC - VBBlank Start", NULL, NULL},
{ NV3_PRAMDAC_VBBLANK_END, "PRAMDAC - VBBlank End", NULL, NULL},
{ NV3_PRAMDAC_HBLANK_END, "PRAMDAC - Horizontal Blanking Interval End", NULL, NULL},
{ NV3_PRAMDAC_HBLANK_START, "PRAMDAC - Horizontal Blanking Interval Start", NULL, NULL},
{ NV3_PRAMDAC_VBLANK_END, "PRAMDAC - Vertical Blanking Interval End", NULL, NULL},
{ NV3_PRAMDAC_VBLANK_START, "PRAMDAC - Vertical Blanking Interval Start", NULL, NULL},
{ NV3_PRAMDAC_VEQU_START, "PRAMDAC - VEqu Start", NULL, NULL},
@@ -220,7 +223,7 @@ uint32_t nv3_pramdac_read(uint32_t address)
// todo: friendly logging
nv_log("PRAMDAC Read from 0x%08x", address);
nv_log("PRAMDAC Read from 0x%08x\n", address);
// if the register actually exists
if (reg)
@@ -301,7 +304,7 @@ void nv3_pramdac_write(uint32_t address, uint32_t value)
{
nv_register_t* reg = nv_get_register(address, pramdac_registers, sizeof(pramdac_registers)/sizeof(pramdac_registers[0]));
nv_log("PRAMDAC Write 0x%08x -> 0x%08x", value, address);
nv_log("PRAMDAC Write 0x%08x -> 0x%08x\n", value, address);
// if the register actually exists
if (reg)

View File

@@ -434,14 +434,14 @@ bool nv3_ramin_find_object(uint32_t name, uint32_t cache_num, uint8_t channel, u
// Perform more validation
if (obj_context_struct.class_id > NV3_PFIFO_FIRST_VALID_GRAPHICS_OBJECT_ID
|| obj_context_struct.class_id < NV3_PFIFO_LAST_VALID_GRAPHICS_OBJECT_ID)
if (obj_context_struct.class_id < NV3_PFIFO_FIRST_VALID_GRAPHICS_OBJECT_ID
|| obj_context_struct.class_id > NV3_PFIFO_LAST_VALID_GRAPHICS_OBJECT_ID)
{
fatal("NV3: Invalid graphics object class ID name=0x%04x type=%04x, interpreted by pgraph as: %04x (Contact starfrost)",
name, obj_context_struct.class_id, obj_context_struct.class_id & 0x1F);
}
else if (obj_context_struct.channel > NV3_DMA_CHANNELS)
fatal("NV3: Super fucked up graphics object. Contact starfrost with the error string: DMA Channel ID=%d, it should be 0-8", obj_context_struct.channel);
fatal("NV3: Super fucked up graphics object. Contact starfrost with the error string: DMA Channel ID=%d, it should be 0-7", obj_context_struct.channel);
// Illegal accesses sent to RAMRO, so ignore here
// TODO: SEND THESE TO RAMRO!!!!!